diff --git a/ChangeLog b/ChangeLog index 02d02a035f77..da4aeb9d0478 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +2024-03-08 Filip Kastl + + * MAINTAINERS: Fix order of names in Write After Aproval + +2024-03-04 demin.han + + * MAINTAINERS: Add myself + +2024-02-28 Fangrui Song + + * MAINTAINERS: Add myself. + +2024-02-26 Juergen Christ + + * MAINTAINERS: Add myself to write after approval and DCO. + +2024-02-23 Xi Ruoyao + + * configure.ac (ENABLE_GOLD): Remove loongarch*-*-* from target + list. + * configure: Regenerate. + +2024-02-23 Monk Chiang + + * MAINTAINERS: Add myself. + 2024-02-10 Alexander Westbrooks * MAINTAINERS: Add myself to write after approval and DCO. diff --git a/MAINTAINERS b/MAINTAINERS index 617133447f04..8f64ee630b45 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -373,8 +373,10 @@ Gabriel Charette Chandra Chavva Dehao Chen Fabien ChĂȘne +Monk Chiang ClĂ©ment Chigot Harshit Chopra +Juergen Christ Tamar Christina Eric Christopher Paul Clarke @@ -448,6 +450,7 @@ Naveen H.S Mostafa Hagog Jivan Hakobyan Andrew Haley +Demin Han Frederik Harwath Stuart Hastings Michael Haubenwallner @@ -667,6 +670,7 @@ Edward Smith-Rowland Anatoly Sokolov Michael Sokolov Jayant Sonar +Fangrui Song Richard Stallman Basile Starynkevitch Jakub Staszak @@ -757,6 +761,7 @@ Certificate of Origin Version 1.1. See https://gcc.gnu.org/dco.html for more information. +Juergen Christ Robin Dapp Robin Dapp Michal Jires @@ -776,6 +781,7 @@ Bill Schmidt Nathaniel Shead Nathan Sidwell Edward Smith-Rowland +Fangrui Song Petter Tomner Martin Uecker Jonathan Wakely diff --git a/configure b/configure index 874966fb9f09..02b435c1163b 100755 --- a/configure +++ b/configure @@ -3092,7 +3092,7 @@ case "${ENABLE_GOLD}" in # Check for target supported by gold. case "${target}" in i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \ - | aarch64*-*-* | tilegx*-*-* | mips*-*-* | s390*-*-* | loongarch*-*-*) + | aarch64*-*-* | tilegx*-*-* | mips*-*-* | s390*-*-*) configdirs="$configdirs gold" if test x${ENABLE_GOLD} = xdefault; then default_ld=gold diff --git a/configure.ac b/configure.ac index 4f34004a0726..1a19c07a27b8 100644 --- a/configure.ac +++ b/configure.ac @@ -364,7 +364,7 @@ case "${ENABLE_GOLD}" in # Check for target supported by gold. case "${target}" in i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \ - | aarch64*-*-* | tilegx*-*-* | mips*-*-* | s390*-*-* | loongarch*-*-*) + | aarch64*-*-* | tilegx*-*-* | mips*-*-* | s390*-*-*) configdirs="$configdirs gold" if test x${ENABLE_GOLD} = xdefault; then default_ld=gold diff --git a/contrib/ChangeLog b/contrib/ChangeLog index faf76427eec4..a85c1bfcfbe0 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,26 @@ +2024-03-08 Sam James + + PR other/109668 + * dg-extract-results.sh: Check for python3 before python. Check for + python2 last. + +2024-03-07 Filip Kastl + + * test_mklog.py: "Moved to..." -> "Move to..." + +2024-03-01 Bernhard Reutner-Fischer + + * mklog.py: Use present tense in ChangeLog. + +2024-02-29 Andrew Pinski + + * gcc-changelog/git_commit.py (bug_components): Add libcc1. + +2024-02-23 Richard Biener + + PR target/90785 + * config-list.mk (LIST): --enable-obsolete for ia64*-*-*. + 2024-02-05 Jakub Jelinek * test_installed: Fill in HOSTCC, HOSTCXX, HOSTCFLAGS and diff --git a/contrib/config-list.mk b/contrib/config-list.mk index 0694cc128fa9..16df66f0fc6b 100644 --- a/contrib/config-list.mk +++ b/contrib/config-list.mk @@ -60,8 +60,9 @@ LIST = \ i686-pc-linux-gnu i686-pc-msdosdjgpp i686-lynxos i686-nto-qnx \ i686-rtems i686-solaris2.11 i686-wrs-vxworks \ i686-wrs-vxworksae \ - i686-cygwinOPT-enable-threads=yes i686-mingw32crt ia64-elf \ - ia64-linux ia64-hpux ia64-hp-vms iq2000-elf lm32-elf \ + i686-cygwinOPT-enable-threads=yes i686-mingw32crt ia64-elfOPT-enable-obsolete \ + ia64-linuxOPT-enable-obsolete ia64-hpuxOPT-enable-obsolete \ + ia64-hp-vmsOPT-enable-obsolete iq2000-elf lm32-elf \ lm32-rtems lm32-uclinux \ loongarch64-linux-gnuf64 loongarch64-linux-gnuf32 loongarch64-linux-gnusf \ m32c-elf m32r-elf m32rle-elf \ diff --git a/contrib/dg-extract-results.sh b/contrib/dg-extract-results.sh index 00ef80046f74..539d596a89d2 100755 --- a/contrib/dg-extract-results.sh +++ b/contrib/dg-extract-results.sh @@ -28,14 +28,17 @@ PROGNAME=dg-extract-results.sh -# Try to use the python version if possible, since it tends to be faster. +# Try to use the python version if possible, since it tends to be faster and +# produces more stable results. PYTHON_VER=`echo "$0" | sed 's/sh$/py/'` -if test "$PYTHON_VER" != "$0" && - test -f "$PYTHON_VER" && - python -c 'import sys, getopt, re, io, datetime, operator; sys.exit (0 if sys.version_info >= (2, 6) else 1)' \ - > /dev/null 2> /dev/null; then - exec python $PYTHON_VER "$@" -fi +for python in python3 python python2 ; do + if test "$PYTHON_VER" != "$0" && + test -f "$PYTHON_VER" && + ${python} -c 'import sys, getopt, re, io, datetime, operator; sys.exit (0 if sys.version_info >= (2, 6) else 1)' \ + > /dev/null 2> /dev/null; then + exec ${python} $PYTHON_VER "$@" + fi +done usage() { cat <&2 diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py index 87bec4e00f56..87ecb9e1a17d 100755 --- a/contrib/gcc-changelog/git_commit.py +++ b/contrib/gcc-changelog/git_commit.py @@ -105,6 +105,7 @@ 'java', 'jit', 'libbacktrace', + 'libcc1', 'libf2c', 'libffi', 'libfortran', diff --git a/contrib/mklog.py b/contrib/mklog.py index d764fb41f99b..7d8d554b15e0 100755 --- a/contrib/mklog.py +++ b/contrib/mklog.py @@ -277,7 +277,7 @@ def generate_changelog(data, no_functions=False, fill_pr_titles=False, # it used to be path.source_file[2:] relative_path = get_rel_path_if_prefixed(file.source_file[2:], changelog) - out = append_changelog_line(out, relative_path, 'Moved to...') + out = append_changelog_line(out, relative_path, 'Move to...') new_path = get_rel_path_if_prefixed(file.target_file[2:], changelog) out += f'\t* {new_path}: ...here.\n' diff --git a/contrib/test_mklog.py b/contrib/test_mklog.py index b6210738e551..80e159fcca46 100755 --- a/contrib/test_mklog.py +++ b/contrib/test_mklog.py @@ -400,7 +400,7 @@ EXPECTED8 = '''\ gcc/ChangeLog: - * ipa-icf.c: Moved to... + * ipa-icf.c: Move to... * ipa-icf2.c: ...here. ''' diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9fe70cb7e490..5b966a63e80e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,1566 @@ +2024-03-08 Martin Jambor + + PR ipa/113757 + * tree-inline.cc (redirect_all_calls): Remove code adding SSAs to + id->killed_new_ssa_names. + +2024-03-08 Vladimir N. Makarov + + PR target/113790 + * lra-assigns.cc (assign_by_spills): Set up all_spilled_pseudos + for non-reload pseudo too. + +2024-03-08 David Faust + + * config/bpf/bpf.cc (bpf_expand_cpymem, bpf_expand_setmem): Do + not attempt inline expansion if size is above threshold. + * config/bpf/bpf.opt (-minline-memops-threshold): New option. + * doc/invoke.texi (eBPF Options) <-minline-memops-threshold>: + Document. + +2024-03-08 Richard Biener + + PR tree-optimization/114269 + PR tree-optimization/114074 + * tree-chrec.cc (chrec_fold_plus_1): Handle sign-conversions + in the third CASE_CONVERT case as well. + (chrec_fold_multiply): Handle sign-conversions from unsigned + by performing the operation in the unsigned type. + +2024-03-08 Georg-Johann Lay + + * config/avr/avr.md (*addhi3_zero_extend.ashift1): New pattern. + * config/avr/avr.cc (avr_rtx_costs_1) [PLUS]: Compute its cost. + +2024-03-08 Jakub Jelinek + + * bb-reorder.cc (fix_up_fall_thru_edges): Fix up checking assert, + asm_noperands < 0 means it is not asm goto too. + +2024-03-08 Jakub Jelinek + + PR target/38534 + * config/i386/i386.opt (mnoreturn-no-callee-saved-registers): New + option. + * config/i386/i386-options.cc (ix86_set_func_type): Don't use + TYPE_NO_CALLEE_SAVED_REGISTERS_EXCEPT_BP unless + ix86_noreturn_no_callee_saved_registers is enabled. + * doc/invoke.texi (-mnoreturn-no-callee-saved-registers): Document. + +2024-03-08 Jakub Jelinek + + PR debug/113918 + * dwarf2out.cc (gen_field_die): Emit DW_AT_export_symbols + on anonymous unions or structs for -gdwarf-5 or -gno-strict-dwarf. + +2024-03-08 demin.han + + PR target/114264 + * config/riscv/riscv-vector-costs.cc: Fix ICE + +2024-03-08 Haochen Gui + + * fwprop.cc (forward_propagate_into): Return false for volatile set + source rtx. + +2024-03-07 Wilco Dijkstra + + PR target/113618 + * config/aarch64/aarch64.cc (aarch64_copy_one_block): Remove. + (aarch64_expand_cpymem): Emit single load/store only. + (aarch64_set_one_block): Emit single stores only. + +2024-03-07 Robin Dapp + + PR middle-end/114196 + * tree-vect-loop-manip.cc (vect_can_peel_nonlinear_iv_p): Merge + vectorization guards. + +2024-03-07 Jonathan Wakely + + * doc/cppopts.texi: Remove incorrect claim about -dD not + outputting predefined macros. + +2024-03-07 Jeevitha Palanisamy + + PR target/113950 + * config/rs6000/vsx.md (vsx_splat_): Correct assignment to operand1 + and simplify else if with else. + +2024-03-07 Francois-Xavier Coudert + + * system.h: Include safe-ctype.h after C++ standard headers. + +2024-03-07 Jakub Jelinek + + PR rtl-optimization/110079 + * bb-reorder.cc (fix_crossing_unconditional_branches): Don't adjust + asm goto. + +2024-03-07 Jakub Jelinek + + PR middle-end/105533 + * expmed.cc (choose_mult_variant): Only try the val - 1 variant + if val is not HOST_WIDE_INT_MIN or if mode has exactly + HOST_BITS_PER_WIDE_INT precision. Avoid triggering UB while computing + val - 1. + +2024-03-07 Jakub Jelinek + + PR middle-end/105533 + * tree-ssa-sccvn.cc (ao_ref_init_from_vn_reference) : + Multiple op->off by BITS_PER_UNIT instead of shifting it left by + LOG2_BITS_PER_UNIT. + +2024-03-07 Yang Yujie + + * config.gcc: Add a case for loongarch*-*-linux-musl*. + * config/loongarch/linux.h: Disable the multilib-compatible + treatment for *musl* targets. + * config/loongarch/musl.h: New file. + +2024-03-07 Jakub Jelinek + + PR tree-optimization/114009 + * genmatch.cc (decision_tree::gen): Emit ARG_UNUSED for captures + argument even for GENERIC, not just for GIMPLE. + * match.pd (a * !a -> 0): New simplifications. + +2024-03-07 demin.han + + * config/riscv/riscv-protos.h (expand_vec_cmp): Change proto + * config/riscv/riscv-v.cc (expand_vec_cmp): Use default arguments + (expand_vec_cmp_float): Adapt arguments + +2024-03-06 Uros Bizjak + + PR target/114232 + * config/i386/mmx.md (negv2qi2): Enable for optimize_size instead + of optimize_function_for_size_p. Explictily enable for TARGET_SSE2. + (negv2qi SSE reg splitter): Enable for TARGET_SSE2 only. + (v2qi3): Enable for optimize_size instead + of optimize_function_for_size_p. Explictily enable for TARGET_SSE2. + (v2qi SSE reg splitter): Enable for TARGET_SSE2 only. + (v2qi3): Enable for optimize_size instead + of optimize_function_for_size_p. + +2024-03-06 Robin Dapp + + PR target/114200 + PR target/114202 + * config/riscv/vector.md: Use vmv[1248]r.v instead of vmv.v.v. + +2024-03-06 Robin Dapp + + * config/riscv/riscv-vector-costs.cc (adjust_stmt_cost): Move... + (costs::adjust_stmt_cost): ... to here and add vec_load/vec_store + offset handling. + (costs::add_stmt_cost): Also adjust cost for statements without + stmt_info. + * config/riscv/riscv-vector-costs.h: Define zero constant. + +2024-03-06 Wilco Dijkstra + + PR target/113915 + * config/arm/arm.md (NOCOND): Improve comment. + (arm_rev*) Add predicable. + * config/arm/arm.cc (arm_final_prescan_insn): Add check for + PREDICABLE_YES. + +2024-03-06 Jeff Law + + PR target/113001 + PR target/112871 + * config/riscv/riscv.cc (expand_conditional_move): Do not swap + operands when the comparison operand is the same as the false + arm for a NE test. + +2024-03-06 Uros Bizjak + + * config/i386/i386-expand.cc (ix86_expand_move) [TARGET_MACHO]: + Eliminate common code and use generic code instead. + +2024-03-06 Georg-Johann Lay + + * config/avr/avr.cc (avr_rtx_costs_1) [PLUS+ZERO_EXTEND]: Adjust + rtx cost. + +2024-03-06 Richard Biener + + PR tree-optimization/114239 + * tree-vect-loop.cc (vect_get_vect_def): Remove. + (vect_create_epilog_for_reduction): The passed in stmt_info + should now be the live stmt that produces the scalar reduction + result. Revert PR114192 fix. Base reduction info off + info_for_reduction. Remove special handling of + early-break/peeled, restore original vector def gathering. + Make sure to pick the correct exit PHIs. + (vectorizable_live_operation): Pass in the proper stmt_info + for early break exits. + +2024-03-06 Richard Sandiford + + * config/aarch64/aarch64-feature-deps.h (feature_deps::info): Add + out-of-class definitions of static constants. + +2024-03-06 Richard Biener + + PR tree-optimization/114249 + * tree-vect-slp.cc (vect_build_slp_instance): Move making + a BB reduction lane number even ... + (vect_slp_check_for_roots): ... here to avoid leaking + pattern defs. + +2024-03-06 Richard Biener + + PR tree-optimization/114246 + * tree-ssa-dse.cc (increment_start_addr): Strip useless + type conversions from the adjusted address. + +2024-03-06 Jakub Jelinek + + PR rtl-optimization/114190 + * config/i386/i386-features.cc (rest_of_handle_insert_vzeroupper): + Call df_remove_problem for df_note before calling df_analyze. + +2024-03-05 Cupertino Miranda + Indu Bhagat + + PR debug/114186 + * dwarf2ctf.cc (gen_ctf_array_type): Invoke the ctf_add_array () + in the correct order of the dimensions. + (gen_ctf_subrange_type): Refactor out handling of + DW_TAG_subrange_type DIE to here. + +2024-03-05 Richard Sandiford + + PR sanitizer/97696 + * asan.cc (asan_expand_mark_ifn): Allow the length to be a poly_int. + +2024-03-05 Richard Sandiford + + * config/aarch64/aarch64.md (stride_type): Remove luti_consecutive + and luti_strided. + * config/aarch64/aarch64-sme.md + (@aarch64_sme_lut): Remove stride_type attribute. + (@aarch64_sme_lut_strided2): Delete. + (@aarch64_sme_lut_strided4): Likewise. + * config/aarch64/aarch64-early-ra.cc (is_stride_candidate) + (early_ra::maybe_convert_to_strided_access): Remove support for + strided LUTI2 and LUTI4. + +2024-03-05 Richard Earnshaw + + PR target/113510 + * config/arm/thumb1.md (peephole2 to fuse mov imm/add SP): Use + low_register_operand. + +2024-03-05 Georg-Johann Lay + + * config/avr/avr.md: Add two RTL peepholes for PLUS, IOR and AND + in HI, PSI, SI that swap operation order from "X = CST, X o= Y" + to "X = Y, X o= CST". + +2024-03-05 Xi Ruoyao + + * config/loongarch/loongarch.h (ADDITIONAL_REGISTER_NAMES): Add + s9 as an alias of r22. + +2024-03-05 Roger Sayle + + * config/avr/avr-protos.h (avr_out_insv): New proto. + * config/avr/avr.cc (avr_out_insv): New function. + (avr_adjust_insn_length) [ADJUST_LEN_INSV]: Handle case. + (avr_cbranch_cost) [ZERO_EXTRACT]: Adjust rtx costs. + * config/avr/avr.md (define_attr "adjust_len") Add insv. + (andhi3, *andhi3, andpsi3, *andpsi3, andsi3, *andsi3): + Add constraint alternative where the 3rd operand is a power + of 2, and the source register may differ from the destination. + (*insv.any_shift._split): Call avr_out_insv to output + instructions. Set attr "length" to "insv". + * config/avr/constraints.md (Cb2, Cb3, Cb4): New constraints. + +2024-03-05 Richard Biener + + PR tree-optimization/114231 + * tree-vect-slp.cc (vect_analyze_slp): Lookup patterns when + processing a BB SLP root. + +2024-03-05 Jakub Jelinek + + PR rtl-optimization/114211 + * lower-subreg.cc (resolve_simple_move): For double-word + rotates by BITS_PER_WORD if there is overlap between source + and destination use a temporary. + +2024-03-05 Jakub Jelinek + + PR middle-end/114157 + * gimple-lower-bitint.cc: Include stor-layout.h. + (mergeable_op): Return true for BIT_FIELD_REF. + (struct bitint_large_huge): Declare handle_bit_field_ref method. + (bitint_large_huge::handle_bit_field_ref): New method. + (bitint_large_huge::handle_stmt): Use it for BIT_FIELD_REF. + +2024-03-05 Jakub Jelinek + + PR target/114116 + * config/i386/i386.h (enum call_saved_registers_type): Add + TYPE_NO_CALLEE_SAVED_REGISTERS_EXCEPT_BP enumerator. + * config/i386/i386-options.cc (ix86_set_func_type): Remove + has_no_callee_saved_registers variable, add no_callee_saved_registers + instead, initialize it depending on whether it is + no_callee_saved_registers function or not. Don't set it if + no_caller_saved_registers attribute is present. Adjust users. + * config/i386/i386.cc (ix86_function_ok_for_sibcall): Handle + TYPE_NO_CALLEE_SAVED_REGISTERS_EXCEPT_BP like + TYPE_NO_CALLEE_SAVED_REGISTERS. + (ix86_save_reg): Handle TYPE_NO_CALLEE_SAVED_REGISTERS_EXCEPT_BP. + +2024-03-05 Pan Li + + * config/riscv/riscv.cc (riscv_v_adjust_bytesize): Cleanup unused + mode_size related code. + +2024-03-05 Patrick Palka + + * doc/invoke.texi (-Wno-global-module): Document. + +2024-03-04 David Faust + + * config/bpf/bpf-protos.h (bpf_expand_setmem): New prototype. + * config/bpf/bpf.cc (bpf_expand_setmem): New. + * config/bpf/bpf.md (setmemdi): New define_expand. + +2024-03-04 Jakub Jelinek + + PR rtl-optimization/113010 + * combine.cc (simplify_comparison): Guard the + WORD_REGISTER_OPERATIONS check on scalar_int_mode of SUBREG_REG + and initialize inner_mode. + +2024-03-04 Andre Vieira + + * config/arm/iterators.md (supf): Remove VMLALDAVXQ_U, VMLALDAVXQ_P_U, + VMLALDAVAXQ_U cases. + (VMLALDAVXQ): Remove iterator. + (VMLALDAVXQ_P): Likewise. + (VMLALDAVAXQ): Likewise. + * config/arm/mve.md (mve_vstrwq_p_fv4sf): Replace use of + mode iterator attribute with V4BI mode. + * config/arm/unspecs.md (VMLALDAVXQ_U, VMLALDAVXQ_P_U, + VMLALDAVAXQ_U): Remove unused unspecs. + +2024-03-04 Andre Vieira + + * config/arm/arm.md (mve_safe_imp_xlane_pred): New attribute. + * config/arm/iterators.md (mve_vmaxmin_safe_imp): New iterator + attribute. + * config/arm/mve.md (vaddvq_s, vaddvq_u, vaddlvq_s, vaddlvq_u, + vaddvaq_s, vaddvaq_u, vmaxavq_s, vmaxvq_u, vmladavq_s, vmladavq_u, + vmladavxq_s, vmlsdavq_s, vmlsdavxq_s, vaddlvaq_s, vaddlvaq_u, + vmlaldavq_u, vmlaldavq_s, vmlaldavq_u, vmlaldavxq_s, vmlsldavq_s, + vmlsldavxq_s, vrmlaldavhq_u, vrmlaldavhq_s, vrmlaldavhxq_s, + vrmlsldavhq_s, vrmlsldavhxq_s, vrmlaldavhaq_s, vrmlaldavhaq_u, + vrmlaldavhaxq_s, vrmlsldavhaq_s, vrmlsldavhaxq_s, vabavq_s, vabavq_u, + vmladavaq_u, vmladavaq_s, vmladavaxq_s, vmlsdavaq_s, vmlsdavaxq_s, + vmlaldavaq_s, vmlaldavaq_u, vmlaldavaxq_s, vmlsldavaq_s, + vmlsldavaxq_s): Added mve_safe_imp_xlane_pred. + +2024-03-04 Stam Markianos-Wright + + * config/arm/arm.md (mve_unpredicated_insn): New attribute. + * config/arm/arm.h (MVE_VPT_PREDICATED_INSN_P): New define. + (MVE_VPT_UNPREDICATED_INSN_P): Likewise. + (MVE_VPT_PREDICABLE_INSN_P): Likewise. + * config/arm/vec-common.md (mve_vshlq_): Add attribute. + * config/arm/mve.md (arm_vcx1q_p_v16qi): Add attribute. + (arm_vcx1qv16qi): Likewise. + (arm_vcx1qav16qi): Likewise. + (arm_vcx1qv16qi): Likewise. + (arm_vcx2q_p_v16qi): Likewise. + (arm_vcx2qv16qi): Likewise. + (arm_vcx2qav16qi): Likewise. + (arm_vcx2qv16qi): Likewise. + (arm_vcx3q_p_v16qi): Likewise. + (arm_vcx3qv16qi): Likewise. + (arm_vcx3qav16qi): Likewise. + (arm_vcx3qv16qi): Likewise. + (@mve_q_): Likewise. + (@mve_q_int_): Likewise. + (@mve_q_v4si): Likewise. + (@mve_q_n_): Likewise. + (@mve_q_r_): Likewise. + (@mve_q_f): Likewise. + (@mve_q_m_): Likewise. + (@mve_q_m_n_): Likewise. + (@mve_q_m_r_): Likewise. + (@mve_q_m_f): Likewise. + (@mve_q_int_m_): Likewise. + (@mve_q_p_v4si): Likewise. + (@mve_q_p_): Likewise. + (@mve_q_): Likewise. + (@mve_q_f): Likewise. + (@mve_q_m_): Likewise. + (@mve_q_m_f): Likewise. + (mve_vq_f): Likewise. + (mve_q): Likewise. + (mve_q_f): Likewise. + (mve_vadciq_v4si): Likewise. + (mve_vadciq_m_v4si): Likewise. + (mve_vadcq_v4si): Likewise. + (mve_vadcq_m_v4si): Likewise. + (mve_vandq_): Likewise. + (mve_vandq_f): Likewise. + (mve_vandq_m_): Likewise. + (mve_vandq_m_f): Likewise. + (mve_vandq_s): Likewise. + (mve_vandq_u): Likewise. + (mve_vbicq_): Likewise. + (mve_vbicq_f): Likewise. + (mve_vbicq_m_): Likewise. + (mve_vbicq_m_f): Likewise. + (mve_vbicq_m_n_): Likewise. + (mve_vbicq_n_): Likewise. + (mve_vbicq_s): Likewise. + (mve_vbicq_u): Likewise. + (@mve_vclzq_s): Likewise. + (mve_vclzq_u): Likewise. + (@mve_vcmp_q_): Likewise. + (@mve_vcmp_q_n_): Likewise. + (@mve_vcmp_q_f): Likewise. + (@mve_vcmp_q_n_f): Likewise. + (@mve_vcmp_q_m_f): Likewise. + (@mve_vcmp_q_m_n_): Likewise. + (@mve_vcmp_q_m_): Likewise. + (@mve_vcmp_q_m_n_f): Likewise. + (mve_vctpq): Likewise. + (mve_vctpq_m): Likewise. + (mve_vcvtaq_): Likewise. + (mve_vcvtaq_m_): Likewise. + (mve_vcvtbq_f16_f32v8hf): Likewise. + (mve_vcvtbq_f32_f16v4sf): Likewise. + (mve_vcvtbq_m_f16_f32v8hf): Likewise. + (mve_vcvtbq_m_f32_f16v4sf): Likewise. + (mve_vcvtmq_): Likewise. + (mve_vcvtmq_m_): Likewise. + (mve_vcvtnq_): Likewise. + (mve_vcvtnq_m_): Likewise. + (mve_vcvtpq_): Likewise. + (mve_vcvtpq_m_): Likewise. + (mve_vcvtq_from_f_): Likewise. + (mve_vcvtq_m_from_f_): Likewise. + (mve_vcvtq_m_n_from_f_): Likewise. + (mve_vcvtq_m_n_to_f_): Likewise. + (mve_vcvtq_m_to_f_): Likewise. + (mve_vcvtq_n_from_f_): Likewise. + (mve_vcvtq_n_to_f_): Likewise. + (mve_vcvtq_to_f_): Likewise. + (mve_vcvttq_f16_f32v8hf): Likewise. + (mve_vcvttq_f32_f16v4sf): Likewise. + (mve_vcvttq_m_f16_f32v8hf): Likewise. + (mve_vcvttq_m_f32_f16v4sf): Likewise. + (mve_vdwdupq_m_wb_u_insn): Likewise. + (mve_vdwdupq_wb_u_insn): Likewise. + (mve_veorq_s>): Likewise. + (mve_veorq_u>): Likewise. + (mve_veorq_f): Likewise. + (mve_vidupq_m_wb_u_insn): Likewise. + (mve_vidupq_u_insn): Likewise. + (mve_viwdupq_m_wb_u_insn): Likewise. + (mve_viwdupq_wb_u_insn): Likewise. + (mve_vldrbq_): Likewise. + (mve_vldrbq_gather_offset_): Likewise. + (mve_vldrbq_gather_offset_z_): Likewise. + (mve_vldrbq_z_): Likewise. + (mve_vldrdq_gather_base_v2di): Likewise. + (mve_vldrdq_gather_base_wb_v2di_insn): Likewise. + (mve_vldrdq_gather_base_wb_z_v2di_insn): Likewise. + (mve_vldrdq_gather_base_z_v2di): Likewise. + (mve_vldrdq_gather_offset_v2di): Likewise. + (mve_vldrdq_gather_offset_z_v2di): Likewise. + (mve_vldrdq_gather_shifted_offset_v2di): Likewise. + (mve_vldrdq_gather_shifted_offset_z_v2di): Likewise. + (mve_vldrhq_): Likewise. + (mve_vldrhq_fv8hf): Likewise. + (mve_vldrhq_gather_offset_): Likewise. + (mve_vldrhq_gather_offset_fv8hf): Likewise. + (mve_vldrhq_gather_offset_z_): Likewise. + (mve_vldrhq_gather_offset_z_fv8hf): Likewise. + (mve_vldrhq_gather_shifted_offset_): Likewise. + (mve_vldrhq_gather_shifted_offset_fv8hf): Likewise. + (mve_vldrhq_gather_shifted_offset_z_): Likewise. + (mve_vldrhq_gather_shifted_offset_z_fv8hf): Likewise. + (mve_vldrhq_z_): Likewise. + (mve_vldrhq_z_fv8hf): Likewise. + (mve_vldrwq_v4si): Likewise. + (mve_vldrwq_fv4sf): Likewise. + (mve_vldrwq_gather_base_v4si): Likewise. + (mve_vldrwq_gather_base_fv4sf): Likewise. + (mve_vldrwq_gather_base_wb_v4si_insn): Likewise. + (mve_vldrwq_gather_base_wb_fv4sf_insn): Likewise. + (mve_vldrwq_gather_base_wb_z_v4si_insn): Likewise. + (mve_vldrwq_gather_base_wb_z_fv4sf_insn): Likewise. + (mve_vldrwq_gather_base_z_v4si): Likewise. + (mve_vldrwq_gather_base_z_fv4sf): Likewise. + (mve_vldrwq_gather_offset_v4si): Likewise. + (mve_vldrwq_gather_offset_fv4sf): Likewise. + (mve_vldrwq_gather_offset_z_v4si): Likewise. + (mve_vldrwq_gather_offset_z_fv4sf): Likewise. + (mve_vldrwq_gather_shifted_offset_v4si): Likewise. + (mve_vldrwq_gather_shifted_offset_fv4sf): Likewise. + (mve_vldrwq_gather_shifted_offset_z_v4si): Likewise. + (mve_vldrwq_gather_shifted_offset_z_fv4sf): Likewise. + (mve_vldrwq_z_v4si): Likewise. + (mve_vldrwq_z_fv4sf): Likewise. + (mve_vmvnq_s): Likewise. + (mve_vmvnq_u): Likewise. + (mve_vornq_): Likewise. + (mve_vornq_f): Likewise. + (mve_vornq_m_): Likewise. + (mve_vornq_m_f): Likewise. + (mve_vornq_s): Likewise. + (mve_vornq_u): Likewise. + (mve_vorrq_): Likewise. + (mve_vorrq_f): Likewise. + (mve_vorrq_m_): Likewise. + (mve_vorrq_m_f): Likewise. + (mve_vorrq_m_n_): Likewise. + (mve_vorrq_n_): Likewise. + (mve_vorrq_s): Likewise. + (mve_vorrq_s): Likewise. + (mve_vsbciq_v4si): Likewise. + (mve_vsbciq_m_v4si): Likewise. + (mve_vsbcq_v4si): Likewise. + (mve_vsbcq_m_v4si): Likewise. + (mve_vshlcq_): Likewise. + (mve_vshlcq_m_): Likewise. + (mve_vshrq_m_n_): Likewise. + (mve_vshrq_n_): Likewise. + (mve_vstrbq_): Likewise. + (mve_vstrbq_p_): Likewise. + (mve_vstrbq_scatter_offset__insn): Likewise. + (mve_vstrbq_scatter_offset_p__insn): Likewise. + (mve_vstrdq_scatter_base_v2di): Likewise. + (mve_vstrdq_scatter_base_p_v2di): Likewise. + (mve_vstrdq_scatter_base_wb_v2di): Likewise. + (mve_vstrdq_scatter_base_wb_p_v2di): Likewise. + (mve_vstrdq_scatter_offset_v2di_insn): Likewise. + (mve_vstrdq_scatter_offset_p_v2di_insn): Likewise. + (mve_vstrdq_scatter_shifted_offset_v2di_insn): Likewise. + (mve_vstrdq_scatter_shifted_offset_p_v2di_insn): Likewise. + (mve_vstrhq_): Likewise. + (mve_vstrhq_fv8hf): Likewise. + (mve_vstrhq_p_): Likewise. + (mve_vstrhq_p_fv8hf): Likewise. + (mve_vstrhq_scatter_offset__insn): Likewise. + (mve_vstrhq_scatter_offset_fv8hf_insn): Likewise. + (mve_vstrhq_scatter_offset_p__insn): Likewise. + (mve_vstrhq_scatter_offset_p_fv8hf_insn): Likewise. + (mve_vstrhq_scatter_shifted_offset__insn): Likewise. + (mve_vstrhq_scatter_shifted_offset_fv8hf_insn): Likewise. + (mve_vstrhq_scatter_shifted_offset_p__insn): Likewise. + (mve_vstrhq_scatter_shifted_offset_p_fv8hf_insn): Likewise. + (mve_vstrwq_v4si): Likewise. + (mve_vstrwq_fv4sf): Likewise. + (mve_vstrwq_p_v4si): Likewise. + (mve_vstrwq_p_fv4sf): Likewise. + (mve_vstrwq_scatter_base_v4si): Likewise. + (mve_vstrwq_scatter_base_fv4sf): Likewise. + (mve_vstrwq_scatter_base_p_v4si): Likewise. + (mve_vstrwq_scatter_base_p_fv4sf): Likewise. + (mve_vstrwq_scatter_base_wb_v4si): Likewise. + (mve_vstrwq_scatter_base_wb_fv4sf): Likewise. + (mve_vstrwq_scatter_base_wb_p_v4si): Likewise. + (mve_vstrwq_scatter_base_wb_p_fv4sf): Likewise. + (mve_vstrwq_scatter_offset_v4si_insn): Likewise. + (mve_vstrwq_scatter_offset_fv4sf_insn): Likewise. + (mve_vstrwq_scatter_offset_p_v4si_insn): Likewise. + (mve_vstrwq_scatter_offset_p_fv4sf_insn): Likewise. + (mve_vstrwq_scatter_shifted_offset_v4si_insn): Likewise. + (mve_vstrwq_scatter_shifted_offset_fv4sf_insn): Likewise. + (mve_vstrwq_scatter_shifted_offset_p_v4si_insn): Likewise. + (mve_vstrwq_scatter_shifted_offset_p_fv4sf_insn): Likewise. + +2024-03-04 Marek Polacek + + * doc/extend.texi: Update [[gnu::no_dangling]]. + +2024-03-04 Andrew Stubbs + + * dojump.cc (do_compare_and_jump): Use full-width integers for shifts. + * expr.cc (store_constructor): Likewise. + (do_store_flag): Likewise. + +2024-03-04 Mark Wielaard + + * common.opt.urls: Regenerate. + * config/avr/avr.opt.urls: Likewise. + * config/i386/i386.opt.urls: Likewise. + * config/pru/pru.opt.urls: Likewise. + * config/riscv/riscv.opt.urls: Likewise. + * config/rs6000/rs6000.opt.urls: Likewise. + +2024-03-04 Richard Biener + + PR tree-optimization/114197 + * tree-if-conv.cc (bitfields_to_lower_p): Do not lower if + there are volatile bitfield accesses. + (pass_if_conversion::execute): Throw away result if the + if-converted and original loops are not nested as expected. + +2024-03-04 Richard Biener + + PR tree-optimization/114164 + * tree-vect-stmts.cc (vectorizable_simd_clone_call): Fail if + the code generated for mask argument setup is not supported. + +2024-03-04 Richard Biener + + PR tree-optimization/114203 + * tree-ssa-loop-niter.cc (build_cltz_expr): Apply CTZ->CLZ + adjustment before making the result defined at zero. + +2024-03-04 Richard Biener + + PR tree-optimization/114192 + * tree-vect-loop.cc (vect_create_epilog_for_reduction): Use the + appropriate def for the live out stmt in case of an alternate + exit. + +2024-03-04 Jakub Jelinek + + PR middle-end/114209 + * gimple-lower-bitint.cc (bitint_large_huge::limb_access): Call + unshare_expr when creating a MEM_REF from MEM_REF. + (bitint_large_huge::lower_stmt): Call unshare_expr. + +2024-03-04 Jakub Jelinek + + PR target/114184 + * config/i386/i386-expand.cc (ix86_expand_move): If XFmode op1 + is SUBREG of CONSTANT_P, force the SUBREG_REG into memory or + register. + +2024-03-04 Roger Sayle + + PR target/114187 + * simplify-rtx.cc (simplify_context::simplify_subreg): Call + lowpart_subreg to perform type conversion, to avoid confusion + over the offset to use in the call to simplify_reg_subreg. + +2024-03-03 Greg McGary + + PR rtl-optimization/113010 + * combine.cc (simplify_comparison): Simplify a SUBREG on + WORD_REGISTER_OPERATIONS targets only if it is a zero-extending + MEM load. + +2024-03-03 Georg-Johann Lay + + * config/avr/avr.cc: Resolve ATTRIBUTE_UNUSED. + Use bool in place of int for boolean logic (if possible). + Move declarations to definitions (if possible). + * config/avr/avr.md: Use C++ comments. Fix some indentation glitches. + * config/avr/avr-dimode.md: Same. + * config/avr/constraints.md: Same. + * config/avr/predicates.md: Same. + +2024-03-03 Uros Bizjak + + PR target/113720 + * config/alpha/alpha.md (umuldi3_highpart): Remove expander. + (*umuldi3_highpart_reg): Rename to umuldi3_highpart and + simplify insn RTX using UMUL_HIGHPART rtx_code. + (*umuldi3_highpart_const): Remove. + +2024-03-03 Georg-Johann Lay + + PR target/114100 + * config/avr/avr-protos.h (_reg_unused_after): Remove proto. + * config/avr/avr.cc (_reg_unused_after): Make static. And + add 3rd argument to skip the current insn. + (reg_unused_after): Adjust call of reg_unused_after. + (avr_out_plus_1) [AVR_TINY && -mfuse-add >= 2]: Don't output + unneeded frame pointer adjustments. + +2024-03-03 Georg-Johann Lay + + PR target/92729 + * config/avr/avr.md (define_attr "cc"): Remove. + * config/avr/avr-protos.h (avr_out_plus): Remove pcc argument + from prototype. + * config/avr/avr.cc (avr_out_plus_1): Remove pcc argument and + its uses. Add insn argument. + (avr_out_plus_symbol): Remove pcc argument and its uses. + (avr_out_plus): Remove pcc argument and its uses. + Adjust calls of avr_out_plus_symbol and avr_out_plus_1. + (avr_out_round): Adjust call of avr_out_plus. + +2024-03-03 Georg-Johann Lay + + * config/avr/avr.cc (avr_init_cumulative_args): Fix a typo + from r14-9273. + +2024-03-03 Oleg Endo + + PR target/101737 + * config/sh/sh.cc (sh_is_nott_insn): Handle case where the input + is not an insn, but e.g. a code label. + +2024-03-02 Georg-Johann Lay + + * config/avr/avr.md (REG_0, ... REG_36): New define_constants. + * config/avr/avr.cc: Use them instead of magic numbers when it + means a register number. + +2024-03-02 Georg-Johann Lay + + * config/avr/avr.cc: Adjust some comments. + +2024-03-02 Georg-Johann Lay + + PR target/114100 + * config/avr/avr.cc (avr_out_plus_1) [-mtiny-stack]: Only adjust + the low part of the frame pointer with 8-bit stack pointer. + +2024-03-01 Patrick Palka + + PR c++/104919 + PR c++/106009 + * tree-inline.cc (remap_decl): Handle copy_decl returning the + original decl. + (remap_decls): Handle remap_decl returning the original decl. + (copy_fn): Adjust copy_decl callback to skip TYPE_DECL and + CONST_DECL. + +2024-03-01 Jeff Law + + * config/riscv/riscv.md (zero_extendqi2_internal): Fix + type attribute. + (extendsidi2_internal, movhf_hardfloat, movhf_softfloat): Likewise. + (movdi_32bit, movdi_64bit, movsi_internal): Likewise. + (movhi_internal, movqi_internal): Likewise. + (movsf_softfloat, movsf_hardfloat): Likewise. + (movdf_hardfloat_rv32, movdf_hardfloat_rv64): Likewise. + (movdf_softfloat): Likewise. + +2024-03-01 Marek Polacek + + PR c++/110358 + PR c++/109642 + * doc/extend.texi: Document gnu::no_dangling. + * doc/invoke.texi: Mention that gnu::no_dangling disables + -Wdangling-reference. + +2024-03-01 Georg-Johann Lay + + * config/avr/avr.opt: Overhaul help screen. + +2024-03-01 Jakub Jelinek + Tobias Burnus + + PR c++/110347 + * gimplify.cc (omp_notice_variable): Fix 'shared' arg to + lang_hooks.decls.omp_disregard_value_expr for + (first)private in target regions. + +2024-03-01 Jakub Jelinek + + PR middle-end/114136 + * calls.cc (expand_call): For TYPE_NO_NAMED_ARGS_STDARG_P set + n_named_args initially before INIT_CUMULATIVE_ARGS to + structure_value_addr_parm rather than 0, after it don't modify + it if strict_argument_naming and clear only if + !pretend_outgoing_varargs_named. + +2024-03-01 Jakub Jelinek + + PR debug/114015 + * dwarf2out.cc (should_move_die_to_comdat): Return false for + aggregates without DW_AT_byte_size attribute or with non-constant + DW_AT_byte_size. + +2024-03-01 Georg-Johann Lay + + * doc/invoke.texi (AVR Options) <-mfuse-add=level>: Document + valid values for level. + +2024-03-01 Richard Biener + + PR middle-end/114070 + * match.pd ((c ? a : b) op d --> c ? (a op d) : (b op d)): + Allow the folding if before lowering and the current IL + isn't supported with vcond_mask. + +2024-03-01 xuli + + * config/riscv/riscv.cc (TARGET_GNU_ATTRIBUTES): Add riscv_vector_cc + attribute to riscv_attribute_table. + (riscv_vector_cc_function_p): Return true if FUNC is a riscv_vector_cc function. + (riscv_fntype_abi): Add riscv_vector_cc attribute check. + * doc/extend.texi: Add riscv_vector_cc attribute description. + +2024-03-01 Pan Li + + PR target/112817 + * config/riscv/riscv-avlprop.cc (pass_avlprop::execute): Replace + RVV_FIXED_VLMAX to RVV_VECTOR_BITS_ZVL. + * config/riscv/riscv-opts.h (enum riscv_autovec_preference_enum): Remove. + (enum rvv_vector_bits_enum): New enum for different RVV vector bits. + * config/riscv/riscv-selftests.cc (riscv_run_selftests): Update + comments for option replacement. + * config/riscv/riscv-v.cc (autovec_use_vlmax_p): Replace enum of + riscv_autovec_preference to rvv_vector_bits. + (vls_mode_valid_p): Ditto. + (estimated_poly_value): Ditto. + * config/riscv/riscv.cc (riscv_convert_vector_chunks): Rename to + vector chunks and honor new option mrvv-vector-bits. + (riscv_override_options_internal): Update comments and rename the + vector chunks. + * config/riscv/riscv.opt: Add option mrvv-vector-bits and remove + internal option param=riscv-autovec-preference. + +2024-03-01 Jakub Jelinek + + * function.cc (assign_parms): Only call assign_parms_setup_varargs + early for TYPE_NO_NAMED_ARGS_STDARG_P functions if fnargs is empty. + +2024-03-01 Jakub Jelinek + + PR middle-end/114156 + * gimple-lower-bitint.cc (bitint_large_huge::lower_stmt): Allow + rhs1 of a VCE to have no underlying variable if it is a load and + handle that case. + +2024-02-29 David Malcolm + + PR analyzer/114159 + * function.cc (function_name): Make param const. + * function.h (function_name): Likewise. + +2024-02-29 Georg-Johann Lay + + PR target/114100 + * doc/invoke.texi (AVR Options) <-mfuse-add>: Document. + * config/avr/avr.opt (-mfuse-add=): New target option. + * common/config/avr/avr-common.cc (avr_option_optimization_table) + [OPT_LEVELS_1_PLUS]: Set -mfuse-add=1. + [OPT_LEVELS_2_PLUS]: Set -mfuse-add=2. + * config/avr/avr-passes.def (avr_pass_fuse_add): Insert new pass. + * config/avr/avr-protos.h (avr_split_tiny_move) + (make_avr_pass_fuse_add): New protos. + * config/avr/avr.md [AVR_TINY]: New post-reload splitter uses + avr_split_tiny_move to split indirect memory accesses. + (gen_move_clobbercc): New define_expand helper. + * config/avr/avr.cc (avr_pass_data_fuse_add): New pass data. + (avr_pass_fuse_add): New class from rtl_opt_pass. + (make_avr_pass_fuse_add, avr_split_tiny_move): New functions. + (reg_seen_between_p, emit_move_ccc, emit_move_ccc_after): New functions. + (avr_legitimate_address_p) [AVR_TINY]: Don't restrict offsets + of PLUS addressing for AVR_TINY. + (avr_regno_mode_code_ok_for_base_p) [AVR_TINY]: Ignore -mstrict-X. + (avr_out_plus_1) [AVR_TINY]: Tweak ++Y and --Y. + (avr_mode_code_base_reg_class) [AVR_TINY]: Always return POINTER_REGS. + +2024-02-29 Georg-Johann Lay + + PR target/114132 + * config/avr/avr.h (CUMULATIVE_ARGS) : New field. + * config/avr/avr.cc (avr_init_cumulative_args): Initialize it. + (avr_function_arg): Set it. + (avr_frame_pointer_required_p): Use it instead of .nregs. + +2024-02-29 Andrew Pinski + + PR target/108174 + * config/aarch64/aarch64-builtins.cc (aarch64_memtag_builtin_data): Make + static and mark with GTY. + +2024-02-29 Xi Ruoyao + + * config/loongarch/loongarch.md + (loongarch__w__w_extended): New define_insn. + +2024-02-29 Xi Ruoyao + + * config/loongarch/loongarch.md (CRC): New define_int_iterator. + (crc): New define_int_attr. + (loongarch_crc_w__w, loongarch_crcc_w__w): Unify + into ... + (loongarch__w__w): ... here. + +2024-02-29 Kito Cheng + + PR target/114130 + * config/riscv/sync.md (atomic_compare_and_swap): Sign + extend the expected value if needed. + +2024-02-28 Cupertino Miranda + + * config.gcc (target_gtfiles): Change coreout to btfext-out. + (extra_objs): Change coreout to btfext-out. + * config/bpf/coreout.cc: Rename to btfext-out.cc. + * config/bpf/btfext-out.cc: Add. + * config/bpf/coreout.h: Rename to btfext-out.h. + * config/bpf/btfext-out.h: Add. + * config/bpf/core-builtins.cc: Change include. + * config/bpf/core-builtins.h: Change include. + * config/bpf/t-bpf: Accomodate renamed files. + +2024-02-28 Cupertino Miranda + + PR target/113453 + * config/bpf/bpf.cc (bpf_function_prologue): Define target + hook. + * config/bpf/coreout.cc (brf_ext_info_section) + (btf_ext_info): Move from coreout.h + (btf_ext_funcinfo, btf_ext_lineinfo): Add struct. + (bpf_core_reloc): Rename to btf_ext_core_reloc. + (btf_ext): Add static variable. + (btfext_info_sec_find_or_add, SEARCH_NODE_AND_RETURN) + (bpf_create_or_find_funcinfo, bpt_create_core_reloc) + (btf_ext_add_string, btf_funcinfo_type_callback) + (btf_add_func_info_for, btf_validate_funcinfo) + (btf_ext_info_len, output_btfext_func_info): Add function. + (output_btfext_header, bpf_core_reloc_add) + (output_btfext_core_relocs, btf_ext_init, btf_ext_output): + Change to support new structs. + * config/bpf/coreout.h (btf_ext_funcinfo, btf_ext_lineinfo): + Move and change in coreout.cc. + (btf_add_func_info_for, btf_ext_add_string): Add prototypes. + +2024-02-28 Cupertino Miranda + + * config/bpf/bpf.cc (bpf_option_override): Make .BTF.ext + enabled by default for BPF. + (bpf_file_end): Call BTF deallocation. + (bpf_asm_init_sections): Correct condition. + * dwarf2ctf.cc (ctf_debug_finalize): Conditionally execute BTF + deallocation. + (ctf_debuf_finish): Correct condition for calling + ctf_debug_finalize. + +2024-02-28 Cupertino Miranda + + * btfout.cc (output_btf_func_types): Use FOR_EACH_VEC_ELT. + (traverse_btf_func_types): Define function. + * ctfc.h (funcs_traverse_callback): Typedef for function + prototype. + (traverse_btf_func_types): Add prototype. + +2024-02-28 Cupertino Miranda + + * btfout.cc (btf_collect_dataset): Corrects BTF type id. + +2024-02-28 Richard Biener + + PR tree-optimization/113831 + PR tree-optimization/108355 + * tree-ssa-sccvn.cc (copy_reference_ops_from_ref): Revert + PR113831 fix. + +2024-02-28 Richard Biener + + PR tree-optimization/114121 + * tree-ssa-sccvn.h (vn_reference_s::offset, + vn_reference_s::max_size): New fields. + (vn_reference_insert_pieces): Adjust prototype. + * tree-ssa-pre.cc (phi_translate_1): Preserve offset/max_size. + * tree-ssa-sccvn.cc (vn_reference_eq): Compare offset and + size, allow using "don't know" state. + (vn_walk_cb_data::finish): Pass along offset/max_size. + (vn_reference_lookup_or_insert_for_pieces): Take offset and + max_size as argument and use it. + (vn_reference_lookup_3): Properly adjust offset and max_size + according to the adjusted ao_ref. + (vn_reference_lookup_pieces): Initialize offset and max_size. + (vn_reference_lookup): Likewise. + (vn_reference_lookup_call): Likewise. + (vn_reference_insert): Likewise. + (visit_reference_op_call): Likewise. + (vn_reference_insert_pieces): Take offset and max_size + as argument and use it. + +2024-02-28 Juergen Christ + + PR tree-optimization/114075 + * tree-vect-stmts.cc (vectorizable_operation): Don't emulate floating + point vectors + +2024-02-28 Jakub Jelinek + + PR tree-optimization/114041 + * graphite-sese-to-poly.cc (add_conditions_to_domain): Check for + INTEGRAL_TYPE_P check rather than INTEGER_TYPE. + +2024-02-28 Jakub Jelinek + + PR tree-optimization/113988 + * stor-layout.h (bitwise_mode_for_size): Declare. + * stor-layout.cc (bitwise_mode_for_size): New function. + * gimple-fold.cc (gimple_fold_builtin_memory_op): Use it. + Use bitwise_type_for_mode instead of build_nonstandard_integer_type. + Use BITS_PER_UNIT instead of 8. + +2024-02-27 Uros Bizjak + + PR target/113871 + * config/i386/mmx.md (V248FI): Add V2BF mode. + (V24FI_32): Ditto. + +2024-02-27 Eric Botcazou + + * 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. + +2024-02-27 Richard Earnshaw + + * config/arm/mmintrin.h: Warn if this header is included without + defining __ENABLE_DEPRECATED_IWMMXT. + +2024-02-27 Richard Biener + + 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. + +2024-02-27 Jakub Jelinek + + 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. + +2024-02-27 Richard Biener + + 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. + +2024-02-26 Georg-Johann Lay + + * config/avr/avr.opt (mcall-prologues, mrelax, maccumulate-args) + (mstrict-X): Tag as "Optimization". + +2024-02-26 Georg-Johann Lay + + * 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. + +2024-02-26 Jakub Jelinek + H.J. Lu + + PR rtl-optimization/113617 + * varasm.cc (default_elf_select_rtx_section): For + references to private symbols in comdat sections + use .data.relro.local.pool., .data.relro.pool. + or .rodata. comdat sections. + +2024-02-26 Richard Biener + + 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. + +2024-02-26 Richard Biener + + 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. + +2024-02-26 H.J. Lu + + PR target/114097 + * config/i386/i386-options.cc (ix86_set_func_type): Check + interrupt instead of noreturn attribute. + +2024-02-26 Jakub Jelinek + + * config/i386/i386.cc (ix86_bitint_type_info): Add support for + !TARGET_64BIT. + +2024-02-26 Jakub Jelinek + + 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. + +2024-02-26 Jakub Jelinek + + 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. + +2024-02-26 Richard Biener + + 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. + +2024-02-26 Jakub Jelinek + + PR target/114094 + * config/i386/i386.cc (x86_function_profiler): Add missing new-line + to printed instruction. + +2024-02-26 H.J. Lu + + 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. + +2024-02-24 Richard Sandiford + + 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. + +2024-02-24 Jakub Jelinek + + * 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. + +2024-02-24 Jakub Jelinek + + 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. + +2024-02-23 Robin Dapp + + PR target/114028 + * config/riscv/riscv-v.cc (rvv_builder::can_duplicate_repeating_sequence_p): + Return false if inner mode is already Pmode. + (rvv_builder::is_all_same_sequence): New function. + (expand_vec_init): Emit broadcast if sequence is all same. + +2024-02-23 Richard Sandiford + + PR target/113613 + * config/aarch64/aarch64-early-ra.cc + (early_ra::m_current_region): New member variable. + (early_ra::m_fpr_recency): Likewise. + (early_ra::start_new_region): Bump m_current_region. + (early_ra::allocate_colors): Prefer less recently used registers + in the event of a tie. Add a comment to explain why we prefer(ed) + higher-numbered registers. + (early_ra::find_oldest_color): Prefer less recently used registers + here too. + (early_ra::finalize_allocation): Update recency information for + allocated registers. + (early_ra::process_blocks): Initialize m_current_region and + m_fpr_recency. + +2024-02-23 Richard Sandiford + + PR target/113295 + * config/aarch64/aarch64-early-ra.cc + (early_ra::test_strictness): New enum. + (early_ra::is_chain_candidate): Add a strictness parameter to + control whether only correctness matters, or whether both correctness + and heuristics should be used. Handle multiple levels of equivalence. + (early_ra::find_related_start): Update call accordingly. + (early_ra::strided_polarity_pref): Likewise. + (early_ra::form_chains): Likewise. + (early_ra::try_to_chain_allocnos): Use is_chain_candidate in + correctness mode rather than trying to inline the test. + +2024-02-23 Richard Sandiford + + PR target/113295 + * config/aarch64/aarch64-early-ra.cc + (early_ra::find_related_start): Account for definitions by shared + registers when testing for a single register definition. + (early_ra::accumulate_defs): New function. + (early_ra::record_copy): If A shares B's register, fold A's + definition information into B's. Fold A's use information into B's. + +2024-02-23 H.J. Lu + + * configure.ac (HAVE_AS_R_X86_64_CODE_6_GOTTPOFF): Defined as 1 + if R_X86_64_CODE_6_GOTTPOFF is supported. + * config.in: Regenerated. + * configure: Likewise. + * config/i386/predicates.md (apx_ndd_add_memory_operand): Allow + UNSPEC_GOTNTPOFF if R_X86_64_CODE_6_GOTTPOFF is supported. + +2024-02-23 Richard Earnshaw + + PR target/108120 + * config/arm/neon.md (div3): Rename from div3. + Gate with ARM_HAVE_NEON__ARITH. + +2024-02-23 Jakub Jelinek + + PR rtl-optimization/114054 + * expr.cc (expand_expr_real_2) : Use + temp variable instead of target parameter for result. + +2024-02-23 Jakub Jelinek + + PR tree-optimization/114040 + * gimple-lower-bitint.cc (bitint_large_huge::lower_addsub_overflow): + Use EQ_EXPR rather than LT_EXPR for g2 condition and change its + probability from likely to unlikely. When handling the true true + store, first cast to limb_access_type and then to l's type. + +2024-02-23 Richard Biener + + PR target/90785 + * config.gcc: Add ia64*-*-* to the list of obsoleted targets. + +2024-02-23 Palmer Dabbelt + + PR other/109668 + * config/riscv/arch-canonicalize: Move to python3 + * config/riscv/multilib-generator: Likewise + +2024-02-23 Palmer Dabbelt + + * doc/invoke.texi: Document -mcpu. + +2024-02-23 Lulu Cheng + + * configure: Regenerate. + * configure.ac: Add parameter "--fatal-warnings" to assemble + when checking whether the assemble support conditional branch + relaxation. + +2024-02-22 Jakub Jelinek + + PR c/114007 + * doc/extend.texi: (__extension__): Remove comments about scope + tokens vs. two colons. + +2024-02-22 Andrew Pinski + + PR tree-optimization/109804 + * gimple-ssa-warn-access.cc (new_delete_mismatch_p): Handle + DEMANGLE_COMPONENT_UNNAMED_TYPE. + +2024-02-22 Richard Biener + + PR tree-optimization/114048 + * tree-ssa-sccvn.cc (copy_reference_ops_from_ref): MEM_REF + can also produce -1 off. + +2024-02-22 Richard Biener + + PR tree-optimization/114027 + * tree-vect-loop.cc (vecctorizable_reduction): Use optimized + condition reduction classification only for single-element + chains. + +2024-02-22 Jakub Jelinek + + PR ipa/111960 + * profile-count.h (profile_count::dump): Remove overload with + char * first argument. + * profile-count.cc (profile_count::dump): Change overload with char * + first argument which uses sprintf into the overfload with FILE * + first argument and use fprintf instead. Remove overload which wrapped + it. + +2024-02-22 Jakub Jelinek + + PR tree-optimization/113993 + * tree-call-cdce.cc (get_no_error_domain): Handle + BUILT_IN_{COSH,SINH,EXP{,M1,2}}{F32X,F64X}. Handle + BUILT_IN_{COSH,SINH,EXP{,M1,2}}L for + REAL_MODE_FORMAT (TYPE_MODE (long_double_type_node))->emax == 16384 + the as the F128 suffixed cases, otherwise as non-suffixed ones. + Handle BUILT_IN_{EXP,POW}10L for + REAL_MODE_FORMAT (TYPE_MODE (long_double_type_node))->emax == 16384 + as (-inf, 4932). + +2024-02-22 Jakub Jelinek + + PR tree-optimization/114038 + * gimple-lower-bitint.cc (bitint_large_huge::lower_mul_overflow): Fix + loop exit condition if end is divisible by limb_prec. + +2024-02-22 YunQiang Su + + * doc/invoke.texi(MIPS Options): Fix skipping UrlSuffix + problem of mabi=, mno-flush-func, mexplicit-relocs; + add missing leading - of mbranch-cost option. + * config/mips/mips.opt.urls: Regenerate. + +2024-02-22 Kewen Lin + + PR target/109987 + * config/rs6000/constraints.md (we): Update internal doc without + referring to option -mpower9-vector. + * config/rs6000/driver-rs6000.cc (asm_names): Remove mpower9-vector + special handlings. + * config/rs6000/rs6000-cpus.def (OTHER_P9_VECTOR_MASKS, + OTHER_P8_VECTOR_MASKS): Merge to ... + (OTHER_VSX_VECTOR_MASKS): ... here. + * config/rs6000/rs6000.cc (rs6000_option_override_internal): Remove + some error message handlings and explicit option mask adjustments on + explicit option power{8,9}-vector conflicting with other options. + (rs6000_print_isa_options): Update comments. + (rs6000_disable_incompatible_switches): Remove power{8,9}-vector + related array items and handlings. + * config/rs6000/rs6000.h (ASM_CPU_SPEC): Remove mpower9-vector + special handlings. + * config/rs6000/rs6000.opt: Make option power{8,9}-vector as + WarnRemoved. + * doc/extend.texi: Remove documentation referring to option + -mpower8-vector. + * doc/invoke.texi: Remove documentation for option + -mpower{8,9}-vector and adjust some documentation referring to them. + * doc/md.texi: Update documentation for constraint we. + * doc/sourcebuild.texi: Remove documentation for powerpc_p8vector_ok. + +2024-02-22 Pan Li + + PR target/114017 + * config/riscv/riscv-c.cc (riscv_cpu_cpp_builtins): Upgrade + the version to 0.12. + +2024-02-21 Edwin Lu + + * config/riscv/riscv.cc (riscv_sched_variable_issue): Enable assert + +2024-02-21 Edwin Lu + Robin Dapp + + * config/riscv/generic-ooo.md (generic_ooo): Move reservation + (generic_ooo_vec_load): Ditto + (generic_ooo_vec_store): Ditto + (generic_ooo_vec_loadstore_seg): Ditto + (generic_ooo_vec_alu): Ditto + (generic_ooo_vec_fcmp): Ditto + (generic_ooo_vec_imul): Ditto + (generic_ooo_vec_fadd): Ditto + (generic_ooo_vec_fmul): Ditto + (generic_ooo_crypto): Ditto + (generic_ooo_perm): Ditto + (generic_ooo_vec_reduction): Ditto + (generic_ooo_vec_ordered_reduction): Ditto + (generic_ooo_vec_idiv): Ditto + (generic_ooo_vec_float_divsqrt): Ditto + (generic_ooo_vec_mask): Ditto + (generic_ooo_vec_vesetvl): Ditto + (generic_ooo_vec_setrm): Ditto + (generic_ooo_vec_readlen): Ditto + * config/riscv/riscv.md: Include generic-vector-ooo + * config/riscv/generic-vector-ooo.md: New file. To here + +2024-02-21 Edwin Lu + + * config/riscv/generic-ooo.md (generic_ooo_sfb_alu): Add reservation + (generic_ooo_branch): Ditto + * config/riscv/generic.md (generic_sfb_alu): Ditto + (generic_fmul_half): Ditto + * config/riscv/riscv.md: Remove cbo, pushpop, and rdfrm types + * config/riscv/sifive-7.md (sifive_7_hfma): Add reservation + (sifive_7_popcount): Ditto + * config/riscv/sifive-p400.md (sifive_p400_clmul): Ditto + * config/riscv/sifive-p600.md (sifive_p600_clmul): Ditto + * config/riscv/vector.md: Change rdfrm to fmove + * config/riscv/zc.md: Change pushpop to load/store + +2024-02-21 Jonathan Wakely + + * doc/invoke.texi (Warning Options): Fix typos. + +2024-02-21 David Faust + + * config/bpf/bpf-protos.h (bpf_expand_cpymem): New. + * config/bpf/bpf.cc: (emit_move_loop, bpf_expand_cpymem): New. + * config/bpf/bpf.md: (cpymemdi, movmemdi): New define_expands. + +2024-02-21 Martin Jambor + + PR ipa/113476 + * ipa-prop.h (ipa_node_params): Convert lattices to a vector, adjust + initializers in the contructor. + (ipa_node_params::~ipa_node_params): Release lattices as a vector. + * ipa-cp.h: New file. + * ipa-cp.cc: Include sreal.h and ipa-cp.h. + (ipcp_value_source): Move to ipa-cp.h. + (ipcp_value_base): Likewise. + (ipcp_value): Likewise. + (ipcp_lattice): Likewise. + (ipcp_agg_lattice): Likewise. + (ipcp_bits_lattice): Likewise. + (ipcp_vr_lattice): Likewise. + (ipcp_param_lattices): Likewise. + (ipa_get_parm_lattices): Remove assert latticess is non-NULL. + (ipa_value_from_jfunc): Adjust a check for empty lattices. + (ipa_context_from_jfunc): Likewise. + (ipa_agg_value_from_jfunc): Likewise. + (merge_agg_lats_step): Do not memset new aggregate lattices to zero. + (ipcp_propagate_stage): Allocate lattices in a vector as opposed to + just in contiguous memory. + (ipcp_store_vr_results): Adjust a check for empty lattices. + * auto-profile.cc: Include sreal.h and ipa-cp.h. + * cgraph.cc: Likewise. + * cgraphclones.cc: Likewise. + * cgraphunit.cc: Likewise. + * config/aarch64/aarch64.cc: Likewise. + * config/i386/i386-builtins.cc: Likewise. + * config/i386/i386-expand.cc: Likewise. + * config/i386/i386-features.cc: Likewise. + * config/i386/i386-options.cc: Likewise. + * config/i386/i386.cc: Likewise. + * config/rs6000/rs6000.cc: Likewise. + * config/s390/s390.cc: Likewise. + * gengtype.cc (open_base_files): Added sreal.h and ipa-cp.h to the + files to be included in gtype-desc.cc. + * gimple-range-fold.cc: Include sreal.h and ipa-cp.h. + * ipa-devirt.cc: Likewise. + * ipa-fnsummary.cc: Likewise. + * ipa-icf.cc: Likewise. + * ipa-inline-analysis.cc: Likewise. + * ipa-inline-transform.cc: Likewise. + * ipa-inline.cc: Include ipa-cp.h, move inclusion of sreal.h higher. + * ipa-modref.cc: Include sreal.h and ipa-cp.h. + * ipa-param-manipulation.cc: Likewise. + * ipa-predicate.cc: Likewise. + * ipa-profile.cc: Likewise. + * ipa-prop.cc: Likewise. + (ipa_node_params_t::duplicate): Assert new lattices remain empty + instead of setting them to NULL. + * ipa-pure-const.cc: Include sreal.h and ipa-cp.h. + * ipa-split.cc: Likewise. + * ipa-sra.cc: Likewise. + * ipa-strub.cc: Likewise. + * ipa-utils.cc: Likewise. + * ipa.cc: Likewise. + * toplev.cc: Likewise. + * tree-ssa-ccp.cc: Likewise. + * tree-ssa-sccvn.cc: Likewise. + * tree-vrp.cc: Likewise. + +2024-02-21 Tamar Christina + + * config/aarch64/aarch64-arches.def (AARCH64_ARCH): Remove LS64 from + Armv8.7-a. + +2024-02-21 Richard Sandiford + + * config/aarch64/aarch64.cc (aarch64_mode_emit_local_sme_state): + Use aarch64_gen_compare_zero_and_branch rather than emitting + a CBZ directly. + +2024-02-21 Richard Sandiford + + * config/aarch64/aarch64.cc (aarch64_option_valid_attribute_p): + Remove duplicated call. + +2024-02-21 Richard Sandiford + + * config/aarch64/aarch64.cc (aarch64_function_ok_for_sibcall): + Check that each individual piece of state is shared in the same + way, rather than using an aggregate check for PSTATE.ZA. + +2024-02-21 Richard Sandiford + + * config/aarch64/aarch64.cc (aarch64_mode_emit_local_sme_state): + In the code that commits a lazy save, only zero ZA if the function + has ZA state. Similarly zero ZT0 if the function has ZT0 state. + +2024-02-21 Richard Sandiford + + * config/aarch64/aarch64-sme.md (aarch64_commit_lazy_save): Remove, + directly inserting the associated sequence + * config/aarch64/aarch64.cc (aarch64_mode_emit_local_sme_state): + ...here instead. + +2024-02-21 Richard Sandiford + + PR target/113995 + * config/aarch64/aarch64.cc (aarch64_expand_prologue): Don't + fold the SVE allocation into the initial allocation if the + initial allocation includes a VG save. + +2024-02-21 Richard Sandiford + + PR target/113220 + * cfgrtl.cc (commit_one_edge_insertion): Handle sequences that + contain jumps even if called after initial RTL expansion. + * mode-switching.cc: Include cfgbuild.h. + (optimize_mode_switching): Allow the sequence returned by the + emit hook to contain internal jumps. Record which blocks + contain such jumps and split the blocks at the end. + * config/aarch64/aarch64.cc (aarch64_mode_emit): Check for + non-debug insns when scanning the sequence. + +2024-02-21 Tobias Burnus + + * config/nvptx/gen-omp-device-properties.sh: Add 'nvptx64' to arch. + * config/nvptx/nvptx.cc (nvptx_omp_device_kind_arch_isa): Likewise. + +2024-02-21 Dimitar Dimitrov + + * doc/invoke.texi (-mmcu): Add information about MCU specs. + +2024-02-21 Dimitar Dimitrov + + * doc/invoke.texi (-minrt): Clarify that main + must take no arguments. + 2024-02-20 Georg-Johann Lay * config/avr/builtins.def: Use function prototypes of given size diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 6f470e71ab94..7237a5054bab 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20240221 +20240309 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 694b255dd3cf..86acfbbf3e5c 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,21 @@ +2024-03-07 Eric Botcazou + + PR ada/113979 + * exp_ch4.adb (Expand_N_Allocator): In the subtype indication case, + call Apply_Predicate_Check on the resulting access value if needed. + +2024-02-26 Eric Botcazou + + 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. + 2024-01-23 Ronan Desplanques * gnatvsn.ads: Update year. diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 4f83cd4737a5..e4a40414872f 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -4657,8 +4657,6 @@ package body Exp_Ch4 is if Is_Array_Type (Dtyp) and then not No_Initialization (N) then Apply_Constraint_Check (Expression (N), Dtyp, No_Sliding => True); - Apply_Predicate_Check (Expression (N), Dtyp); - if Nkind (Expression (N)) = N_Raise_Constraint_Error then Rewrite (N, New_Copy (Expression (N))); Set_Etype (N, PtrT); @@ -4752,6 +4750,8 @@ package body Exp_Ch4 is Rewrite (N, New_Occurrence_Of (Temp, Loc)); Analyze_And_Resolve (N, PtrT); + Apply_Predicate_Check (N, Dtyp, Deref => True); + -- Case of no initialization procedure present elsif not Has_Non_Null_Base_Init_Proc (T) then @@ -5119,6 +5119,8 @@ package body Exp_Ch4 is Rewrite (N, New_Occurrence_Of (Temp, Loc)); Analyze_And_Resolve (N, PtrT); + Apply_Predicate_Check (N, Dtyp, Deref => True); + -- When designated type has Default_Initial_Condition aspects, -- make a call to the type's DIC procedure to perform the -- checks. Theoretically this might also be needed for cases diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index 2ac731013512..e594a5342445 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -749,6 +749,7 @@ package body Exp_Ch7 is Desig_Typ : Entity_Id; FM_Id : Entity_Id; Priv_View : Entity_Id; + Scop : Entity_Id; Unit_Decl : Node_Id; Unit_Id : Entity_Id; @@ -787,6 +788,18 @@ package body Exp_Ch7 is Desig_Typ := Priv_View; end if; + -- For a designated type not declared at library level, we cannot create + -- a finalization collection attached to an outer unit since this would + -- generate dangling references to the dynamic scope through access-to- + -- procedure values designating the local Finalize_Address primitive. + + Scop := Enclosing_Dynamic_Scope (Desig_Typ); + if Scop /= Standard_Standard + and then Scope_Depth (Scop) > Scope_Depth (Unit_Id) + then + return; + end if; + -- Determine whether the current semantic unit already has an anonymous -- master which services the designated type. diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 31cd47de7d2f..04d114694ab6 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -936,6 +936,16 @@ package body Exp_Util is Needs_Finalization (Desig_Typ) and then not No_Heap_Finalization (Ptr_Typ); + -- The allocation/deallocation of a controlled object must be associated + -- with an attachment to/detachment from a finalization master, but the + -- implementation cannot guarantee this property for every anonymous + -- access tyoe, see Build_Anonymous_Collection. + + if Needs_Fin and then No (Finalization_Master (Ptr_Typ)) then + pragma Assert (Ekind (Ptr_Typ) = E_Anonymous_Access_Type); + Needs_Fin := False; + end if; + if Needs_Fin then -- Do nothing if the access type may never allocate / deallocate @@ -945,11 +955,6 @@ package body Exp_Util is return; end if; - -- The allocation / deallocation of a controlled object must be - -- chained on / detached from a finalization master. - - pragma Assert (Present (Finalization_Master (Ptr_Typ))); - -- The only other kind of allocation / deallocation supported by this -- routine is on / from a subpool. diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 8e9714c1c86c..075c0d85ccd9 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -5679,19 +5679,19 @@ package body Sem_Res is Set_Is_Dynamic_Coextension (N, False); Set_Is_Static_Coextension (N, False); - -- Anonymous access-to-controlled objects are not finalized on - -- time because this involves run-time ownership and currently - -- this property is not available. In rare cases the object may - -- not be finalized at all. Warn on potential issues involving - -- anonymous access-to-controlled objects. + -- Objects allocated through anonymous access types are not + -- finalized on time because this involves run-time ownership + -- and currently this property is not available. In rare cases + -- the object might not be finalized at all. Warn on potential + -- issues involving anonymous access-to-controlled types. if Ekind (Typ) = E_Anonymous_Access_Type and then Is_Controlled_Active (Desig_T) then Error_Msg_N - ("??object designated by anonymous access object might " + ("??object designated by anonymous access value might " & "not be finalized until its enclosing library unit " - & "goes out of scope", N); + & "goes out of scope, or not be finalized at all", N); Error_Msg_N ("\use named access type instead", N); end if; end if; diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog index d8165bbb86d9..22a54e5332ec 100644 --- a/gcc/analyzer/ChangeLog +++ b/gcc/analyzer/ChangeLog @@ -1,3 +1,130 @@ +2024-03-07 Jakub Jelinek + + * access-diagram.cc: Include diagnostic-core.h before including + diagnostic.h or diagnostic-path.h. + * sm-malloc.cc: Likewise. + * diagnostic-manager.cc: Likewise. + * call-summary.cc: Likewise. + * record-layout.cc: Likewise. + +2024-02-29 David Malcolm + + PR analyzer/114159 + * analyzer.cc: Include "tree-dfa.h". + (get_ssa_default_def): New decl. + * analyzer.h (get_ssa_default_def): New. + * call-info.cc (call_info::call_info): New ctor taking an explicit + called_fn. + * call-info.h (call_info::call_info): Likewise. + * call-summary.cc (call_summary_replay::call_summary_replay): + Convert param from function * to const function &. + * call-summary.h (call_summary_replay::call_summary_replay): + Likewise. + * checker-event.h (state_change_event::get_dest_function): + Constify return value. + * engine.cc (point_and_state::validate): Update for conversion to + const function &. + (exploded_node::on_stmt): Likewise. + (call_summary_edge_info::call_summary_edge_info): Likewise. + Pass in called_fn to call_info ctor. + (exploded_node::replay_call_summaries): Update for conversion to + const function &. Convert per_function_data from * to &. + (exploded_node::replay_call_summary): Update for conversion to + const function &. + (exploded_graph::add_function_entry): Likewise. + (toplevel_function_p): Likewise. + (add_tainted_args_callback): Likewise. + (exploded_graph::build_initial_worklist): Likewise. + (exploded_graph::maybe_create_dynamic_call): Likewise. + (maybe_update_for_edge): Likewise. + (exploded_graph::on_escaped_function): Likewise. + * exploded-graph.h (exploded_node::replay_call_summaries): + Likewise. + (exploded_node::replay_call_summary): Likewise. + (exploded_graph::add_function_entry): Likewise. + * program-point.cc (function_point::from_function_entry): + Likewise. + (program_point::from_function_entry): Likewise. + * program-point.h (function_point::from_function_entry): Likewise. + (program_point::from_function_entry): Likewise. + * program-state.cc (program_state::push_frame): Likewise. + (program_state::get_current_function): Constify return type. + * program-state.h (program_state::push_frame): Update for + conversion to const function &. + (program_state::get_current_function): Likewise. + * region-model-manager.cc + (region_model_manager::get_frame_region): Likewise. + * region-model-manager.h + (region_model_manager::get_frame_region): Likewise. + * region-model.cc (region_model::called_from_main_p): Likewise. + (region_model::update_for_gcall): Likewise. + (region_model::push_frame): Likewise. + (region_model::get_current_function): Constify return type. + (region_model::pop_frame): Update for conversion to + const function &. + (selftest::test_stack_frames): Likewise. + (selftest::test_get_representative_path_var): Likewise. + (selftest::test_state_merging): Likewise. + (selftest::test_alloca): Likewise. + * region-model.h (region_model::push_frame): Likewise. + (region_model::get_current_function): Likewise. + * region.cc (frame_region::dump_to_pp): Likewise. + (frame_region::get_region_for_local): Likewise. + * region.h (class frame_region): Likewise. + * sm-signal.cc (signal_unsafe_call::describe_state_change): + Likewise. + (update_model_for_signal_handler): Likewise. + (signal_delivery_edge_info_t::update_model): Likewise. + (register_signal_handler::impl_transition): Likewise. + * state-purge.cc (class gimple_op_visitor): Likewise. + (state_purge_map::state_purge_map): Likewise. + (state_purge_map::get_or_create_data_for_decl): Likewise. + (state_purge_per_ssa_name::state_purge_per_ssa_name): Likewise. + (state_purge_per_ssa_name::add_to_worklist): Likewise. + (state_purge_per_ssa_name::process_point): Likewise. + (state_purge_per_decl::add_to_worklist): Likewise. + (state_purge_annotator::print_needed): Likewise. + * state-purge.h + (state_purge_map::get_or_create_data_for_decl): Likewise. + (class state_purge_per_tree): Likewise. + (class state_purge_per_ssa_name): Likewise. + (class state_purge_per_decl): Likewise. + * supergraph.cc (supergraph::dump_dot_to_pp): Likewise. + * supergraph.h + (supergraph::get_node_for_function_entry): Likewise. + (supergraph::get_node_for_function_exit): Likewise. + +2024-02-27 David Malcolm + + 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. + +2024-02-27 David Malcolm + + 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. + +2024-02-21 David Malcolm + + PR analyzer/113999 + * analyzer.h (get_string_cst_size): New decl. + * region-model-manager.cc (get_string_cst_size): New. + (region_model_manager::maybe_get_char_from_string_cst): Treat + single-byte accesses within string_cst but beyond + TREE_STRING_LENGTH as being 0. + * region-model.cc (string_cst_has_null_terminator): Likewise. + +2024-02-21 David Malcolm + + PR analyzer/113998 + * ranges.cc (symbolic_byte_range::intersection): Handle empty ranges. + (selftest::test_intersects): Add test coverage for empty ranges. + 2024-02-19 David Malcolm PR analyzer/111289 diff --git a/gcc/analyzer/access-diagram.cc b/gcc/analyzer/access-diagram.cc index 9555ee823931..2836308c0199 100644 --- a/gcc/analyzer/access-diagram.cc +++ b/gcc/analyzer/access-diagram.cc @@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see #include "function.h" #include "basic-block.h" #include "gimple.h" +#include "diagnostic-core.h" #include "diagnostic.h" #include "intl.h" #include "make-unique.h" @@ -1905,7 +1906,7 @@ class string_literal_spatial_item : public svalue_spatial_item const table::rect_t idx_table_rect = btm.get_table_rect (&m_string_reg, bytes, byte_idx_table_y, 1); t.set_cell_span (idx_table_rect, - fmt_styled_string (sm, "[%li]", + fmt_styled_string (sm, "[%wu]", byte_idx_within_string.ulow ())); } diff --git a/gcc/analyzer/analyzer.cc b/gcc/analyzer/analyzer.cc index 389496cd57ab..7f5d3d56d338 100644 --- a/gcc/analyzer/analyzer.cc +++ b/gcc/analyzer/analyzer.cc @@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see #include "analyzer/analyzer.h" #include "tree-pretty-print.h" #include "diagnostic-event-id.h" +#include "tree-dfa.h" #if ENABLE_ANALYZER @@ -275,6 +276,14 @@ byte_offset_to_json (const byte_offset_t &offset) return new json::string (pp_formatted_text (&pp)); } +/* Workaround for lack of const-correctness of ssa_default_def. */ + +tree +get_ssa_default_def (const function &fun, tree var) +{ + return ssa_default_def (const_cast (&fun), var); +} + } // namespace ana /* Helper function for checkers. Is the CALL to the given function name, diff --git a/gcc/analyzer/analyzer.h b/gcc/analyzer/analyzer.h index 20a8e3f9a1d0..1d792ed23ec7 100644 --- a/gcc/analyzer/analyzer.h +++ b/gcc/analyzer/analyzer.h @@ -433,6 +433,9 @@ compare_constants (tree lhs_const, enum tree_code op, tree rhs_const); extern tree get_string_cst_size (const_tree string_cst); +extern tree +get_ssa_default_def (const function &fun, tree var); + } // namespace ana extern bool is_special_named_call_p (const gcall *call, const char *funcname, diff --git a/gcc/analyzer/call-info.cc b/gcc/analyzer/call-info.cc index 7ec82124d523..4c965b2136c0 100644 --- a/gcc/analyzer/call-info.cc +++ b/gcc/analyzer/call-info.cc @@ -143,6 +143,14 @@ call_info::call_info (const call_details &cd) gcc_assert (m_fndecl); } +call_info::call_info (const call_details &cd, + const function &called_fn) +: m_call_stmt (cd.get_call_stmt ()), + m_fndecl (called_fn.decl) +{ + gcc_assert (m_fndecl); +} + /* class succeed_or_fail_call_info : public call_info. */ label_text diff --git a/gcc/analyzer/call-info.h b/gcc/analyzer/call-info.h index 9815b4141c34..17d5fdfec735 100644 --- a/gcc/analyzer/call-info.h +++ b/gcc/analyzer/call-info.h @@ -44,6 +44,7 @@ class call_info : public custom_edge_info protected: call_info (const call_details &cd); + call_info (const call_details &cd, const function &called_fn); private: const gcall *m_call_stmt; diff --git a/gcc/analyzer/call-summary.cc b/gcc/analyzer/call-summary.cc index ecb6fb13c9ec..a569bb94cec5 100644 --- a/gcc/analyzer/call-summary.cc +++ b/gcc/analyzer/call-summary.cc @@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see #include "coretypes.h" #include "tree.h" #include "tree-dfa.h" +#include "diagnostic-core.h" #include "diagnostic.h" #include "tree-diagnostic.h" #include "analyzer/analyzer.h" @@ -167,7 +168,7 @@ call_summary::dump (const extrinsic_state &ext_state, bool simple) const arguments at the caller. */ call_summary_replay::call_summary_replay (const call_details &cd, - function *called_fn, + const function &called_fn, call_summary *summary, const extrinsic_state &ext_state) : m_cd (cd), @@ -177,7 +178,7 @@ call_summary_replay::call_summary_replay (const call_details &cd, region_model_manager *mgr = cd.get_manager (); // populate params based on args - tree fndecl = called_fn->decl; + tree fndecl = called_fn.decl; /* Get a frame_region for use with respect to the summary. This will be a top-level frame, since that's what's in @@ -196,7 +197,7 @@ call_summary_replay::call_summary_replay (const call_details &cd, break; const svalue *caller_arg_sval = cd.get_arg_svalue (idx); tree parm_lval = iter_parm; - if (tree parm_default_ssa = ssa_default_def (called_fn, iter_parm)) + if (tree parm_default_ssa = get_ssa_default_def (called_fn, iter_parm)) parm_lval = parm_default_ssa; const region *summary_parm_reg = summary_frame->get_region_for_local (mgr, parm_lval, cd.get_ctxt ()); diff --git a/gcc/analyzer/call-summary.h b/gcc/analyzer/call-summary.h index 73f21ac72826..220dd0831846 100644 --- a/gcc/analyzer/call-summary.h +++ b/gcc/analyzer/call-summary.h @@ -68,7 +68,7 @@ class call_summary_replay { public: call_summary_replay (const call_details &cd, - function *called_fn, + const function &called_fn, call_summary *m_summary, const extrinsic_state &ext_state); diff --git a/gcc/analyzer/checker-event.h b/gcc/analyzer/checker-event.h index 7d8915c8e530..d2fb87fb523f 100644 --- a/gcc/analyzer/checker-event.h +++ b/gcc/analyzer/checker-event.h @@ -370,7 +370,7 @@ class state_change_event : public checker_event label_text get_desc (bool can_colorize) const final override; meaning get_meaning () const override; - function *get_dest_function () const + const function *get_dest_function () const { return m_dst_state.get_current_function (); } diff --git a/gcc/analyzer/constraint-manager.cc b/gcc/analyzer/constraint-manager.cc index e8bcabeb0cd5..a380b95315ee 100644 --- a/gcc/analyzer/constraint-manager.cc +++ b/gcc/analyzer/constraint-manager.cc @@ -124,10 +124,12 @@ bound::ensure_closed (enum bound_kind bound_kind) For example, convert 3 < x into 4 <= x, and convert x < 5 into x <= 4. */ gcc_assert (CONSTANT_CLASS_P (m_constant)); + gcc_assert (INTEGRAL_TYPE_P (TREE_TYPE (m_constant))); m_constant = fold_build2 (bound_kind == BK_UPPER ? MINUS_EXPR : PLUS_EXPR, TREE_TYPE (m_constant), m_constant, integer_one_node); gcc_assert (CONSTANT_CLASS_P (m_constant)); + gcc_assert (INTEGRAL_TYPE_P (TREE_TYPE (m_constant))); m_closed = true; } } @@ -306,6 +308,10 @@ range::above_upper_bound (tree rhs_const) const bool range::add_bound (bound b, enum bound_kind bound_kind) { + /* Bail out on floating point constants. */ + if (!INTEGRAL_TYPE_P (TREE_TYPE (b.m_constant))) + return true; + b.ensure_closed (bound_kind); switch (bound_kind) diff --git a/gcc/analyzer/diagnostic-manager.cc b/gcc/analyzer/diagnostic-manager.cc index 246d052100fa..08d92f9780e7 100644 --- a/gcc/analyzer/diagnostic-manager.cc +++ b/gcc/analyzer/diagnostic-manager.cc @@ -24,11 +24,11 @@ along with GCC; see the file COPYING3. If not see #include "coretypes.h" #include "tree.h" #include "input.h" +#include "diagnostic-core.h" #include "pretty-print.h" #include "gcc-rich-location.h" #include "gimple-pretty-print.h" #include "function.h" -#include "diagnostic-core.h" #include "diagnostic-event-id.h" #include "diagnostic-path.h" #include "bitmap.h" diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc index 44ff20cf9af7..ad310b4d8731 100644 --- a/gcc/analyzer/engine.cc +++ b/gcc/analyzer/engine.cc @@ -1072,7 +1072,7 @@ point_and_state::validate (const extrinsic_state &ext_state) const { int index = iter_frame->get_index (); gcc_assert (m_point.get_function_at_depth (index) - == iter_frame->get_function ()); + == &iter_frame->get_function ()); } } @@ -1496,14 +1496,17 @@ exploded_node::on_stmt (exploded_graph &eg, per_function_data *called_fn_data = eg.get_per_function_data (called_fn); if (called_fn_data) - return replay_call_summaries (eg, - snode, - as_a (stmt), - state, - path_ctxt, - called_fn, - called_fn_data, - &ctxt); + { + gcc_assert (called_fn); + return replay_call_summaries (eg, + snode, + as_a (stmt), + state, + path_ctxt, + *called_fn, + *called_fn_data, + &ctxt); + } } bool unknown_side_effects = false; @@ -1610,10 +1613,10 @@ class call_summary_edge_info : public call_info { public: call_summary_edge_info (const call_details &cd, - function *called_fn, + const function &called_fn, call_summary *summary, const extrinsic_state &ext_state) - : call_info (cd), + : call_info (cd, called_fn), m_called_fn (called_fn), m_summary (summary), m_ext_state (ext_state) @@ -1648,7 +1651,7 @@ class call_summary_edge_info : public call_info } private: - function *m_called_fn; + const function &m_called_fn; call_summary *m_summary; const extrinsic_state &m_ext_state; }; @@ -1662,18 +1665,15 @@ exploded_node::replay_call_summaries (exploded_graph &eg, const gcall *call_stmt, program_state *state, path_context *path_ctxt, - function *called_fn, - per_function_data *called_fn_data, + const function &called_fn, + per_function_data &called_fn_data, region_model_context *ctxt) { logger *logger = eg.get_logger (); LOG_SCOPE (logger); - gcc_assert (called_fn); - gcc_assert (called_fn_data); - /* Each summary will call bifurcate on the PATH_CTXT. */ - for (auto summary : called_fn_data->m_summaries) + for (auto summary : called_fn_data.m_summaries) replay_call_summary (eg, snode, call_stmt, state, path_ctxt, called_fn, summary, ctxt); path_ctxt->terminate_path (); @@ -1691,7 +1691,7 @@ exploded_node::replay_call_summary (exploded_graph &eg, const gcall *call_stmt, program_state *old_state, path_context *path_ctxt, - function *called_fn, + const function &called_fn, call_summary *summary, region_model_context *ctxt) { @@ -1700,13 +1700,12 @@ exploded_node::replay_call_summary (exploded_graph &eg, gcc_assert (snode); gcc_assert (call_stmt); gcc_assert (old_state); - gcc_assert (called_fn); gcc_assert (summary); if (logger) logger->log ("using %s as summary for call to %qE from %qE", summary->get_desc ().get (), - called_fn->decl, + called_fn.decl, snode->get_function ()->decl); const extrinsic_state &ext_state = eg.get_ext_state (); const program_state &summary_end_state = summary->get_state (); @@ -2784,16 +2783,17 @@ class tainted_args_function_info : public custom_edge_info Return the exploded_node for the entrypoint to the function. */ exploded_node * -exploded_graph::add_function_entry (function *fun) +exploded_graph::add_function_entry (const function &fun) { - gcc_assert (gimple_has_body_p (fun->decl)); + gcc_assert (gimple_has_body_p (fun.decl)); /* Be idempotent. */ - if (m_functions_with_enodes.contains (fun)) + function *key = const_cast (&fun); + if (m_functions_with_enodes.contains (key)) { logger * const logger = get_logger (); if (logger) - logger->log ("entrypoint for %qE already exists", fun->decl); + logger->log ("entrypoint for %qE already exists", fun.decl); return NULL; } @@ -2805,10 +2805,10 @@ exploded_graph::add_function_entry (function *fun) std::unique_ptr edge_info = NULL; - if (lookup_attribute ("tainted_args", DECL_ATTRIBUTES (fun->decl))) + if (lookup_attribute ("tainted_args", DECL_ATTRIBUTES (fun.decl))) { - if (mark_params_as_tainted (&state, fun->decl, m_ext_state)) - edge_info = make_unique (fun->decl); + if (mark_params_as_tainted (&state, fun.decl, m_ext_state)) + edge_info = make_unique (fun.decl); } if (!state.m_valid) @@ -2820,7 +2820,7 @@ exploded_graph::add_function_entry (function *fun) add_edge (m_origin, enode, NULL, false, std::move (edge_info)); - m_functions_with_enodes.add (fun); + m_functions_with_enodes.add (key); return enode; } @@ -3108,7 +3108,7 @@ exploded_graph::get_per_function_data (function *fun) const called via other functions. */ static bool -toplevel_function_p (function *fun, logger *logger) +toplevel_function_p (const function &fun, logger *logger) { /* Don't directly traverse into functions that have an "__analyzer_" prefix. Doing so is useful for the analyzer test suite, allowing @@ -3119,17 +3119,17 @@ toplevel_function_p (function *fun, logger *logger) excess messages from the case of the first function being traversed directly. */ #define ANALYZER_PREFIX "__analyzer_" - if (!strncmp (IDENTIFIER_POINTER (DECL_NAME (fun->decl)), ANALYZER_PREFIX, + if (!strncmp (IDENTIFIER_POINTER (DECL_NAME (fun.decl)), ANALYZER_PREFIX, strlen (ANALYZER_PREFIX))) { if (logger) logger->log ("not traversing %qE (starts with %qs)", - fun->decl, ANALYZER_PREFIX); + fun.decl, ANALYZER_PREFIX); return false; } if (logger) - logger->log ("traversing %qE (all checks passed)", fun->decl); + logger->log ("traversing %qE (all checks passed)", fun.decl); return true; } @@ -3254,9 +3254,9 @@ add_tainted_args_callback (exploded_graph *eg, tree field, tree fndecl, program_point point = program_point::from_function_entry (*ext_state.get_model_manager (), - eg->get_supergraph (), fun); + eg->get_supergraph (), *fun); program_state state (ext_state); - state.push_frame (ext_state, fun); + state.push_frame (ext_state, *fun); if (!mark_params_as_tainted (&state, fndecl, ext_state)) return; @@ -3330,9 +3330,10 @@ exploded_graph::build_initial_worklist () FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node) { function *fun = node->get_fun (); - if (!toplevel_function_p (fun, logger)) + gcc_assert (fun); + if (!toplevel_function_p (*fun, logger)) continue; - exploded_node *enode = add_function_entry (fun); + exploded_node *enode = add_function_entry (*fun); if (logger) { if (enode) @@ -3838,8 +3839,8 @@ exploded_graph::maybe_create_dynamic_call (const gcall *call, if (fun) { const supergraph &sg = this->get_supergraph (); - supernode *sn_entry = sg.get_node_for_function_entry (fun); - supernode *sn_exit = sg.get_node_for_function_exit (fun); + supernode *sn_entry = sg.get_node_for_function_entry (*fun); + supernode *sn_exit = sg.get_node_for_function_exit (*fun); program_point new_point = program_point::before_supernode (sn_entry, @@ -4962,7 +4963,7 @@ maybe_update_for_edge (logger *logger, == PK_BEFORE_SUPERNODE); function *fun = eedge->m_dest->get_function (); gcc_assert (fun); - m_model.push_frame (fun, NULL, ctxt); + m_model.push_frame (*fun, NULL, ctxt); if (logger) logger->log (" pushing frame for %qD", fun->decl); } @@ -5582,7 +5583,7 @@ exploded_graph::on_escaped_function (tree fndecl) if (!gimple_has_body_p (fndecl)) return; - exploded_node *enode = add_function_entry (fun); + exploded_node *enode = add_function_entry (*fun); if (logger) { if (enode) diff --git a/gcc/analyzer/exploded-graph.h b/gcc/analyzer/exploded-graph.h index 387ae3a3aea0..642d69bbcc0a 100644 --- a/gcc/analyzer/exploded-graph.h +++ b/gcc/analyzer/exploded-graph.h @@ -285,15 +285,15 @@ class exploded_node : public dnode const gcall *call_stmt, program_state *state, path_context *path_ctxt, - function *called_fn, - per_function_data *called_fn_data, + const function &called_fn, + per_function_data &called_fn_data, region_model_context *ctxt); void replay_call_summary (exploded_graph &eg, const supernode *snode, const gcall *call_stmt, program_state *state, path_context *path_ctxt, - function *called_fn, + const function &called_fn, call_summary *summary, region_model_context *ctxt); @@ -810,7 +810,7 @@ class exploded_graph : public digraph exploded_node *get_origin () const { return m_origin; } - exploded_node *add_function_entry (function *fun); + exploded_node *add_function_entry (const function &fun); void build_initial_worklist (); void process_worklist (); diff --git a/gcc/analyzer/program-point.cc b/gcc/analyzer/program-point.cc index 5e98b5234dcc..6e225cfe7254 100644 --- a/gcc/analyzer/program-point.cc +++ b/gcc/analyzer/program-point.cc @@ -230,7 +230,7 @@ function_point::final_stmt_p () const /* Create a function_point representing the entrypoint of function FUN. */ function_point -function_point::from_function_entry (const supergraph &sg, function *fun) +function_point::from_function_entry (const supergraph &sg, const function &fun) { return before_supernode (sg.get_node_for_function_entry (fun), NULL); } @@ -698,7 +698,7 @@ program_point::origin (const region_model_manager &mgr) program_point program_point::from_function_entry (const region_model_manager &mgr, const supergraph &sg, - function *fun) + const function &fun) { return program_point (function_point::from_function_entry (sg, fun), mgr.get_empty_call_string ()); diff --git a/gcc/analyzer/program-point.h b/gcc/analyzer/program-point.h index 62c2c946412d..61b895f4499b 100644 --- a/gcc/analyzer/program-point.h +++ b/gcc/analyzer/program-point.h @@ -112,7 +112,7 @@ class function_point /* Factory functions for making various kinds of program_point. */ static function_point from_function_entry (const supergraph &sg, - function *fun); + const function &fun); static function_point before_supernode (const supernode *supernode, const superedge *from_edge); @@ -252,7 +252,7 @@ class program_point static program_point origin (const region_model_manager &mgr); static program_point from_function_entry (const region_model_manager &mgr, const supergraph &sg, - function *fun); + const function &fun); static program_point before_supernode (const supernode *supernode, const superedge *from_edge, diff --git a/gcc/analyzer/program-state.cc b/gcc/analyzer/program-state.cc index 55dd6ca71667..c88652baf5ca 100644 --- a/gcc/analyzer/program-state.cc +++ b/gcc/analyzer/program-state.cc @@ -1143,14 +1143,14 @@ program_state::to_json (const extrinsic_state &ext_state) const void program_state::push_frame (const extrinsic_state &ext_state ATTRIBUTE_UNUSED, - function *fun) + const function &fun) { m_region_model->push_frame (fun, NULL, NULL); } /* Get the current function of this state. */ -function * +const function * program_state::get_current_function () const { return m_region_model->get_current_function (); diff --git a/gcc/analyzer/program-state.h b/gcc/analyzer/program-state.h index 69bf931f070c..3ba6a931cd6f 100644 --- a/gcc/analyzer/program-state.h +++ b/gcc/analyzer/program-state.h @@ -226,8 +226,8 @@ class program_state json::object *to_json (const extrinsic_state &ext_state) const; - void push_frame (const extrinsic_state &ext_state, function *fun); - function * get_current_function () const; + void push_frame (const extrinsic_state &ext_state, const function &fun); + const function * get_current_function () const; void push_call (exploded_graph &eg, exploded_node *enode, diff --git a/gcc/analyzer/record-layout.cc b/gcc/analyzer/record-layout.cc index 62951474bb77..567dfd9809a6 100644 --- a/gcc/analyzer/record-layout.cc +++ b/gcc/analyzer/record-layout.cc @@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see #include "function.h" #include "basic-block.h" #include "gimple.h" +#include "diagnostic-core.h" #include "diagnostic.h" #include "tree-diagnostic.h" #include "analyzer/analyzer.h" diff --git a/gcc/analyzer/region-model-manager.cc b/gcc/analyzer/region-model-manager.cc index 93e72ec45a85..8530f49e74ab 100644 --- a/gcc/analyzer/region-model-manager.cc +++ b/gcc/analyzer/region-model-manager.cc @@ -1676,7 +1676,7 @@ region_model_manager::get_cast_region (const region *original_region, const frame_region * region_model_manager::get_frame_region (const frame_region *calling_frame, - function *fun) + const function &fun) { int index = calling_frame ? calling_frame->get_index () + 1 : 0; diff --git a/gcc/analyzer/region-model-manager.h b/gcc/analyzer/region-model-manager.h index 5c89de1f7c13..7d1208c70a70 100644 --- a/gcc/analyzer/region-model-manager.h +++ b/gcc/analyzer/region-model-manager.h @@ -131,7 +131,7 @@ class region_model_manager const region *get_cast_region (const region *original_region, tree type); const frame_region *get_frame_region (const frame_region *calling_frame, - function *fun); + const function &fun); const region *get_symbolic_region (const svalue *sval); const string_region *get_region_for_string (tree string_cst); const region *get_bit_range (const region *parent, tree type, diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc index 6ab917465d6f..33a4584841e4 100644 --- a/gcc/analyzer/region-model.cc +++ b/gcc/analyzer/region-model.cc @@ -2619,7 +2619,7 @@ region_model::called_from_main_p () const /* Determine if the oldest stack frame in this model is for "main". */ const frame_region *frame0 = get_frame_at_index (0); gcc_assert (frame0); - return id_equal (DECL_NAME (frame0->get_function ()->decl), "main"); + return id_equal (DECL_NAME (frame0->get_function ().decl), "main"); } /* Subroutine of region_model::get_store_value for when REG is (or is within) @@ -5552,7 +5552,8 @@ region_model::update_for_gcall (const gcall *call_stmt, callee = DECL_STRUCT_FUNCTION (fn_decl); } - push_frame (callee, &arg_svals, ctxt); + gcc_assert (callee); + push_frame (*callee, &arg_svals, ctxt); } /* Pop the top-most frame_region from the stack, and copy the return @@ -5896,14 +5897,15 @@ region_model::on_top_level_param (tree param, Return the frame_region for the new frame. */ const region * -region_model::push_frame (function *fun, const vec *arg_svals, +region_model::push_frame (const function &fun, + const vec *arg_svals, region_model_context *ctxt) { m_current_frame = m_mgr->get_frame_region (m_current_frame, fun); if (arg_svals) { /* Arguments supplied from a caller frame. */ - tree fndecl = fun->decl; + tree fndecl = fun.decl; unsigned idx = 0; for (tree iter_parm = DECL_ARGUMENTS (fndecl); iter_parm; iter_parm = DECL_CHAIN (iter_parm), ++idx) @@ -5914,7 +5916,7 @@ region_model::push_frame (function *fun, const vec *arg_svals, if (idx >= arg_svals->length ()) break; tree parm_lval = iter_parm; - if (tree parm_default_ssa = ssa_default_def (fun, iter_parm)) + if (tree parm_default_ssa = get_ssa_default_def (fun, iter_parm)) parm_lval = parm_default_ssa; const region *parm_reg = get_lvalue (parm_lval, ctxt); const svalue *arg_sval = (*arg_svals)[idx]; @@ -5937,7 +5939,7 @@ region_model::push_frame (function *fun, const vec *arg_svals, /* Otherwise we have a top-level call within the analysis. The params have defined but unknown initial values. Anything they point to has escaped. */ - tree fndecl = fun->decl; + tree fndecl = fun.decl; /* Handle "__attribute__((nonnull))". */ tree fntype = TREE_TYPE (fndecl); @@ -5951,7 +5953,7 @@ region_model::push_frame (function *fun, const vec *arg_svals, ? (bitmap_empty_p (nonnull_args) || bitmap_bit_p (nonnull_args, parm_idx)) : false); - if (tree parm_default_ssa = ssa_default_def (fun, iter_parm)) + if (tree parm_default_ssa = get_ssa_default_def (fun, iter_parm)) on_top_level_param (parm_default_ssa, non_null, ctxt); else on_top_level_param (iter_parm, non_null, ctxt); @@ -5967,12 +5969,12 @@ region_model::push_frame (function *fun, const vec *arg_svals, /* Get the function of the top-most frame in this region_model's stack. There must be such a frame. */ -function * +const function * region_model::get_current_function () const { const frame_region *frame = get_current_frame (); gcc_assert (frame); - return frame->get_function (); + return &frame->get_function (); } /* Pop the topmost frame_region from this region_model's stack; @@ -6007,7 +6009,7 @@ region_model::pop_frame (tree result_lvalue, ctxt->on_pop_frame (frame_reg); /* Evaluate the result, within the callee frame. */ - tree fndecl = m_current_frame->get_function ()->decl; + tree fndecl = m_current_frame->get_function ().decl; tree result = DECL_RESULT (fndecl); const svalue *retval = NULL; if (result @@ -7966,7 +7968,7 @@ test_stack_frames () /* Push stack frame for "parent_fn". */ const region *parent_frame_reg - = model.push_frame (DECL_STRUCT_FUNCTION (parent_fndecl), + = model.push_frame (*DECL_STRUCT_FUNCTION (parent_fndecl), NULL, &ctxt); ASSERT_EQ (model.get_current_frame (), parent_frame_reg); ASSERT_TRUE (model.region_exists_p (parent_frame_reg)); @@ -7982,7 +7984,7 @@ test_stack_frames () /* Push stack frame for "child_fn". */ const region *child_frame_reg - = model.push_frame (DECL_STRUCT_FUNCTION (child_fndecl), NULL, &ctxt); + = model.push_frame (*DECL_STRUCT_FUNCTION (child_fndecl), NULL, &ctxt); ASSERT_EQ (model.get_current_frame (), child_frame_reg); ASSERT_TRUE (model.region_exists_p (child_frame_reg)); const region *x_in_child_reg = model.get_lvalue (x, &ctxt); @@ -8075,7 +8077,7 @@ test_get_representative_path_var () for (int depth = 0; depth < 5; depth++) { const region *frame_n_reg - = model.push_frame (DECL_STRUCT_FUNCTION (fndecl), NULL, &ctxt); + = model.push_frame (*DECL_STRUCT_FUNCTION (fndecl), NULL, &ctxt); const region *parm_n_reg = model.get_lvalue (path_var (n, depth), &ctxt); parm_regs.safe_push (parm_n_reg); @@ -8319,9 +8321,9 @@ test_state_merging () region_model model0 (&mgr); region_model model1 (&mgr); ASSERT_EQ (model0.get_stack_depth (), 0); - model0.push_frame (DECL_STRUCT_FUNCTION (test_fndecl), NULL, &ctxt); + model0.push_frame (*DECL_STRUCT_FUNCTION (test_fndecl), NULL, &ctxt); ASSERT_EQ (model0.get_stack_depth (), 1); - model1.push_frame (DECL_STRUCT_FUNCTION (test_fndecl), NULL, &ctxt); + model1.push_frame (*DECL_STRUCT_FUNCTION (test_fndecl), NULL, &ctxt); placeholder_svalue test_sval (mgr.alloc_symbol_id (), integer_type_node, "test sval"); @@ -8413,7 +8415,7 @@ test_state_merging () /* Pointers: non-NULL and non-NULL: ptr to a local. */ { region_model model0 (&mgr); - model0.push_frame (DECL_STRUCT_FUNCTION (test_fndecl), NULL, NULL); + model0.push_frame (*DECL_STRUCT_FUNCTION (test_fndecl), NULL, NULL); model0.set_value (model0.get_lvalue (p, NULL), model0.get_rvalue (addr_of_a, NULL), NULL); @@ -8552,12 +8554,12 @@ test_state_merging () frame points to a local in a more recent stack frame. */ { region_model model0 (&mgr); - model0.push_frame (DECL_STRUCT_FUNCTION (test_fndecl), NULL, NULL); + model0.push_frame (*DECL_STRUCT_FUNCTION (test_fndecl), NULL, NULL); const region *q_in_first_frame = model0.get_lvalue (q, NULL); /* Push a second frame. */ const region *reg_2nd_frame - = model0.push_frame (DECL_STRUCT_FUNCTION (test_fndecl), NULL, NULL); + = model0.push_frame (*DECL_STRUCT_FUNCTION (test_fndecl), NULL, NULL); /* Have a pointer in the older frame point to a local in the more recent frame. */ @@ -8584,7 +8586,7 @@ test_state_merging () /* Verify that we can merge a model in which a local points to a global. */ { region_model model0 (&mgr); - model0.push_frame (DECL_STRUCT_FUNCTION (test_fndecl), NULL, NULL); + model0.push_frame (*DECL_STRUCT_FUNCTION (test_fndecl), NULL, NULL); model0.set_value (model0.get_lvalue (q, NULL), model0.get_rvalue (addr_of_y, NULL), NULL); @@ -9110,7 +9112,7 @@ test_alloca () /* Push stack frame. */ const region *frame_reg - = model.push_frame (DECL_STRUCT_FUNCTION (fndecl), + = model.push_frame (*DECL_STRUCT_FUNCTION (fndecl), NULL, &ctxt); /* "p = alloca (n * 4);". */ const svalue *size_sval = model.get_rvalue (n_times_4, &ctxt); diff --git a/gcc/analyzer/region-model.h b/gcc/analyzer/region-model.h index d4ef10120dd5..118e0f254273 100644 --- a/gcc/analyzer/region-model.h +++ b/gcc/analyzer/region-model.h @@ -347,10 +347,10 @@ class region_model void update_for_return_gcall (const gcall *call_stmt, region_model_context *ctxt); - const region *push_frame (function *fun, const vec *arg_sids, + const region *push_frame (const function &fun, const vec *arg_sids, region_model_context *ctxt); const frame_region *get_current_frame () const { return m_current_frame; } - function * get_current_function () const; + const function *get_current_function () const; void pop_frame (tree result_lvalue, const svalue **out_result, region_model_context *ctxt, diff --git a/gcc/analyzer/region.cc b/gcc/analyzer/region.cc index 50821a592302..d45706141fb0 100644 --- a/gcc/analyzer/region.cc +++ b/gcc/analyzer/region.cc @@ -1306,10 +1306,10 @@ void frame_region::dump_to_pp (pretty_printer *pp, bool simple) const { if (simple) - pp_printf (pp, "frame: %qs@%i", function_name (m_fun), get_stack_depth ()); + pp_printf (pp, "frame: %qs@%i", function_name (&m_fun), get_stack_depth ()); else pp_printf (pp, "frame_region(%qs, index: %i, depth: %i)", - function_name (m_fun), m_index, get_stack_depth ()); + function_name (&m_fun), m_index, get_stack_depth ()); } const decl_region * @@ -1334,14 +1334,14 @@ frame_region::get_region_for_local (region_model_manager *mgr, /* Fall through. */ case PARM_DECL: case RESULT_DECL: - gcc_assert (DECL_CONTEXT (expr) == m_fun->decl); + gcc_assert (DECL_CONTEXT (expr) == m_fun.decl); break; case SSA_NAME: { if (tree var = SSA_NAME_VAR (expr)) { if (DECL_P (var)) - gcc_assert (DECL_CONTEXT (var) == m_fun->decl); + gcc_assert (DECL_CONTEXT (var) == m_fun.decl); } else if (ctxt) if (const extrinsic_state *ext_state = ctxt->get_ext_state ()) @@ -1351,7 +1351,7 @@ frame_region::get_region_for_local (region_model_manager *mgr, const gimple *def_stmt = SSA_NAME_DEF_STMT (expr); const supernode *snode = sg->get_supernode_for_stmt (def_stmt); - gcc_assert (snode->get_function () == m_fun); + gcc_assert (snode->get_function () == &m_fun); } } break; diff --git a/gcc/analyzer/region.h b/gcc/analyzer/region.h index 70557babbc04..73f35f55ba71 100644 --- a/gcc/analyzer/region.h +++ b/gcc/analyzer/region.h @@ -305,11 +305,10 @@ class frame_region : public space_region /* A support class for uniquifying instances of frame_region. */ struct key_t { - key_t (const frame_region *calling_frame, function *fun) - : m_calling_frame (calling_frame), m_fun (fun) + key_t (const frame_region *calling_frame, const function &fun) + : m_calling_frame (calling_frame), m_fun (&fun) { /* calling_frame can be NULL. */ - gcc_assert (fun); } hashval_t hash () const @@ -322,7 +321,8 @@ class frame_region : public space_region bool operator== (const key_t &other) const { - return (m_calling_frame == other.m_calling_frame && m_fun == other.m_fun); + return (m_calling_frame == other.m_calling_frame + && m_fun == other.m_fun); } void mark_deleted () { m_fun = reinterpret_cast (1); } @@ -334,12 +334,12 @@ class frame_region : public space_region bool is_empty () const { return m_fun == NULL; } const frame_region *m_calling_frame; - function *m_fun; + const function *m_fun; }; frame_region (symbol::id_t id, const region *parent, const frame_region *calling_frame, - function *fun, int index) + const function &fun, int index) : space_region (id, parent), m_calling_frame (calling_frame), m_fun (fun), m_index (index) {} @@ -356,8 +356,8 @@ class frame_region : public space_region /* Accessors. */ const frame_region *get_calling_frame () const { return m_calling_frame; } - function *get_function () const { return m_fun; } - tree get_fndecl () const { return get_function ()->decl; } + const function &get_function () const { return m_fun; } + tree get_fndecl () const { return get_function ().decl; } int get_index () const { return m_index; } int get_stack_depth () const { return m_index + 1; } @@ -373,7 +373,7 @@ class frame_region : public space_region private: const frame_region *m_calling_frame; - function *m_fun; + const function &m_fun; int m_index; /* The regions for the decls within this frame are managed by this diff --git a/gcc/analyzer/sm-malloc.cc b/gcc/analyzer/sm-malloc.cc index 2e0cf8a6887e..a518816b2b8b 100644 --- a/gcc/analyzer/sm-malloc.cc +++ b/gcc/analyzer/sm-malloc.cc @@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple.h" #include "options.h" #include "bitmap.h" +#include "diagnostic-core.h" #include "diagnostic-path.h" #include "analyzer/analyzer.h" #include "diagnostic-event-id.h" diff --git a/gcc/analyzer/sm-signal.cc b/gcc/analyzer/sm-signal.cc index 5be857a99ff8..93269caa0dc5 100644 --- a/gcc/analyzer/sm-signal.cc +++ b/gcc/analyzer/sm-signal.cc @@ -146,7 +146,8 @@ class signal_unsafe_call if (change.is_global_p () && change.m_new_state == m_sm.m_in_signal_handler) { - function *handler = change.m_event.get_dest_function (); + const function *handler = change.m_event.get_dest_function (); + gcc_assert (handler); return change.formatted_print ("registering %qD as signal handler", handler->decl); } @@ -193,7 +194,7 @@ signal_state_machine::signal_state_machine (logger *logger) static void update_model_for_signal_handler (region_model *model, - function *handler_fun) + const function &handler_fun) { gcc_assert (model); /* Purge all state within MODEL. */ @@ -222,7 +223,9 @@ class signal_delivery_edge_info_t : public custom_edge_info region_model_context *) const final override { gcc_assert (eedge); - update_model_for_signal_handler (model, eedge->m_dest->get_function ()); + gcc_assert (eedge->m_dest->get_function ()); + update_model_for_signal_handler (model, + *eedge->m_dest->get_function ()); return true; } @@ -263,11 +266,11 @@ class register_signal_handler : public custom_transition program_point entering_handler = program_point::from_function_entry (*ext_state.get_model_manager (), eg->get_supergraph (), - handler_fun); + *handler_fun); program_state state_entering_handler (ext_state); update_model_for_signal_handler (state_entering_handler.m_region_model, - handler_fun); + *handler_fun); state_entering_handler.m_checker_states[sm_idx]->set_global_state (m_sm.m_in_signal_handler); diff --git a/gcc/analyzer/state-purge.cc b/gcc/analyzer/state-purge.cc index 93959fb08ea3..324b548f75b1 100644 --- a/gcc/analyzer/state-purge.cc +++ b/gcc/analyzer/state-purge.cc @@ -89,7 +89,7 @@ class gimple_op_visitor : public log_user public: gimple_op_visitor (state_purge_map *map, const function_point &point, - function *fun) + const function &fun) : log_user (map->get_logger ()), m_map (map), m_point (point), @@ -172,7 +172,7 @@ class gimple_op_visitor : public log_user state_purge_map *m_map; const function_point &m_point; - function *m_fun; + const function &m_fun; }; static bool @@ -214,6 +214,7 @@ state_purge_map::state_purge_map (const supergraph &sg, FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node) { function *fun = node->get_fun (); + gcc_assert (fun); if (logger) log ("function: %s", function_name (fun)); tree name; @@ -225,7 +226,7 @@ state_purge_map::state_purge_map (const supergraph &sg, if (TREE_CODE (var) == VAR_DECL) if (VAR_DECL_IS_VIRTUAL_OPERAND (var)) continue; - m_ssa_map.put (name, new state_purge_per_ssa_name (*this, name, fun)); + m_ssa_map.put (name, new state_purge_per_ssa_name (*this, name, *fun)); } } @@ -241,8 +242,10 @@ state_purge_map::state_purge_map (const supergraph &sg, unsigned i; FOR_EACH_VEC_ELT (snode->m_stmts, i, stmt) { + function *fun = snode->get_function (); + gcc_assert (fun); function_point point (function_point::before_stmt (snode, i)); - gimple_op_visitor v (this, point, snode->get_function ()); + gimple_op_visitor v (this, point, *fun); walk_stmt_load_store_addr_ops (stmt, &v, my_load_cb, my_store_cb, my_addr_cb); } @@ -272,7 +275,7 @@ state_purge_map::~state_purge_map () if necessary. */ state_purge_per_decl & -state_purge_map::get_or_create_data_for_decl (function *fun, tree decl) +state_purge_map::get_or_create_data_for_decl (const function &fun, tree decl) { if (state_purge_per_decl **slot = const_cast (m_decl_map).get (decl)) @@ -295,14 +298,14 @@ state_purge_map::get_or_create_data_for_decl (function *fun, tree decl) state_purge_per_ssa_name::state_purge_per_ssa_name (const state_purge_map &map, tree name, - function *fun) + const function &fun) : state_purge_per_tree (fun), m_points_needing_name (), m_name (name) { LOG_FUNC (map.get_logger ()); if (map.get_logger ()) { - map.log ("SSA name: %qE within %qD", name, fun->decl); + map.log ("SSA name: %qE within %qD", name, fun.decl); /* Show def stmt. */ const gimple *def_stmt = SSA_NAME_DEF_STMT (name); @@ -410,7 +413,7 @@ state_purge_per_ssa_name::state_purge_per_ssa_name (const state_purge_map &map, if (map.get_logger ()) { - map.log ("%qE in %qD is needed to process:", name, fun->decl); + map.log ("%qE in %qD is needed to process:", name, fun.decl); /* Log m_points_needing_name, sorting it to avoid churn when comparing dumps. */ auto_vec points; @@ -472,7 +475,7 @@ state_purge_per_ssa_name::add_to_worklist (const function_point &point, logger->end_log_line (); } - gcc_assert (point.get_function () == get_function ()); + gcc_assert (point.get_function () == &get_function ()); if (point.get_from_edge ()) gcc_assert (point.get_from_edge ()->get_kind () == SUPEREDGE_CFG_EDGE); @@ -678,7 +681,7 @@ state_purge_per_ssa_name::process_point (const function_point &point, state_purge_per_decl::state_purge_per_decl (const state_purge_map &map, tree decl, - function *fun) + const function &fun) : state_purge_per_tree (fun), m_decl (decl) { @@ -794,7 +797,7 @@ state_purge_per_decl::add_to_worklist (const function_point &point, logger->end_log_line (); } - gcc_assert (point.get_function () == get_function ()); + gcc_assert (point.get_function () == &get_function ()); if (point.get_from_edge ()) gcc_assert (point.get_from_edge ()->get_kind () == SUPEREDGE_CFG_EDGE); @@ -1192,7 +1195,7 @@ state_purge_annotator::print_needed (graphviz_out *gv, { tree name = (*iter).first; state_purge_per_ssa_name *per_name_data = (*iter).second; - if (per_name_data->get_function () == point.get_function ()) + if (&per_name_data->get_function () == point.get_function ()) { if (per_name_data->needed_at_point_p (point)) needed.safe_push (name); @@ -1206,7 +1209,7 @@ state_purge_annotator::print_needed (graphviz_out *gv, { tree decl = (*iter).first; state_purge_per_decl *per_decl_data = (*iter).second; - if (per_decl_data->get_function () == point.get_function ()) + if (&per_decl_data->get_function () == point.get_function ()) { if (per_decl_data->needed_at_point_p (point)) needed.safe_push (decl); diff --git a/gcc/analyzer/state-purge.h b/gcc/analyzer/state-purge.h index c6d64b41fd46..4eb2ba0a908a 100644 --- a/gcc/analyzer/state-purge.h +++ b/gcc/analyzer/state-purge.h @@ -112,7 +112,8 @@ class state_purge_map : public log_user return NULL; } - state_purge_per_decl &get_or_create_data_for_decl (function *fun, tree decl); + state_purge_per_decl & + get_or_create_data_for_decl (const function &fun, tree decl); const supergraph &get_sg () const { return m_sg; } @@ -135,19 +136,19 @@ class state_purge_map : public log_user class state_purge_per_tree { public: - function *get_function () const { return m_fun; } - tree get_fndecl () const { return m_fun->decl; } + const function &get_function () const { return m_fun; } + tree get_fndecl () const { return m_fun.decl; } protected: typedef hash_set point_set_t; - state_purge_per_tree (function *fun) + state_purge_per_tree (const function &fun) : m_fun (fun) { } private: - function *m_fun; + const function &m_fun; }; /* The part of a state_purge_map relating to a specific SSA name. @@ -162,7 +163,7 @@ class state_purge_per_ssa_name : public state_purge_per_tree public: state_purge_per_ssa_name (const state_purge_map &map, tree name, - function *fun); + const function &fun); bool needed_at_point_p (const function_point &point) const; @@ -194,7 +195,7 @@ class state_purge_per_decl : public state_purge_per_tree public: state_purge_per_decl (const state_purge_map &map, tree decl, - function *fun); + const function &fun); bool needed_at_point_p (const function_point &point) const; diff --git a/gcc/analyzer/supergraph.cc b/gcc/analyzer/supergraph.cc index b82275256b72..adbf90f17ede 100644 --- a/gcc/analyzer/supergraph.cc +++ b/gcc/analyzer/supergraph.cc @@ -364,6 +364,7 @@ supergraph::dump_dot_to_pp (pretty_printer *pp, FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node) { function *fun = node->get_fun (); + gcc_assert (fun); const char *funcname = function_name (fun); gv.println ("subgraph \"cluster_%s\" {", funcname); @@ -409,9 +410,9 @@ supergraph::dump_dot_to_pp (pretty_printer *pp, /* Add an invisible edge from ENTRY to EXIT, to improve the graph layout. */ pp_string (pp, "\t"); - get_node_for_function_entry (fun)->dump_dot_id (pp); + get_node_for_function_entry (*fun)->dump_dot_id (pp); pp_string (pp, ":s -> "); - get_node_for_function_exit (fun)->dump_dot_id (pp); + get_node_for_function_exit (*fun)->dump_dot_id (pp); pp_string (pp, ":n [style=\"invis\",constraint=true];\n"); /* Terminate per-function "subgraph" */ diff --git a/gcc/analyzer/supergraph.h b/gcc/analyzer/supergraph.h index 2677acad8d6a..86f918bc8b5d 100644 --- a/gcc/analyzer/supergraph.h +++ b/gcc/analyzer/supergraph.h @@ -111,14 +111,14 @@ class supergraph : public digraph supergraph (logger *logger); ~supergraph (); - supernode *get_node_for_function_entry (function *fun) const + supernode *get_node_for_function_entry (const function &fun) const { - return get_node_for_block (ENTRY_BLOCK_PTR_FOR_FN (fun)); + return get_node_for_block (ENTRY_BLOCK_PTR_FOR_FN (&fun)); } - supernode *get_node_for_function_exit (function *fun) const + supernode *get_node_for_function_exit (const function &fun) const { - return get_node_for_block (EXIT_BLOCK_PTR_FOR_FN (fun)); + return get_node_for_block (EXIT_BLOCK_PTR_FOR_FN (&fun)); } supernode *get_node_for_block (basic_block bb) const diff --git a/gcc/asan.cc b/gcc/asan.cc index 0fd7dd1f3ed4..d621ec9c3232 100644 --- a/gcc/asan.cc +++ b/gcc/asan.cc @@ -3795,9 +3795,7 @@ asan_expand_mark_ifn (gimple_stmt_iterator *iter) } tree len = gimple_call_arg (g, 2); - gcc_assert (tree_fits_shwi_p (len)); - unsigned HOST_WIDE_INT size_in_bytes = tree_to_shwi (len); - gcc_assert (size_in_bytes); + gcc_assert (poly_int_tree_p (len)); g = gimple_build_assign (make_ssa_name (pointer_sized_int_node), NOP_EXPR, base); @@ -3806,9 +3804,10 @@ asan_expand_mark_ifn (gimple_stmt_iterator *iter) tree base_addr = gimple_assign_lhs (g); /* Generate direct emission if size_in_bytes is small. */ - if (size_in_bytes - <= (unsigned)param_use_after_scope_direct_emission_threshold) + unsigned threshold = param_use_after_scope_direct_emission_threshold; + if (tree_fits_uhwi_p (len) && tree_to_uhwi (len) <= threshold) { + unsigned HOST_WIDE_INT size_in_bytes = tree_to_uhwi (len); const unsigned HOST_WIDE_INT shadow_size = shadow_mem_size (size_in_bytes); const unsigned int shadow_align diff --git a/gcc/auto-profile.cc b/gcc/auto-profile.cc index 63d0c3dc36df..e5407d32fbbf 100644 --- a/gcc/auto-profile.cc +++ b/gcc/auto-profile.cc @@ -42,6 +42,8 @@ along with GCC; see the file COPYING3. If not see #include "gimple-iterator.h" #include "value-prof.h" #include "symbol-summary.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "ipa-inline.h" diff --git a/gcc/bb-reorder.cc b/gcc/bb-reorder.cc index 3137f88a2365..ba11a2337ab7 100644 --- a/gcc/bb-reorder.cc +++ b/gcc/bb-reorder.cc @@ -2024,7 +2024,8 @@ fix_up_fall_thru_edges (void) See PR108596. */ rtx_insn *j = BB_END (cur_bb); gcc_checking_assert (JUMP_P (j) - && asm_noperands (PATTERN (j))); + && (asm_noperands (PATTERN (j)) + > 0)); edge e2 = find_edge (cur_bb, e->dest); if (e2) e2->flags |= EDGE_CROSSING; @@ -2266,7 +2267,8 @@ fix_crossing_unconditional_branches (void) /* Make sure the jump is not already an indirect or table jump. */ if (!computed_jump_p (last_insn) - && !tablejump_p (last_insn, NULL, NULL)) + && !tablejump_p (last_insn, NULL, NULL) + && asm_noperands (PATTERN (last_insn)) < 0) { /* We have found a "crossing" unconditional branch. Now we must convert it to an indirect jump. First create diff --git a/gcc/btfout.cc b/gcc/btfout.cc index dcf751f8fe0d..7aabd99f3e7c 100644 --- a/gcc/btfout.cc +++ b/gcc/btfout.cc @@ -457,7 +457,8 @@ btf_collect_datasec (ctf_container_ref ctfc) func_dtd->dtd_data.ctti_type = dtd->dtd_type; func_dtd->linkage = dtd->linkage; func_dtd->dtd_name = dtd->dtd_name; - func_dtd->dtd_type = num_types_added + num_types_created; + /* +1 for the sentinel type not in the types map. */ + func_dtd->dtd_type = num_types_added + num_types_created + 1; /* Only the BTF_KIND_FUNC type actually references the name. The BTF_KIND_FUNC_PROTO is always anonymous. */ @@ -480,8 +481,7 @@ btf_collect_datasec (ctf_container_ref ctfc) struct btf_var_secinfo info; - /* +1 for the sentinel type not in the types map. */ - info.type = func_dtd->dtd_type + 1; + info.type = func_dtd->dtd_type; /* Both zero at compile time. */ info.size = 0; @@ -1276,8 +1276,10 @@ output_btf_types (ctf_container_ref ctfc) static void output_btf_func_types (ctf_container_ref ctfc) { - for (size_t i = 0; i < vec_safe_length (funcs); i++) - btf_asm_func_type (ctfc, (*funcs)[i], i); + ctf_dtdef_ref ref; + unsigned i; + FOR_EACH_VEC_ELT (*funcs, i, ref) + btf_asm_func_type (ctfc, ref, i); } /* Output all BTF_KIND_DATASEC records. */ @@ -1452,4 +1454,20 @@ btf_finalize (void) tu_ctfc = NULL; } +/* Traversal function for all BTF_KIND_FUNC type records. */ + +bool +traverse_btf_func_types (funcs_traverse_callback callback, void *data) +{ + ctf_dtdef_ref ref; + unsigned i; + FOR_EACH_VEC_ELT (*funcs, i, ref) + { + bool stop = callback (ref, data); + if (stop == true) + return true; + } + return false; +} + #include "gt-btfout.h" diff --git a/gcc/builtins.cc b/gcc/builtins.cc index 4c04ae03321f..eda8bea9c4be 100644 --- a/gcc/builtins.cc +++ b/gcc/builtins.cc @@ -9326,7 +9326,7 @@ fold_builtin_isascii (location_t loc, tree arg) /* Transform isascii(c) -> ((c & ~0x7f) == 0). */ arg = fold_build2 (BIT_AND_EXPR, integer_type_node, arg, build_int_cst (integer_type_node, - ~ (unsigned HOST_WIDE_INT) 0x7f)); + ~ HOST_WIDE_INT_UC (0x7f))); return fold_build2_loc (loc, EQ_EXPR, integer_type_node, arg, integer_zero_node); } diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 11589f48b796..71291e72d369 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,28 @@ +2024-03-08 Jakub Jelinek + + * c-common.cc (resolve_overloaded_atomic_exchange): Instead of setting + p1 to VIEW_CONVERT_EXPR (*p1), set it to MEM_REF with p1 and + (typeof (p1)) 0 operands and I_type type. + (resolve_overloaded_atomic_compare_exchange): Similarly for p2. + +2024-03-05 Mark Wielaard + + * c.opt.urls: Regenerate. + +2024-03-05 Patrick Palka + + * c.opt (Wglobal-module): New warning. + +2024-03-04 Mark Wielaard + + * c.opt.urls: Regenerate. + +2024-02-22 Jakub Jelinek + + PR c/114007 + * c-lex.cc (c_common_has_attribute): Parse 2 CPP_COLONs with + the first one with COLON_SCOPE flag the same as CPP_SCOPE. + 2024-02-10 Marek Polacek DR 2237 diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc index e15eff698dfd..48844b17f77a 100644 --- a/gcc/c-family/c-common.cc +++ b/gcc/c-family/c-common.cc @@ -7793,9 +7793,14 @@ resolve_overloaded_atomic_exchange (location_t loc, tree function, /* Convert object pointer to required type. */ p0 = build1 (VIEW_CONVERT_EXPR, I_type_ptr, p0); (*params)[0] = p0; - /* Convert new value to required type, and dereference it. */ - p1 = build_indirect_ref (loc, p1, RO_UNARY_STAR); - p1 = build1 (VIEW_CONVERT_EXPR, I_type, p1); + /* Convert new value to required type, and dereference it. + If *p1 type can have padding or may involve floating point which + could e.g. be promoted to wider precision and demoted afterwards, + state of padding bits might not be preserved. */ + build_indirect_ref (loc, p1, RO_UNARY_STAR); + p1 = build2_loc (loc, MEM_REF, I_type, + build1 (VIEW_CONVERT_EXPR, I_type_ptr, p1), + build_zero_cst (TREE_TYPE (p1))); (*params)[1] = p1; /* Move memory model to the 3rd position, and end param list. */ @@ -7873,9 +7878,14 @@ resolve_overloaded_atomic_compare_exchange (location_t loc, tree function, p1 = build1 (VIEW_CONVERT_EXPR, I_type_ptr, p1); (*params)[1] = p1; - /* Convert desired value to required type, and dereference it. */ - p2 = build_indirect_ref (loc, p2, RO_UNARY_STAR); - p2 = build1 (VIEW_CONVERT_EXPR, I_type, p2); + /* Convert desired value to required type, and dereference it. + If *p2 type can have padding or may involve floating point which + could e.g. be promoted to wider precision and demoted afterwards, + state of padding bits might not be preserved. */ + build_indirect_ref (loc, p2, RO_UNARY_STAR); + p2 = build2_loc (loc, MEM_REF, I_type, + build1 (VIEW_CONVERT_EXPR, I_type_ptr, p2), + build_zero_cst (TREE_TYPE (p2))); (*params)[2] = p2; /* The rest of the parameters are fine. NULL means no special return value diff --git a/gcc/c-family/c-lex.cc b/gcc/c-family/c-lex.cc index 8b0987ee0741..ff5ce2bf729a 100644 --- a/gcc/c-family/c-lex.cc +++ b/gcc/c-family/c-lex.cc @@ -357,7 +357,27 @@ c_common_has_attribute (cpp_reader *pfile, bool std_syntax) do nxt_token = cpp_peek_token (pfile, idx++); while (nxt_token->type == CPP_PADDING); - if (nxt_token->type == CPP_SCOPE) + if (!c_dialect_cxx () + && nxt_token->type == CPP_COLON + && (nxt_token->flags & COLON_SCOPE) != 0) + { + const cpp_token *prev_token = nxt_token; + do + nxt_token = cpp_peek_token (pfile, idx++); + while (nxt_token->type == CPP_PADDING); + if (nxt_token->type == CPP_COLON) + { + /* __has_attribute (vendor::attr) in -std=c17 etc. modes. + :: isn't CPP_SCOPE but 2 CPP_COLON tokens, where the + first one should have COLON_SCOPE flag to distinguish + it from : :. */ + have_scope = true; + get_token_no_padding (pfile); // Eat first colon. + } + else + nxt_token = prev_token; + } + if (nxt_token->type == CPP_SCOPE || have_scope) { have_scope = true; get_token_no_padding (pfile); // Eat scope. diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index b7a4a1a68e32..56cccf2a67bd 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -802,6 +802,10 @@ Wframe-address C ObjC C++ ObjC++ Var(warn_frame_address) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall) Warn when __builtin_frame_address or __builtin_return_address is used unsafely. +Wglobal-module +C++ ObjC++ Var(warn_global_module) Warning Init(1) +Warn about the global module fragment not containing only preprocessing directives. + Wif-not-aligned C ObjC C++ ObjC++ Var(warn_if_not_aligned) Init(1) Warning Warn when the field in a struct is not aligned. diff --git a/gcc/c-family/c.opt.urls b/gcc/c-family/c.opt.urls index 5365c8e2bc54..631719863a5e 100644 --- a/gcc/c-family/c.opt.urls +++ b/gcc/c-family/c.opt.urls @@ -88,6 +88,9 @@ UrlSuffix(gcc/Warning-Options.html#index-Wabsolute-value) Waddress UrlSuffix(gcc/Warning-Options.html#index-Waddress) +Waddress-of-packed-member +UrlSuffix(gcc/Warning-Options.html#index-Waddress-of-packed-member) + Waligned-new UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Waligned-new) @@ -115,6 +118,9 @@ UrlSuffix(gcc/Warning-Options.html#index-Walloc-zero) Walloca-larger-than= UrlSuffix(gcc/Warning-Options.html#index-Walloca-larger-than_003d) LangUrlSuffix_D(gdc/Warnings.html#index-Walloca-larger-than) +Warith-conversion +UrlSuffix(gcc/Warning-Options.html#index-Warith-conversion) + Warray-bounds= UrlSuffix(gcc/Warning-Options.html#index-Warray-bounds) @@ -122,13 +128,10 @@ Warray-compare UrlSuffix(gcc/Warning-Options.html#index-Warray-compare) Warray-parameter -UrlSuffix(gcc/Warning-Options.html#index-Wno-array-parameter) +UrlSuffix(gcc/Warning-Options.html#index-Warray-parameter) Warray-parameter= -UrlSuffix(gcc/Warning-Options.html#index-Wno-array-parameter) - -Wzero-length-bounds -UrlSuffix(gcc/Warning-Options.html#index-Wzero-length-bounds) +UrlSuffix(gcc/Warning-Options.html#index-Warray-parameter) Wassign-intercept UrlSuffix(gcc/Objective-C-and-Objective-C_002b_002b-Dialect-Options.html#index-Wassign-intercept) @@ -148,9 +151,6 @@ UrlSuffix(gcc/Warning-Options.html#index-Wbool-compare) Wbool-operation UrlSuffix(gcc/Warning-Options.html#index-Wbool-operation) -Wframe-address -UrlSuffix(gcc/Warning-Options.html#index-Wframe-address) - Wbuiltin-declaration-mismatch UrlSuffix(gcc/Warning-Options.html#index-Wbuiltin-declaration-mismatch) LangUrlSuffix_D(gdc/Warnings.html#index-Wbuiltin-declaration-mismatch) @@ -217,6 +217,12 @@ UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wcatch-value) Wchar-subscripts UrlSuffix(gcc/Warning-Options.html#index-Wchar-subscripts) +Wclass-conversion +UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wclass-conversion) + +Wclass-memaccess +UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wclass-memaccess) + Wclobbered UrlSuffix(gcc/Warning-Options.html#index-Wclobbered) @@ -298,6 +304,12 @@ UrlSuffix(gcc/Warning-Options.html#index-Wdiscarded-qualifiers) Wdiv-by-zero UrlSuffix(gcc/Warning-Options.html#index-Wdiv-by-zero) +Wdouble-promotion +UrlSuffix(gcc/Warning-Options.html#index-Wdouble-promotion) + +Wduplicate-decl-specifier +UrlSuffix(gcc/Warning-Options.html#index-Wduplicate-decl-specifier) + Wduplicated-branches UrlSuffix(gcc/Warning-Options.html#index-Wduplicated-branches) @@ -307,6 +319,9 @@ UrlSuffix(gcc/Warning-Options.html#index-Wduplicated-cond) Weffc++ UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Weffc_002b_002b) +Welaborated-enum-base +UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Welaborated-enum-base) + Wempty-body UrlSuffix(gcc/Warning-Options.html#index-Wempty-body) @@ -328,12 +343,18 @@ UrlSuffix(gcc/Warning-Options.html#index-Werror) LangUrlSuffix_D(gdc/Warnings.ht Wexceptions UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wexceptions) +Wexpansion-to-defined +UrlSuffix(gcc/Warning-Options.html#index-Wexpansion-to-defined) + Wextra UrlSuffix(gcc/Warning-Options.html#index-Wextra) LangUrlSuffix_D(gdc/Warnings.html#index-Wextra) Wextra-semi UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wextra-semi) +Wflex-array-member-not-at-end +UrlSuffix(gcc/Warning-Options.html#index-Wflex-array-member-not-at-end) + Wfloat-conversion UrlSuffix(gcc/Warning-Options.html#index-Wfloat-conversion) @@ -355,6 +376,9 @@ UrlSuffix(gcc/Warning-Options.html#index-Wformat-nonliteral) Wformat-overflow UrlSuffix(gcc/Warning-Options.html#index-Wformat-overflow) +Wformat-overflow= +UrlSuffix(gcc/Warning-Options.html#index-Wformat-overflow) + Wformat-security UrlSuffix(gcc/Warning-Options.html#index-Wformat-security) @@ -364,6 +388,9 @@ UrlSuffix(gcc/Warning-Options.html#index-Wformat-signedness) Wformat-truncation UrlSuffix(gcc/Warning-Options.html#index-Wformat-truncation) +Wformat-truncation= +UrlSuffix(gcc/Warning-Options.html#index-Wformat-truncation) + Wformat-y2k UrlSuffix(gcc/Warning-Options.html#index-Wformat-y2k) @@ -373,14 +400,11 @@ UrlSuffix(gcc/Warning-Options.html#index-Wformat-zero-length) Wformat= UrlSuffix(gcc/Warning-Options.html#index-Wformat) -Wformat-overflow= -UrlSuffix(gcc/Warning-Options.html#index-Wformat-overflow) - -Wformat-truncation= -UrlSuffix(gcc/Warning-Options.html#index-Wformat-truncation) +Wframe-address +UrlSuffix(gcc/Warning-Options.html#index-Wframe-address) -Wflex-array-member-not-at-end -UrlSuffix(gcc/Warning-Options.html#index-Wflex-array-member-not-at-end) +Wglobal-module +UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wglobal-module) Wif-not-aligned UrlSuffix(gcc/Warning-Options.html#index-Wif-not-aligned) @@ -391,6 +415,18 @@ UrlSuffix(gcc/Warning-Options.html#index-Wignored-qualifiers) Wignored-attributes UrlSuffix(gcc/Warning-Options.html#index-Wignored-attributes) +Wimplicit +UrlSuffix(gcc/Warning-Options.html#index-Wimplicit) + +Wimplicit-fallthrough= +UrlSuffix(gcc/Warning-Options.html#index-Wimplicit-fallthrough) + +Wimplicit-function-declaration +UrlSuffix(gcc/Warning-Options.html#index-Wimplicit-function-declaration) + +Wimplicit-int +UrlSuffix(gcc/Warning-Options.html#index-Wimplicit-int) + Winaccessible-base UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Winaccessible-base) @@ -400,9 +436,6 @@ UrlSuffix(gcc/Warning-Options.html#index-Wincompatible-pointer-types) Winfinite-recursion UrlSuffix(gcc/Warning-Options.html#index-Winfinite-recursion) -Waddress-of-packed-member -UrlSuffix(gcc/Warning-Options.html#index-Waddress-of-packed-member) - Winit-self UrlSuffix(gcc/Warning-Options.html#index-Winit-self) @@ -412,24 +445,6 @@ UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Winit-list-lifetime) Winterference-size UrlSuffix(gcc/Warning-Options.html#index-Winterference-size) -Wimplicit -UrlSuffix(gcc/Warning-Options.html#index-Wimplicit) - -Wimplicit-fallthrough= -UrlSuffix(gcc/Warning-Options.html#index-Wimplicit-fallthrough) - -Wdouble-promotion -UrlSuffix(gcc/Warning-Options.html#index-Wdouble-promotion) - -Wexpansion-to-defined -UrlSuffix(gcc/Warning-Options.html#index-Wexpansion-to-defined) - -Wimplicit-function-declaration -UrlSuffix(gcc/Warning-Options.html#index-Wimplicit-function-declaration) - -Wimplicit-int -UrlSuffix(gcc/Warning-Options.html#index-Wimplicit-int) - Winherited-variadic-ctor UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Winherited-variadic-ctor) @@ -460,12 +475,12 @@ UrlSuffix(gcc/Warning-Options.html#index-Wjump-misses-init) Wliteral-suffix UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wliteral-suffix) -Wlogical-op -UrlSuffix(gcc/Warning-Options.html#index-Wlogical-op) - Wlogical-not-parentheses UrlSuffix(gcc/Warning-Options.html#index-Wlogical-not-parentheses) +Wlogical-op +UrlSuffix(gcc/Warning-Options.html#index-Wlogical-op) + Wlong-long UrlSuffix(gcc/Warning-Options.html#index-Wlong-long) @@ -475,12 +490,15 @@ UrlSuffix(gcc/Warning-Options.html#index-Wmain) Wmain UrlSuffix(gcc/Warning-Options.html#index-Wmain) -Wmemset-transposed-args -UrlSuffix(gcc/Warning-Options.html#index-Wmemset-transposed-args) +Wmaybe-uninitialized +UrlSuffix(gcc/Warning-Options.html#index-Wmaybe-uninitialized) Wmemset-elt-size UrlSuffix(gcc/Warning-Options.html#index-Wmemset-elt-size) +Wmemset-transposed-args +UrlSuffix(gcc/Warning-Options.html#index-Wmemset-transposed-args) + Wmisleading-indentation UrlSuffix(gcc/Warning-Options.html#index-Wmisleading-indentation) @@ -493,6 +511,9 @@ UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wmismatched-new-delete) Wmismatched-tags UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wmismatched-tags) +Wmissing-attributes +UrlSuffix(gcc/Warning-Options.html#index-Wmissing-attributes) + Wmissing-braces UrlSuffix(gcc/Warning-Options.html#index-Wmissing-braces) @@ -502,93 +523,6 @@ UrlSuffix(gcc/Warning-Options.html#index-Wmissing-declarations) Wmissing-field-initializers UrlSuffix(gcc/Warning-Options.html#index-Wmissing-field-initializers) -Wmissing-requires -UrlSuffix(gcc/Warning-Options.html#index-Wmissing-requires) - -Wmissing-template-keyword -UrlSuffix(gcc/Warning-Options.html#index-Wmissing-template-keyword) - -Wmultistatement-macros -UrlSuffix(gcc/Warning-Options.html#index-Wmultistatement-macros) - -Wmultiple-inheritance -UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wmultiple-inheritance) - -Wnamespaces -UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wnamespaces) - -Wnrvo -UrlSuffix(gcc/Warning-Options.html#index-Wno-nrvo) - -Wpacked-not-aligned -UrlSuffix(gcc/Warning-Options.html#index-Wno-packed-not-aligned) - -Wrange-loop-construct -UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-range-loop-construct) - -Wredundant-tags -UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-redundant-tags) - -Wsized-deallocation -UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-sized-deallocation) - -Wsizeof-pointer-div -UrlSuffix(gcc/Warning-Options.html#index-Wno-sizeof-pointer-div) - -Wsizeof-array-div -UrlSuffix(gcc/Warning-Options.html#index-Wno-sizeof-array-div) - -Wsizeof-pointer-memaccess -UrlSuffix(gcc/Warning-Options.html#index-Wno-sizeof-pointer-memaccess) - -Wsizeof-array-argument -UrlSuffix(gcc/Warning-Options.html#index-Wno-sizeof-array-argument) - -Wstring-compare -UrlSuffix(gcc/Warning-Options.html#index-Wno-string-compare) - -Wstringop-overflow -UrlSuffix(gcc/Warning-Options.html#index-Wno-stringop-overflow) - -Wstringop-overflow= -UrlSuffix(gcc/Warning-Options.html#index-Wno-stringop-overflow) - -Wstringop-overread -UrlSuffix(gcc/Warning-Options.html#index-Wno-stringop-overread) - -Wstringop-truncation -UrlSuffix(gcc/Warning-Options.html#index-Wno-stringop-truncation) - -Wstrict-flex-arrays -UrlSuffix(gcc/Warning-Options.html#index-Wno-strict-flex-arrays) - -Wsuggest-attribute=format -UrlSuffix(gcc/Warning-Options.html#index-Wno-suggest-attribute_003dformat) - -Wsuggest-override -UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-suggest-override) - -Wswitch -UrlSuffix(gcc/Warning-Options.html#index-Wno-switch) - -Wswitch-default -UrlSuffix(gcc/Warning-Options.html#index-Wno-switch-default) - -Wswitch-enum -UrlSuffix(gcc/Warning-Options.html#index-Wno-switch-enum) - -Wswitch-bool -UrlSuffix(gcc/Warning-Options.html#index-Wno-switch-bool) - -Wswitch-outside-range -UrlSuffix(gcc/Warning-Options.html#index-Wno-switch-outside-range) - -Wtemplates -UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-templates) - -Wmissing-attributes -UrlSuffix(gcc/Warning-Options.html#index-Wmissing-attributes) - Wmissing-format-attribute UrlSuffix(gcc/Warning-Options.html#index-Wmissing-format-attribute) @@ -601,12 +535,27 @@ UrlSuffix(gcc/Warning-Options.html#index-Wmissing-parameter-type) Wmissing-prototypes UrlSuffix(gcc/Warning-Options.html#index-Wmissing-prototypes) +Wmissing-requires +UrlSuffix(gcc/Warning-Options.html#index-Wmissing-requires) + +Wmissing-template-keyword +UrlSuffix(gcc/Warning-Options.html#index-Wmissing-template-keyword) + Wmissing-variable-declarations UrlSuffix(gcc/Warning-Options.html#index-Wmissing-variable-declarations) Wmultichar UrlSuffix(gcc/Warning-Options.html#index-Wmultichar) +Wmultiple-inheritance +UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wmultiple-inheritance) + +Wmultistatement-macros +UrlSuffix(gcc/Warning-Options.html#index-Wmultistatement-macros) + +Wnamespaces +UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wnamespaces) + Wnarrowing UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wnarrowing) @@ -622,12 +571,6 @@ UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-noexcept-type) Wnon-template-friend UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-non-template-friend) -Wclass-conversion -UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wclass-conversion) - -Wclass-memaccess -UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wclass-memaccess) - Wnon-virtual-dtor UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-non-virtual-dtor) @@ -682,9 +625,15 @@ UrlSuffix(gcc/Warning-Options.html#index-Wno-override-init) Woverride-init-side-effects UrlSuffix(gcc/Warning-Options.html#index-Wno-override-init-side-effects) +Wnrvo +UrlSuffix(gcc/Warning-Options.html#index-Wno-nrvo) + Wpacked-bitfield-compat UrlSuffix(gcc/Warning-Options.html#index-Wno-packed-bitfield-compat) +Wpacked-not-aligned +UrlSuffix(gcc/Warning-Options.html#index-Wno-packed-not-aligned) + Wparentheses UrlSuffix(gcc/Warning-Options.html#index-Wno-parentheses) @@ -694,6 +643,12 @@ UrlSuffix(gcc/Warning-Options.html#index-Wno-pedantic) Wpessimizing-move UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-pessimizing-move) +Wplacement-new +UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-placement-new) + +Wplacement-new= +UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-placement-new) + ; skipping UrlSuffix for 'Wpmf-conversions' due to multiple URLs: ; duplicate: 'gcc/Bound-member-functions.html#index-Wno-pmf-conversions-1' ; duplicate: 'gcc/C_002b_002b-Dialect-Options.html#index-Wno-pmf-conversions' @@ -723,11 +678,8 @@ UrlSuffix(gcc/Objective-C-and-Objective-C_002b_002b-Dialect-Options.html#index-W Wprotocol UrlSuffix(gcc/Objective-C-and-Objective-C_002b_002b-Dialect-Options.html#index-Wno-protocol) -Wplacement-new -UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-placement-new) - -Wplacement-new= -UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-placement-new) +Wrange-loop-construct +UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-range-loop-construct) Wredundant-decls UrlSuffix(gcc/Warning-Options.html#index-Wno-redundant-decls) @@ -735,12 +687,18 @@ UrlSuffix(gcc/Warning-Options.html#index-Wno-redundant-decls) Wredundant-move UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-redundant-move) +Wredundant-tags +UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-redundant-tags) + Wregister UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-register) Wreorder UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-reorder) +Wrestrict +UrlSuffix(gcc/Warning-Options.html#index-Wno-restrict) + Wreturn-mismatch UrlSuffix(gcc/Warning-Options.html#index-Wno-return-mismatch) @@ -777,9 +735,6 @@ UrlSuffix(gcc/Warning-Options.html#index-Wno-shift-count-overflow) Wshift-negative-value UrlSuffix(gcc/Warning-Options.html#index-Wno-shift-negative-value) -Warith-conversion -UrlSuffix(gcc/Warning-Options.html#index-Warith-conversion) - Wsign-compare UrlSuffix(gcc/Warning-Options.html#index-Wno-sign-compare) @@ -792,30 +747,93 @@ UrlSuffix(gcc/Warning-Options.html#index-Wno-sign-conversion) Wsign-promo UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-sign-promo) -Wstrict-null-sentinel -UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-strict-null-sentinel) +Wsized-deallocation +UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-sized-deallocation) -Wstrict-prototypes -UrlSuffix(gcc/Warning-Options.html#index-Wno-strict-prototypes) +Wsizeof-array-div +UrlSuffix(gcc/Warning-Options.html#index-Wno-sizeof-array-div) + +Wsizeof-array-argument +UrlSuffix(gcc/Warning-Options.html#index-Wno-sizeof-array-argument) + +Wsizeof-pointer-div +UrlSuffix(gcc/Warning-Options.html#index-Wno-sizeof-pointer-div) + +Wsizeof-pointer-memaccess +UrlSuffix(gcc/Warning-Options.html#index-Wno-sizeof-pointer-memaccess) Wstrict-aliasing= UrlSuffix(gcc/Warning-Options.html#index-Wno-strict-aliasing) +Wstrict-flex-arrays +UrlSuffix(gcc/Warning-Options.html#index-Wno-strict-flex-arrays) + +Wstrict-null-sentinel +UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-strict-null-sentinel) + Wstrict-overflow= UrlSuffix(gcc/Warning-Options.html#index-Wno-strict-overflow) +Wstrict-prototypes +UrlSuffix(gcc/Warning-Options.html#index-Wno-strict-prototypes) + Wstrict-selector-match UrlSuffix(gcc/Objective-C-and-Objective-C_002b_002b-Dialect-Options.html#index-Wno-strict-selector-match) +Wstring-compare +UrlSuffix(gcc/Warning-Options.html#index-Wno-string-compare) + +Wstringop-overflow +UrlSuffix(gcc/Warning-Options.html#index-Wno-stringop-overflow) + +Wstringop-overflow= +UrlSuffix(gcc/Warning-Options.html#index-Wno-stringop-overflow) + +Wstringop-overread +UrlSuffix(gcc/Warning-Options.html#index-Wno-stringop-overread) + +Wstringop-truncation +UrlSuffix(gcc/Warning-Options.html#index-Wno-stringop-truncation) + +Wsubobject-linkage +UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-subobject-linkage) + +Wsuggest-attribute=format +UrlSuffix(gcc/Warning-Options.html#index-Wno-suggest-attribute_003dformat) + +Wsuggest-override +UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-suggest-override) + +Wswitch +UrlSuffix(gcc/Warning-Options.html#index-Wno-switch) + +Wswitch-default +UrlSuffix(gcc/Warning-Options.html#index-Wno-switch-default) + +Wswitch-enum +UrlSuffix(gcc/Warning-Options.html#index-Wno-switch-enum) + +Wswitch-bool +UrlSuffix(gcc/Warning-Options.html#index-Wno-switch-bool) + +Wswitch-outside-range +UrlSuffix(gcc/Warning-Options.html#index-Wno-switch-outside-range) + Wsync-nand UrlSuffix(gcc/Warning-Options.html#index-Wno-sync-nand) Wsystem-headers UrlSuffix(gcc/Warning-Options.html#index-Wno-system-headers) +Wtemplates +UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-templates) + Wtautological-compare UrlSuffix(gcc/Warning-Options.html#index-Wno-tautological-compare) +Wtemplate-id-cdtor +UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-template-id-cdtor) + Wterminate UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-terminate) @@ -840,9 +858,6 @@ UrlSuffix(gcc/Warning-Options.html#index-Wno-unicode) Wuninitialized UrlSuffix(gcc/Warning-Options.html#index-Wno-uninitialized) -Wmaybe-uninitialized -UrlSuffix(gcc/Warning-Options.html#index-Wmaybe-uninitialized) - Wunknown-pragmas UrlSuffix(gcc/Warning-Options.html#index-Wno-unknown-pragmas) LangUrlSuffix_D(gdc/Warnings.html#index-Wno-unknown-pragmas) @@ -852,6 +867,12 @@ UrlSuffix(gcc/Warning-Options.html#index-Wno-unsuffixed-float-constants) Wunused UrlSuffix(gcc/Warning-Options.html#index-Wno-unused) +Wunused-const-variable +UrlSuffix(gcc/Warning-Options.html#index-Wno-unused-const-variable) + +Wunused-const-variable= +UrlSuffix(gcc/Warning-Options.html#index-Wno-unused-const-variable) + Wunused-local-typedefs UrlSuffix(gcc/Warning-Options.html#index-Wno-unused-local-typedefs) @@ -864,14 +885,11 @@ UrlSuffix(gcc/Warning-Options.html#index-Wno-unused-result) Wunused-variable UrlSuffix(gcc/Warning-Options.html#index-Wno-unused-variable) -Wunused-const-variable -UrlSuffix(gcc/Warning-Options.html#index-Wno-unused-const-variable) - -Wunused-const-variable= -UrlSuffix(gcc/Warning-Options.html#index-Wno-unused-const-variable) - Wuse-after-free= -UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-use-after-free) +UrlSuffix(gcc/Warning-Options.html#index-Wno-use-after-free) + +Wuseless-cast +UrlSuffix(gcc/Warning-Options.html#index-Wno-useless-cast) Wvariadic-macros UrlSuffix(gcc/Warning-Options.html#index-Wno-variadic-macros) @@ -882,6 +900,9 @@ UrlSuffix(gcc/Warning-Options.html#index-Wno-varargs) LangUrlSuffix_D(gdc/Warnin Wvexing-parse UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-vexing-parse) +Wvirtual-move-assign +UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-virtual-move-assign) + Wvla UrlSuffix(gcc/Warning-Options.html#index-Wno-vla) @@ -900,9 +921,6 @@ UrlSuffix(gcc/Warning-Options.html#index-Wno-volatile-register-var) Wvirtual-inheritance UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-virtual-inheritance) -Wvirtual-move-assign -UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-virtual-move-assign) - Wwrite-strings UrlSuffix(gcc/Warning-Options.html#index-Wno-write-strings) @@ -912,20 +930,8 @@ UrlSuffix(gcc/Warning-Options.html#index-Wno-xor-used-as-pow) Wzero-as-null-pointer-constant UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-zero-as-null-pointer-constant) -Wuseless-cast -UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-useless-cast) - -Wsubobject-linkage -UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-subobject-linkage) - -Welaborated-enum-base -UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Welaborated-enum-base) - -Wduplicate-decl-specifier -UrlSuffix(gcc/Warning-Options.html#index-Wduplicate-decl-specifier) - -Wrestrict -UrlSuffix(gcc/Warning-Options.html#index-Wno-restrict) +Wzero-length-bounds +UrlSuffix(gcc/Warning-Options.html#index-Wzero-length-bounds) ; skipping UrlSuffix for 'ansi' due to multiple URLs: ; duplicate: 'gcc/C-Dialect-Options.html#index-ansi-1' diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 553b7a26599a..f8b56315ce5d 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,30 @@ +2024-03-08 Jakub Jelinek + + PR debug/113918 + * c-tree.h (c_type_dwarf_attribute): Declare. + * c-objc-common.h (LANG_HOOKS_TYPE_DWARF_ATTRIBUTE): Redefine. + * c-objc-common.cc: Include dwarf2.h. + (c_type_dwarf_attribute): New function. + +2024-02-26 Jakub Jelinek + + 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. + +2024-02-22 Jakub Jelinek + + PR c/114007 + * c-parser.cc (c_parser_std_attribute): Remove loose_scope_p argument. + Instead of checking it, parse 2 CPP_COLONs with the first one with + COLON_SCOPE flag the same as CPP_SCOPE. + (c_parser_std_attribute_list): Remove loose_scope_p argument, don't + pass it to c_parser_std_attribute. + (c_parser_std_attribute_specifier): Adjust c_parser_std_attribute_list + caller. + 2024-02-13 Tobias Burnus PR middle-end/113904 diff --git a/gcc/c/c-objc-common.cc b/gcc/c/c-objc-common.cc index 116b73af6db3..b7c72d2609c6 100644 --- a/gcc/c/c-objc-common.cc +++ b/gcc/c/c-objc-common.cc @@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see #include "gcc-rich-location.h" #include "stringpool.h" #include "attribs.h" +#include "dwarf2.h" static bool c_tree_printer (pretty_printer *, text_info *, const char *, int, bool, bool, bool, bool *, const char **); @@ -446,3 +447,25 @@ instantiation_dependent_expression_p (tree) { return false; } + +/* Return -1 if dwarf ATTR shouldn't be added for TYPE, or the attribute + value otherwise. */ +int +c_type_dwarf_attribute (const_tree type, int attr) +{ + if (type == NULL_TREE) + return -1; + + switch (attr) + { + case DW_AT_export_symbols: + if (RECORD_OR_UNION_TYPE_P (type) && TYPE_NAME (type) == NULL_TREE) + return 1; + break; + + default: + break; + } + + return -1; +} diff --git a/gcc/c/c-objc-common.h b/gcc/c/c-objc-common.h index 35a59988e900..20af5a5bb944 100644 --- a/gcc/c/c-objc-common.h +++ b/gcc/c/c-objc-common.h @@ -119,6 +119,9 @@ static const scoped_attribute_specs *const c_objc_attribute_table[] = #undef LANG_HOOKS_GIMPLIFY_EXPR #define LANG_HOOKS_GIMPLIFY_EXPR c_gimplify_expr +#undef LANG_HOOKS_TYPE_DWARF_ATTRIBUTE +#define LANG_HOOKS_TYPE_DWARF_ATTRIBUTE c_type_dwarf_attribute + #undef LANG_HOOKS_OMP_PREDETERMINED_SHARING #define LANG_HOOKS_OMP_PREDETERMINED_SHARING c_omp_predetermined_sharing diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index 3be91d666a58..53e99aa29d96 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -5705,8 +5705,7 @@ c_parser_omp_sequence_args (c_parser *parser, tree attribute) indicates whether this relaxation is in effect. */ static tree -c_parser_std_attribute (c_parser *parser, bool for_tm, - bool loose_scope_p = false) +c_parser_std_attribute (c_parser *parser, bool for_tm) { c_token *token = c_parser_peek_token (parser); tree ns, name, attribute; @@ -5720,8 +5719,8 @@ c_parser_std_attribute (c_parser *parser, bool for_tm, name = canonicalize_attr_name (token->value); c_parser_consume_token (parser); if (c_parser_next_token_is (parser, CPP_SCOPE) - || (loose_scope_p - && c_parser_next_token_is (parser, CPP_COLON) + || (c_parser_next_token_is (parser, CPP_COLON) + && (c_parser_peek_token (parser)->flags & COLON_SCOPE) != 0 && c_parser_peek_2nd_token (parser)->type == CPP_COLON)) { ns = name; @@ -5841,8 +5840,7 @@ c_parser_std_attribute (c_parser *parser, bool for_tm, } static tree -c_parser_std_attribute_list (c_parser *parser, bool for_tm, - bool loose_scope_p = false) +c_parser_std_attribute_list (c_parser *parser, bool for_tm) { tree attributes = NULL_TREE; while (true) @@ -5855,7 +5853,7 @@ c_parser_std_attribute_list (c_parser *parser, bool for_tm, c_parser_consume_token (parser); continue; } - tree attribute = c_parser_std_attribute (parser, for_tm, loose_scope_p); + tree attribute = c_parser_std_attribute (parser, for_tm); if (attribute != error_mark_node) { TREE_CHAIN (attribute) = attributes; @@ -5883,7 +5881,7 @@ c_parser_std_attribute_specifier (c_parser *parser, bool for_tm) { auto ext = disable_extension_diagnostics (); c_parser_consume_token (parser); - attributes = c_parser_std_attribute_list (parser, for_tm, true); + attributes = c_parser_std_attribute_list (parser, for_tm); restore_extension_diagnostics (ext); } else @@ -11861,6 +11859,27 @@ c_parser_postfix_expression (c_parser *parser) expr.set_error (); break; } + if (TREE_CODE (TREE_TYPE (arg_p->value)) == ENUMERAL_TYPE) + { + error_at (loc, "argument %u in call to function " + "%qs has enumerated type", 1, name); + expr.set_error (); + break; + } + if (TREE_CODE (TREE_TYPE (arg_p->value)) == BOOLEAN_TYPE) + { + error_at (loc, "argument %u in call to function " + "%qs has boolean type", 1, name); + expr.set_error (); + break; + } + if (!TYPE_UNSIGNED (TREE_TYPE (arg_p->value))) + { + error_at (loc, "argument 1 in call to function " + "%qs has signed type", name); + expr.set_error (); + break; + } tree arg = arg_p->value; tree type = TYPE_MAIN_VARIANT (TREE_TYPE (arg)); /* Expand: diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h index 1fba9c8dae76..22b0009874b5 100644 --- a/gcc/c/c-tree.h +++ b/gcc/c/c-tree.h @@ -731,6 +731,7 @@ extern bool c_warn_unused_global_decl (const_tree); extern void c_initialize_diagnostics (diagnostic_context *); extern bool c_var_mod_p (tree x, tree fn); extern alias_set_type c_get_alias_set (tree); +extern int c_type_dwarf_attribute (const_tree, int); /* in c-typeck.cc */ extern int in_alignof; diff --git a/gcc/calls.cc b/gcc/calls.cc index 01f447347437..21d78f9779fe 100644 --- a/gcc/calls.cc +++ b/gcc/calls.cc @@ -2938,7 +2938,7 @@ expand_call (tree exp, rtx target, int ignore) /* Count the struct value address, if it is passed as a parm. */ + structure_value_addr_parm); else if (TYPE_NO_NAMED_ARGS_STDARG_P (funtype)) - n_named_args = 0; + n_named_args = structure_value_addr_parm; else /* If we know nothing, treat all args as named. */ n_named_args = num_actuals; @@ -2970,14 +2970,15 @@ expand_call (tree exp, rtx target, int ignore) we do not have any reliable way to pass unnamed args in registers, so we must force them into memory. */ - if (type_arg_types != 0 + if ((type_arg_types != 0 || TYPE_NO_NAMED_ARGS_STDARG_P (funtype)) && targetm.calls.strict_argument_naming (args_so_far)) ; else if (type_arg_types != 0 && ! targetm.calls.pretend_outgoing_varargs_named (args_so_far)) /* Don't include the last named arg. */ --n_named_args; - else if (TYPE_NO_NAMED_ARGS_STDARG_P (funtype)) + else if (TYPE_NO_NAMED_ARGS_STDARG_P (funtype) + && ! targetm.calls.pretend_outgoing_varargs_named (args_so_far)) n_named_args = 0; else /* Treat all args as named. */ diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc index 0ac8f73204b2..473d8410bc97 100644 --- a/gcc/cgraph.cc +++ b/gcc/cgraph.cc @@ -51,6 +51,8 @@ along with GCC; see the file COPYING3. If not see #include "ipa-utils.h" #include "symbol-summary.h" #include "tree-vrp.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "cfgloop.h" diff --git a/gcc/cgraphclones.cc b/gcc/cgraphclones.cc index 6d7bc402a291..4fff6873a369 100644 --- a/gcc/cgraphclones.cc +++ b/gcc/cgraphclones.cc @@ -84,6 +84,8 @@ along with GCC; see the file COPYING3. If not see #include "alloc-pool.h" #include "symbol-summary.h" #include "tree-vrp.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "symtab-thunks.h" diff --git a/gcc/cgraphunit.cc b/gcc/cgraphunit.cc index 5c405258ec30..d200166f7e93 100644 --- a/gcc/cgraphunit.cc +++ b/gcc/cgraphunit.cc @@ -191,6 +191,8 @@ along with GCC; see the file COPYING3. If not see #include "debug.h" #include "symbol-summary.h" #include "tree-vrp.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "gimple-pretty-print.h" #include "plugin.h" diff --git a/gcc/combine.cc b/gcc/combine.cc index 812553c091e6..a4479f8d8364 100644 --- a/gcc/combine.cc +++ b/gcc/combine.cc @@ -9745,7 +9745,7 @@ make_field_assignment (rtx x) if (width >= HOST_BITS_PER_WIDE_INT) ze_mask = -1; else - ze_mask = ((unsigned HOST_WIDE_INT)1 << width) - 1; + ze_mask = (HOST_WIDE_INT_1U << width) - 1; /* Complete overlap. We can remove the source AND. */ if ((and_mask & ze_mask) == ze_mask) @@ -12550,9 +12550,22 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1) } /* If the inner mode is narrower and we are extracting the low part, - we can treat the SUBREG as if it were a ZERO_EXTEND. */ + we can treat the SUBREG as if it were a ZERO_EXTEND ... */ if (paradoxical_subreg_p (op0)) - ; + { + if (WORD_REGISTER_OPERATIONS + && is_a (GET_MODE (SUBREG_REG (op0)), + &inner_mode) + && GET_MODE_PRECISION (inner_mode) < BITS_PER_WORD + /* On WORD_REGISTER_OPERATIONS targets the bits + beyond sub_mode aren't considered undefined, + so optimize only if it is a MEM load when MEM loads + zero extend, because then the upper bits are all zero. */ + && !(MEM_P (SUBREG_REG (op0)) + && load_extend_op (inner_mode) == ZERO_EXTEND)) + break; + /* FALLTHROUGH to case ZERO_EXTEND */ + } else if (subreg_lowpart_p (op0) && GET_MODE_CLASS (mode) == MODE_INT && is_int_mode (GET_MODE (SUBREG_REG (op0)), &inner_mode) diff --git a/gcc/common.opt.urls b/gcc/common.opt.urls index 4cb2d7dc628e..db4354989fcc 100644 --- a/gcc/common.opt.urls +++ b/gcc/common.opt.urls @@ -64,10 +64,10 @@ Warray-bounds= UrlSuffix(gcc/Warning-Options.html#index-Warray-bounds) Wuse-after-free -UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-use-after-free) +UrlSuffix(gcc/Warning-Options.html#index-Wno-use-after-free) Wuse-after-free= -UrlSuffix(gcc/C_002b_002b-Dialect-Options.html#index-Wno-use-after-free) +UrlSuffix(gcc/Warning-Options.html#index-Wno-use-after-free) Wattributes UrlSuffix(gcc/Warning-Options.html#index-Wattributes) diff --git a/gcc/common/config/avr/avr-common.cc b/gcc/common/config/avr/avr-common.cc index 7867483909de..fdf130f1e1ae 100644 --- a/gcc/common/config/avr/avr-common.cc +++ b/gcc/common/config/avr/avr-common.cc @@ -34,6 +34,8 @@ static const struct default_options avr_option_optimization_table[] = { OPT_LEVELS_ALL, OPT_fcaller_saves, NULL, 0 }, { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_mgas_isr_prologues, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_mmain_is_OS_task, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_mfuse_add_, NULL, 1 }, + { OPT_LEVELS_2_PLUS, OPT_mfuse_add_, NULL, 2 }, // Stick to the "old" placement of the subreg lowering pass. { OPT_LEVELS_1_PLUS, OPT_fsplit_wide_types_early, NULL, 1 }, /* Allow optimizer to introduce store data races. This used to be the diff --git a/gcc/config.gcc b/gcc/config.gcc index a0f9c6723083..624e0dae191a 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -273,6 +273,7 @@ esac # Obsolete configurations. case ${target}${target_min} in *-*-solaris2.11.[0-3]* \ + | ia64*-*-* \ ) if test "x$enable_obsolete" != xyes; then echo "*** Configuration ${target}${target_min} is obsolete." >&2 @@ -1653,8 +1654,8 @@ bpf-*-*) tmake_file="${tmake_file} bpf/t-bpf" use_collect2=no use_gcc_stdint=provide - extra_objs="coreout.o core-builtins.o" - target_gtfiles="$target_gtfiles \$(srcdir)/config/bpf/coreout.cc \$(srcdir)/config/bpf/core-builtins.cc" + extra_objs="btfext-out.o core-builtins.o" + target_gtfiles="$target_gtfiles \$(srcdir)/config/bpf/btfext-out.cc \$(srcdir)/config/bpf/core-builtins.cc" ;; cris-*-elf | cris-*-none) tm_file="elfos.h newlib-stdint.h ${tm_file}" @@ -2537,6 +2538,9 @@ riscv*-*-freebsd*) loongarch*-*-linux*) tm_file="elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file}" + case ${target} in + *-linux-musl*) tm_file="${tm_file} loongarch/musl.h" + esac tm_file="${tm_file} loongarch/gnu-user.h loongarch/linux.h loongarch/loongarch-driver.h" extra_options="${extra_options} linux-android.opt" tmake_file="${tmake_file} loongarch/t-multilib loongarch/t-linux" diff --git a/gcc/config.in b/gcc/config.in index ce1d073833fc..f3de4ba6776b 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -737,6 +737,13 @@ #endif +/* Define 0/1 if your assembler and linker support R_X86_64_CODE_6_GOTTPOFF. + */ +#ifndef USED_FOR_TARGET +#undef HAVE_AS_R_X86_64_CODE_6_GOTTPOFF +#endif + + /* Define if your assembler supports relocs needed by -fpic. */ #ifndef USED_FOR_TARGET #undef HAVE_AS_SMALL_PIC_RELOCS diff --git a/gcc/config/aarch64/aarch64-builtins.cc b/gcc/config/aarch64/aarch64-builtins.cc index 277904f6d142..75d21de14011 100644 --- a/gcc/config/aarch64/aarch64-builtins.cc +++ b/gcc/config/aarch64/aarch64-builtins.cc @@ -1840,7 +1840,7 @@ aarch64_init_prefetch_builtin (void) } /* Initialize the memory tagging extension (MTE) builtins. */ -struct +static GTY(()) struct GTY(()) { tree ftype; enum insn_code icode; diff --git a/gcc/config/aarch64/aarch64-early-ra.cc b/gcc/config/aarch64/aarch64-early-ra.cc index 1a03d86e94b9..1e2c823cb2eb 100644 --- a/gcc/config/aarch64/aarch64-early-ra.cc +++ b/gcc/config/aarch64/aarch64-early-ra.cc @@ -95,6 +95,10 @@ class early_ra void execute (); private: + // Whether to test only things that are required for correctness, + // or whether to take optimization heuristics into account as well. + enum test_strictness { CORRECTNESS_ONLY, ALL_REASONS }; + static_assert (MAX_RECOG_OPERANDS <= 32, "Operand mask is 32 bits"); using operand_mask = uint32_t; @@ -440,6 +444,7 @@ class early_ra void record_allocno_use (allocno_info *); void record_allocno_def (allocno_info *); allocno_info *find_related_start (allocno_info *, allocno_info *, bool); + void accumulate_defs (allocno_info *, allocno_info *); void record_copy (rtx, rtx, bool = false); void record_constraints (rtx_insn *); void record_artificial_refs (unsigned int); @@ -451,7 +456,7 @@ class early_ra template static int cmp_increasing (const void *, const void *); - bool is_chain_candidate (allocno_info *, allocno_info *); + bool is_chain_candidate (allocno_info *, allocno_info *, test_strictness); int rate_chain (allocno_info *, allocno_info *); static int cmp_chain_candidates (const void *, const void *); void chain_allocnos (unsigned int &, unsigned int &); @@ -527,6 +532,12 @@ class early_ra // The set of FPRs that are currently live. unsigned int m_live_fprs; + // A unique one-based identifier for the current region. + unsigned int m_current_region; + + // The region in which each FPR was last used, or 0 if none. + unsigned int m_fpr_recency[32]; + // ---------------------------------------------------------------------- // A mask of the FPRs that have already been allocated. @@ -1049,8 +1060,7 @@ is_stride_candidate (rtx_insn *insn) return false; auto stride_type = get_attr_stride_type (insn); - return (stride_type == STRIDE_TYPE_LUTI_CONSECUTIVE - || stride_type == STRIDE_TYPE_LD1_CONSECUTIVE + return (stride_type == STRIDE_TYPE_LD1_CONSECUTIVE || stride_type == STRIDE_TYPE_ST1_CONSECUTIVE); } @@ -1300,6 +1310,7 @@ early_ra::start_new_region () m_allocated_fprs = 0; m_call_preserved_fprs = 0; m_allocation_successful = true; + m_current_region += 1; } // Create and return an allocno group of size SIZE for register REGNO. @@ -1569,6 +1580,8 @@ early_ra::find_related_start (allocno_info *dest_allocno, } if (dest_allocno->group_size != 1 + // Account for definitions by shared registers. + || dest_allocno->num_defs > 1 || DF_REG_DEF_COUNT (dest_allocno->group ()->regno) != 1) // Currently only single allocnos that are defined once can // share registers with non-equivalent allocnos. This could be @@ -1585,7 +1598,7 @@ early_ra::find_related_start (allocno_info *dest_allocno, return res; auto *next_allocno = m_allocnos[dest_allocno->copy_dest]; - if (!is_chain_candidate (dest_allocno, next_allocno)) + if (!is_chain_candidate (dest_allocno, next_allocno, ALL_REASONS)) return res; dest_allocno = next_allocno; @@ -1593,6 +1606,20 @@ early_ra::find_related_start (allocno_info *dest_allocno, } } +// Add FROM_ALLOCNO's definition information to TO_ALLOCNO's. +void +early_ra::accumulate_defs (allocno_info *to_allocno, + allocno_info *from_allocno) +{ + if (from_allocno->num_defs > 0) + { + to_allocno->num_defs = MIN (from_allocno->num_defs + + to_allocno->num_defs, 2); + to_allocno->last_def_point = MAX (to_allocno->last_def_point, + from_allocno->last_def_point); + } +} + // Record any relevant allocno-related information for an actual or imagined // copy from SRC to DEST. FROM_MOVE_P is true if the copy was an explicit // move instruction, false if it represents one way of satisfying the previous @@ -1687,6 +1714,16 @@ early_ra::record_copy (rtx dest, rtx src, bool from_move_p) next_allocno->related_allocno = src_allocno->id; next_allocno->is_equiv = (start_allocno == dest_allocno && from_move_p); + // If we're sharing two allocnos that are not equivalent, + // carry across the definition information. This is needed + // to prevent multiple incompatible attempts to share with + // the same register. + if (next_allocno->is_shared ()) + accumulate_defs (src_allocno, next_allocno); + src_allocno->last_use_point + = MAX (src_allocno->last_use_point, + next_allocno->last_use_point); + if (next_allocno == start_allocno) break; next_allocno = m_allocnos[next_allocno->copy_dest]; @@ -1984,7 +2021,7 @@ early_ra::strided_polarity_pref (allocno_info *allocno1, if (allocno1->offset + 1 < allocno1->group_size && allocno2->offset + 1 < allocno2->group_size) { - if (is_chain_candidate (allocno1 + 1, allocno2 + 1)) + if (is_chain_candidate (allocno1 + 1, allocno2 + 1, ALL_REASONS)) return 1; else return -1; @@ -1992,7 +2029,7 @@ early_ra::strided_polarity_pref (allocno_info *allocno1, if (allocno1->offset > 0 && allocno2->offset > 0) { - if (is_chain_candidate (allocno1 - 1, allocno2 - 1)) + if (is_chain_candidate (allocno1 - 1, allocno2 - 1, ALL_REASONS)) return 1; else return -1; @@ -2188,38 +2225,37 @@ early_ra::cmp_increasing (const void *allocno1_ptr, const void *allocno2_ptr) } // Return true if we should consider chaining ALLOCNO1 onto the head -// of ALLOCNO2. This is just a local test of the two allocnos; it doesn't -// guarantee that chaining them would give a self-consistent system. +// of ALLOCNO2. STRICTNESS says whether we should take copy-elision +// heuristics into account, or whether we should just consider things +// that matter for correctness. +// +// This is just a local test of the two allocnos; it doesn't guarantee +// that chaining them would give a self-consistent system. bool -early_ra::is_chain_candidate (allocno_info *allocno1, allocno_info *allocno2) +early_ra::is_chain_candidate (allocno_info *allocno1, allocno_info *allocno2, + test_strictness strictness) { if (allocno2->is_shared ()) return false; - if (allocno1->is_equiv) + while (allocno1->is_equiv) allocno1 = m_allocnos[allocno1->related_allocno]; if (allocno2->start_point >= allocno1->end_point && !allocno2->is_equiv_to (allocno1->id)) return false; - if (allocno2->is_strong_copy_dest) - { - if (!allocno1->is_strong_copy_src - || allocno1->copy_dest != allocno2->id) - return false; - } - else if (allocno2->is_copy_dest) + if (allocno1->is_earlyclobbered + && allocno1->end_point == allocno2->start_point + 1) + return false; + + if (strictness == ALL_REASONS && allocno2->is_copy_dest) { if (allocno1->copy_dest != allocno2->id) return false; - } - else if (allocno1->is_earlyclobbered) - { - if (allocno1->end_point == allocno2->start_point + 1) + if (allocno2->is_strong_copy_dest && !allocno1->is_strong_copy_src) return false; } - return true; } @@ -2443,8 +2479,7 @@ early_ra::try_to_chain_allocnos (allocno_info *allocno1, auto *head2 = m_allocnos[headi2]; if (head1->chain_next != INVALID_ALLOCNO) return false; - if (!head2->is_equiv_to (head1->id) - && head1->end_point <= head2->start_point) + if (!is_chain_candidate (head1, head2, CORRECTNESS_ONLY)) return false; } } @@ -2593,7 +2628,7 @@ early_ra::form_chains () auto *allocno2 = m_sorted_allocnos[sci]; if (allocno2->chain_prev == INVALID_ALLOCNO) { - if (!is_chain_candidate (allocno1, allocno2)) + if (!is_chain_candidate (allocno1, allocno2, ALL_REASONS)) continue; chain_candidate_info candidate; candidate.allocno = allocno2; @@ -2790,19 +2825,30 @@ early_ra::allocate_colors () candidates &= ~(m_allocated_fprs >> i); unsigned int best = INVALID_REGNUM; int best_weight = 0; + unsigned int best_recency = 0; for (unsigned int fpr = 0; fpr <= 32U - color->group->size; ++fpr) { if ((candidates & (1U << fpr)) == 0) continue; int weight = color->fpr_preferences[fpr]; + unsigned int recency = 0; // Account for registers that the current function must preserve. for (unsigned int i = 0; i < color->group->size; ++i) - if (m_call_preserved_fprs & (1U << (fpr + i))) - weight -= 1; - if (best == INVALID_REGNUM || best_weight <= weight) + { + if (m_call_preserved_fprs & (1U << (fpr + i))) + weight -= 1; + recency = MAX (recency, m_fpr_recency[fpr + i]); + } + // Prefer higher-numbered registers in the event of a tie. + // This should tend to keep lower-numbered registers free + // for allocnos that require V0-V7 or V0-V15. + if (best == INVALID_REGNUM + || best_weight < weight + || (best_weight == weight && recency <= best_recency)) { best = fpr; best_weight = weight; + best_recency = recency; } } @@ -2859,19 +2905,27 @@ early_ra::find_oldest_color (unsigned int first_color, { color_info *best = nullptr; unsigned int best_start_point = ~0U; + unsigned int best_recency = 0; for (unsigned int ci = first_color; ci < m_colors.length (); ++ci) { auto *color = m_colors[ci]; - if (fpr_conflicts & (1U << (color->hard_regno - V0_REGNUM))) + unsigned int fpr = color->hard_regno - V0_REGNUM; + if (fpr_conflicts & (1U << fpr)) continue; - if (!color->group) - return color; - auto chain_head = color->group->chain_heads ()[0]; - auto start_point = m_allocnos[chain_head]->start_point; - if (!best || best_start_point > start_point) + unsigned int start_point = 0; + if (color->group) + { + auto chain_head = color->group->chain_heads ()[0]; + start_point = m_allocnos[chain_head]->start_point; + } + unsigned int recency = m_fpr_recency[fpr]; + if (!best + || best_start_point > start_point + || (best_start_point == start_point && recency < best_recency)) { best = color; best_start_point = start_point; + best_recency = recency; } } return best; @@ -2975,6 +3029,13 @@ early_ra::broaden_colors () void early_ra::finalize_allocation () { + for (auto *color : m_colors) + if (color->group) + { + unsigned int fpr = color->hard_regno - V0_REGNUM; + for (unsigned int i = 0; i < color->group->size; ++i) + m_fpr_recency[fpr + i] = m_current_region; + } for (auto *allocno : m_allocnos) { if (allocno->is_shared ()) @@ -3150,8 +3211,7 @@ early_ra::maybe_convert_to_strided_access (rtx_insn *insn) auto stride_type = get_attr_stride_type (insn); rtx pat = PATTERN (insn); rtx op; - if (stride_type == STRIDE_TYPE_LUTI_CONSECUTIVE - || stride_type == STRIDE_TYPE_LD1_CONSECUTIVE) + if (stride_type == STRIDE_TYPE_LD1_CONSECUTIVE) op = SET_DEST (pat); else if (stride_type == STRIDE_TYPE_ST1_CONSECUTIVE) op = XVECEXP (SET_SRC (pat), 0, 1); @@ -3201,20 +3261,6 @@ early_ra::maybe_convert_to_strided_access (rtx_insn *insn) XVECEXP (SET_SRC (pat), 0, XVECLEN (SET_SRC (pat), 0) - 1) = *recog_data.dup_loc[0]; } - else if (stride_type == STRIDE_TYPE_LUTI_CONSECUTIVE) - { - auto bits = INTVAL (XVECEXP (SET_SRC (pat), 0, 4)); - if (range.count == 2) - pat = gen_aarch64_sme_lut_strided2 (bits, single_mode, - regs[0], regs[1], - recog_data.operand[1], - recog_data.operand[2]); - else - pat = gen_aarch64_sme_lut_strided4 (bits, single_mode, - regs[0], regs[1], regs[2], regs[3], - recog_data.operand[1], - recog_data.operand[2]); - } else gcc_unreachable (); PATTERN (insn) = pat; @@ -3492,6 +3538,10 @@ early_ra::process_blocks () bitmap_set_bit (fpr_pseudos_live_in, bb->index); } + // This is incremented by 1 at the start of each region. + m_current_region = 0; + memset (m_fpr_recency, 0, sizeof (m_fpr_recency)); + struct stack_node { edge_iterator ei; basic_block bb; }; auto_vec stack; diff --git a/gcc/config/aarch64/aarch64-feature-deps.h b/gcc/config/aarch64/aarch64-feature-deps.h index a1b81f9070bf..3641badb82f5 100644 --- a/gcc/config/aarch64/aarch64-feature-deps.h +++ b/gcc/config/aarch64/aarch64-feature-deps.h @@ -71,6 +71,9 @@ template struct info; static constexpr auto enable = flag | get_enable REQUIRES; \ static constexpr auto explicit_on = enable | get_enable EXPLICIT_ON; \ }; \ + const aarch64_feature_flags info::flag; \ + const aarch64_feature_flags info::enable; \ + const aarch64_feature_flags info::explicit_on; \ constexpr info IDENT () \ { \ return info (); \ diff --git a/gcc/config/aarch64/aarch64-sme.md b/gcc/config/aarch64/aarch64-sme.md index c95d4aa696c6..78ad2fc699f2 100644 --- a/gcc/config/aarch64/aarch64-sme.md +++ b/gcc/config/aarch64/aarch64-sme.md @@ -1939,74 +1939,4 @@ "TARGET_STREAMING_SME2 && !( == 4 && == 4 && == 8)" "luti\t%0, zt0, %1[%2]" - [(set_attr "stride_type" "luti_consecutive")] -) - -(define_insn "@aarch64_sme_lut_strided2" - [(set (match_operand:SVE_FULL_BHS 0 "aarch64_simd_register" "=Uwd") - (unspec:SVE_FULL_BHS - [(reg:V8DI ZT0_REGNUM) - (reg:DI SME_STATE_REGNUM) - (match_operand:VNx16QI 2 "register_operand" "w") - (match_operand:DI 3 "const_int_operand") - (const_int LUTI_BITS) - (const_int 0)] - UNSPEC_SME_LUTI)) - (set (match_operand:SVE_FULL_BHS 1 "aarch64_simd_register" "=w") - (unspec:SVE_FULL_BHS - [(reg:V8DI ZT0_REGNUM) - (reg:DI SME_STATE_REGNUM) - (match_dup 2) - (match_dup 3) - (const_int LUTI_BITS) - (const_int 1)] - UNSPEC_SME_LUTI))] - "TARGET_STREAMING_SME2 - && aarch64_strided_registers_p (operands, 2, 8)" - "luti\t{%0., %1.}, zt0, %2[%3]" - [(set_attr "stride_type" "luti_strided")] -) - -(define_insn "@aarch64_sme_lut_strided4" - [(set (match_operand:SVE_FULL_BHS 0 "aarch64_simd_register" "=Uwt") - (unspec:SVE_FULL_BHS - [(reg:V8DI ZT0_REGNUM) - (reg:DI SME_STATE_REGNUM) - (match_operand:VNx16QI 4 "register_operand" "w") - (match_operand:DI 5 "const_int_operand") - (const_int LUTI_BITS) - (const_int 0)] - UNSPEC_SME_LUTI)) - (set (match_operand:SVE_FULL_BHS 1 "aarch64_simd_register" "=w") - (unspec:SVE_FULL_BHS - [(reg:V8DI ZT0_REGNUM) - (reg:DI SME_STATE_REGNUM) - (match_dup 4) - (match_dup 5) - (const_int LUTI_BITS) - (const_int 1)] - UNSPEC_SME_LUTI)) - (set (match_operand:SVE_FULL_BHS 2 "aarch64_simd_register" "=w") - (unspec:SVE_FULL_BHS - [(reg:V8DI ZT0_REGNUM) - (reg:DI SME_STATE_REGNUM) - (match_dup 4) - (match_dup 5) - (const_int LUTI_BITS) - (const_int 2)] - UNSPEC_SME_LUTI)) - (set (match_operand:SVE_FULL_BHS 3 "aarch64_simd_register" "=w") - (unspec:SVE_FULL_BHS - [(reg:V8DI ZT0_REGNUM) - (reg:DI SME_STATE_REGNUM) - (match_dup 4) - (match_dup 5) - (const_int LUTI_BITS) - (const_int 3)] - UNSPEC_SME_LUTI))] - "TARGET_STREAMING_SME2 - && !( == 4 && == 8) - && aarch64_strided_registers_p (operands, 4, 4)" - "luti\t{%0., %1., %2., %3.}, zt0, %4[%5]" - [(set_attr "stride_type" "luti_strided")] ) diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 28d1555dada9..0a28e033088a 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -91,6 +91,8 @@ #include "tree-pass.h" #include "cfgbuild.h" #include "symbol-summary.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "hash-map.h" @@ -26463,33 +26465,6 @@ aarch64_progress_pointer (rtx pointer) return aarch64_move_pointer (pointer, GET_MODE_SIZE (GET_MODE (pointer))); } -typedef auto_vec, 12> copy_ops; - -/* Copy one block of size MODE from SRC to DST at offset OFFSET. */ -static void -aarch64_copy_one_block (copy_ops &ops, rtx src, rtx dst, - int offset, machine_mode mode) -{ - /* Emit explict load/store pair instructions for 32-byte copies. */ - if (known_eq (GET_MODE_SIZE (mode), 32)) - { - mode = V4SImode; - rtx src1 = adjust_address (src, mode, offset); - rtx dst1 = adjust_address (dst, mode, offset); - rtx reg1 = gen_reg_rtx (mode); - rtx reg2 = gen_reg_rtx (mode); - rtx load = aarch64_gen_load_pair (reg1, reg2, src1); - rtx store = aarch64_gen_store_pair (dst1, reg1, reg2); - ops.safe_push ({ load, store }); - return; - } - - rtx reg = gen_reg_rtx (mode); - rtx load = gen_move_insn (reg, adjust_address (src, mode, offset)); - rtx store = gen_move_insn (adjust_address (dst, mode, offset), reg); - ops.safe_push ({ load, store }); -} - /* Expand a cpymem/movmem using the MOPS extension. OPERANDS are taken from the cpymem/movmem pattern. IS_MEMMOVE is true if this is a memmove rather than memcpy. Return true iff we succeeded. */ @@ -26525,7 +26500,7 @@ aarch64_expand_cpymem (rtx *operands, bool is_memmove) rtx src = operands[1]; unsigned align = UINTVAL (operands[3]); rtx base; - machine_mode cur_mode = BLKmode, next_mode; + machine_mode mode = BLKmode, next_mode; /* Variable-sized or strict-align copies may use the MOPS expansion. */ if (!CONST_INT_P (operands[2]) || (STRICT_ALIGNMENT && align < 16)) @@ -26548,16 +26523,12 @@ aarch64_expand_cpymem (rtx *operands, bool is_memmove) if (size > max_copy_size || (TARGET_MOPS && size > mops_threshold)) return aarch64_expand_cpymem_mops (operands, is_memmove); - unsigned copy_max = 32; - - /* Default to 32-byte LDP/STP on large copies, however small copies, no SIMD - support or slow LDP/STP fall back to 16-byte chunks. - + /* Default to 32-byte LDP/STP on large copies, however small copies or + no SIMD support fall back to 16-byte chunks. ??? Although it would be possible to use LDP/STP Qn in streaming mode (so using TARGET_BASE_SIMD instead of TARGET_SIMD), it isn't clear whether that would improve performance. */ - if (size <= 24 || !use_ldpq) - copy_max = 16; + bool use_qregs = size > 24 && TARGET_SIMD; base = copy_to_mode_reg (Pmode, XEXP (dst, 0)); dst = adjust_automodify_address (dst, VOIDmode, base, 0); @@ -26565,7 +26536,7 @@ aarch64_expand_cpymem (rtx *operands, bool is_memmove) base = copy_to_mode_reg (Pmode, XEXP (src, 0)); src = adjust_automodify_address (src, VOIDmode, base, 0); - copy_ops ops; + auto_vec, 16> ops; int offset = 0; while (size > 0) @@ -26574,23 +26545,27 @@ aarch64_expand_cpymem (rtx *operands, bool is_memmove) or writing. */ opt_scalar_int_mode mode_iter; FOR_EACH_MODE_IN_CLASS (mode_iter, MODE_INT) - if (GET_MODE_SIZE (mode_iter.require ()) <= MIN (size, copy_max)) - cur_mode = mode_iter.require (); + if (GET_MODE_SIZE (mode_iter.require ()) <= MIN (size, 16)) + mode = mode_iter.require (); - gcc_assert (cur_mode != BLKmode); + gcc_assert (mode != BLKmode); + + mode_bytes = GET_MODE_SIZE (mode).to_constant (); - mode_bytes = GET_MODE_SIZE (cur_mode).to_constant (); + /* Prefer Q-register accesses. */ + if (mode_bytes == 16 && use_qregs) + mode = V4SImode; - /* Prefer Q-register accesses for the last bytes. */ - if (mode_bytes == 16 && copy_max == 32) - cur_mode = V4SImode; - aarch64_copy_one_block (ops, src, dst, offset, cur_mode); + rtx reg = gen_reg_rtx (mode); + rtx load = gen_move_insn (reg, adjust_address (src, mode, offset)); + rtx store = gen_move_insn (adjust_address (dst, mode, offset), reg); + ops.safe_push ({ load, store }); size -= mode_bytes; offset += mode_bytes; /* Emit trailing copies using overlapping unaligned accesses (when !STRICT_ALIGNMENT) - this is smaller and faster. */ - if (size > 0 && size < copy_max / 2 && !STRICT_ALIGNMENT) + if (size > 0 && size < 16 && !STRICT_ALIGNMENT) { next_mode = smallest_mode_for_size (size * BITS_PER_UNIT, MODE_INT); int n_bytes = GET_MODE_SIZE (next_mode).to_constant (); @@ -26602,7 +26577,7 @@ aarch64_expand_cpymem (rtx *operands, bool is_memmove) /* Memcpy interleaves loads with stores, memmove emits all loads first. */ int nops = ops.length(); - int inc = is_memmove ? nops : nops == 4 ? 2 : 3; + int inc = is_memmove || nops <= 8 ? nops : 6; for (int i = 0; i < nops; i += inc) { @@ -26631,7 +26606,8 @@ aarch64_set_one_block_and_progress_pointer (rtx src, rtx *dst, /* "Cast" the *dst to the correct mode. */ *dst = adjust_address (*dst, mode, 0); /* Emit the memset. */ - emit_insn (aarch64_gen_store_pair (*dst, src, src)); + emit_move_insn (*dst, src); + emit_move_insn (aarch64_move_pointer (*dst, 16), src); /* Move the pointers forward. */ *dst = aarch64_move_pointer (*dst, 32); diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 33fbe1b2e8db..7d51d923bf68 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -553,8 +553,7 @@ ;; The RTL mapping therefore applies at LD1 granularity, rather than ;; being broken down into individual types of load. (define_attr "stride_type" - "none,ld1_consecutive,ld1_strided,st1_consecutive,st1_strided, - luti_consecutive,luti_strided" + "none,ld1_consecutive,ld1_strided,st1_consecutive,st1_strided" (const_string "none")) ;; Attribute used to identify load pair and store pair instructions. diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md index 94d5d339c3de..79f12c53c168 100644 --- a/gcc/config/alpha/alpha.md +++ b/gcc/config/alpha/alpha.md @@ -683,41 +683,10 @@ [(set_attr "type" "imul") (set_attr "opsize" "")]) -(define_expand "umuldi3_highpart" - [(set (match_operand:DI 0 "register_operand") - (truncate:DI - (lshiftrt:TI - (mult:TI (zero_extend:TI - (match_operand:DI 1 "register_operand")) - (match_operand:DI 2 "reg_or_8bit_operand")) - (const_int 64))))] - "" -{ - if (REG_P (operands[2])) - operands[2] = gen_rtx_ZERO_EXTEND (TImode, operands[2]); -}) - -(define_insn "*umuldi3_highpart_reg" - [(set (match_operand:DI 0 "register_operand" "=r") - (truncate:DI - (lshiftrt:TI - (mult:TI (zero_extend:TI - (match_operand:DI 1 "register_operand" "r")) - (zero_extend:TI - (match_operand:DI 2 "register_operand" "r"))) - (const_int 64))))] - "" - "umulh %1,%2,%0" - [(set_attr "type" "imul") - (set_attr "opsize" "udi")]) - -(define_insn "*umuldi3_highpart_const" +(define_insn "umuldi3_highpart" [(set (match_operand:DI 0 "register_operand" "=r") - (truncate:DI - (lshiftrt:TI - (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r")) - (match_operand:TI 2 "cint8_operand" "I")) - (const_int 64))))] + (umul_highpart:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ") + (match_operand:DI 2 "reg_or_8bit_operand" "rI")))] "" "umulh %1,%2,%0" [(set_attr "type" "imul") diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc index 1cd69268ee98..6a35fe441381 100644 --- a/gcc/config/arm/arm.cc +++ b/gcc/config/arm/arm.cc @@ -25613,11 +25613,12 @@ arm_final_prescan_insn (rtx_insn *insn) break; case INSN: - /* Instructions using or affecting the condition codes make it - fail. */ + /* Check the instruction is explicitly marked as predicable. + Instructions using or affecting the condition codes are not. */ scanbody = PATTERN (this_insn); if (!(GET_CODE (scanbody) == SET || GET_CODE (scanbody) == PARALLEL) + || get_attr_predicable (this_insn) != PREDICABLE_YES || get_attr_conds (this_insn) != CONDS_NOCOND) fail = TRUE; break; diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 2a2207c0ba1a..449e6935b32f 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -2375,6 +2375,21 @@ extern int making_const_table; else if (TARGET_THUMB1) \ thumb1_final_prescan_insn (INSN) +/* These defines are useful to refer to the value of the mve_unpredicated_insn + insn attribute. Note that, because these use the get_attr_* function, these + will change recog_data if (INSN) isn't current_insn. */ +#define MVE_VPT_PREDICABLE_INSN_P(INSN) \ + (recog_memoized (INSN) >= 0 \ + && get_attr_mve_unpredicated_insn (INSN) != CODE_FOR_nothing) + +#define MVE_VPT_PREDICATED_INSN_P(INSN) \ + (MVE_VPT_PREDICABLE_INSN_P (INSN) \ + && recog_memoized (INSN) != get_attr_mve_unpredicated_insn (INSN)) + +#define MVE_VPT_UNPREDICATED_INSN_P(INSN) \ + (MVE_VPT_PREDICABLE_INSN_P (INSN) \ + && recog_memoized (INSN) == get_attr_mve_unpredicated_insn (INSN)) + #define ARM_SIGN_EXTEND(x) ((HOST_WIDE_INT) \ (HOST_BITS_PER_WIDE_INT <= 32 ? (unsigned HOST_WIDE_INT) (x) \ : ((((unsigned HOST_WIDE_INT)(x)) & (unsigned HOST_WIDE_INT) 0xffffffff) |\ diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 5816409f86f1..1fd00146ca9e 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -124,6 +124,18 @@ ; and not all ARM insns do. (define_attr "predicated" "yes,no" (const_string "no")) +; An attribute that encodes the CODE_FOR_ of the MVE VPT unpredicated +; version of a VPT-predicated instruction. For unpredicated instructions +; that are predicable, encode the same pattern's CODE_FOR_ as a way to +; encode that it is a predicable instruction. +(define_attr "mve_unpredicated_insn" "" (symbol_ref "CODE_FOR_nothing")) + +; An attribute used by the loop-doloop pass when determining whether it is +; safe to predicate a MVE instruction, that operates across lanes, and was +; previously not predicated. The pass will still check whether all inputs +; are predicated by the VCTP predication mask. +(define_attr "mve_safe_imp_xlane_pred" "yes,no" (const_string "no")) + ; LENGTH of an instruction (in bytes) (define_attr "length" "" (const_int 4)) @@ -307,6 +319,8 @@ ; ; NOCOND means that the instruction does not use or alter the condition ; codes but can be converted into a conditionally exectuted instruction. +; Given that NOCOND is the default for most instructions if omitted, +; the attribute predicable must be set to yes as well. (define_attr "conds" "use,set,clob,unconditional,nocond" (if_then_else @@ -12547,6 +12561,7 @@ revsh%?\t%0, %1" [(set_attr "arch" "t1,t2,32") (set_attr "length" "2,2,4") + (set_attr "predicable" "no,yes,yes") (set_attr "type" "rev")] ) @@ -12560,6 +12575,7 @@ rev16%?\t%0, %1" [(set_attr "arch" "t1,t2,32") (set_attr "length" "2,2,4") + (set_attr "predicable" "no,yes,yes") (set_attr "type" "rev")] ) @@ -12584,6 +12600,7 @@ rev16%?\t%0, %1" [(set_attr "arch" "t1,t2,32") (set_attr "length" "2,2,4") + (set_attr "predicable" "no,yes,yes") (set_attr "type" "rev")] ) @@ -12604,6 +12621,7 @@ rev16%?\t%0, %1" [(set_attr "arch" "t1,t2,32") (set_attr "length" "2,2,4") + (set_attr "predicable" "no,yes,yes") (set_attr "type" "rev")] ) diff --git a/gcc/config/arm/iterators.md b/gcc/config/arm/iterators.md index 547d87f3bc8e..8d066fcf05df 100644 --- a/gcc/config/arm/iterators.md +++ b/gcc/config/arm/iterators.md @@ -869,6 +869,14 @@ (plus "vadd") ]) +(define_int_attr mve_vmaxmin_safe_imp [ + (VMAXVQ_U "yes") + (VMAXVQ_S "no") + (VMAXAVQ_S "yes") + (VMINVQ_U "no") + (VMINVQ_S "no") + (VMINAVQ_S "no")]) + (define_int_attr mve_cmp_op1 [ (VCMPCSQ_M_U "cs") (VCMPEQQ_M_S "eq") (VCMPEQQ_M_U "eq") @@ -2361,7 +2369,7 @@ (VSUBQ_S "s") (VSUBQ_U "u") (VADDVAQ_S "s") (VADDVAQ_U "u") (VADDLVAQ_S "s") (VADDLVAQ_U "u") (VBICQ_N_S "s") (VBICQ_N_U "u") (VMLALDAVQ_U "u") - (VMLALDAVQ_S "s") (VMLALDAVXQ_U "u") (VMLALDAVXQ_S "s") + (VMLALDAVQ_S "s") (VMLALDAVXQ_S "s") (VMOVNBQ_U "u") (VMOVNBQ_S "s") (VMOVNTQ_U "u") (VMOVNTQ_S "s") (VORRQ_N_S "s") (VORRQ_N_U "u") (VQMOVNBQ_U "u") (VQMOVNBQ_S "s") (VQMOVNTQ_S "s") @@ -2403,8 +2411,8 @@ (VREV16Q_M_S "s") (VREV16Q_M_U "u") (VQRSHRNTQ_N_U "u") (VMOVNTQ_M_U "u") (VMOVLBQ_M_U "u") (VMLALDAVAQ_U "u") (VQSHRNBQ_N_U "u") (VSHRNBQ_N_U "u") - (VRSHRNBQ_N_U "u") (VMLALDAVXQ_P_U "u") - (VMVNQ_M_N_U "u") (VQSHRNTQ_N_U "u") (VMLALDAVAXQ_U "u") + (VRSHRNBQ_N_U "u") + (VMVNQ_M_N_U "u") (VQSHRNTQ_N_U "u") (VQMOVNTQ_M_U "u") (VSHRNTQ_N_U "u") (VCVTMQ_M_S "s") (VCVTMQ_M_U "u") (VCVTNQ_M_S "s") (VCVTNQ_M_U "u") (VCVTPQ_M_S "s") (VCVTPQ_M_U "u") (VADDLVAQ_P_S "s") @@ -2753,7 +2761,6 @@ (define_int_iterator VADDLVAQ [VADDLVAQ_S VADDLVAQ_U]) (define_int_iterator VBICQ_N [VBICQ_N_S VBICQ_N_U]) (define_int_iterator VMLALDAVQ [VMLALDAVQ_U VMLALDAVQ_S]) -(define_int_iterator VMLALDAVXQ [VMLALDAVXQ_U VMLALDAVXQ_S]) (define_int_iterator VMOVNBQ [VMOVNBQ_U VMOVNBQ_S]) (define_int_iterator VMOVNTQ [VMOVNTQ_S VMOVNTQ_U]) (define_int_iterator VORRQ_N [VORRQ_N_U VORRQ_N_S]) @@ -2808,11 +2815,9 @@ (define_int_iterator VQSHRNBQ_N [VQSHRNBQ_N_U VQSHRNBQ_N_S]) (define_int_iterator VSHRNBQ_N [VSHRNBQ_N_U VSHRNBQ_N_S]) (define_int_iterator VRSHRNBQ_N [VRSHRNBQ_N_S VRSHRNBQ_N_U]) -(define_int_iterator VMLALDAVXQ_P [VMLALDAVXQ_P_U VMLALDAVXQ_P_S]) (define_int_iterator VQMOVNTQ_M [VQMOVNTQ_M_U VQMOVNTQ_M_S]) (define_int_iterator VMVNQ_M_N [VMVNQ_M_N_U VMVNQ_M_N_S]) (define_int_iterator VQSHRNTQ_N [VQSHRNTQ_N_U VQSHRNTQ_N_S]) -(define_int_iterator VMLALDAVAXQ [VMLALDAVAXQ_S VMLALDAVAXQ_U]) (define_int_iterator VSHRNTQ_N [VSHRNTQ_N_S VSHRNTQ_N_U]) (define_int_iterator VCVTMQ_M [VCVTMQ_M_S VCVTMQ_M_U]) (define_int_iterator VCVTNQ_M [VCVTNQ_M_S VCVTNQ_M_U]) diff --git a/gcc/config/arm/mmintrin.h b/gcc/config/arm/mmintrin.h index 07659502bf2f..e9cc3ddd7ab7 100644 --- a/gcc/config/arm/mmintrin.h +++ b/gcc/config/arm/mmintrin.h @@ -28,6 +28,9 @@ #error mmintrin.h included without enabling WMMX/WMMX2 instructions (e.g. -march=iwmmxt or -march=iwmmxt2) #endif +#ifndef __ENABLE_DEPRECATED_IWMMXT +#warning support for WMMX/WMMX2 is deprecated and will be removed in GCC 15. Define __ENABLE_DEPRECATED_IWMMXT to suppress this warning +#endif #if defined __cplusplus extern "C" { diff --git a/gcc/config/arm/mve.md b/gcc/config/arm/mve.md index 0fabbaa931b4..9fe51298cdc2 100644 --- a/gcc/config/arm/mve.md +++ b/gcc/config/arm/mve.md @@ -17,7 +17,7 @@ ;; along with GCC; see the file COPYING3. If not see ;; . -(define_insn "*mve_mov" +(define_insn "mve_mov" [(set (match_operand:MVE_types 0 "nonimmediate_operand" "=w,w,r,w , w, r,Ux,w") (match_operand:MVE_types 1 "general_operand" " w,r,w,DnDm,UxUi,r,w, Ul"))] "TARGET_HAVE_MVE || TARGET_HAVE_MVE_FLOAT" @@ -81,18 +81,27 @@ return ""; } } - [(set_attr "type" "mve_move,mve_move,mve_move,mve_move,mve_load,multiple,mve_store,mve_load") + [(set_attr_alternative "mve_unpredicated_insn" [(symbol_ref "CODE_FOR_mve_mov") + (symbol_ref "CODE_FOR_nothing") + (symbol_ref "CODE_FOR_nothing") + (symbol_ref "CODE_FOR_mve_mov") + (symbol_ref "CODE_FOR_mve_mov") + (symbol_ref "CODE_FOR_nothing") + (symbol_ref "CODE_FOR_mve_mov") + (symbol_ref "CODE_FOR_nothing")]) + (set_attr "type" "mve_move,mve_move,mve_move,mve_move,mve_load,multiple,mve_store,mve_load") (set_attr "length" "4,8,8,4,4,8,4,8") (set_attr "thumb2_pool_range" "*,*,*,*,1018,*,*,*") (set_attr "neg_pool_range" "*,*,*,*,996,*,*,*")]) -(define_insn "*mve_vdup" +(define_insn "mve_vdup" [(set (match_operand:MVE_vecs 0 "s_register_operand" "=w") (vec_duplicate:MVE_vecs (match_operand: 1 "s_register_operand" "r")))] "TARGET_HAVE_MVE || TARGET_HAVE_MVE_FLOAT" "vdup.\t%q0, %1" - [(set_attr "length" "4") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vdup")) + (set_attr "length" "4") (set_attr "type" "mve_move")]) ;; @@ -145,7 +154,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" ".f%#\t%q0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_f")) + (set_attr "type" "mve_move") ]) ;; @@ -159,7 +169,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" ".%#\t%q0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_f")) + (set_attr "type" "mve_move") ]) ;; @@ -173,7 +184,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "v.f%#\t%q0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vq_f")) + (set_attr "type" "mve_move") ]) ;; @@ -187,7 +199,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" ".%#\t%q0, %1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_f")) + (set_attr "type" "mve_move") ]) ;; @@ -201,7 +214,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" ".\t%q0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_f")) + (set_attr "type" "mve_move") ]) ;; ;; [vcvttq_f32_f16]) @@ -214,7 +228,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vcvtt.f32.f16\t%q0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvttq_f32_f16v4sf")) + (set_attr "type" "mve_move") ]) ;; @@ -228,7 +243,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vcvtb.f32.f16\t%q0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvtbq_f32_f16v4sf")) + (set_attr "type" "mve_move") ]) ;; @@ -242,7 +258,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vcvt.f%#.%#\t%q0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvtq_to_f_")) + (set_attr "type" "mve_move") ]) ;; @@ -256,7 +273,8 @@ ] "TARGET_HAVE_MVE" ".%#\t%q0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") ]) ;; @@ -270,7 +288,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vcvt.%#.f%#\t%q0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvtq_from_f_")) + (set_attr "type" "mve_move") ]) ;; @@ -284,7 +303,8 @@ ] "TARGET_HAVE_MVE" "v.s%#\t%q0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vq_s")) + (set_attr "type" "mve_move") ]) ;; @@ -297,7 +317,8 @@ ] "TARGET_HAVE_MVE" "vmvn\t%q0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vmvnq_u")) + (set_attr "type" "mve_move") ]) (define_expand "mve_vmvnq_s" [ @@ -318,7 +339,8 @@ ] "TARGET_HAVE_MVE" ".%#\t%q0, %1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") ]) ;; @@ -331,7 +353,8 @@ ] "TARGET_HAVE_MVE" "vclz.i%#\t%q0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vclzq_s")) + (set_attr "type" "mve_move") ]) (define_expand "mve_vclzq_u" [ @@ -354,7 +377,8 @@ ] "TARGET_HAVE_MVE" ".%#\t%q0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") ]) ;; @@ -368,7 +392,9 @@ ] "TARGET_HAVE_MVE" ".%#\t%0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "mve_safe_imp_xlane_pred" "yes") + (set_attr "type" "mve_move") ]) ;; @@ -382,7 +408,8 @@ ] "TARGET_HAVE_MVE" ".%#\t%q0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") ]) ;; @@ -397,7 +424,8 @@ ] "TARGET_HAVE_MVE" ".%#\t%q0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") ]) ;; @@ -411,7 +439,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vcvtp.%#.f%#\t%q0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvtpq_")) + (set_attr "type" "mve_move") ]) ;; @@ -425,7 +454,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vcvtn.%#.f%#\t%q0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvtnq_")) + (set_attr "type" "mve_move") ]) ;; @@ -439,7 +469,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vcvtm.%#.f%#\t%q0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvtmq_")) + (set_attr "type" "mve_move") ]) ;; @@ -453,7 +484,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vcvta.%#.f%#\t%q0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvtaq_")) + (set_attr "type" "mve_move") ]) ;; @@ -467,7 +499,8 @@ ] "TARGET_HAVE_MVE" ".i%#\t%q0, %1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") ]) ;; @@ -481,7 +514,8 @@ ] "TARGET_HAVE_MVE" ".\t%q0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") ]) ;; @@ -495,7 +529,9 @@ ] "TARGET_HAVE_MVE" ".32\t%Q0, %R0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_v4si")) + (set_attr "mve_safe_imp_xlane_pred" "yes") + (set_attr "type" "mve_move") ]) ;; @@ -509,7 +545,8 @@ ] "TARGET_HAVE_MVE" "vctp.\t%1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vctpq")) + (set_attr "type" "mve_move") ]) ;; @@ -523,7 +560,8 @@ ] "TARGET_HAVE_MVE" "vpnot" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vpnotv16bi")) + (set_attr "type" "mve_move") ]) ;; @@ -538,7 +576,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" ".\t%q0, %q1, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_f")) + (set_attr "type" "mve_move") ]) ;; @@ -553,7 +592,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vcvt.f.\t%q0, %q1, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvtq_n_to_f_")) + (set_attr "type" "mve_move") ]) ;; [vcreateq_f]) @@ -599,7 +639,8 @@ ] "TARGET_HAVE_MVE" ".\t%q0, %q1, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") ]) ;; Versions that take constant vectors as operand 2 (with all elements @@ -617,7 +658,8 @@ VALID_NEON_QREG_MODE (mode), true); } - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vshrq_n_s_imm")) + (set_attr "type" "mve_move") ]) (define_insn "mve_vshrq_n_u_imm" [ @@ -632,7 +674,8 @@ VALID_NEON_QREG_MODE (mode), true); } - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vshrq_n_u_imm")) + (set_attr "type" "mve_move") ]) ;; @@ -647,7 +690,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vcvt..f\t%q0, %q1, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvtq_n_from_f_")) + (set_attr "type" "mve_move") ]) ;; @@ -662,8 +706,9 @@ ] "TARGET_HAVE_MVE" "vpst\;t.32\t%Q0, %R0, %q1" - [(set_attr "type" "mve_move") - (set_attr "length""8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_v4si")) + (set_attr "type" "mve_move") + (set_attr "length""8")]) ;; ;; [vcmpneq_, vcmpcsq_, vcmpeqq_, vcmpgeq_, vcmpgtq_, vcmphiq_, vcmpleq_, vcmpltq_]) @@ -676,7 +721,8 @@ ] "TARGET_HAVE_MVE" "vcmp.%#\t, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcmpq_")) + (set_attr "type" "mve_move") ]) ;; @@ -691,7 +737,8 @@ ] "TARGET_HAVE_MVE" "vcmp.%# , %q1, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcmpq_n_")) + (set_attr "type" "mve_move") ]) ;; @@ -722,7 +769,8 @@ ] "TARGET_HAVE_MVE" ".%#\t%q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") ]) ;; @@ -739,7 +787,8 @@ ] "TARGET_HAVE_MVE" ".i%#\t%q0, %q1, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") ]) ;; @@ -754,7 +803,9 @@ ] "TARGET_HAVE_MVE" ".%#\t%0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "mve_safe_imp_xlane_pred" "yes") + (set_attr "type" "mve_move") ]) ;; @@ -769,7 +820,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%0, %q1" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -789,8 +841,11 @@ "@ vand\t%q0, %q1, %q2 * return neon_output_logic_immediate (\"vand\", &operands[2], mode, 1, VALID_NEON_QREG_MODE (mode));" - [(set_attr "type" "mve_move") + [(set_attr_alternative "mve_unpredicated_insn" [(symbol_ref "CODE_FOR_mve_vandq_u") + (symbol_ref "CODE_FOR_nothing")]) + (set_attr "type" "mve_move") ]) + (define_expand "mve_vandq_s" [ (set (match_operand:MVE_2 0 "s_register_operand") @@ -811,7 +866,8 @@ ] "TARGET_HAVE_MVE" "vbic\t%q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vbicq_u")) + (set_attr "type" "mve_move") ]) (define_expand "mve_vbicq_s" @@ -835,7 +891,8 @@ ] "TARGET_HAVE_MVE" ".%#\t%q0, %q1, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") ]) ;; @@ -853,7 +910,8 @@ ] "TARGET_HAVE_MVE" ".%#\t%q0, %q1, %q2, #" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") ]) ;; Auto vectorizer pattern for int vcadd @@ -876,7 +934,8 @@ ] "TARGET_HAVE_MVE" "veor\t%q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_veorq_u")) + (set_attr "type" "mve_move") ]) (define_expand "mve_veorq_s" [ @@ -904,7 +963,8 @@ ] "TARGET_HAVE_MVE" ".%#\t%q0, %q1, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") ]) ;; @@ -920,7 +980,8 @@ ] "TARGET_HAVE_MVE" ".s%#\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") ]) ;; @@ -935,7 +996,8 @@ ] "TARGET_HAVE_MVE" ".%#\t%q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") ]) @@ -954,7 +1016,9 @@ ] "TARGET_HAVE_MVE" ".%#\t%0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "mve_safe_imp_xlane_pred" "") + (set_attr "type" "mve_move") ]) ;; @@ -972,7 +1036,9 @@ ] "TARGET_HAVE_MVE" ".%#\t%0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "mve_safe_imp_xlane_pred" "yes") + (set_attr "type" "mve_move") ]) ;; @@ -988,7 +1054,8 @@ ] "TARGET_HAVE_MVE" ".%#\t%q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_int_")) + (set_attr "type" "mve_move") ]) ;; @@ -1004,7 +1071,8 @@ ] "TARGET_HAVE_MVE" ".i%#\t%q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q")) + (set_attr "type" "mve_move") ]) ;; @@ -1018,7 +1086,8 @@ ] "TARGET_HAVE_MVE" "vorn\t%q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vornq_s")) + (set_attr "type" "mve_move") ]) (define_expand "mve_vornq_u" @@ -1047,7 +1116,8 @@ "@ vorr\t%q0, %q1, %q2 * return neon_output_logic_immediate (\"vorr\", &operands[2], mode, 0, VALID_NEON_QREG_MODE (mode));" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vorrq_s")) + (set_attr "type" "mve_move") ]) (define_expand "mve_vorrq_u" [ @@ -1071,7 +1141,8 @@ ] "TARGET_HAVE_MVE" ".%#\t%q0, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") ]) ;; @@ -1087,7 +1158,8 @@ ] "TARGET_HAVE_MVE" ".%#\t%q0, %q1, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") ]) ;; @@ -1103,7 +1175,8 @@ ] "TARGET_HAVE_MVE" ".%#\t%q0, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_r_")) + (set_attr "type" "mve_move") ]) ;; @@ -1118,7 +1191,8 @@ ] "TARGET_HAVE_MVE" ".%#\t%q0, %q1, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") ]) ;; @@ -1133,7 +1207,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" ".f%#\t%q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_f")) + (set_attr "type" "mve_move") ]) ;; @@ -1148,7 +1223,9 @@ ] "TARGET_HAVE_MVE" ".32\t%Q0, %R0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_v4si")) + (set_attr "mve_safe_imp_xlane_pred" "yes") + (set_attr "type" "mve_move") ]) ;; @@ -1165,7 +1242,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" ".f%#\t%q0, %q1, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_f")) + (set_attr "type" "mve_move") ]) ;; @@ -1179,7 +1257,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vand\t%q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vandq_f")) + (set_attr "type" "mve_move") ]) ;; @@ -1193,7 +1272,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vbic\t%q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vbicq_f")) + (set_attr "type" "mve_move") ]) ;; @@ -1209,7 +1289,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" ".f%#\t%q0, %q1, %q2, #" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_f")) + (set_attr "type" "mve_move") ]) ;; @@ -1223,7 +1304,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vcmp.f%# , %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcmpq_f")) + (set_attr "type" "mve_move") ]) ;; @@ -1238,7 +1320,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vcmp.f%# , %q1, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcmpq_n_f")) + (set_attr "type" "mve_move") ]) ;; @@ -1253,8 +1336,10 @@ ] "TARGET_HAVE_MVE" "vpst\;vctpt.\t%1" - [(set_attr "type" "mve_move") - (set_attr "length""8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vctpq")) + (set_attr "type" "mve_move") + (set_attr "length""8") +]) ;; ;; [vcvtbq_f16_f32]) @@ -1268,7 +1353,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vcvtb.f16.f32\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvtbq_f16_f32v8hf")) + (set_attr "type" "mve_move") ]) ;; @@ -1283,7 +1369,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vcvtt.f16.f32\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvttq_f16_f32v8hf")) + (set_attr "type" "mve_move") ]) ;; @@ -1297,7 +1384,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "veor\t%q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_veorq_f")) + (set_attr "type" "mve_move") ]) ;; @@ -1313,7 +1401,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" ".f%#\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_f")) + (set_attr "type" "mve_move") ]) ;; @@ -1331,7 +1420,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" ".f%#\t%0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_f")) + (set_attr "type" "mve_move") ]) ;; @@ -1346,7 +1436,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" ".f%# %q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_f")) + (set_attr "type" "mve_move") ]) ;; @@ -1364,7 +1455,9 @@ ] "TARGET_HAVE_MVE" ".%#\t%Q0, %R0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "mve_safe_imp_xlane_pred" "yes") + (set_attr "type" "mve_move") ]) ;; @@ -1384,7 +1477,8 @@ ] "TARGET_HAVE_MVE" ".%#\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") ]) ;; @@ -1400,7 +1494,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" ".f%#\t%q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_f")) + (set_attr "type" "mve_move") ]) ;; @@ -1414,7 +1509,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vorn\t%q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vornq_f")) + (set_attr "type" "mve_move") ]) ;; @@ -1428,7 +1524,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vorr\t%q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vorrq_f")) + (set_attr "type" "mve_move") ]) ;; @@ -1444,7 +1541,8 @@ ] "TARGET_HAVE_MVE" ".i%# %q0, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") ]) ;; @@ -1460,7 +1558,8 @@ ] "TARGET_HAVE_MVE" ".s%#\t%q0, %q1, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") ]) ;; @@ -1476,7 +1575,8 @@ ] "TARGET_HAVE_MVE" ".s%#\t%q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") ]) ;; @@ -1494,7 +1594,9 @@ ] "TARGET_HAVE_MVE" ".32\t%Q0, %R0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_v4si")) + (set_attr "mve_safe_imp_xlane_pred" "yes") + (set_attr "type" "mve_move") ]) ;; @@ -1510,7 +1612,8 @@ ] "TARGET_HAVE_MVE" ".%#\t%q0, %q1, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") ]) ;; @@ -1526,7 +1629,8 @@ ] "TARGET_HAVE_MVE" ".%#\t%q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_poly_")) + (set_attr "type" "mve_move") ]) ;; @@ -1547,8 +1651,9 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;vcmpt.f%#\t, %q1, %q2" - [(set_attr "type" "mve_move") - (set_attr "length""8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcmpq_f")) + (set_attr "length""8")]) + ;; ;; [vcvtaq_m_u, vcvtaq_m_s]) ;; @@ -1562,8 +1667,10 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;vcvtat.%#.f%#\t%q0, %q2" - [(set_attr "type" "mve_move") - (set_attr "length""8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvtaq_")) + (set_attr "type" "mve_move") + (set_attr "length""8")]) + ;; ;; [vcvtq_m_to_f_s, vcvtq_m_to_f_u]) ;; @@ -1577,8 +1684,9 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;vcvtt.f%#.%#\t%q0, %q2" - [(set_attr "type" "mve_move") - (set_attr "length""8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvtq_to_f_")) + (set_attr "type" "mve_move") + (set_attr "length""8")]) ;; ;; [vqrshrnbq_n_u, vqrshrnbq_n_s] @@ -1604,7 +1712,8 @@ ] "TARGET_HAVE_MVE" ".%#\t%q0, %q2, %3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") ]) ;; @@ -1623,7 +1732,9 @@ ] "TARGET_HAVE_MVE" ".32\t%Q0, %R0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_v4si")) + (set_attr "mve_safe_imp_xlane_pred" "yes") + (set_attr "type" "mve_move") ]) ;; @@ -1639,7 +1750,9 @@ ] "TARGET_HAVE_MVE" ".%#\t%0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "mve_safe_imp_xlane_pred" "yes") + (set_attr "type" "mve_move") ]) ;; @@ -1685,7 +1798,10 @@ (match_dup 4)] VSHLCQ))] "TARGET_HAVE_MVE" - "vshlc\t%q0, %1, %4") + "vshlc\t%q0, %1, %4" + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vshlcq_")) + (set_attr "type" "mve_move") +]) ;; ;; [vabsq_m_s] @@ -1705,7 +1821,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -1721,7 +1838,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -1744,7 +1862,8 @@ ] "TARGET_HAVE_MVE" "vpst\;vcmpt.%#\t, %q1, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcmpq_n_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -1767,7 +1886,8 @@ ] "TARGET_HAVE_MVE" "vpst\;vcmpt.%#\t, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcmpq_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -1783,7 +1903,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%q0, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -1800,7 +1921,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.s%#\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -1819,7 +1941,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -1838,7 +1961,9 @@ ] "TARGET_HAVE_MVE" ".%#\t%0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "mve_safe_imp_xlane_pred" "yes") + (set_attr "type" "mve_move") ]) ;; @@ -1857,7 +1982,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -1878,7 +2004,8 @@ ] "TARGET_HAVE_MVE" ".%#\t%q0, %q2, %3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") ]) ;; @@ -1894,7 +2021,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -1910,7 +2038,8 @@ ] "TARGET_HAVE_MVE" "\t%q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") ]) ;; @@ -1933,7 +2062,8 @@ ] "TARGET_HAVE_MVE" ".s%#\t%q0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") ]) ;; @@ -1950,7 +2080,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%q0, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -1967,7 +2098,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%q0, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_r_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -1983,7 +2115,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -1999,7 +2132,8 @@ ] "TARGET_HAVE_MVE" ".%#\t%q0, %q2, %3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") ]) ;; @@ -2015,7 +2149,8 @@ ] "TARGET_HAVE_MVE" ".%#\t%q0, %q2, %3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") ]) ;; @@ -2038,7 +2173,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;t.f%#\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_f")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2054,7 +2190,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.32\t%Q0, %R0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_v4si")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; ;; [vcmlaq, vcmlaq_rot90, vcmlaq_rot180, vcmlaq_rot270]) @@ -2072,7 +2209,9 @@ "@ vcmul.f%# %q0, %q2, %q3, # vcmla.f%# %q0, %q2, %q3, #" - [(set_attr "type" "mve_move") + [(set_attr_alternative "mve_unpredicated_insn" [(symbol_ref "CODE_FOR_mve_q_f") + (symbol_ref "CODE_FOR_mve_q_f")]) + (set_attr "type" "mve_move") ]) ;; @@ -2093,7 +2232,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;vcmpt.f%#\t, %q1, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcmpq_n_f")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2109,7 +2249,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;vcvtbt.f16.f32\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvtbq_f16_f32v8hf")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2125,7 +2266,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;vcvtbt.f32.f16\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvtbq_f32_f16v4sf")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2141,7 +2283,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;vcvttt.f16.f32\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvttq_f16_f32v8hf")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2157,8 +2300,9 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;vcvttt.f32.f16\t%q0, %q2" - [(set_attr "type" "mve_move") - (set_attr "length""8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvttq_f32_f16v4sf")) + (set_attr "type" "mve_move") + (set_attr "length""8")]) ;; ;; [vdupq_m_n_f]) @@ -2173,7 +2317,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;t.%#\t%q0, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_f")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2190,7 +2335,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" ".f%#\t%q0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_f")) + (set_attr "type" "mve_move") ]) ;; @@ -2207,7 +2353,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" ".f%#\t%q0, %q2, %3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_f")) + (set_attr "type" "mve_move") ]) ;; @@ -2224,7 +2371,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;t.f%#\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_f")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2243,7 +2391,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;t.f%#\t%0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_f")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2262,7 +2411,9 @@ ] "TARGET_HAVE_MVE" ".%#\t%Q0, %R0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "mve_safe_imp_xlane_pred" "yes") + (set_attr "type" "mve_move") ]) ;; @@ -2281,7 +2432,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%Q0, %R0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2298,7 +2450,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2319,7 +2472,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2335,7 +2489,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.i%#\t%q0, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2352,7 +2507,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.i%#\t%q0, %2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2368,7 +2524,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "\t%q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_f")) + (set_attr "type" "mve_move") ]) ;; @@ -2384,7 +2541,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;t.\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_f")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2400,7 +2558,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2416,7 +2575,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;t.%#\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_f")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2435,7 +2595,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.32\t%Q0, %R0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_v4si")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2451,7 +2612,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;vcvtmt.%#.f%#\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvtmq_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2467,7 +2629,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;vcvtpt.%#.f%#\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvtpq_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2483,7 +2646,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;vcvtnt.%#.f%#\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvtnq_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2500,7 +2664,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;vcvtt.%#.f%#\t%q0, %q2, %3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvtq_n_from_f_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2516,7 +2681,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.\t%q0, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2532,8 +2698,9 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;vcvtt.%#.f%#\t%q0, %q2" - [(set_attr "type" "mve_move") - (set_attr "length""8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvtq_from_f_")) + (set_attr "type" "mve_move") + (set_attr "length""8")]) ;; ;; [vabavq_p_s, vabavq_p_u]) @@ -2549,7 +2716,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") (set_attr "length" "8")]) ;; @@ -2566,8 +2734,9 @@ ] "TARGET_HAVE_MVE" "vpst\n\tt.%#\t%q0, %q2, %3" - [(set_attr "type" "mve_move") - (set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") + (set_attr "length" "8")]) ;; ;; [vsriq_m_n_s, vsriq_m_n_u]) @@ -2583,8 +2752,9 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%q0, %q2, %3" - [(set_attr "type" "mve_move") - (set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") + (set_attr "length" "8")]) ;; ;; [vcvtq_m_n_to_f_u, vcvtq_m_n_to_f_s]) @@ -2600,7 +2770,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;vcvtt.f%#.%#\t%q0, %q2, %3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vcvtq_n_to_f_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2640,7 +2811,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%q0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2659,8 +2831,9 @@ ] "TARGET_HAVE_MVE" "vpst\;t.i%# %q0, %q2, %3" - [(set_attr "type" "mve_move") - (set_attr "length""8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") + (set_attr "length""8")]) ;; ;; [vaddq_m_u, vaddq_m_s] @@ -2678,7 +2851,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.i%#\t%q0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2698,7 +2872,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t\t%q0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2715,8 +2890,9 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%q0, %q2, %3" - [(set_attr "type" "mve_move") - (set_attr "length""8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") + (set_attr "length""8")]) ;; ;; [vcaddq_rot90_m_u, vcaddq_rot90_m_s] @@ -2735,7 +2911,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%q0, %q2, %q3, #" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2763,7 +2940,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%q0, %q2, %3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2784,7 +2962,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2802,7 +2981,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%q0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_int_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2819,7 +2999,8 @@ ] "TARGET_HAVE_MVE" "vpst\;vornt\t%q0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vornq_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2837,7 +3018,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%q0, %q2, %3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2855,7 +3037,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%q0, %q2, %3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2872,7 +3055,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%q0, %q2, %3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2892,7 +3076,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%Q0, %R0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2920,7 +3105,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%q0, %q2, %3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2940,7 +3126,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.32\t%Q0, %R0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_v4si")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2958,7 +3145,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%q0, %q2, %3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2976,7 +3164,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.%#\t%q0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_poly_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -2994,7 +3183,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.s%#\t%q0, %q2, %3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -3012,7 +3202,8 @@ ] "TARGET_HAVE_MVE" "vpst\;t.s%#\t%q0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -3036,7 +3227,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;t.f%# %q0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_f")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -3057,7 +3249,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;t.f%#\t%q0, %q2, %3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_f")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -3077,7 +3270,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;t\t%q0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_f")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -3094,7 +3288,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;t.%#\t%q0, %q2, %3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_n_f")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -3116,7 +3311,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;t.f%#\t%q0, %q2, %q3, #" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_f")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -3136,7 +3332,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;t.f%#\t%q0, %q2, %q3, #" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_f")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -3153,7 +3350,8 @@ ] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;vornt\t%q0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vornq_f")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -3173,7 +3371,8 @@ output_asm_insn("vstrb.\t%q1, %E0",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrbq_")) + (set_attr "length" "4")]) ;; ;; [vstrbq_scatter_offset_s vstrbq_scatter_offset_u] @@ -3201,7 +3400,8 @@ VSTRBSOQ))] "TARGET_HAVE_MVE" "vstrb.\t%q2, [%0, %q1]" - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrbq_scatter_offset__insn")) + (set_attr "length" "4")]) ;; ;; [vstrwq_scatter_base_s vstrwq_scatter_base_u] @@ -3223,7 +3423,8 @@ output_asm_insn("vstrw.u32\t%q2, [%q0, %1]",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrwq_scatter_base_v4si")) + (set_attr "length" "4")]) ;; ;; [vldrbq_gather_offset_s vldrbq_gather_offset_u] @@ -3246,7 +3447,8 @@ output_asm_insn ("vldrb.\t%q0, [%m1, %q2]",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrbq_gather_offset_")) + (set_attr "length" "4")]) ;; ;; [vldrbq_s vldrbq_u] @@ -3268,7 +3470,8 @@ output_asm_insn ("vldrb.\t%q0, %E1",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrbq_")) + (set_attr "length" "4")]) ;; ;; [vldrwq_gather_base_s vldrwq_gather_base_u] @@ -3288,7 +3491,8 @@ output_asm_insn ("vldrw.u32\t%q0, [%q1, %2]",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrwq_gather_base_v4si")) + (set_attr "length" "4")]) ;; ;; [vstrbq_scatter_offset_p_s vstrbq_scatter_offset_p_u] @@ -3320,7 +3524,8 @@ VSTRBSOQ))] "TARGET_HAVE_MVE" "vpst\;vstrbt.\t%q2, [%0, %q1]" - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrbq_scatter_offset__insn")) + (set_attr "length" "8")]) ;; ;; [vstrwq_scatter_base_p_s vstrwq_scatter_base_p_u] @@ -3343,7 +3548,8 @@ output_asm_insn ("vpst\n\tvstrwt.u32\t%q2, [%q0, %1]",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrwq_scatter_base_v4si")) + (set_attr "length" "8")]) (define_insn "mve_vstrbq_p_" [(set (match_operand: 0 "mve_memory_operand" "=Ux") @@ -3361,7 +3567,8 @@ output_asm_insn ("vpst\;vstrbt.\t%q1, %E0",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrbq_")) + (set_attr "length" "8")]) ;; ;; [vldrbq_gather_offset_z_s vldrbq_gather_offset_z_u] @@ -3386,7 +3593,8 @@ output_asm_insn ("vpst\n\tvldrbt.\t%q0, [%m1, %q2]",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrbq_gather_offset_")) + (set_attr "length" "8")]) ;; ;; [vldrbq_z_s vldrbq_z_u] @@ -3409,7 +3617,8 @@ output_asm_insn ("vpst\;vldrbt.\t%q0, %E1",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrbq_")) + (set_attr "length" "8")]) ;; ;; [vldrwq_gather_base_z_s vldrwq_gather_base_z_u] @@ -3430,7 +3639,8 @@ output_asm_insn ("vpst\n\tvldrwt.u32\t%q0, [%q1, %2]",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrwq_gather_base_v4si")) + (set_attr "length" "8")]) ;; ;; [vldrhq_f] @@ -3449,7 +3659,8 @@ output_asm_insn ("vldrh.16\t%q0, %E1",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrhq_fv8hf")) + (set_attr "length" "4")]) ;; ;; [vldrhq_gather_offset_s vldrhq_gather_offset_u] @@ -3472,7 +3683,8 @@ output_asm_insn ("vldrh.\t%q0, [%m1, %q2]",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrhq_gather_offset_")) + (set_attr "length" "4")]) ;; ;; [vldrhq_gather_offset_z_s vldrhq_gather_offset_z_u] @@ -3497,7 +3709,8 @@ output_asm_insn ("vpst\n\tvldrht.\t%q0, [%m1, %q2]",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrhq_gather_offset_")) + (set_attr "length" "8")]) ;; ;; [vldrhq_gather_shifted_offset_s vldrhq_gather_shifted_offset_u] @@ -3520,7 +3733,8 @@ output_asm_insn ("vldrh.\t%q0, [%m1, %q2, uxtw #1]",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrhq_gather_shifted_offset_")) + (set_attr "length" "4")]) ;; ;; [vldrhq_gather_shifted_offset_z_s vldrhq_gather_shited_offset_z_u] @@ -3545,7 +3759,8 @@ output_asm_insn ("vpst\n\tvldrht.\t%q0, [%m1, %q2, uxtw #1]",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrhq_gather_shifted_offset_")) + (set_attr "length" "8")]) ;; ;; [vldrhq_s, vldrhq_u] @@ -3567,7 +3782,8 @@ output_asm_insn ("vldrh.\t%q0, %E1",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrhq_")) + (set_attr "length" "4")]) ;; ;; [vldrhq_z_f] @@ -3587,7 +3803,8 @@ output_asm_insn ("vpst\;vldrht.16\t%q0, %E1",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrhq_fv8hf")) + (set_attr "length" "8")]) ;; ;; [vldrhq_z_s vldrhq_z_u] @@ -3610,7 +3827,8 @@ output_asm_insn ("vpst\;vldrht.\t%q0, %E1",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrhq_")) + (set_attr "length" "8")]) ;; ;; [vldrwq_f] @@ -3629,7 +3847,8 @@ output_asm_insn ("vldrw.32\t%q0, %E1",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrwq_fv4sf")) + (set_attr "length" "4")]) ;; ;; [vldrwq_s vldrwq_u] @@ -3648,7 +3867,8 @@ output_asm_insn ("vldrw.32\t%q0, %E1",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrwq_v4si")) + (set_attr "length" "4")]) ;; ;; [vldrwq_z_f] @@ -3668,7 +3888,8 @@ output_asm_insn ("vpst\;vldrwt.32\t%q0, %E1",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrwq_fv4sf")) + (set_attr "length" "8")]) ;; ;; [vldrwq_z_s vldrwq_z_u] @@ -3688,7 +3909,8 @@ output_asm_insn ("vpst\;vldrwt.32\t%q0, %E1",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrwq_v4si")) + (set_attr "length" "8")]) (define_expand "@mve_vld1q_f" [(match_operand:MVE_0 0 "s_register_operand") @@ -3728,7 +3950,8 @@ output_asm_insn ("vldrd.64\t%q0, [%q1, %2]",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrdq_gather_base_v2di")) + (set_attr "length" "4")]) ;; ;; [vldrdq_gather_base_z_s vldrdq_gather_base_z_u] @@ -3749,7 +3972,8 @@ output_asm_insn ("vpst\n\tvldrdt.u64\t%q0, [%q1, %2]",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrdq_gather_base_v2di")) + (set_attr "length" "8")]) ;; ;; [vldrdq_gather_offset_s vldrdq_gather_offset_u] @@ -3769,7 +3993,8 @@ output_asm_insn ("vldrd.u64\t%q0, [%m1, %q2]",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrdq_gather_offset_v2di")) + (set_attr "length" "4")]) ;; ;; [vldrdq_gather_offset_z_s vldrdq_gather_offset_z_u] @@ -3790,7 +4015,8 @@ output_asm_insn ("vpst\n\tvldrdt.u64\t%q0, [%m1, %q2]",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrdq_gather_offset_v2di")) + (set_attr "length" "8")]) ;; ;; [vldrdq_gather_shifted_offset_s vldrdq_gather_shifted_offset_u] @@ -3810,7 +4036,8 @@ output_asm_insn ("vldrd.u64\t%q0, [%m1, %q2, uxtw #3]",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrdq_gather_shifted_offset_v2di")) + (set_attr "length" "4")]) ;; ;; [vldrdq_gather_shifted_offset_z_s vldrdq_gather_shifted_offset_z_u] @@ -3831,7 +4058,8 @@ output_asm_insn ("vpst\n\tvldrdt.u64\t%q0, [%m1, %q2, uxtw #3]",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrdq_gather_shifted_offset_v2di")) + (set_attr "length" "8")]) ;; ;; [vldrhq_gather_offset_f] @@ -3851,7 +4079,8 @@ output_asm_insn ("vldrh.f16\t%q0, [%m1, %q2]",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrhq_gather_offset_fv8hf")) + (set_attr "length" "4")]) ;; ;; [vldrhq_gather_offset_z_f] @@ -3873,7 +4102,8 @@ output_asm_insn ("vpst\n\tvldrht.f16\t%q0, [%m1, %q2]",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrhq_gather_offset_fv8hf")) + (set_attr "length" "8")]) ;; ;; [vldrhq_gather_shifted_offset_f] @@ -3893,7 +4123,8 @@ output_asm_insn ("vldrh.f16\t%q0, [%m1, %q2, uxtw #1]",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrhq_gather_shifted_offset_fv8hf")) + (set_attr "length" "4")]) ;; ;; [vldrhq_gather_shifted_offset_z_f] @@ -3915,7 +4146,8 @@ output_asm_insn ("vpst\n\tvldrht.f16\t%q0, [%m1, %q2, uxtw #1]",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrhq_gather_shifted_offset_fv8hf")) + (set_attr "length" "8")]) ;; ;; [vldrwq_gather_base_f] @@ -3935,7 +4167,8 @@ output_asm_insn ("vldrw.u32\t%q0, [%q1, %2]",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrwq_gather_base_fv4sf")) + (set_attr "length" "4")]) ;; ;; [vldrwq_gather_base_z_f] @@ -3956,7 +4189,8 @@ output_asm_insn ("vpst\n\tvldrwt.u32\t%q0, [%q1, %2]",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrwq_gather_base_fv4sf")) + (set_attr "length" "8")]) ;; ;; [vldrwq_gather_offset_f] @@ -3976,7 +4210,8 @@ output_asm_insn ("vldrw.u32\t%q0, [%m1, %q2]",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrwq_gather_offset_fv4sf")) + (set_attr "length" "4")]) ;; ;; [vldrwq_gather_offset_s vldrwq_gather_offset_u] @@ -3996,7 +4231,8 @@ output_asm_insn ("vldrw.u32\t%q0, [%m1, %q2]",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrwq_gather_offset_v4si")) + (set_attr "length" "4")]) ;; ;; [vldrwq_gather_offset_z_f] @@ -4018,7 +4254,8 @@ output_asm_insn ("vpst\n\tvldrwt.u32\t%q0, [%m1, %q2]",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrwq_gather_offset_fv4sf")) + (set_attr "length" "8")]) ;; ;; [vldrwq_gather_offset_z_s vldrwq_gather_offset_z_u] @@ -4040,7 +4277,8 @@ output_asm_insn ("vpst\n\tvldrwt.u32\t%q0, [%m1, %q2]",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrwq_gather_offset_v4si")) + (set_attr "length" "8")]) ;; ;; [vldrwq_gather_shifted_offset_f] @@ -4060,7 +4298,8 @@ output_asm_insn ("vldrw.u32\t%q0, [%m1, %q2, uxtw #2]",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrwq_gather_shifted_offset_fv4sf")) + (set_attr "length" "4")]) ;; ;; [vldrwq_gather_shifted_offset_s vldrwq_gather_shifted_offset_u] @@ -4080,7 +4319,8 @@ output_asm_insn ("vldrw.u32\t%q0, [%m1, %q2, uxtw #2]",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrwq_gather_shifted_offset_v4si")) + (set_attr "length" "4")]) ;; ;; [vldrwq_gather_shifted_offset_z_f] @@ -4102,7 +4342,8 @@ output_asm_insn ("vpst\n\tvldrwt.u32\t%q0, [%m1, %q2, uxtw #2]",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrwq_gather_shifted_offset_fv4sf")) + (set_attr "length" "8")]) ;; ;; [vldrwq_gather_shifted_offset_z_s vldrwq_gather_shifted_offset_z_u] @@ -4124,7 +4365,8 @@ output_asm_insn ("vpst\n\tvldrwt.u32\t%q0, [%m1, %q2, uxtw #2]",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrwq_gather_shifted_offset_v4si")) + (set_attr "length" "8")]) ;; ;; [vstrhq_f] @@ -4143,7 +4385,8 @@ output_asm_insn ("vstrh.16\t%q1, %E0",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrhq_fv8hf")) + (set_attr "length" "4")]) ;; ;; [vstrhq_p_f] @@ -4164,7 +4407,8 @@ output_asm_insn ("vpst\;vstrht.16\t%q1, %E0",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrhq_fv8hf")) + (set_attr "length" "8")]) ;; ;; [vstrhq_p_s vstrhq_p_u] @@ -4186,7 +4430,8 @@ output_asm_insn ("vpst\;vstrht.\t%q1, %E0",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrhq_")) + (set_attr "length" "8")]) ;; ;; [vstrhq_scatter_offset_p_s vstrhq_scatter_offset_p_u] @@ -4218,7 +4463,8 @@ VSTRHSOQ))] "TARGET_HAVE_MVE" "vpst\;vstrht.\t%q2, [%0, %q1]" - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrhq_scatter_offset__insn")) + (set_attr "length" "8")]) ;; ;; [vstrhq_scatter_offset_s vstrhq_scatter_offset_u] @@ -4246,7 +4492,8 @@ VSTRHSOQ))] "TARGET_HAVE_MVE" "vstrh.\t%q2, [%0, %q1]" - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrhq_scatter_offset__insn")) + (set_attr "length" "4")]) ;; ;; [vstrhq_scatter_shifted_offset_p_s vstrhq_scatter_shifted_offset_p_u] @@ -4278,7 +4525,8 @@ VSTRHSSOQ))] "TARGET_HAVE_MVE" "vpst\;vstrht.\t%q2, [%0, %q1, uxtw #1]" - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrhq_scatter_shifted_offset__insn")) + (set_attr "length" "8")]) ;; ;; [vstrhq_scatter_shifted_offset_s vstrhq_scatter_shifted_offset_u] @@ -4307,7 +4555,8 @@ VSTRHSSOQ))] "TARGET_HAVE_MVE" "vstrh.\t%q2, [%0, %q1, uxtw #1]" - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrhq_scatter_shifted_offset__insn")) + (set_attr "length" "4")]) ;; ;; [vstrhq_s, vstrhq_u] @@ -4326,7 +4575,8 @@ output_asm_insn ("vstrh.\t%q1, %E0",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrhq_")) + (set_attr "length" "4")]) ;; ;; [vstrwq_f] @@ -4345,7 +4595,8 @@ output_asm_insn ("vstrw.32\t%q1, %E0",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrwq_fv4sf")) + (set_attr "length" "4")]) ;; ;; [vstrwq_p_f] @@ -4354,7 +4605,7 @@ [(set (match_operand:V4SI 0 "mve_memory_operand" "=Ux") (unspec:V4SI [(match_operand:V4SF 1 "s_register_operand" "w") - (match_operand: 2 "vpr_register_operand" "Up") + (match_operand:V4BI 2 "vpr_register_operand" "Up") (match_dup 0)] VSTRWQ_F))] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" @@ -4366,7 +4617,8 @@ output_asm_insn ("vpst\;vstrwt.32\t%q1, %E0",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrwq_fv4sf")) + (set_attr "length" "8")]) ;; ;; [vstrwq_p_s vstrwq_p_u] @@ -4387,7 +4639,8 @@ output_asm_insn ("vpst\;vstrwt.32\t%q1, %E0",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrwq_v4si")) + (set_attr "length" "8")]) ;; ;; [vstrwq_s vstrwq_u] @@ -4406,7 +4659,8 @@ output_asm_insn ("vstrw.32\t%q1, %E0",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrwq_v4si")) + (set_attr "length" "4")]) (define_expand "@mve_vst1q_f" [(match_operand: 0 "mve_memory_operand") @@ -4449,7 +4703,8 @@ output_asm_insn ("vpst\;\tvstrdt.u64\t%q2, [%q0, %1]",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrdq_scatter_base_v2di")) + (set_attr "length" "8")]) ;; ;; [vstrdq_scatter_base_s vstrdq_scatter_base_u] @@ -4471,7 +4726,8 @@ output_asm_insn ("vstrd.u64\t%q2, [%q0, %1]",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrdq_scatter_base_v2di")) + (set_attr "length" "4")]) ;; ;; [vstrdq_scatter_offset_p_s vstrdq_scatter_offset_p_u] @@ -4502,7 +4758,8 @@ VSTRDSOQ))] "TARGET_HAVE_MVE" "vpst\;vstrdt.64\t%q2, [%0, %q1]" - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrdq_scatter_offset_v2di_insn")) + (set_attr "length" "8")]) ;; ;; [vstrdq_scatter_offset_s vstrdq_scatter_offset_u] @@ -4530,7 +4787,8 @@ VSTRDSOQ))] "TARGET_HAVE_MVE" "vstrd.64\t%q2, [%0, %q1]" - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrdq_scatter_offset_v2di_insn")) + (set_attr "length" "4")]) ;; ;; [vstrdq_scatter_shifted_offset_p_s vstrdq_scatter_shifted_offset_p_u] @@ -4562,7 +4820,8 @@ VSTRDSSOQ))] "TARGET_HAVE_MVE" "vpst\;vstrdt.64\t%q2, [%0, %q1, uxtw #3]" - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrdq_scatter_shifted_offset_v2di_insn")) + (set_attr "length" "8")]) ;; ;; [vstrdq_scatter_shifted_offset_s vstrdq_scatter_shifted_offset_u] @@ -4591,7 +4850,8 @@ VSTRDSSOQ))] "TARGET_HAVE_MVE" "vstrd.64\t%q2, [%0, %q1, uxtw #3]" - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrdq_scatter_shifted_offset_v2di_insn")) + (set_attr "length" "4")]) ;; ;; [vstrhq_scatter_offset_f] @@ -4619,7 +4879,8 @@ VSTRHQSO_F))] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vstrh.16\t%q2, [%0, %q1]" - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrhq_scatter_offset_fv8hf_insn")) + (set_attr "length" "4")]) ;; ;; [vstrhq_scatter_offset_p_f] @@ -4650,7 +4911,8 @@ VSTRHQSO_F))] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;vstrht.16\t%q2, [%0, %q1]" - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrhq_scatter_offset_fv8hf_insn")) + (set_attr "length" "8")]) ;; ;; [vstrhq_scatter_shifted_offset_f] @@ -4678,7 +4940,8 @@ VSTRHQSSO_F))] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vstrh.16\t%q2, [%0, %q1, uxtw #1]" - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrhq_scatter_shifted_offset_fv8hf_insn")) + (set_attr "length" "4")]) ;; ;; [vstrhq_scatter_shifted_offset_p_f] @@ -4710,7 +4973,8 @@ VSTRHQSSO_F))] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;vstrht.16\t%q2, [%0, %q1, uxtw #1]" - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrhq_scatter_shifted_offset_fv8hf_insn")) + (set_attr "length" "8")]) ;; ;; [vstrwq_scatter_base_f] @@ -4732,7 +4996,8 @@ output_asm_insn ("vstrw.u32\t%q2, [%q0, %1]",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrwq_scatter_base_fv4sf")) + (set_attr "length" "4")]) ;; ;; [vstrwq_scatter_base_p_f] @@ -4755,7 +5020,8 @@ output_asm_insn ("vpst\n\tvstrwt.u32\t%q2, [%q0, %1]",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrwq_scatter_base_fv4sf")) + (set_attr "length" "8")]) ;; ;; [vstrwq_scatter_offset_f] @@ -4783,7 +5049,8 @@ VSTRWQSO_F))] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vstrw.32\t%q2, [%0, %q1]" - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrwq_scatter_offset_fv4sf_insn")) + (set_attr "length" "4")]) ;; ;; [vstrwq_scatter_offset_p_f] @@ -4814,7 +5081,8 @@ VSTRWQSO_F))] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;vstrwt.32\t%q2, [%0, %q1]" - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrwq_scatter_offset_fv4sf_insn")) + (set_attr "length" "8")]) ;; ;; [vstrwq_scatter_offset_s vstrwq_scatter_offset_u] @@ -4845,7 +5113,8 @@ VSTRWSOQ))] "TARGET_HAVE_MVE" "vpst\;vstrwt.32\t%q2, [%0, %q1]" - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrwq_scatter_offset_v4si_insn")) + (set_attr "length" "8")]) ;; ;; [vstrwq_scatter_offset_s vstrwq_scatter_offset_u] @@ -4873,7 +5142,8 @@ VSTRWSOQ))] "TARGET_HAVE_MVE" "vstrw.32\t%q2, [%0, %q1]" - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrwq_scatter_offset_v4si_insn")) + (set_attr "length" "4")]) ;; ;; [vstrwq_scatter_shifted_offset_f] @@ -4901,7 +5171,8 @@ VSTRWQSSO_F))] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vstrw.32\t%q2, [%0, %q1, uxtw #2]" - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrwq_scatter_shifted_offset_fv4sf_insn")) + (set_attr "length" "8")]) ;; ;; [vstrwq_scatter_shifted_offset_p_f] @@ -4933,7 +5204,8 @@ VSTRWQSSO_F))] "TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT" "vpst\;vstrwt.32\t%q2, [%0, %q1, uxtw #2]" - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrwq_scatter_shifted_offset_fv4sf_insn")) + (set_attr "length" "8")]) ;; ;; [vstrwq_scatter_shifted_offset_p_s vstrwq_scatter_shifted_offset_p_u] @@ -4965,7 +5237,8 @@ VSTRWSSOQ))] "TARGET_HAVE_MVE" "vpst\;vstrwt.32\t%q2, [%0, %q1, uxtw #2]" - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrwq_scatter_shifted_offset_v4si_insn")) + (set_attr "length" "8")]) ;; ;; [vstrwq_scatter_shifted_offset_s vstrwq_scatter_shifted_offset_u] @@ -4994,7 +5267,8 @@ VSTRWSSOQ))] "TARGET_HAVE_MVE" "vstrw.32\t%q2, [%0, %q1, uxtw #2]" - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrwq_scatter_shifted_offset_v4si_insn")) + (set_attr "length" "4")]) ;; ;; [vidupq_n_u]) @@ -5062,7 +5336,8 @@ (match_operand:SI 6 "immediate_operand" "i")))] "TARGET_HAVE_MVE" "vpst\;\tvidupt.u%#\t%q0, %2, %4" - [(set_attr "length""8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vidupq_u_insn")) + (set_attr "length""8")]) ;; ;; [vddupq_n_u]) @@ -5130,7 +5405,8 @@ (match_operand:SI 6 "immediate_operand" "i")))] "TARGET_HAVE_MVE" "vpst\;vddupt.u%#\t%q0, %2, %4" - [(set_attr "length""8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vddupq_u_insn")) + (set_attr "length""8")]) ;; ;; [vdwdupq_n_u]) @@ -5246,8 +5522,9 @@ ] "TARGET_HAVE_MVE" "vpst\;vdwdupt.u%#\t%q2, %3, %R4, %5" - [(set_attr "type" "mve_move") - (set_attr "length""8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vdwdupq_wb_u_insn")) + (set_attr "type" "mve_move") + (set_attr "length""8")]) ;; ;; [viwdupq_n_u]) @@ -5363,7 +5640,8 @@ ] "TARGET_HAVE_MVE" "vpst\;\tviwdupt.u%#\t%q2, %3, %R4, %5" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_viwdupq_wb_u_insn")) + (set_attr "type" "mve_move") (set_attr "length""8")]) ;; @@ -5389,7 +5667,8 @@ output_asm_insn ("vstrw.u32\t%q2, [%q0, %1]!",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrwq_scatter_base_wb_v4si")) + (set_attr "length" "4")]) ;; ;; [vstrwq_scatter_base_wb_p_s vstrwq_scatter_base_wb_p_u] @@ -5415,7 +5694,8 @@ output_asm_insn ("vpst\;\tvstrwt.u32\t%q2, [%q0, %1]!",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrwq_scatter_base_wb_v4si")) + (set_attr "length" "8")]) ;; ;; [vstrwq_scatter_base_wb_f] @@ -5440,7 +5720,8 @@ output_asm_insn ("vstrw.u32\t%q2, [%q0, %1]!",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrwq_scatter_base_wb_fv4sf")) + (set_attr "length" "4")]) ;; ;; [vstrwq_scatter_base_wb_p_f] @@ -5466,7 +5747,8 @@ output_asm_insn ("vpst\;vstrwt.u32\t%q2, [%q0, %1]!",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrwq_scatter_base_wb_fv4sf")) + (set_attr "length" "8")]) ;; ;; [vstrdq_scatter_base_wb_s vstrdq_scatter_base_wb_u] @@ -5491,7 +5773,8 @@ output_asm_insn ("vstrd.u64\t%q2, [%q0, %1]!",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrdq_scatter_base_wb_v2di")) + (set_attr "length" "4")]) ;; ;; [vstrdq_scatter_base_wb_p_s vstrdq_scatter_base_wb_p_u] @@ -5517,7 +5800,8 @@ output_asm_insn ("vpst\;vstrdt.u64\t%q2, [%q0, %1]!",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vstrdq_scatter_base_wb_v2di")) + (set_attr "length" "8")]) (define_expand "mve_vldrwq_gather_base_wb_v4si" [(match_operand:V4SI 0 "s_register_operand") @@ -5569,7 +5853,8 @@ output_asm_insn ("vldrw.u32\t%q0, [%q1, %2]!",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrwq_gather_base_wb_v4si_insn")) + (set_attr "length" "4")]) (define_expand "mve_vldrwq_gather_base_wb_z_v4si" [(match_operand:V4SI 0 "s_register_operand") @@ -5625,7 +5910,8 @@ output_asm_insn ("vpst\;vldrwt.u32\t%q0, [%q1, %2]!",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrwq_gather_base_wb_v4si_insn")) + (set_attr "length" "8")]) (define_expand "mve_vldrwq_gather_base_wb_fv4sf" [(match_operand:V4SI 0 "s_register_operand") @@ -5677,7 +5963,8 @@ output_asm_insn ("vldrw.u32\t%q0, [%q1, %2]!",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrwq_gather_base_wb_fv4sf_insn")) + (set_attr "length" "4")]) (define_expand "mve_vldrwq_gather_base_wb_z_fv4sf" [(match_operand:V4SI 0 "s_register_operand") @@ -5734,7 +6021,8 @@ output_asm_insn ("vpst\;vldrwt.u32\t%q0, [%q1, %2]!",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrwq_gather_base_wb_fv4sf_insn")) + (set_attr "length" "8")]) (define_expand "mve_vldrdq_gather_base_wb_v2di" [(match_operand:V2DI 0 "s_register_operand") @@ -5787,7 +6075,8 @@ output_asm_insn ("vldrd.64\t%q0, [%q1, %2]!",ops); return ""; } - [(set_attr "length" "4")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrdq_gather_base_wb_v2di_insn")) + (set_attr "length" "4")]) (define_expand "mve_vldrdq_gather_base_wb_z_v2di" [(match_operand:V2DI 0 "s_register_operand") @@ -5826,7 +6115,7 @@ (unspec_volatile:SI [(reg:SI VFPCC_REGNUM)] UNSPEC_GET_FPSCR_NZCVQC))] "TARGET_HAVE_MVE" "vmrs\\t%0, FPSCR_nzcvqc" - [(set_attr "type" "mve_move")]) + [(set_attr "type" "mve_move")]) (define_insn "set_fpscr_nzcvqc" [(set (reg:SI VFPCC_REGNUM) @@ -5834,7 +6123,7 @@ VUNSPEC_SET_FPSCR_NZCVQC))] "TARGET_HAVE_MVE" "vmsr\\tFPSCR_nzcvqc, %0" - [(set_attr "type" "mve_move")]) + [(set_attr "type" "mve_move")]) ;; ;; [vldrdq_gather_base_wb_z_s vldrdq_gather_base_wb_z_u] @@ -5859,7 +6148,8 @@ output_asm_insn ("vpst\;vldrdt.u64\t%q0, [%q1, %2]!",ops); return ""; } - [(set_attr "length" "8")]) + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vldrdq_gather_base_wb_v2di_insn")) + (set_attr "length" "8")]) ;; ;; [vadciq_m_s, vadciq_m_u]) ;; @@ -5876,7 +6166,8 @@ ] "TARGET_HAVE_MVE" "vpst\;vadcit.i32\t%q0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vadciq_v4si")) + (set_attr "type" "mve_move") (set_attr "length" "8")]) ;; @@ -5893,7 +6184,8 @@ ] "TARGET_HAVE_MVE" "vadci.i32\t%q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vadciq_v4si")) + (set_attr "type" "mve_move") (set_attr "length" "4")]) ;; @@ -5912,7 +6204,8 @@ ] "TARGET_HAVE_MVE" "vpst\;vadct.i32\t%q0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vadcq_v4si")) + (set_attr "type" "mve_move") (set_attr "length" "8")]) ;; @@ -5929,7 +6222,8 @@ ] "TARGET_HAVE_MVE" "vadc.i32\t%q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vadcq_v4si")) + (set_attr "type" "mve_move") (set_attr "length" "4") (set_attr "conds" "set")]) @@ -5949,7 +6243,8 @@ ] "TARGET_HAVE_MVE" "vpst\;vsbcit.i32\t%q0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vsbciq_v4si")) + (set_attr "type" "mve_move") (set_attr "length" "8")]) ;; @@ -5966,7 +6261,8 @@ ] "TARGET_HAVE_MVE" "vsbci.i32\t%q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vsbciq_v4si")) + (set_attr "type" "mve_move") (set_attr "length" "4")]) ;; @@ -5985,7 +6281,8 @@ ] "TARGET_HAVE_MVE" "vpst\;vsbct.i32\t%q0, %q2, %q3" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vsbcq_v4si")) + (set_attr "type" "mve_move") (set_attr "length" "8")]) ;; @@ -6002,7 +6299,8 @@ ] "TARGET_HAVE_MVE" "vsbc.i32\t%q0, %q1, %q2" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vsbcq_v4si")) + (set_attr "type" "mve_move") (set_attr "length" "4")]) ;; @@ -6031,7 +6329,7 @@ "vst21.\t{%q0, %q1}, %3", ops); return ""; } - [(set_attr "length" "8")]) + [(set_attr "length" "8")]) ;; ;; [vld2q]) @@ -6059,7 +6357,7 @@ "vld21.\t{%q0, %q1}, %3", ops); return ""; } - [(set_attr "length" "8")]) + [(set_attr "length" "8")]) ;; ;; [vld4q]) @@ -6402,7 +6700,8 @@ ] "TARGET_HAVE_MVE" "vpst\;vshlct\t%q0, %1, %4" - [(set_attr "type" "mve_move") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_vshlcq_")) + (set_attr "type" "mve_move") (set_attr "length" "8")]) ;; CDE instructions on MVE registers. @@ -6414,7 +6713,8 @@ UNSPEC_VCDE))] "TARGET_CDE && TARGET_HAVE_MVE" "vcx1\\tp%c1, %q0, #%c2" - [(set_attr "type" "coproc")] + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_arm_vcx1qv16qi")) + (set_attr "type" "coproc")] ) (define_insn "arm_vcx1qav16qi" @@ -6425,7 +6725,8 @@ UNSPEC_VCDEA))] "TARGET_CDE && TARGET_HAVE_MVE" "vcx1a\\tp%c1, %q0, #%c3" - [(set_attr "type" "coproc")] + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_arm_vcx1qav16qi")) + (set_attr "type" "coproc")] ) (define_insn "arm_vcx2qv16qi" @@ -6436,7 +6737,8 @@ UNSPEC_VCDE))] "TARGET_CDE && TARGET_HAVE_MVE" "vcx2\\tp%c1, %q0, %q2, #%c3" - [(set_attr "type" "coproc")] + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_arm_vcx2qv16qi")) + (set_attr "type" "coproc")] ) (define_insn "arm_vcx2qav16qi" @@ -6448,7 +6750,8 @@ UNSPEC_VCDEA))] "TARGET_CDE && TARGET_HAVE_MVE" "vcx2a\\tp%c1, %q0, %q3, #%c4" - [(set_attr "type" "coproc")] + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_arm_vcx2qav16qi")) + (set_attr "type" "coproc")] ) (define_insn "arm_vcx3qv16qi" @@ -6460,7 +6763,8 @@ UNSPEC_VCDE))] "TARGET_CDE && TARGET_HAVE_MVE" "vcx3\\tp%c1, %q0, %q2, %q3, #%c4" - [(set_attr "type" "coproc")] + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_arm_vcx3qv16qi")) + (set_attr "type" "coproc")] ) (define_insn "arm_vcx3qav16qi" @@ -6473,7 +6777,8 @@ UNSPEC_VCDEA))] "TARGET_CDE && TARGET_HAVE_MVE" "vcx3a\\tp%c1, %q0, %q3, %q4, #%c5" - [(set_attr "type" "coproc")] + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_arm_vcx3qav16qi")) + (set_attr "type" "coproc")] ) (define_insn "arm_vcx1q_p_v16qi" @@ -6485,7 +6790,8 @@ CDE_VCX))] "TARGET_CDE && TARGET_HAVE_MVE" "vpst\;vcx1t\\tp%c1, %q0, #%c3" - [(set_attr "type" "coproc") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_arm_vcx1qv16qi")) + (set_attr "type" "coproc") (set_attr "length" "8")] ) @@ -6499,7 +6805,8 @@ CDE_VCX))] "TARGET_CDE && TARGET_HAVE_MVE" "vpst\;vcx2t\\tp%c1, %q0, %q3, #%c4" - [(set_attr "type" "coproc") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_arm_vcx2qv16qi")) + (set_attr "type" "coproc") (set_attr "length" "8")] ) @@ -6514,11 +6821,12 @@ CDE_VCX))] "TARGET_CDE && TARGET_HAVE_MVE" "vpst\;vcx3t\\tp%c1, %q0, %q3, %q4, #%c5" - [(set_attr "type" "coproc") + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_arm_vcx3qv16qi")) + (set_attr "type" "coproc") (set_attr "length" "8")] ) -(define_insn "*movmisalign_mve_store" +(define_insn "movmisalign_mve_store" [(set (match_operand:MVE_VLD_ST 0 "mve_memory_operand" "=Ux") (unspec:MVE_VLD_ST [(match_operand:MVE_VLD_ST 1 "s_register_operand" " w")] UNSPEC_MISALIGNED_ACCESS))] @@ -6526,11 +6834,12 @@ || (TARGET_HAVE_MVE_FLOAT && VALID_MVE_SF_MODE (mode))) && !BYTES_BIG_ENDIAN && unaligned_access" "vstr.\t%q1, %E0" - [(set_attr "type" "mve_store")] + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_movmisalign_mve_store")) + (set_attr "type" "mve_store")] ) -(define_insn "*movmisalign_mve_load" +(define_insn "movmisalign_mve_load" [(set (match_operand:MVE_VLD_ST 0 "s_register_operand" "=w") (unspec:MVE_VLD_ST [(match_operand:MVE_VLD_ST 1 "mve_memory_operand" " Ux")] UNSPEC_MISALIGNED_ACCESS))] @@ -6538,7 +6847,8 @@ || (TARGET_HAVE_MVE_FLOAT && VALID_MVE_SF_MODE (mode))) && !BYTES_BIG_ENDIAN && unaligned_access" "vldr.\t%q0, %E1" - [(set_attr "type" "mve_load")] + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_movmisalign_mve_load")) + (set_attr "type" "mve_load")] ) ;; Expander for VxBI moves diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md index 17c90f436c6c..fa4a7aeda357 100644 --- a/gcc/config/arm/neon.md +++ b/gcc/config/arm/neon.md @@ -553,11 +553,11 @@ Enabled with -funsafe-math-optimizations -freciprocal-math and disabled for -Os since it increases code size . */ -(define_expand "div3" +(define_expand "div3" [(set (match_operand:VCVTF 0 "s_register_operand") (div:VCVTF (match_operand:VCVTF 1 "s_register_operand") (match_operand:VCVTF 2 "s_register_operand")))] - "TARGET_NEON && !optimize_size + "ARM_HAVE_NEON__ARITH && !optimize_size && flag_reciprocal_math" { rtx rec = gen_reg_rtx (mode); diff --git a/gcc/config/arm/thumb1.md b/gcc/config/arm/thumb1.md index 14d6df580afe..d7074b43f601 100644 --- a/gcc/config/arm/thumb1.md +++ b/gcc/config/arm/thumb1.md @@ -113,7 +113,7 @@ ;; Reloading and elimination of the frame pointer can ;; sometimes cause this optimization to be missed. (define_peephole2 - [(set (match_operand:SI 0 "arm_general_register_operand" "") + [(set (match_operand:SI 0 "low_register_operand" "") (match_operand:SI 1 "const_int_operand" "")) (set (match_dup 0) (plus:SI (match_dup 0) (reg:SI SP_REGNUM)))] diff --git a/gcc/config/arm/unspecs.md b/gcc/config/arm/unspecs.md index b9db306c0675..46ac8b371574 100644 --- a/gcc/config/arm/unspecs.md +++ b/gcc/config/arm/unspecs.md @@ -717,7 +717,6 @@ VCVTBQ_F16_F32 VCVTTQ_F16_F32 VMLALDAVQ_U - VMLALDAVXQ_U VMLALDAVXQ_S VMLALDAVQ_S VMLSLDAVQ_S @@ -934,7 +933,6 @@ VSHRNBQ_N_S VRSHRNBQ_N_S VRSHRNBQ_N_U - VMLALDAVXQ_P_U VMLALDAVXQ_P_S VQMOVNTQ_M_U VQMOVNTQ_M_S @@ -943,7 +941,6 @@ VQSHRNTQ_N_U VQSHRNTQ_N_S VMLALDAVAXQ_S - VMLALDAVAXQ_U VSHRNTQ_N_S VSHRNTQ_N_U VCVTBQ_M_F16_F32 diff --git a/gcc/config/arm/vec-common.md b/gcc/config/arm/vec-common.md index dac888535cb3..ff1c27a0d717 100644 --- a/gcc/config/arm/vec-common.md +++ b/gcc/config/arm/vec-common.md @@ -366,7 +366,8 @@ "@ .%#\t%0, %1, %2 * return neon_output_shift_immediate (\"vshl\", 'i', &operands[2], mode, VALID_NEON_QREG_MODE (mode), true);" - [(set_attr "type" "neon_shift_reg, neon_shift_imm")] + [(set (attr "mve_unpredicated_insn") (symbol_ref "CODE_FOR_mve_q_")) + (set_attr "type" "neon_shift_reg, neon_shift_imm")] ) (define_expand "vashl3" diff --git a/gcc/config/avr/avr-dimode.md b/gcc/config/avr/avr-dimode.md index 6fcabdaaf6ee..4b74e77e5e51 100644 --- a/gcc/config/avr/avr-dimode.md +++ b/gcc/config/avr/avr-dimode.md @@ -43,8 +43,8 @@ ;; so that no DImode insn contains pseudos or needs reloading. (define_constants - [(ACC_A 18) - (ACC_B 10)]) + [(ACC_A 18) + (ACC_B 10)]) ;; Supported modes that are 8 bytes wide (define_mode_iterator ALL8 [DI DQ UDQ DA UDA TA UTA]) diff --git a/gcc/config/avr/avr-passes.def b/gcc/config/avr/avr-passes.def index 34e5b95f9209..748260edaef6 100644 --- a/gcc/config/avr/avr-passes.def +++ b/gcc/config/avr/avr-passes.def @@ -17,6 +17,15 @@ along with GCC; see the file COPYING3. If not see . */ +/* A post reload optimization pass that fuses PLUS insns with CONST_INT + addend with a load or store insn to get POST_INC or PRE_DEC addressing. + It can also fuse two PLUSes to a single one, which may occur due to + splits from `avr_split_tiny_move'. We do this in an own pass because + it can find more cases than peephole2, for example when there are + unrelated insns between the interesting ones. */ + +INSERT_PASS_BEFORE (pass_peephole2, 1, avr_pass_fuse_add); + /* An analysis pass that runs prior to prologue / epilogue generation. Computes cfun->machine->gasisr.maybe which is used in prologue and epilogue generation provided -mgas-isr-prologues is on. */ diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h index 7d1f815c6649..bb6803121177 100644 --- a/gcc/config/avr/avr-protos.h +++ b/gcc/config/avr/avr-protos.h @@ -58,6 +58,7 @@ extern const char *ret_cond_branch (rtx x, int len, int reverse); extern const char *avr_out_movpsi (rtx_insn *, rtx*, int*); extern const char *avr_out_sign_extend (rtx_insn *, rtx*, int*); extern const char *avr_out_insert_notbit (rtx_insn *, rtx*, int*); +extern const char *avr_out_insv (rtx_insn *, rtx*, int*); extern const char *avr_out_extr (rtx_insn *, rtx*, int*); extern const char *avr_out_extr_not (rtx_insn *, rtx*, int*); extern const char *avr_out_plus_set_ZN (rtx*, int*); @@ -88,11 +89,12 @@ extern void avr_expand_prologue (void); extern void avr_expand_epilogue (bool); extern bool avr_emit_cpymemhi (rtx*); extern int avr_epilogue_uses (int regno); +extern bool avr_split_tiny_move (rtx_insn *insn, rtx *operands); extern void avr_output_addr_vec (rtx_insn*, rtx); extern const char *avr_out_sbxx_branch (rtx_insn *insn, rtx operands[]); extern const char* avr_out_bitop (rtx, rtx*, int*); -extern const char* avr_out_plus (rtx, rtx*, int* =NULL, int* =NULL, bool =true); +extern const char* avr_out_plus (rtx, rtx*, int* =NULL, bool =true); extern const char* avr_out_round (rtx_insn *, rtx*, int* =NULL); extern const char* avr_out_addto_sp (rtx*, int*); extern const char* avr_out_xload (rtx_insn *, rtx*, int*); @@ -109,7 +111,6 @@ extern const char* avr_out_reload_inpsi (rtx*, rtx, int*); extern const char* avr_out_lpm (rtx_insn *, rtx*, int*); extern void avr_notice_update_cc (rtx body, rtx_insn *insn); extern int reg_unused_after (rtx_insn *insn, rtx reg); -extern int _reg_unused_after (rtx_insn *insn, rtx reg); extern int avr_jump_mode (rtx x, rtx_insn *insn); extern int test_hard_reg_class (enum reg_class rclass, rtx x); extern int jump_over_one_insn_p (rtx_insn *insn, rtx dest); @@ -161,6 +162,7 @@ extern bool avr_have_dimode; namespace gcc { class context; } class rtl_opt_pass; +extern rtl_opt_pass *make_avr_pass_fuse_add (gcc::context *); extern rtl_opt_pass *make_avr_pass_pre_proep (gcc::context *); extern rtl_opt_pass *make_avr_pass_recompute_notes (gcc::context *); extern rtl_opt_pass *make_avr_pass_casesi (gcc::context *); diff --git a/gcc/config/avr/avr.cc b/gcc/config/avr/avr.cc index d3756a2f0369..00fce8da15f1 100644 --- a/gcc/config/avr/avr.cc +++ b/gcc/config/avr/avr.cc @@ -163,6 +163,7 @@ static int avr_operand_rtx_cost (rtx, machine_mode, enum rtx_code, int, bool); static void output_reload_in_const (rtx *, rtx, int *, bool); static struct machine_function *avr_init_machine_status (void); +static bool _reg_unused_after (rtx_insn *insn, rtx reg, bool look_at_insn); /* Prototypes for hook implementors if needed before their implementation. */ @@ -170,11 +171,12 @@ static struct machine_function *avr_init_machine_status (void); static bool avr_rtx_costs (rtx, machine_mode, int, int, int *, bool); -/* Allocate registers from r25 to r8 for parameters for function calls. */ -#define FIRST_CUM_REG 26 +/* Allocate registers from r25 to r8 for parameters for function calls + resp. r25 to r20 for reduced Tiny. */ +#define FIRST_CUM_REG REG_26 /* Last call saved register */ -#define LAST_CALLEE_SAVED_REG (AVR_TINY ? 19 : 17) +#define LAST_CALLEE_SAVED_REG (AVR_TINY ? REG_19 : REG_17) /* Implicit target register of LPM instruction (R0) */ extern GTY(()) rtx lpm_reg_rtx; @@ -197,8 +199,8 @@ extern GTY(()) rtx cc_reg_rtx; rtx cc_reg_rtx; /* RTXs for all general purpose registers as QImode */ -extern GTY(()) rtx all_regs_rtx[32]; -rtx all_regs_rtx[32]; +extern GTY(()) rtx all_regs_rtx[REG_32]; +rtx all_regs_rtx[REG_32]; /* SREG, the processor status */ extern GTY(()) rtx sreg_rtx; @@ -542,7 +544,7 @@ avr_casei_sequence_check_operands (rtx *xop) if (AVR_HAVE_EIJMP_EICALL // The last clobber op of the tablejump. - && xop[8] == all_regs_rtx[24]) + && xop[8] == all_regs_rtx[REG_24]) { // $6 is: (subreg:SI ($5) 0) sub_5 = xop[6]; @@ -646,8 +648,6 @@ avr_optimize_casesi (rtx_insn *insns[5], rtx *xop) start_sequence(); - rtx_insn *seq1, *seq2, *last1, *last2; - rtx reg = copy_to_mode_reg (mode, xop[10]); rtx (*gen_add)(rtx,rtx,rtx) = QImode == mode ? gen_addqi3 : gen_addhi3; @@ -663,8 +663,8 @@ avr_optimize_casesi (rtx_insn *insns[5], rtx *xop) JUMP_LABEL (cbranch) = xop[4]; ++LABEL_NUSES (xop[4]); - seq1 = get_insns(); - last1 = get_last_insn(); + rtx_insn *seq1 = get_insns(); + rtx_insn *last1 = get_last_insn(); end_sequence(); emit_insn_after (seq1, insns[2]); @@ -684,8 +684,8 @@ avr_optimize_casesi (rtx_insn *insns[5], rtx *xop) emit_insn (pat_4); - seq2 = get_insns(); - last2 = get_last_insn(); + rtx_insn *seq2 = get_insns(); + rtx_insn *last2 = get_last_insn(); end_sequence(); emit_insn_after (seq2, insns[3]); @@ -1171,7 +1171,7 @@ avr_init_machine_status (void) void avr_init_expanders (void) { - for (int regno = 0; regno < 32; regno ++) + for (int regno = REG_0; regno < REG_32; regno ++) all_regs_rtx[regno] = gen_rtx_REG (QImode, regno); lpm_reg_rtx = all_regs_rtx[LPM_REGNO]; @@ -1307,7 +1307,7 @@ avr_mem_memx_p (rtx x) /* A helper for the subsequent function attribute used to dig for attribute 'name' in a FUNCTION_DECL or FUNCTION_TYPE */ -static inline int +static inline bool avr_lookup_function_attribute1 (const_tree func, const char *name) { if (FUNCTION_DECL == TREE_CODE (func)) @@ -1327,7 +1327,7 @@ avr_lookup_function_attribute1 (const_tree func, const char *name) /* Return nonzero if FUNC is a naked function. */ -static int +static bool avr_naked_function_p (tree func) { return avr_lookup_function_attribute1 (func, "naked"); @@ -1336,7 +1336,7 @@ avr_naked_function_p (tree func) /* Return nonzero if FUNC is an interrupt function as specified by the "interrupt" attribute. */ -static int +static bool avr_interrupt_function_p (tree func) { return avr_lookup_function_attribute1 (func, "interrupt"); @@ -1345,7 +1345,7 @@ avr_interrupt_function_p (tree func) /* Return nonzero if FUNC is a signal function as specified by the "signal" attribute. */ -static int +static bool avr_signal_function_p (tree func) { return avr_lookup_function_attribute1 (func, "signal"); @@ -1353,7 +1353,7 @@ avr_signal_function_p (tree func) /* Return nonzero if FUNC is an OS_task function. */ -static int +static bool avr_OS_task_function_p (tree func) { return avr_lookup_function_attribute1 (func, "OS_task"); @@ -1361,7 +1361,7 @@ avr_OS_task_function_p (tree func) /* Return nonzero if FUNC is an OS_main function. */ -static int +static bool avr_OS_main_function_p (tree func) { return avr_lookup_function_attribute1 (func, "OS_main"); @@ -1371,7 +1371,7 @@ avr_OS_main_function_p (tree func) /* Return nonzero if FUNC is a no_gccisr function as specified by the "no_gccisr" attribute. */ -static int +static bool avr_no_gccisr_function_p (tree func) { return avr_lookup_function_attribute1 (func, "no_gccisr"); @@ -1517,7 +1517,7 @@ avr_outgoing_args_size (void) } -/* Implement TARGET_STARTING_FRAME_OFFSET. */ +/* Implement `TARGET_STARTING_FRAME_OFFSET'. */ /* This is the offset from the frame pointer register to the first stack slot that contains a variable living in the frame. */ @@ -1534,12 +1534,11 @@ avr_starting_frame_offset (void) static int avr_regs_to_save (HARD_REG_SET *set) { - int count; + int count = 0; int int_or_sig_p = cfun->machine->is_interrupt || cfun->machine->is_signal; if (set) CLEAR_HARD_REG_SET (*set); - count = 0; /* No need to save any registers if the function never returns or has the "OS_task" or "OS_main" attribute. */ @@ -1549,7 +1548,7 @@ avr_regs_to_save (HARD_REG_SET *set) || cfun->machine->is_OS_main) return 0; - for (int reg = 0; reg < 32; reg++) + for (int reg = REG_0; reg < REG_32; reg++) { /* Do not push/pop __tmp_reg__, __zero_reg__, as well as any global register variables. */ @@ -1583,10 +1582,11 @@ avr_allocate_stack_slots_for_args (void) } +/* Implement `TARGET_CAN_ELIMINATE'. */ /* Return true if register FROM can be eliminated via register TO. */ static bool -avr_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to) +avr_can_eliminate (const int /*from*/, const int to) { return ((frame_pointer_needed && to == FRAME_POINTER_REGNUM) || !frame_pointer_needed); @@ -1604,6 +1604,8 @@ avr_warn_func_return (tree decl) return !avr_naked_function_p (decl); } + +/* Worker function for `INITIAL_ELIMINATION_OFFSET'. */ /* Compute offset between arg_pointer and frame_pointer. */ int @@ -1676,6 +1678,7 @@ avr_build_builtin_va_list (void) } +/* Worker function for `INCOMING_RETURN_ADDR_RTX'. */ /* Return contents of MEM at frame pointer + stack size + 1 (+2 if 3-byte PC). This is return address of function. */ @@ -1779,6 +1782,585 @@ sequent_regs_live (void) return (cur_seq == live_seq) ? live_seq : 0; } + +namespace { +static const pass_data avr_pass_data_fuse_add = +{ + RTL_PASS, // type + "", // name (will be patched) + OPTGROUP_NONE, // optinfo_flags + TV_DF_SCAN, // tv_id + 0, // properties_required + 0, // properties_provided + 0, // properties_destroyed + 0, // todo_flags_start + TODO_df_finish // todo_flags_finish +}; + + +class avr_pass_fuse_add : public rtl_opt_pass +{ +public: + avr_pass_fuse_add (gcc::context *ctxt, const char *name) + : rtl_opt_pass (avr_pass_data_fuse_add, ctxt) + { + this->name = name; + } + + virtual bool gate (function *) { return optimize && avr_fuse_add > 0; } + + virtual unsigned int execute (function *); + + struct Some_Insn + { + rtx_insn *insn = nullptr; + rtx dest, src; + bool valid () const { return insn != nullptr; } + void set_deleted () + { + gcc_assert (insn); + SET_INSN_DELETED (insn); + insn = nullptr; + } + }; + + // If .insn is not NULL, then this is a reg:HI += const_int + // of an address register. + struct Add_Insn : Some_Insn + { + rtx addend; + int regno; + Add_Insn () {} + Add_Insn (rtx_insn *insn); + }; + + // If .insn is not NULL, then this sets an address register + // to a constant value. + struct Ldi_Insn : Some_Insn + { + int regno; + Ldi_Insn () {} + Ldi_Insn (rtx_insn *insn); + }; + + // If .insn is not NULL, then this is a load or store insn where the + // address is REG or POST_INC with an address register. + struct Mem_Insn : Some_Insn + { + rtx reg_or_0, mem, addr, addr_reg; + int addr_regno; + enum rtx_code addr_code; + machine_mode mode; + addr_space_t addr_space; + bool store_p, volatile_p; + Mem_Insn () {} + Mem_Insn (rtx_insn *insn); + }; + + rtx_insn *fuse_ldi_add (Ldi_Insn &prev_ldi, Add_Insn &add); + rtx_insn *fuse_add_add (Add_Insn &prev_add, Add_Insn &add); + rtx_insn *fuse_add_mem (Add_Insn &prev_add, Mem_Insn &mem); + rtx_insn *fuse_mem_add (Mem_Insn &prev_mem, Add_Insn &add); +}; // avr_pass_fuse_add + +} // anon namespace + +rtl_opt_pass * +make_avr_pass_fuse_add (gcc::context *ctxt) +{ + return new avr_pass_fuse_add (ctxt, "avr-fuse-add"); +} + +/* Describe properties of AVR's indirect load and store instructions + LD, LDD, ST, STD, LPM, ELPM depending on register number, volatility etc. + Rules for "volatile" accesses are: + + | Xmega | non-Xmega + ------+-----------------+---------------- + load | read LSB first | read LSB first + store | write LSB first | write MSB first +*/ + +struct AVR_LdSt_Props +{ + bool has_postinc, has_predec, has_ldd; + // The insn printers will use POST_INC or PRE_DEC addressing, no matter + // what adressing modes we are feeding into them. + bool want_postinc, want_predec; + + AVR_LdSt_Props (int regno, bool store_p, bool volatile_p, addr_space_t as) + { + bool generic_p = ADDR_SPACE_GENERIC_P (as); + bool flashx_p = ! generic_p && as != ADDR_SPACE_MEMX; + has_postinc = generic_p || (flashx_p && regno == REG_Z); + has_predec = generic_p; + has_ldd = ! AVR_TINY && generic_p && (regno == REG_Y || regno == REG_Z); + want_predec = volatile_p && generic_p && ! AVR_XMEGA && store_p; + want_postinc = volatile_p && generic_p && (AVR_XMEGA || ! store_p); + want_postinc |= flashx_p && regno == REG_Z; + } + + AVR_LdSt_Props (const avr_pass_fuse_add::Mem_Insn &m) + : AVR_LdSt_Props (m.addr_regno, m.store_p, m.volatile_p, m.addr_space) + { + gcc_assert (m.valid ()); + } +}; + +/* Emit a single_set that clobbers REG_CC. */ + +static rtx_insn * +emit_move_ccc (rtx dest, rtx src) +{ + return emit_insn (gen_gen_move_clobbercc (dest, src)); +} + +/* Emit a single_set that clobbers REG_CC after insn AFTER. */ + +static rtx_insn * +emit_move_ccc_after (rtx dest, rtx src, rtx_insn *after) +{ + return emit_insn_after (gen_gen_move_clobbercc (dest, src), after); +} + +static bool +reg_seen_between_p (const_rtx reg, const rtx_insn *from, const rtx_insn *to) +{ + return (reg_used_between_p (reg, from, to) + || reg_set_between_p (reg, from, to)); +} + + +static void +avr_maybe_adjust_cfa (rtx_insn *insn, rtx reg, int addend) +{ + if (addend + && frame_pointer_needed + && REGNO (reg) == FRAME_POINTER_REGNUM + && avr_fuse_add == 3) + { + rtx plus = plus_constant (Pmode, reg, addend); + RTX_FRAME_RELATED_P (insn) = 1; + add_reg_note (insn, REG_CFA_ADJUST_CFA, gen_rtx_SET (reg, plus)); + } +} + + +// If successful, this represents a SET of a pointer register to a constant. +avr_pass_fuse_add::Ldi_Insn::Ldi_Insn (rtx_insn *insn) +{ + rtx set = single_set (insn); + if (!set) + return; + + src = SET_SRC (set); + dest = SET_DEST (set); + + if (REG_P (dest) + && GET_MODE (dest) == Pmode + && IN_RANGE (regno = REGNO (dest), REG_X, REG_Z) + && CONSTANT_P (src)) + { + this->insn = insn; + } +} + +// If successful, this represents a PLUS with CONST_INT of a pointer +// register X, Y or Z. Otherwise, the object is not valid(). +avr_pass_fuse_add::Add_Insn::Add_Insn (rtx_insn *insn) +{ + rtx set = single_set (insn); + if (!set) + return; + + src = SET_SRC (set); + dest = SET_DEST (set); + if (REG_P (dest) + // We are only interested in PLUSes that change address regs. + && GET_MODE (dest) == Pmode + && IN_RANGE (regno = REGNO (dest), REG_X, REG_Z) + && PLUS == GET_CODE (src) + && rtx_equal_p (XEXP (src, 0), dest) + && CONST_INT_P (XEXP (src, 1))) + { + // This is reg:HI += const_int. + addend = XEXP (src, 1); + this->insn = insn; + } +} + +// If successful, this represents a load or store insn where the addressing +// mode uses pointer register X, Y or Z. Otherwise, the object is not valid(). +avr_pass_fuse_add::Mem_Insn::Mem_Insn (rtx_insn *insn) +{ + rtx set = single_set (insn); + if (!set) + return; + + src = SET_SRC (set); + dest = SET_DEST (set); + mode = GET_MODE (dest); + + if (MEM_P (dest) + && (REG_P (src) || src == CONST0_RTX (mode))) + { + reg_or_0 = src; + mem = dest; + } + else if (REG_P (dest) && MEM_P (src)) + { + reg_or_0 = dest; + mem = src; + } + else + return; + + addr = XEXP (mem, 0); + addr_code = GET_CODE (addr); + + if (addr_code == REG) + addr_reg = addr; + else if (addr_code == POST_INC || addr_code == PRE_DEC) + addr_reg = XEXP (addr, 0); + else + return; + + addr_regno = REGNO (addr_reg); + + if (avr_fuse_add == 2 + && frame_pointer_needed + && addr_regno == FRAME_POINTER_REGNUM) + MEM_VOLATILE_P (mem) = 0; + + if (reg_overlap_mentioned_p (reg_or_0, addr) // Can handle CONSTANT_P. + || addr_regno > REG_Z + || avr_mem_memx_p (mem) + // The following optimizations only handle REG and POST_INC, + // so that's all what we allow here. + || (addr_code != REG && addr_code != POST_INC)) + return; + + addr_space = MEM_ADDR_SPACE (mem); + volatile_p = MEM_VOLATILE_P (mem); + store_p = MEM_P (dest); + + // Turn this "valid". + this->insn = insn; +} + +/* Try to combine a Ldi insn with a PLUS CONST_INT addend to one Ldi insn. + If LDI is valid, then it precedes ADD in the same block. + When a replacement is found, a new insn is emitted and the old insns + are pseudo-deleted. The returned insn is the point where the calling + scanner should continue. When no replacement is found, nullptr is + returned and nothing changed. */ + +rtx_insn * +avr_pass_fuse_add::fuse_ldi_add (Ldi_Insn &ldi, Add_Insn &add) +{ + if (! ldi.valid () + || reg_seen_between_p (ldi.dest, ldi.insn, add.insn)) + { + // If something is between the Ldi and the current insn, we can + // set the Ldi invalid to speed future scans. + return ldi.insn = nullptr; + } + + // Found a Ldi with const and a PLUS insns in the same BB, + // and with no interfering insns between them. + + // Emit new Ldi with the sum of the original offsets after the old Ldi. + rtx xval = plus_constant (Pmode, ldi.src, INTVAL (add.addend)); + + rtx_insn *insn = emit_move_ccc_after (ldi.dest, xval, ldi.insn); + avr_dump (";; new Ldi[%d] insn %d after %d: R%d = %r\n\n", ldi.regno, + INSN_UID (insn), INSN_UID (ldi.insn), ldi.regno, xval); + + rtx_insn *next = NEXT_INSN (add.insn); + ldi.set_deleted (); + add.set_deleted (); + + return next; +} + +/* Try to combine two PLUS insns with CONST_INT addend to one such insn. + If PREV_ADD is valid, then it precedes ADD in the same basic block. + When a replacement is found, a new insn is emitted and the old insns + are pseudo-deleted. The returned insn is the point where the calling + scanner should continue. When no replacement is found, nullptr is + returned and nothing changed. */ + +rtx_insn * +avr_pass_fuse_add::fuse_add_add (Add_Insn &prev_add, Add_Insn &add) +{ + if (! prev_add.valid () + || reg_seen_between_p (add.dest, prev_add.insn, add.insn)) + { + // If something is between the previous Add and the current insn, + // we can set the previous Add invalid to speed future scans. + return prev_add.insn = nullptr; + } + + // Found two PLUS insns in the same BB, and with no interfering + // insns between them. + rtx plus = plus_constant (Pmode, add.src, INTVAL (prev_add.addend)); + + rtx_insn *next; + if (REG_P (plus)) + { + avr_dump (";; Add[%d] from %d annihilates %d\n\n", add.regno, + INSN_UID (prev_add.insn), INSN_UID (add.insn)); + next = NEXT_INSN (add.insn); + } + else + { + // Emit after the current insn, so that it will be picked + // up as next valid Add insn. + next = emit_move_ccc_after (add.dest, plus, add.insn); + avr_dump (";; #1 new Add[%d] insn %d after %d: R%d += %d\n\n", + add.regno, INSN_UID (next), INSN_UID (add.insn), + add.regno, (int) INTVAL (XEXP (plus, 1))); + gcc_assert (GET_CODE (plus) == PLUS); + } + + add.set_deleted (); + prev_add.set_deleted (); + + return next; +} + +/* Try to combine a PLUS of the address register with a load or store insn. + If ADD is valid, then it precedes MEM in the same basic block. + When a replacement is found, a new insn is emitted and the old insns + are pseudo-deleted. The returned insn is the point where the calling + scanner should continue. When no replacement is found, nullptr is + returned and nothing changed. */ + +rtx_insn * +avr_pass_fuse_add::fuse_add_mem (Add_Insn &add, Mem_Insn &mem) +{ + if (! add.valid () + || reg_seen_between_p (add.dest, add.insn, mem.insn)) + { + // If something is between the Add and the current insn, we can + // set the Add invalid to speed future scans. + return add.insn = nullptr; + } + + AVR_LdSt_Props ap { mem }; + + int msize = GET_MODE_SIZE (mem.mode); + + // The mem insn really wants PRE_DEC. + bool case1 = ((mem.addr_code == REG || mem.addr_code == POST_INC) + && msize > 1 && ap.want_predec && ! ap.has_ldd); + + // The offset can be consumed by a PRE_DEC. + bool case2 = (- INTVAL (add.addend) == msize + && (mem.addr_code == REG || mem.addr_code == POST_INC) + && ap.has_predec && ! ap.want_postinc); + + if (! case1 && ! case2) + return nullptr; + + // Change from REG or POST_INC to PRE_DEC. + rtx xmem = change_address (mem.mem, mem.mode, + gen_rtx_PRE_DEC (Pmode, mem.addr_reg)); + rtx dest = mem.store_p ? xmem : mem.reg_or_0; + rtx src = mem.store_p ? mem.reg_or_0 : xmem; + + rtx_insn *next = emit_move_ccc_after (dest, src, mem.insn); + add_reg_note (next, REG_INC, mem.addr_reg); + avr_dump (";; new Mem[%d] insn %d after %d: %r = %r\n\n", mem.addr_regno, + INSN_UID (next), INSN_UID (mem.insn), dest, src); + + // Changing REG or POST_INC -> PRE_DEC means that the addend before + // the memory access must be increased by the size of the access, + rtx plus = plus_constant (Pmode, add.src, msize); + if (! REG_P (plus)) + { + rtx_insn *insn = emit_move_ccc_after (add.dest, plus, add.insn); + avr_dump (";; #2 new Add[%d] insn %d after %d: R%d += %d\n\n", + add.regno, INSN_UID (insn), INSN_UID (add.insn), + add.regno, (int) INTVAL (XEXP (plus, 1))); + gcc_assert (GET_CODE (plus) == PLUS); + } + else + avr_dump (";; Add[%d] insn %d consumed into %d\n\n", + add.regno, INSN_UID (add.insn), INSN_UID (next)); + + // Changing POST_INC -> PRE_DEC means that the addend after the mem has to be + // the size of the access. The hope is that this new add insn may be unused. + if (mem.addr_code == POST_INC) + { + plus = plus_constant (Pmode, add.dest, msize); + rtx_insn *next2 = emit_move_ccc_after (add.dest, plus, next); + avr_dump (";; #3 new Add[%d] insn %d after %d: R%d += %d\n\n", add.regno, + INSN_UID (next2), INSN_UID (next), add.regno, msize); + next = next2; + } + + add.set_deleted (); + mem.set_deleted (); + + return next; +} + +/* Try to combine a load or store insn with a PLUS of the address register. + If MEM is valid, then it precedes ADD in the same basic block. + When a replacement is found, a new insn is emitted and the old insns + are pseudo-deleted. The returned insn is the point where the calling + scanner should continue. When no replacement is found, nullptr is + returned and nothing changed. */ + +rtx_insn * +avr_pass_fuse_add::fuse_mem_add (Mem_Insn &mem, Add_Insn &add) +{ + if (! mem.valid () + || reg_seen_between_p (add.dest, mem.insn, add.insn)) + { + // If something is between the Mem and the current insn, we can + // set the Mem invalid to speed future scans. + return mem.insn = nullptr; + } + + AVR_LdSt_Props ap { mem }; + + int msize = GET_MODE_SIZE (mem.mode); + + // The add insn can be consumed by a POST_INC. + bool case1 = (mem.addr_code == REG + && INTVAL (add.addend) == msize + && ap.has_postinc && ! ap.want_predec); + + // There are cases where even a partial consumption of the offset is better. + // This are the cases where no LD+offset addressing is available, because + // the address register is obviously used after the mem insn, and a mem insn + // with REG addressing mode will have to restore the address. + bool case2 = (mem.addr_code == REG + && msize > 1 && ap.want_postinc && ! ap.has_ldd); + + if (! case1 && ! case2) + return nullptr; + + // Change addressing mode from REG to POST_INC. + rtx xmem = change_address (mem.mem, mem.mode, + gen_rtx_POST_INC (Pmode, mem.addr_reg)); + rtx dest = mem.store_p ? xmem : mem.reg_or_0; + rtx src = mem.store_p ? mem.reg_or_0 : xmem; + + rtx_insn *insn = emit_move_ccc_after (dest, src, mem.insn); + add_reg_note (insn, REG_INC, mem.addr_reg); + avr_dump (";; new Mem[%d] insn %d after %d: %r = %r\n\n", add.regno, + INSN_UID (insn), INSN_UID (mem.insn), dest, src); + + rtx_insn *next = NEXT_INSN (add.insn); + + // Changing REG -> POST_INC means that the post addend must be + // decreased by the size of the access. + rtx plus = plus_constant (Pmode, add.src, -msize); + if (! REG_P (plus)) + { + next = emit_move_ccc_after (mem.addr_reg, plus, add.insn); + avr_dump (";; #4 new Add[%d] insn %d after %d: R%d += %d\n\n", + add.regno, INSN_UID (next), INSN_UID (add.insn), + add.regno, (int) INTVAL (XEXP (plus, 1))); + gcc_assert (GET_CODE (plus) == PLUS); + } + else + avr_dump (";; Add[%d] insn %d consumed into %d\n\n", + add.regno, INSN_UID (add.insn), INSN_UID (insn)); + + add.set_deleted (); + mem.set_deleted (); + + return next; +} + +/* Try to post-reload combine PLUS with CONST_INt of pointer registers with: + - Sets to a constant address. + - PLUS insn of that kind. + - Indirect loads and stores. + In almost all cases, combine opportunities arise from the preparation + done by `avr_split_tiny_move', but in some rare cases combinations are + found for the ordinary cores, too. + As we consider at most one Mem insn per try, there may still be missed + optimizations like POST_INC + PLUS + POST_INC might be performed + as PRE_DEC + PRE_DEC for two adjacent locations. */ + +unsigned int +avr_pass_fuse_add::execute (function *func) +{ + df_note_add_problem (); + df_analyze (); + + int n_add = 0, n_mem = 0, n_ldi = 0; + basic_block bb; + + FOR_EACH_BB_FN (bb, func) + { + Ldi_Insn prev_ldi_insns[REG_32]; + Add_Insn prev_add_insns[REG_32]; + Mem_Insn prev_mem_insns[REG_32]; + rtx_insn *insn, *curr; + + avr_dump ("\n;; basic block %d\n\n", bb->index); + + FOR_BB_INSNS_SAFE (bb, insn, curr) + { + rtx_insn *next = nullptr; + Ldi_Insn ldi_insn { insn }; + Add_Insn add_insn { insn }; + Mem_Insn mem_insn { insn }; + + if (add_insn.valid ()) + { + // Found reg:HI += const_int + avr_dump (";; insn %d: Add[%d]: R%d += %d\n\n", + INSN_UID (add_insn.insn), add_insn.regno, + add_insn.regno, (int) INTVAL (add_insn.addend)); + Ldi_Insn &prev_ldi_insn = prev_ldi_insns[add_insn.regno]; + Add_Insn &prev_add_insn = prev_add_insns[add_insn.regno]; + Mem_Insn &prev_mem_insn = prev_mem_insns[add_insn.regno]; + if ((next = fuse_ldi_add (prev_ldi_insn, add_insn))) + curr = next, n_ldi += 1; + else if ((next = fuse_add_add (prev_add_insn, add_insn))) + curr = next, n_add += 1; + else if ((next = fuse_mem_add (prev_mem_insn, add_insn))) + curr = next, n_mem += 1; + else + prev_add_insn = add_insn; + } + else if (mem_insn.valid ()) + { + int addr_regno = REGNO (mem_insn.addr_reg); + avr_dump (";; insn %d: Mem[%d]: %r = %r\n\n", + INSN_UID (mem_insn.insn), addr_regno, + mem_insn.dest, mem_insn.src); + Add_Insn &prev_add_insn = prev_add_insns[addr_regno]; + if ((next = fuse_add_mem (prev_add_insn, mem_insn))) + curr = next, n_mem += 1; + else + prev_mem_insns[addr_regno] = mem_insn; + } + else if (ldi_insn.valid ()) + { + if (! CONST_INT_P (ldi_insn.src)) + avr_dump (";; insn %d: Ldi[%d]: R%d = %r\n\n", + INSN_UID (ldi_insn.insn), ldi_insn.regno, + ldi_insn.regno, ldi_insn.src); + prev_ldi_insns[ldi_insn.regno] = ldi_insn; + } + } // for insns + } // for BBs + + avr_dump (";; Function %f: Found %d changes: %d ldi, %d add, %d mem.\n", + n_ldi + n_add + n_mem, n_ldi, n_add, n_mem); + + return 0; +} + + namespace { static const pass_data avr_pass_data_pre_proep = { @@ -1901,7 +2483,7 @@ avr_incoming_return_addr_rtx (void) static int avr_hregs_split_reg (HARD_REG_SET *set) { - for (int regno = 0; regno < 32; regno++) + for (int regno = REG_0; regno < REG_32; regno++) if (TEST_HARD_REG_BIT (*set, regno)) { // Don't remove a register from *SET which might indicate that @@ -1961,12 +2543,10 @@ emit_push_byte (unsigned regno, bool frame_related_p) static void emit_push_sfr (rtx sfr, bool frame_related_p, bool clr_p, int treg) { - rtx_insn *insn; - gcc_assert (MEM_P (sfr)); /* IN treg, IO(SFR) */ - insn = emit_move_insn (all_regs_rtx[treg], sfr); + rtx_insn *insn = emit_move_insn (all_regs_rtx[treg], sfr); if (frame_related_p) RTX_FRAME_RELATED_P (insn) = 1; @@ -2007,7 +2587,7 @@ avr_prologue_setup_frame (HOST_WIDE_INT size, HARD_REG_SET set) || live_seq > 7)) { rtx pattern; - int first_reg, reg, offset; + int reg, offset; emit_move_insn (gen_rtx_REG (HImode, REG_X), gen_int_mode (size, HImode)); @@ -2035,11 +2615,11 @@ avr_prologue_setup_frame (HOST_WIDE_INT size, HARD_REG_SET set) /* Note that live_seq always contains r28+r29, but the other registers to be saved are all below 18. */ - first_reg = (LAST_CALLEE_SAVED_REG + 1) - (live_seq - 2); + int first_reg = (LAST_CALLEE_SAVED_REG + 1) - (live_seq - 2); - for (reg = 29, offset = -live_seq + 1; + for (reg = REG_29, offset = -live_seq + 1; reg >= first_reg; - reg = (reg == 28 ? LAST_CALLEE_SAVED_REG : reg - 1), ++offset) + reg = (reg == REG_28 ? LAST_CALLEE_SAVED_REG : reg - 1), ++offset) { rtx m, r; @@ -2053,7 +2633,7 @@ avr_prologue_setup_frame (HOST_WIDE_INT size, HARD_REG_SET set) } else /* !minimize */ { - for (int reg = 0; reg < 32; ++reg) + for (int reg = REG_0; reg < REG_32; ++reg) if (TEST_HARD_REG_BIT (set, reg)) emit_push_byte (reg, true); @@ -2101,15 +2681,15 @@ avr_prologue_setup_frame (HOST_WIDE_INT size, HARD_REG_SET set) int irq_state = -1; HOST_WIDE_INT size_cfa = size, neg_size; rtx_insn *fp_plus_insns; - rtx fp, my_fp; gcc_assert (frame_pointer_needed || !isr_p || !crtl->is_leaf); - fp = my_fp = (frame_pointer_needed - ? frame_pointer_rtx - : gen_rtx_REG (Pmode, REG_X)); + rtx my_fp = (frame_pointer_needed + ? frame_pointer_rtx + : gen_rtx_REG (Pmode, REG_X)); + rtx fp = my_fp; if (AVR_HAVE_8BIT_SP) { @@ -2259,9 +2839,7 @@ void avr_expand_prologue (void) { HARD_REG_SET set; - HOST_WIDE_INT size; - - size = get_frame_size() + avr_outgoing_args_size(); + HOST_WIDE_INT size = get_frame_size() + avr_outgoing_args_size(); cfun->machine->stack_usage = 0; @@ -2411,10 +2989,10 @@ avr_asm_function_end_prologue (FILE *file) } -/* Implement `EPILOGUE_USES'. */ +/* Worker function for `EPILOGUE_USES'. */ int -avr_epilogue_uses (int regno ATTRIBUTE_UNUSED) +avr_epilogue_uses (int /*regno*/) { if (reload_completed && cfun->machine @@ -2428,11 +3006,9 @@ avr_epilogue_uses (int regno ATTRIBUTE_UNUSED) static void emit_pop_byte (unsigned regno) { - rtx mem, reg; - - mem = gen_rtx_PRE_INC (HImode, stack_pointer_rtx); + rtx mem = gen_rtx_PRE_INC (HImode, stack_pointer_rtx); mem = gen_frame_mem (QImode, mem); - reg = gen_rtx_REG (QImode, regno); + rtx reg = gen_rtx_REG (QImode, regno); emit_insn (gen_rtx_SET (reg, mem)); } @@ -2442,13 +3018,10 @@ emit_pop_byte (unsigned regno) void avr_expand_epilogue (bool sibcall_p) { - int live_seq; HARD_REG_SET set; - int minimize; - HOST_WIDE_INT size; bool isr_p = cfun->machine->is_interrupt || cfun->machine->is_signal; - size = get_frame_size() + avr_outgoing_args_size(); + HOST_WIDE_INT size = get_frame_size() + avr_outgoing_args_size(); /* epilogue: naked */ if (cfun->machine->is_naked) @@ -2460,14 +3033,14 @@ avr_expand_epilogue (bool sibcall_p) } avr_regs_to_save (&set); - live_seq = sequent_regs_live (); + int live_seq = sequent_regs_live (); - minimize = (TARGET_CALL_PROLOGUES - && live_seq - && !isr_p - && !cfun->machine->is_OS_task - && !cfun->machine->is_OS_main - && !AVR_TINY); + bool minimize = (TARGET_CALL_PROLOGUES + && live_seq + && !isr_p + && !cfun->machine->is_OS_task + && !cfun->machine->is_OS_main + && !AVR_TINY); if (minimize && (live_seq > 4 @@ -2496,17 +3069,15 @@ avr_expand_epilogue (bool sibcall_p) /* Try two methods to adjust stack and select shortest. */ int irq_state = -1; - rtx fp, my_fp; - rtx_insn *fp_plus_insns; - HOST_WIDE_INT size_max; gcc_assert (frame_pointer_needed || !isr_p || !crtl->is_leaf); - fp = my_fp = (frame_pointer_needed - ? frame_pointer_rtx - : gen_rtx_REG (Pmode, REG_X)); + rtx my_fp = (frame_pointer_needed + ? frame_pointer_rtx + : gen_rtx_REG (Pmode, REG_X)); + rtx fp = my_fp; if (AVR_HAVE_8BIT_SP) { @@ -2518,7 +3089,7 @@ avr_expand_epilogue (bool sibcall_p) /* For rationale see comment in prologue generation. */ - size_max = (HOST_WIDE_INT) GET_MODE_MASK (GET_MODE (my_fp)); + HOST_WIDE_INT size_max = (HOST_WIDE_INT) GET_MODE_MASK (GET_MODE (my_fp)); if (size > size_max) size = size_max; size = trunc_int_for_mode (size, GET_MODE (my_fp)); @@ -2543,21 +3114,19 @@ avr_expand_epilogue (bool sibcall_p) emit_insn (gen_movhi_sp_r (stack_pointer_rtx, fp, GEN_INT (irq_state))); - fp_plus_insns = get_insns (); + rtx_insn *fp_plus_insns = get_insns (); end_sequence (); /********** Method 2: Adjust Stack pointer **********/ if (avr_sp_immediate_operand (gen_int_mode (size, HImode), HImode)) { - rtx_insn *sp_plus_insns; - start_sequence (); emit_move_insn (stack_pointer_rtx, plus_constant (Pmode, stack_pointer_rtx, size)); - sp_plus_insns = get_insns (); + rtx_insn *sp_plus_insns = get_insns (); end_sequence (); /************ Use shortest method ************/ @@ -2592,7 +3161,7 @@ avr_expand_epilogue (bool sibcall_p) CLEAR_HARD_REG_BIT (set, treg); } - for (int reg = 31; reg >= 0; --reg) + for (int reg = REG_31; reg >= REG_0; --reg) if (TEST_HARD_REG_BIT (set, reg)) emit_pop_byte (reg); @@ -2676,21 +3245,16 @@ avr_cannot_modify_jumps_p (void) /* Naked Functions must not have any instructions after their epilogue, see PR42240 */ - if (reload_completed - && cfun->machine - && cfun->machine->is_naked) - { - return true; - } - - return false; + return (reload_completed + && cfun->machine + && cfun->machine->is_naked); } /* Implement `TARGET_MODE_DEPENDENT_ADDRESS_P'. */ static bool -avr_mode_dependent_address_p (const_rtx addr ATTRIBUTE_UNUSED, addr_space_t as) +avr_mode_dependent_address_p (const_rtx /*addr*/, addr_space_t as) { /* FIXME: Non-generic addresses are not mode-dependent in themselves. This hook just serves to hack around PR rtl-optimization/52543 by @@ -2776,7 +3340,10 @@ avr_legitimate_address_p (machine_mode mode, rtx x, bool strict) && CONST_INT_P (op1) && INTVAL (op1) >= 0) { - bool fit = IN_RANGE (INTVAL (op1), 0, MAX_LD_OFFSET (mode)); + bool fit = (IN_RANGE (INTVAL (op1), 0, MAX_LD_OFFSET (mode)) + // Reduced Tiny does not support PLUS addressing + // anyway, so we are not restricted to LD offset. + || AVR_TINY); if (fit) { @@ -2892,9 +3459,8 @@ avr_legitimize_address (rtx x, rtx oldx, machine_mode mode) than 63 bytes or for R++ or --R addressing. */ rtx -avr_legitimize_reload_address (rtx *px, machine_mode mode, - int opnum, int type, int addr_type, - int ind_levels ATTRIBUTE_UNUSED, +avr_legitimize_reload_address (rtx *px, machine_mode mode, int opnum, + int type, int addr_type, int /*ind_levels*/, rtx (*mk_memloc)(rtx,int)) { rtx x = *px; @@ -3209,7 +3775,7 @@ avr_print_operand (FILE *file, rtx x, int code) { if (x == zero_reg_rtx) fprintf (file, "__zero_reg__"); - else if (code == 'r' && REGNO (x) < 32) + else if (code == 'r' && REGNO (x) < REG_32) fprintf (file, "%d", (int) REGNO (x)); else fprintf (file, "%s", reg_names[REGNO (x) + abcd]); @@ -3352,8 +3918,7 @@ avr_print_operand (FILE *file, rtx x, int code) } -/* Implement TARGET_USE_BY_PIECES_INFRASTRUCTURE_P. */ - +/* Implement `TARGET_USE_BY_PIECES_INFRASTRUCTURE_P'. */ /* Prefer sequence of loads/stores for moves of size upto two - two pairs of load/store instructions are always better than the 5 instruction sequence for a loop (1 instruction @@ -3361,9 +3926,8 @@ avr_print_operand (FILE *file, rtx x, int code) static bool avr_use_by_pieces_infrastructure_p (unsigned HOST_WIDE_INT size, - unsigned int align ATTRIBUTE_UNUSED, - enum by_pieces_operation op, - bool speed_p) + unsigned int align, + enum by_pieces_operation op, bool speed_p) { if (op != MOVE_BY_PIECES || (speed_p && size > MOVE_MAX_PIECES)) @@ -3503,8 +4067,8 @@ ret_cond_branch (rtx x, int len, int reverse) /* Output insn cost for next insn. */ void -avr_final_prescan_insn (rtx_insn *insn, rtx *operand ATTRIBUTE_UNUSED, - int num_operands ATTRIBUTE_UNUSED) +avr_final_prescan_insn (rtx_insn *insn, rtx * /*operands*/, + int /*num_operands*/) { if (avr_log.rtx_costs) { @@ -3551,7 +4115,9 @@ avr_asm_final_postscan_insn (FILE *stream, rtx_insn *insn, rtx *, int) int avr_function_arg_regno_p (int r) { - return AVR_TINY ? IN_RANGE (r, 20, 25) : IN_RANGE (r, 8, 25); + return AVR_TINY + ? IN_RANGE (r, REG_20, REG_25) + : IN_RANGE (r, REG_8, REG_25); } @@ -3561,10 +4127,11 @@ avr_function_arg_regno_p (int r) void avr_init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype, rtx libname, - tree fndecl ATTRIBUTE_UNUSED) + tree /*fndecl*/) { - cum->nregs = AVR_TINY ? 6 : 18; + cum->nregs = AVR_TINY ? 1 + REG_25 - REG_20 : 1 + REG_25 - REG_8; cum->regno = FIRST_CUM_REG; + cum->has_stack_args = 0; if (!libname && stdarg_p (fntype)) cum->nregs = 0; @@ -3578,12 +4145,9 @@ avr_init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype, rtx libname, static int avr_num_arg_regs (machine_mode mode, const_tree type) { - int size; - - if (mode == BLKmode) - size = int_size_in_bytes (type); - else - size = GET_MODE_SIZE (mode); + int size = (mode == BLKmode + ? int_size_in_bytes (type) + : GET_MODE_SIZE (mode)); /* Align all function arguments to start in even-numbered registers. Odd-sized arguments leave holes above them. */ @@ -3605,6 +4169,8 @@ avr_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) if (cum->nregs && bytes <= cum->nregs) return gen_rtx_REG (arg.mode, cum->regno - bytes); + cum->has_stack_args = 1; + return NULL_RTX; } @@ -3614,8 +4180,7 @@ avr_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) in the argument list. */ static void -avr_function_arg_advance (cumulative_args_t cum_v, - const function_arg_info &arg) +avr_function_arg_advance (cumulative_args_t cum_v, const function_arg_info &arg) { CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v); int bytes = avr_num_arg_regs (arg.mode, arg.type); @@ -3628,7 +4193,7 @@ avr_function_arg_advance (cumulative_args_t cum_v, a function must not pass arguments in call-saved regs in order to get tail-called. */ - if (cum->regno >= 8 + if (cum->regno >= REG_8 && cum->nregs >= 0 && !call_used_or_fixed_reg_p (cum->regno)) { @@ -3645,7 +4210,7 @@ avr_function_arg_advance (cumulative_args_t cum_v, user has fixed a GPR needed to pass an argument, an (implicit) function call will clobber that fixed register. See PR45099 for an example. */ - if (cum->regno >= 8 + if (cum->regno >= REG_8 && cum->nregs >= 0) { for (int regno = cum->regno; regno < cum->regno + bytes; regno++) @@ -3669,8 +4234,6 @@ avr_function_arg_advance (cumulative_args_t cum_v, static bool avr_function_ok_for_sibcall (tree decl_callee, tree exp_callee) { - tree fntype_callee; - /* Tail-calling must fail if callee-saved regs are used to pass function args. We must not tail-call when `epilogue_restores' is used. Unfortunately, we cannot tell at this point if that @@ -3683,7 +4246,7 @@ avr_function_ok_for_sibcall (tree decl_callee, tree exp_callee) return false; } - fntype_callee = TREE_TYPE (CALL_EXPR_FN (exp_callee)); + tree fntype_callee = TREE_TYPE (CALL_EXPR_FN (exp_callee)); if (decl_callee) { @@ -3760,7 +4323,7 @@ avr_find_unused_d_reg (rtx_insn *insn, rtx exclude) bool isr_p = (avr_interrupt_function_p (current_function_decl) || avr_signal_function_p (current_function_decl)); - for (int regno = 16; regno < 32; regno++) + for (int regno = REG_16; regno < REG_32; regno++) { rtx reg = all_regs_rtx[regno]; @@ -3904,10 +4467,7 @@ avr_out_lpm (rtx_insn *insn, rtx *op, int *plen) rtx xop[7]; rtx dest = op[0]; rtx src = SET_SRC (single_set (insn)); - rtx addr; int n_bytes = GET_MODE_SIZE (GET_MODE (dest)); - int segment; - RTX_CODE code; addr_space_t as = MEM_ADDR_SPACE (src); if (plen) @@ -3921,8 +4481,8 @@ avr_out_lpm (rtx_insn *insn, rtx *op, int *plen) return ""; } - addr = XEXP (src, 0); - code = GET_CODE (addr); + rtx addr = XEXP (src, 0); + RTX_CODE code = GET_CODE (addr); gcc_assert (REG_P (dest)); gcc_assert (REG == code || POST_INC == code); @@ -3934,7 +4494,7 @@ avr_out_lpm (rtx_insn *insn, rtx *op, int *plen) xop[5] = tmp_reg_rtx; xop[6] = XEXP (rampz_rtx, 0); - segment = avr_addrspace[as].segment; + int segment = avr_addrspace[as].segment; /* Set RAMPZ as needed. */ @@ -4071,7 +4631,7 @@ avr_out_lpm (rtx_insn *insn, rtx *op, int *plen) /* Worker function for xload_8 insn. */ const char * -avr_out_xload (rtx_insn *insn ATTRIBUTE_UNUSED, rtx *op, int *plen) +avr_out_xload (rtx_insn * /*insn*/, rtx *op, int *plen) { rtx xop[4]; @@ -4368,14 +4928,13 @@ avr_out_movhi_r_mr_reg_disp_tiny (rtx_insn *insn, rtx op[], int *plen) static const char * avr_out_movhi_r_mr_pre_dec_tiny (rtx_insn *insn, rtx op[], int *plen) { - int mem_volatile_p = 0; rtx dest = op[0]; rtx src = op[1]; rtx base = XEXP (src, 0); /* "volatile" forces reading low byte first, even if less efficient, for correct operation with 16-bit I/O registers. */ - mem_volatile_p = MEM_VOLATILE_P (src); + bool mem_volatile_p = MEM_VOLATILE_P (src); if (reg_overlap_mentioned_p (dest, XEXP (base, 0))) fatal_insn ("incorrect insn:", insn); @@ -4401,7 +4960,7 @@ out_movhi_r_mr (rtx_insn *insn, rtx op[], int *plen) int reg_base = true_regnum (base); /* "volatile" forces reading low byte first, even if less efficient, for correct operation with 16-bit I/O registers. */ - int mem_volatile_p = MEM_VOLATILE_P (src); + bool mem_volatile_p = MEM_VOLATILE_P (src); if (reg_base > 0) { @@ -5714,7 +6273,7 @@ avr_out_movhi_mr_r_xmega (rtx_insn *insn, rtx op[], int *plen) /* "volatile" forces writing low byte first, even if less efficient, for correct operation with 16-bit I/O registers like SP. */ - int mem_volatile_p = MEM_VOLATILE_P (dest); + bool mem_volatile_p = MEM_VOLATILE_P (dest); if (CONSTANT_ADDRESS_P (base)) { @@ -5821,7 +6380,7 @@ avr_out_movhi_mr_r_reg_no_disp_tiny (rtx_insn *insn, rtx op[], int *plen) rtx base = XEXP (dest, 0); int reg_base = true_regnum (base); int reg_src = true_regnum (src); - int mem_volatile_p = MEM_VOLATILE_P (dest); + bool mem_volatile_p = MEM_VOLATILE_P (dest); if (reg_base == reg_src) { @@ -5889,7 +6448,6 @@ out_movhi_mr_r (rtx_insn *insn, rtx op[], int *plen) rtx base = XEXP (dest, 0); int reg_base = true_regnum (base); int reg_src = true_regnum (src); - int mem_volatile_p; /* "volatile" forces writing high-byte first (no-xmega) resp. low-byte first (xmega) even if less efficient, for correct @@ -5898,7 +6456,7 @@ out_movhi_mr_r (rtx_insn *insn, rtx op[], int *plen) if (AVR_XMEGA) return avr_out_movhi_mr_r_xmega (insn, op, plen); - mem_volatile_p = MEM_VOLATILE_P (dest); + bool mem_volatile_p = MEM_VOLATILE_P (dest); if (CONSTANT_ADDRESS_P (base)) { @@ -6014,6 +6572,176 @@ out_movhi_mr_r (rtx_insn *insn, rtx op[], int *plen) return ""; } + +/* During reload, we allow much more addresses than Reduced Tiny actually + supports. Split them after reload in order to get closer to the + core's capabilities. This sets the stage for pass .avr-fuse-add. */ + +bool +avr_split_tiny_move (rtx_insn * /*insn*/, rtx *xop) +{ + bool store_p = false; + rtx mem, reg_or_0; + + if (REG_P (xop[0]) && MEM_P (xop[1])) + { + reg_or_0 = xop[0]; + mem = xop[1]; + } + else if (MEM_P (xop[0]) + && (REG_P (xop[1]) + || xop[1] == CONST0_RTX (GET_MODE (xop[0])))) + { + mem = xop[0]; + reg_or_0 = xop[1]; + store_p = true; + } + else + return false; + + machine_mode mode = GET_MODE (mem); + rtx base, addr = XEXP (mem, 0); + enum rtx_code addr_code = GET_CODE (addr); + + if (REG_P (reg_or_0) + && reg_overlap_mentioned_p (reg_or_0, addr)) + return false; + else if (addr_code == PLUS || addr_code == PRE_DEC || addr_code == POST_INC) + base = XEXP (addr, 0); + else if (addr_code == REG) + base = addr; + else + return false; + + if (REGNO (base) > REG_Z) + return false; + + bool volatile_p = MEM_VOLATILE_P (mem); + bool mem_volatile_p = false; + if (frame_pointer_needed + && REGNO (base) == FRAME_POINTER_REGNUM) + { + if (avr_fuse_add < 2 + // Be a projection (we always split PLUS). + || (avr_fuse_add == 2 && volatile_p && addr_code != PLUS)) + return false; + + // Changing the frame pointer locally may confuse later passes + // like .dse2 which don't track changes of FP, not even when + // respective CFA notes are present. An example is pr22141-1.c. + if (avr_fuse_add == 2) + mem_volatile_p = true; + } + + enum rtx_code new_code = UNKNOWN; + HOST_WIDE_INT add = 0, sub = 0; + int msize = GET_MODE_SIZE (mode); + + AVR_LdSt_Props ap { REGNO (base), store_p, volatile_p, ADDR_SPACE_GENERIC }; + + switch (addr_code) + { + default: + return false; + + case PLUS: + add = INTVAL (XEXP (addr, 1)); + if (msize == 1) + { + new_code = REG; + sub = -add; + } + else if (ap.want_predec) + { + // volatile stores prefer PRE_DEC (MSB first) + sub = -add; + add += msize; + new_code = PRE_DEC; + } + else + { + new_code = POST_INC; + sub = -add - msize; + } + break; + + case POST_INC: + // volatile stores prefer PRE_DEC (MSB first) + if (msize > 1 && ap.want_predec) + { + add = msize; + new_code = PRE_DEC; + sub = msize; + break; + } + return false; + + case PRE_DEC: + // volatile loads prefer POST_INC (LSB first) + if (msize > 1 && ap.want_postinc) + { + add = -msize; + new_code = POST_INC; + sub = -msize; + break; + } + return false; + + case REG: + if (msize == 1) + return false; + + if (ap.want_predec) + { + add = msize; + new_code = PRE_DEC; + sub = 0; + } + else + { + add = 0; + new_code = POST_INC; + sub = -msize; + } + break; + } // switch addr_code + + rtx_insn *insn; + + if (add) + { + insn = emit_move_ccc (base, plus_constant (Pmode, base, add)); + avr_maybe_adjust_cfa (insn, base, add); + } + + rtx new_addr = new_code == REG + ? base + : gen_rtx_fmt_e (new_code, Pmode, base); + + rtx new_mem = change_address (mem, mode, new_addr); + if (mem_volatile_p) + MEM_VOLATILE_P (new_mem) = 1; + + insn = emit_move_ccc (store_p ? new_mem : reg_or_0, + store_p ? reg_or_0 : new_mem); + if (auto_inc_p (new_addr)) + { + add_reg_note (insn, REG_INC, base); + int off = new_code == POST_INC ? msize : -msize; + avr_maybe_adjust_cfa (insn, base, off); + } + + if (sub) + { + insn = emit_move_ccc (base, plus_constant (Pmode, base, sub)); + avr_maybe_adjust_cfa (insn, base, sub); + } + + return true; +} + + +/* Implement `TARGET_FRAME_POINTER_REQUIRED'. */ /* Return 1 if frame pointer for current function required. */ static bool @@ -6022,7 +6750,7 @@ avr_frame_pointer_required_p (void) return (cfun->calls_alloca || cfun->calls_setjmp || cfun->has_nonlocal_label - || crtl->args.info.nregs == 0 + || crtl->args.info.has_stack_args || get_frame_size () > 0); } @@ -6175,9 +6903,6 @@ avr_out_compare (rtx_insn *insn, rtx *xop, int *plen) rtx xreg = xop[0]; rtx xval = xop[1]; - /* MODE of the comparison. */ - machine_mode mode; - /* Number of bytes to operate on. */ int n_bytes = GET_MODE_SIZE (GET_MODE (xreg)); @@ -6193,7 +6918,8 @@ avr_out_compare (rtx_insn *insn, rtx *xop, int *plen) xval = avr_to_int_mode (xop[1]); } - mode = GET_MODE (xreg); + /* MODE of the comparison. */ + machine_mode mode = GET_MODE (xreg); gcc_assert (REG_P (xreg)); gcc_assert ((CONST_INT_P (xval) && n_bytes <= 4) @@ -6291,10 +7017,7 @@ avr_out_compare (rtx_insn *insn, rtx *xop, int *plen) && (val8 == 0 || reg_unused_after (insn, xreg))) { - if (AVR_TINY) - avr_asm_len (TINY_SBIW (%A0, %B0, %1), xop, plen, 2); - else - avr_asm_len ("sbiw %0,%1", xop, plen, 1); + avr_asm_len ("sbiw %0,%1", xop, plen, 1); i++; continue; @@ -6305,9 +7028,7 @@ avr_out_compare (rtx_insn *insn, rtx *xop, int *plen) && compare_eq_p (insn) && reg_unused_after (insn, xreg)) { - return AVR_TINY - ? avr_asm_len (TINY_ADIW (%A0, %B0, %n1), xop, plen, 2) - : avr_asm_len ("adiw %0,%n1", xop, plen, 1); + return avr_asm_len ("adiw %0,%n1", xop, plen, 1); } } @@ -6362,11 +7083,7 @@ avr_out_compare (rtx_insn *insn, rtx *xop, int *plen) const char * avr_out_compare64 (rtx_insn *insn, rtx *op, int *plen) { - rtx xop[3]; - - xop[0] = gen_rtx_REG (DImode, 18); - xop[1] = op[0]; - xop[2] = op[1]; + rtx xop[3] = { gen_rtx_REG (DImode, ACC_A), op[0], op[1] }; return avr_out_compare (insn, xop, plen); } @@ -6587,7 +7304,7 @@ out_shift_with_cnt (const char *templ, rtx_insn *insn, rtx operands[], /* No scratch register available, use one from LD_REGS (saved in __tmp_reg__) that doesn't overlap with registers to shift. */ - op[3] = all_regs_rtx[((REGNO (op[0]) - 1) & 15) + 16]; + op[3] = all_regs_rtx[((REGNO (op[0]) - 1) & 15) + REG_16]; op[4] = tmp_reg_rtx; saved_in_tmp = true; @@ -8043,6 +8760,7 @@ lshrsi3_out (rtx_insn *insn, rtx operands[], int *len) /* Output addition of register XOP[0] and compile time constant XOP[2]. + INSN is a single_set insn or an insn pattern. CODE == PLUS: perform addition by using ADD instructions or CODE == MINUS: perform addition by using SUB instructions: @@ -8055,7 +8773,6 @@ lshrsi3_out (rtx_insn *insn, rtx operands[], int *len) If PLEN == NULL, print assembler instructions to perform the operation; otherwise, set *PLEN to the length of the instruction sequence (in words) printed with PLEN == NULL. XOP[3] is an 8-bit scratch register or NULL_RTX. - Set *PCC to effect on cc0 according to respective CC_* insn attribute. CODE_SAT == UNKNOWN: Perform ordinary, non-saturating operation. CODE_SAT != UNKNOWN: Perform operation and saturate according to CODE_SAT. @@ -8069,7 +8786,7 @@ lshrsi3_out (rtx_insn *insn, rtx operands[], int *len) fixed-point rounding, cf. `avr_out_round'. */ static void -avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc, +avr_out_plus_1 (rtx insn, rtx *xop, int *plen, enum rtx_code code, enum rtx_code code_sat, int sign, bool out_label) { /* MODE of the operation. */ @@ -8105,8 +8822,6 @@ avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc, if (REG_P (xop[2])) { - *pcc = MINUS == code ? (int) CC_SET_CZN : (int) CC_CLOBBER; - for (int i = 0; i < n_bytes; i++) { /* We operate byte-wise on the destination. */ @@ -8132,21 +8847,13 @@ avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc, goto saturate; } - /* Except in the case of ADIW with 16-bit register (see below) - addition does not set cc0 in a usable way. */ - - *pcc = (MINUS == code) ? CC_SET_CZN : CC_CLOBBER; - if (CONST_FIXED_P (xval)) xval = avr_to_int_mode (xval); /* Adding/Subtracting zero is a no-op. */ if (xval == const0_rtx) - { - *pcc = CC_NONE; - return; - } + return; if (MINUS == code) xval = simplify_unary_operation (NEG, imode, xval, imode); @@ -8191,9 +8898,6 @@ avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc, /* To get usable cc0 no low-bytes must have been skipped. */ - if (i && !started) - *pcc = CC_CLOBBER; - if (!started && i % 2 == 0 && i + 2 <= n_bytes @@ -8212,9 +8916,6 @@ avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc, started = true; avr_asm_len (code == PLUS ? "adiw %0,%1" : "sbiw %0,%1", op, plen, 1); - - if (n_bytes == 2 && PLUS == code) - *pcc = CC_SET_CZN; } i++; @@ -8222,6 +8923,35 @@ avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc, } } + if (AVR_TINY + && optimize + && i == 0 + && n_bytes == 2 + // When that pass adjusts the frame pointer, then we know that + // reg Y points to ordinary memory, and the only side-effect + // of -Y and Y+ is the side effect on Y. + && avr_fuse_add >= 2 + && frame_pointer_needed + && REGNO (xop[0]) == FRAME_POINTER_REGNUM) + { + if (INSN_P (insn) + && _reg_unused_after (as_a (insn), xop[0], false)) + return; + + if (AVR_HAVE_8BIT_SP) + { + avr_asm_len ("subi %A0,%n2", xop, plen, 1); + return; + } + else if (xop[2] == const1_rtx || xop[2] == constm1_rtx) + { + avr_asm_len (xop[2] == const1_rtx + ? "ld __tmp_reg__,%a0+" + : "ld __tmp_reg__,-%a0", xop, plen, 1); + return; + } + } + if (val8 == 0) { if (started) @@ -8237,7 +8967,6 @@ avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc, { avr_asm_len ((code == PLUS) ^ (val8 == 1) ? "dec %0" : "inc %0", op, plen, 1); - *pcc = CC_CLOBBER; break; } @@ -8296,8 +9025,6 @@ avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc, if (UNKNOWN == code_sat) return; - *pcc = (int) CC_CLOBBER; - /* Vanilla addition/subtraction is done. We are left with saturation. We have to compute A = A B where A is a register and @@ -8517,7 +9244,7 @@ avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc, /* Output addition/subtraction of register XOP[0] and a constant XOP[2] that - is ont a compile-time constant: + is not a compile-time constant: XOP[0] = XOP[0] +/- XOP[2] @@ -8525,7 +9252,7 @@ avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc, are additions/subtraction for pointer modes, i.e. HImode and PSImode. */ static const char * -avr_out_plus_symbol (rtx *xop, enum rtx_code code, int *plen, int *pcc) +avr_out_plus_symbol (rtx *xop, enum rtx_code code, int *plen) { machine_mode mode = GET_MODE (xop[0]); @@ -8533,8 +9260,6 @@ avr_out_plus_symbol (rtx *xop, enum rtx_code code, int *plen, int *pcc) gcc_assert (mode == HImode || mode == PSImode); - *pcc = MINUS == code ? (int) CC_SET_CZN : (int) CC_SET_N; - avr_asm_len (PLUS == code ? "subi %A0,lo8(-(%2))" CR_TAB "sbci %B0,hi8(-(%2))" : "subi %A0,lo8(%2)" CR_TAB "sbci %B0,hi8(%2)", @@ -8561,19 +9286,15 @@ avr_out_plus_symbol (rtx *xop, enum rtx_code code, int *plen, int *pcc) If PLEN == NULL output the instructions. If PLEN != NULL set *PLEN to the length of the sequence in words. - PCC is a pointer to store the instructions' effect on cc0. - PCC may be NULL. - - PLEN and PCC default to NULL. + PLEN defaults to NULL. OUT_LABEL defaults to TRUE. For a description, see AVR_OUT_PLUS_1. Return "" */ const char * -avr_out_plus (rtx insn, rtx *xop, int *plen, int *pcc, bool out_label) +avr_out_plus (rtx insn, rtx *xop, int *plen, bool out_label) { - int cc_plus, cc_minus, cc_dummy; int len_plus, len_minus; rtx op[4]; rtx xpattern = INSN_P (insn) ? single_set (as_a (insn)) : insn; @@ -8586,9 +9307,6 @@ avr_out_plus (rtx insn, rtx *xop, int *plen, int *pcc, bool out_label) = (PLUS == code_sat || SS_PLUS == code_sat || US_PLUS == code_sat ? PLUS : MINUS); - if (!pcc) - pcc = &cc_dummy; - /* PLUS and MINUS don't saturate: Use modular wrap-around. */ if (PLUS == code_sat || MINUS == code_sat) @@ -8596,7 +9314,7 @@ avr_out_plus (rtx insn, rtx *xop, int *plen, int *pcc, bool out_label) if (n_bytes <= 4 && REG_P (xop[2])) { - avr_out_plus_1 (xop, plen, code, pcc, code_sat, 0, out_label); + avr_out_plus_1 (insn, xop, plen, code, code_sat, 0, out_label); return ""; } @@ -8612,7 +9330,7 @@ avr_out_plus (rtx insn, rtx *xop, int *plen, int *pcc, bool out_label) && !CONST_INT_P (xop[2]) && !CONST_FIXED_P (xop[2])) { - return avr_out_plus_symbol (xop, code, plen, pcc); + return avr_out_plus_symbol (xop, code, plen); } op[0] = avr_to_int_mode (xop[0]); @@ -8639,18 +9357,15 @@ avr_out_plus (rtx insn, rtx *xop, int *plen, int *pcc, bool out_label) /* Work out the shortest sequence. */ - avr_out_plus_1 (op, &len_minus, MINUS, &cc_minus, code_sat, sign, out_label); - avr_out_plus_1 (op, &len_plus, PLUS, &cc_plus, code_sat, sign, out_label); + avr_out_plus_1 (insn, op, &len_minus, MINUS, code_sat, sign, out_label); + avr_out_plus_1 (insn, op, &len_plus, PLUS, code_sat, sign, out_label); if (plen) - { - *plen = (len_minus <= len_plus) ? len_minus : len_plus; - *pcc = (len_minus <= len_plus) ? cc_minus : cc_plus; - } + *plen = (len_minus <= len_plus) ? len_minus : len_plus; else if (len_minus <= len_plus) - avr_out_plus_1 (op, NULL, MINUS, pcc, code_sat, sign, out_label); + avr_out_plus_1 (insn, op, NULL, MINUS, code_sat, sign, out_label); else - avr_out_plus_1 (op, NULL, PLUS, pcc, code_sat, sign, out_label); + avr_out_plus_1 (insn, op, NULL, PLUS, code_sat, sign, out_label); return ""; } @@ -9080,6 +9795,178 @@ avr_out_insert_notbit (rtx_insn *insn, rtx op[], int *plen) } +/* Output instructions for XOP[0] = (XOP[1] XOP[2]) & XOP[3] where + - XOP[0] and XOP[1] have the same mode which is one of: QI, HI, PSI, SI. + - XOP[3] is an exact const_int power of 2. + - XOP[2] and XOP[3] are const_int. + - is any of: ASHIFT, LSHIFTRT, ASHIFTRT. + - The result depends on XOP[1]. + or XOP[0] = XOP[1] & XOP[2] where + - XOP[0] and XOP[1] have the same mode which is one of: HI, PSI, SI. + - XOP[2] is an exact const_int power of 2. + Returns "". + PLEN != 0: Set *PLEN to the code length in words. Don't output anything. + PLEN == 0: Output instructions. */ + +const char* +avr_out_insv (rtx_insn *insn, rtx xop[], int *plen) +{ + machine_mode mode = GET_MODE (xop[0]); + int n_bytes = GET_MODE_SIZE (mode); + rtx xsrc = SET_SRC (single_set (insn)); + + gcc_assert (AND == GET_CODE (xsrc)); + + rtx xop2 = xop[2]; + rtx xop3 = xop[3]; + + if (REG_P (XEXP (xsrc, 0))) + { + // This function can also handle AND with an exact power of 2, + // which can be regarded as a XOP[1] shift with offset 0. + rtx xshift = gen_rtx_ASHIFT (mode, xop[1], const0_rtx); + xsrc = gen_rtx_AND (mode, xshift, xop[2]); + xop3 = xop[2]; + xop2 = const0_rtx; + } + + // Any of ASHIFT, LSHIFTRT, ASHIFTRT. + enum rtx_code code = GET_CODE (XEXP (xsrc, 0)); + int shift = code == ASHIFT ? INTVAL (xop2) : -INTVAL (xop2); + + // Determines the position of the output bit. + unsigned mask = GET_MODE_MASK (mode) & INTVAL (xop3); + + // Position of the output / input bit, respectively. + int obit = exact_log2 (mask); + int ibit = obit - shift; + + gcc_assert (IN_RANGE (obit, 0, GET_MODE_BITSIZE (mode) - 1)); + gcc_assert (IN_RANGE (ibit, 0, GET_MODE_BITSIZE (mode) - 1)); + + // In the remainder, use the sub-bytes that hold the bits. + rtx op[4] = + { + // Output + simplify_gen_subreg (QImode, xop[0], mode, obit / 8), + GEN_INT (obit & 7), + // Input + simplify_gen_subreg (QImode, xop[1], mode, ibit / 8), + GEN_INT (ibit & 7) + }; + obit &= 7; + ibit &= 7; + + // The length of the default sequence at the end of this function. + // We only emit anything other than the default when we find a sequence + // that is strictly shorter than the default sequence; which is: + // BST + + BLD. + const int len0 = 2 + n_bytes - (n_bytes == 4 && AVR_HAVE_MOVW); + + // Finding something shorter than the default sequence implies that there + // must be at most 2 instructions that deal with the bytes containing the + // relevant bits. In addition, we need N_BYTES - 1 instructions to clear + // the remaining result bytes. + + const int n_clr = n_bytes - 1; + bool clr_p = false; + bool andi_p = false; + + if (plen) + *plen = 0; + + if (REGNO (op[0]) == REGNO (op[2]) + // Output reg allows ANDI. + && test_hard_reg_class (LD_REGS, op[0])) + { + if (1 + n_clr < len0 + // Same byte and bit: A single ANDI will do. + && obit == ibit) + { + clr_p = andi_p = true; + } + else if (2 + n_clr < len0 + // |obit - ibit| = 4: SWAP + ANDI will do. + && (obit == ibit + 4 || obit == ibit - 4)) + { + avr_asm_len ("swap %0", op, plen, 1); + clr_p = andi_p = true; + } + else if (2 + n_clr < len0 + // LSL + ANDI will do. + && obit == ibit + 1) + { + avr_asm_len ("lsl %0", op, plen, 1); + clr_p = andi_p = true; + } + else if (2 + n_clr < len0 + // LSR + ANDI will do. + && obit == ibit - 1) + { + avr_asm_len ("lsr %0", op, plen, 1); + clr_p = andi_p = true; + } + } + + if (REGNO (op[0]) != REGNO (op[2]) + && obit == ibit) + { + if (2 + n_clr < len0 + // Same bit but different byte: MOV + ANDI will do. + && test_hard_reg_class (LD_REGS, op[0])) + { + avr_asm_len ("mov %0,%2", op, plen, 1); + clr_p = andi_p = true; + } + else if (2 + n_clr < len0 + // Same bit but different byte: We can use ANDI + MOV, + // but only if the input byte is LD_REGS and unused after. + && test_hard_reg_class (LD_REGS, op[2]) + && reg_unused_after (insn, op[2])) + { + avr_asm_len ("andi %2,1<<%3" CR_TAB + "mov %0,%2", op, plen, 2); + clr_p = true; + } + } + + // Output remaining instructions of the shorter sequence. + + if (andi_p) + avr_asm_len ("andi %0,1<<%1", op, plen, 1); + + if (clr_p) + { + for (int b = 0; b < n_bytes; ++b) + { + rtx byte = simplify_gen_subreg (QImode, xop[0], mode, b); + if (REGNO (byte) != REGNO (op[0])) + avr_asm_len ("clr %0", &byte, plen, 1); + } + + // CLR_P means we found a shorter sequence, so we are done now. + return ""; + } + + // No shorter sequence found, just emit BST, CLR*, BLD sequence. + + avr_asm_len ("bst %2,%3", op, plen, -1); + + if (n_bytes == 4 && AVR_HAVE_MOVW) + avr_asm_len ("clr %A0" CR_TAB + "clr %B0" CR_TAB + "movw %C0,%A0", xop, plen, 3); + else + for (int b = 0; b < n_bytes; ++b) + { + rtx byte = simplify_gen_subreg (QImode, xop[0], mode, b); + avr_asm_len ("clr %0", &byte, plen, 1); + } + + return avr_asm_len ("bld %0,%1", op, plen, 1); +} + + /* Output instructions to extract a bit to 8-bit register XOP[0]. The input XOP[1] is a register or an 8-bit MEM in the lower I/O range. XOP[2] is the const_int bit position. Return "". @@ -9751,7 +10638,7 @@ avr_out_fract (rtx_insn *insn, rtx operands[], bool intsigned, int *plen) preparing operands for calls to `avr_out_plus' and `avr_out_bitop'. */ const char * -avr_out_round (rtx_insn *insn ATTRIBUTE_UNUSED, rtx *xop, int *plen) +avr_out_round (rtx_insn * /*insn*/, rtx *xop, int *plen) { scalar_mode mode = as_a (GET_MODE (xop[0])); scalar_int_mode imode = int_mode_for_mode (mode).require (); @@ -9779,7 +10666,7 @@ avr_out_round (rtx_insn *insn ATTRIBUTE_UNUSED, rtx *xop, int *plen) op[0] = xop[0]; op[1] = xop[1]; op[2] = xadd; - avr_out_plus (xpattern, op, plen_add, NULL, false /* Don't print "0:" */); + avr_out_plus (xpattern, op, plen_add, false /* Don't print "0:" */); avr_asm_len ("rjmp 1f" CR_TAB "0:", NULL, plen_add, 1); @@ -9822,7 +10709,6 @@ avr_rotate_bytes (rtx operands[]) /* Work out if byte or word move is needed. Odd byte rotates need QImode. Word move if no scratch is needed, otherwise use size of scratch. */ machine_mode move_mode = QImode; - int move_size, offset, size; if (num & 0xf) move_mode = QImode; @@ -9841,11 +10727,11 @@ avr_rotate_bytes (rtx operands[]) && QImode == move_mode) scratch = simplify_gen_subreg (move_mode, scratch, HImode, 0); - move_size = GET_MODE_SIZE (move_mode); + int move_size = GET_MODE_SIZE (move_mode); /* Number of bytes/words to rotate. */ - offset = (num >> 3) / move_size; + int offset = (num >> 3) / move_size; /* Number of moves needed. */ - size = GET_MODE_SIZE (mode) / move_size; + int size = GET_MODE_SIZE (mode) / move_size; /* Himode byte swap is special case to avoid a scratch register. */ if (mode == HImode && same_reg) { @@ -9963,7 +10849,6 @@ int avr_adjust_insn_length (rtx_insn *insn, int len) { rtx *op = recog_data.operand; - enum attr_adjust_len adjust_len; /* As we pretend jump tables in .text, fix branch offsets crossing jump tables now. */ @@ -9983,7 +10868,7 @@ avr_adjust_insn_length (rtx_insn *insn, int len) /* Read from insn attribute "adjust_len" if/how length is to be adjusted. */ - adjust_len = get_attr_adjust_len (insn); + enum attr_adjust_len adjust_len = get_attr_adjust_len (insn); if (adjust_len == ADJUST_LEN_NO) { @@ -10008,6 +10893,7 @@ avr_adjust_insn_length (rtx_insn *insn, int len) case ADJUST_LEN_OUT_BITOP: avr_out_bitop (insn, op, &len); break; case ADJUST_LEN_EXTR_NOT: avr_out_extr_not (insn, op, &len); break; case ADJUST_LEN_EXTR: avr_out_extr (insn, op, &len); break; + case ADJUST_LEN_INSV: avr_out_insv (insn, op, &len); break; case ADJUST_LEN_PLUS: avr_out_plus (insn, op, &len); break; case ADJUST_LEN_ADDTO_SP: avr_out_addto_sp (op, &len); break; @@ -10068,31 +10954,32 @@ int reg_unused_after (rtx_insn *insn, rtx reg) { return (dead_or_set_p (insn, reg) - || (REG_P (reg) && _reg_unused_after (insn, reg))); + || (REG_P (reg) && _reg_unused_after (insn, reg, true))); } -/* Return nonzero if REG is not used after INSN. +/* A helper for the previous function. + Return nonzero if REG is not used after INSN. We assume REG is a reload reg, and therefore does not live past labels. It may live past calls or jumps though. */ -int -_reg_unused_after (rtx_insn *insn, rtx reg) +bool +_reg_unused_after (rtx_insn *insn, rtx reg, bool look_at_insn) { - enum rtx_code code; - rtx set; - - /* If the reg is set by this instruction, then it is safe for our - case. Disregard the case where this is a store to memory, since - we are checking a register used in the store address. */ - set = single_set (insn); - if (set && !MEM_P (SET_DEST (set)) - && reg_overlap_mentioned_p (reg, SET_DEST (set))) - return 1; + if (look_at_insn) + { + /* If the reg is set by this instruction, then it is safe for our + case. Disregard the case where this is a store to memory, since + we are checking a register used in the store address. */ + rtx set = single_set (insn); + if (set && !MEM_P (SET_DEST (set)) + && reg_overlap_mentioned_p (reg, SET_DEST (set))) + return 1; + } while ((insn = NEXT_INSN (insn))) { rtx set; - code = GET_CODE (insn); + enum rtx_code code = GET_CODE (insn); #if 0 /* If this is a label that existed before reload, then the register @@ -10233,14 +11120,14 @@ avr_assemble_integer (rtx x, unsigned int size, int aligned_p) return default_assemble_integer (x, size, aligned_p); } -/* Implement TARGET_CLASS_MAX_NREGS. Reasons described in comments for +/* Implement `TARGET_CLASS_MAX_NREGS'. Reasons described in comments for avr_hard_regno_nregs. */ static unsigned char avr_class_max_nregs (reg_class_t rclass, machine_mode mode) { if (rclass == CC_REG && mode == CCmode) - return 1; + return 1; return CEIL (GET_MODE_SIZE (mode), UNITS_PER_WORD); } @@ -10254,8 +11141,8 @@ avr_class_max_nregs (reg_class_t rclass, machine_mode mode) static bool avr_class_likely_spilled_p (reg_class_t c) { - return (c != ALL_REGS && - (AVR_TINY ? 1 : c != ADDW_REGS)); + return (c != ALL_REGS + && (AVR_TINY ? 1 : c != ADDW_REGS)); } @@ -10272,10 +11159,8 @@ avr_class_likely_spilled_p (reg_class_t c) struct attribute_spec.handler. */ static tree -avr_handle_progmem_attribute (tree *node, tree name, - tree args ATTRIBUTE_UNUSED, - int flags ATTRIBUTE_UNUSED, - bool *no_add_attrs) +avr_handle_progmem_attribute (tree *node, tree name, tree args, + int /*flags*/, bool *no_add_attrs) { if (DECL_P (*node)) { @@ -10311,10 +11196,8 @@ avr_handle_progmem_attribute (tree *node, tree name, struct attribute_spec.handler. */ static tree -avr_handle_fndecl_attribute (tree *node, tree name, - tree args ATTRIBUTE_UNUSED, - int flags ATTRIBUTE_UNUSED, - bool *no_add_attrs) +avr_handle_fndecl_attribute (tree *node, tree name, tree /*args*/, + int /*flags*/, bool *no_add_attrs) { if (TREE_CODE (*node) != FUNCTION_DECL) { @@ -10327,10 +11210,8 @@ avr_handle_fndecl_attribute (tree *node, tree name, } static tree -avr_handle_fntype_attribute (tree *node, tree name, - tree args ATTRIBUTE_UNUSED, - int flags ATTRIBUTE_UNUSED, - bool *no_add_attrs) +avr_handle_fntype_attribute (tree *node, tree name, tree /*args*/, + int /*flags*/, bool *no_add_attrs) { if (TREE_CODE (*node) != FUNCTION_TYPE) { @@ -10370,7 +11251,7 @@ avr_handle_absdata_attribute (tree *node, tree name, tree /* args */, static tree avr_handle_addr_attribute (tree *node, tree name, tree args, - int flags ATTRIBUTE_UNUSED, bool *no_add) + int /*flags*/, bool *no_add) { bool io_p = startswith (IDENTIFIER_POINTER (name), "io"); HOST_WIDE_INT io_start = avr_arch->sfr_offset; @@ -10527,7 +11408,8 @@ avr_addr_space_diagnose_usage (addr_space_t as, location_t loc) (void) avr_addr_space_supported_p (as, loc); } -/* Implement `TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID. Zero is a valid + +/* Implement `TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID'. Zero is a valid address in all address spaces. Even in ADDR_SPACE_FLASH1 etc.., a zero address is valid and means 0x0000, where RAMPZ is set to the appropriate segment value. */ @@ -10538,6 +11420,7 @@ avr_addr_space_zero_address_valid (addr_space_t) return true; } + /* Look if DECL shall be placed in program memory space by means of attribute `progmem' or some address-space qualifier. Return non-zero if DECL is data that must end up in Flash and @@ -10551,8 +11434,6 @@ avr_addr_space_zero_address_valid (addr_space_t) int avr_progmem_p (tree decl, tree attributes) { - tree a; - if (TREE_CODE (decl) != VAR_DECL) return 0; @@ -10566,7 +11447,7 @@ avr_progmem_p (tree decl, tree attributes) != lookup_attribute ("progmem", attributes)) return -1; - a = decl; + tree a = decl; do a = TREE_TYPE(a); @@ -10606,7 +11487,6 @@ avr_nonconst_pointer_addrspace (tree typ) if (POINTER_TYPE_P (typ)) { - addr_space_t as; tree target = TREE_TYPE (typ); /* Pointer to function: Test the function's return type. */ @@ -10621,7 +11501,7 @@ avr_nonconst_pointer_addrspace (tree typ) /* Pointers to non-generic address space must be const. */ - as = TYPE_ADDR_SPACE (target); + addr_space_t as = TYPE_ADDR_SPACE (target); if (!ADDR_SPACE_GENERIC_P (as) && !TYPE_READONLY (target) @@ -10740,7 +11620,6 @@ avr_insert_attributes (tree node, tree *attributes) && (TREE_STATIC (node) || DECL_EXTERNAL (node)) && avr_progmem_p (node, *attributes)) { - addr_space_t as; tree node0 = node; /* For C++, we have to peel arrays in order to get correct @@ -10753,7 +11632,7 @@ avr_insert_attributes (tree node, tree *attributes) if (error_mark_node == node0) return; - as = TYPE_ADDR_SPACE (TREE_TYPE (node)); + addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (node)); if (!TYPE_READONLY (node0) && !TREE_READONLY (node)) @@ -10994,7 +11873,7 @@ avr_asm_named_section (const char *name, unsigned int flags, tree decl) if (!avr_has_rodata_p) avr_has_rodata_p = (startswith (name, ".rodata") - || startswith (name, ".gnu.linkonce.r")); + || startswith (name, ".gnu.linkonce.r")); if (!avr_need_clear_bss_p) avr_need_clear_bss_p = startswith (name, ".bss"); @@ -11412,8 +12291,7 @@ avr_adjust_reg_alloc_order (void) /* Implement `TARGET_REGISTER_MOVE_COST' */ static int -avr_register_move_cost (machine_mode mode ATTRIBUTE_UNUSED, - reg_class_t from, reg_class_t to) +avr_register_move_cost (machine_mode /*mode*/, reg_class_t from, reg_class_t to) { return (from == STACK_REG ? 6 : to == STACK_REG ? 12 @@ -11424,9 +12302,7 @@ avr_register_move_cost (machine_mode mode ATTRIBUTE_UNUSED, /* Implement `TARGET_MEMORY_MOVE_COST' */ static int -avr_memory_move_cost (machine_mode mode, - reg_class_t rclass ATTRIBUTE_UNUSED, - bool in ATTRIBUTE_UNUSED) +avr_memory_move_cost (machine_mode mode, reg_class_t /*rclass*/, bool /*in*/) { return (mode == QImode ? 2 : mode == HImode ? 4 @@ -11503,6 +12379,14 @@ avr_cbranch_cost (rtx x) return COSTS_N_INSNS (size + 1 + 1); } + if (GET_CODE (xreg) == ZERO_EXTRACT + && XEXP (xreg, 1) == const1_rtx) + { + // Branch on a single bit, with an additional edge due to less + // register pressure. + return (int) COSTS_N_INSNS (1.5); + } + bool reg_p = register_operand (xreg, mode); bool reg_or_0_p = reg_or_0_operand (xval, mode); @@ -11525,7 +12409,6 @@ avr_operand_rtx_cost (rtx x, machine_mode mode, enum rtx_code outer, int opno, bool speed) { enum rtx_code code = GET_CODE (x); - int total; switch (code) { @@ -11542,7 +12425,7 @@ avr_operand_rtx_cost (rtx x, machine_mode mode, enum rtx_code outer, break; } - total = 0; + int total = 0; avr_rtx_costs (x, mode, outer, opno, &total, speed); return total; } @@ -11555,7 +12438,7 @@ avr_operand_rtx_cost (rtx x, machine_mode mode, enum rtx_code outer, static bool avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code, - int opno ATTRIBUTE_UNUSED, int *total, bool speed) + int /*opno*/, int *total, bool speed) { enum rtx_code code = GET_CODE (x); HOST_WIDE_INT val; @@ -11630,6 +12513,39 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code, return true; case PLUS: + // uint16_t += 2 * uint8_t; + if (mode == HImode + && GET_CODE (XEXP (x, 0)) == ASHIFT + && REG_P (XEXP (x, 1)) + && XEXP (XEXP (x, 0), 1) == const1_rtx + && GET_CODE (XEXP (XEXP (x, 0), 0)) == ZERO_EXTEND) + { + *total = COSTS_N_INSNS (4); + return true; + } + + // *usum_widenqihi + if (mode == HImode + && GET_CODE (XEXP (x, 0)) == ZERO_EXTEND + && GET_CODE (XEXP (x, 1)) == ZERO_EXTEND) + { + *total = COSTS_N_INSNS (3); + return true; + } + + if (GET_CODE (XEXP (x, 0)) == ZERO_EXTEND + && REG_P (XEXP (x, 1))) + { + *total = COSTS_N_INSNS (GET_MODE_SIZE (mode)); + return true; + } + if (REG_P (XEXP (x, 0)) + && GET_CODE (XEXP (x, 1)) == ZERO_EXTEND) + { + *total = COSTS_N_INSNS (GET_MODE_SIZE (mode)); + return true; + } + switch (mode) { case E_QImode: @@ -11709,6 +12625,29 @@ avr_rtx_costs_1 (rtx x, machine_mode mode, int outer_code, return true; case MINUS: + // *udiff_widenqihi + if (mode == HImode + && GET_CODE (XEXP (x, 0)) == ZERO_EXTEND + && GET_CODE (XEXP (x, 1)) == ZERO_EXTEND) + { + *total = COSTS_N_INSNS (2); + return true; + } + // *sub3_zero_extend1 + if (REG_P (XEXP (x, 0)) + && GET_CODE (XEXP (x, 1)) == ZERO_EXTEND) + { + *total = COSTS_N_INSNS (GET_MODE_SIZE (mode)); + return true; + } + // *sub3.sign_extend2 + if (REG_P (XEXP (x, 0)) + && GET_CODE (XEXP (x, 1)) == SIGN_EXTEND) + { + *total = COSTS_N_INSNS (2 + GET_MODE_SIZE (mode)); + return true; + } + if (AVR_HAVE_MUL && QImode == mode && register_operand (XEXP (x, 0), QImode) @@ -12500,9 +13439,8 @@ avr_insn_cost (rtx_insn *insn, bool speed) /* Implement `TARGET_ADDRESS_COST'. */ static int -avr_address_cost (rtx x, machine_mode mode ATTRIBUTE_UNUSED, - addr_space_t as ATTRIBUTE_UNUSED, - bool speed ATTRIBUTE_UNUSED) +avr_address_cost (rtx x, machine_mode mode, addr_space_t /*as*/, + bool /*speed*/) { int cost = 4; @@ -12590,7 +13528,7 @@ avr_normalize_condition (RTX_CODE condition) static inline unsigned int avr_ret_register (void) { - return 24; + return REG_24; } @@ -12599,7 +13537,7 @@ avr_ret_register (void) static bool avr_function_value_regno_p (const unsigned int regno) { - return (regno == avr_ret_register ()); + return regno == avr_ret_register (); } @@ -12608,8 +13546,7 @@ avr_function_value_regno_p (const unsigned int regno) library function returns a value of mode MODE. */ static rtx -avr_libcall_value (machine_mode mode, - const_rtx func ATTRIBUTE_UNUSED) +avr_libcall_value (machine_mode mode, const_rtx /*func*/) { int offs = GET_MODE_SIZE (mode); @@ -12625,16 +13562,13 @@ avr_libcall_value (machine_mode mode, function returns a value of data type VALTYPE. */ static rtx -avr_function_value (const_tree type, - const_tree fn_decl_or_type ATTRIBUTE_UNUSED, - bool outgoing ATTRIBUTE_UNUSED) +avr_function_value (const_tree type, const_tree /*fn_decl_or_type*/, + bool /*outgoing*/) { - unsigned int offs; - if (TYPE_MODE (type) != BLKmode) return avr_libcall_value (TYPE_MODE (type), NULL_RTX); - offs = int_size_in_bytes (type); + unsigned int offs = int_size_in_bytes (type); if (offs < 2) offs = 2; if (offs > 2 && offs < GET_MODE_SIZE (SImode)) @@ -12721,7 +13655,8 @@ jump_over_one_insn_p (rtx_insn *insn, rtx dest) && avr_2word_insn_p (next_active_insn (insn)))); } -/* Implement TARGET_HARD_REGNO_NREGS. CCmode is four units for historical + +/* Implement `TARGET_HARD_REGNO_NREGS'. CCmode is four units for historical reasons. If this hook is not defined, TARGET_HARD_REGNO_NREGS reports that CCmode requires four registers. Define this hook to allow CCmode to fit in a single REG_CC. For @@ -12738,7 +13673,7 @@ avr_hard_regno_nregs (unsigned int regno, machine_mode mode) } -/* Implement TARGET_HARD_REGNO_MODE_OK. On the enhanced core, anything +/* Implement `TARGET_HARD_REGNO_MODE_OK'. On the enhanced core, anything larger than 1 byte must start in even numbered register for "movw" to work (this way we don't have to check for odd registers everywhere). */ @@ -12776,7 +13711,7 @@ avr_hard_regno_mode_ok (unsigned int regno, machine_mode mode) } -/* Implement TARGET_HARD_REGNO_CALL_PART_CLOBBERED. */ +/* Implement `TARGET_HARD_REGNO_CALL_PART_CLOBBERED'. */ static bool avr_hard_regno_call_part_clobbered (unsigned, unsigned regno, @@ -12803,15 +13738,19 @@ avr_hard_regno_call_part_clobbered (unsigned, unsigned regno, /* Implement `MODE_CODE_BASE_REG_CLASS'. */ enum reg_class -avr_mode_code_base_reg_class (machine_mode mode ATTRIBUTE_UNUSED, - addr_space_t as, RTX_CODE outer_code, - RTX_CODE index_code ATTRIBUTE_UNUSED) +avr_mode_code_base_reg_class (machine_mode /*mode*/, addr_space_t as, + RTX_CODE outer_code, RTX_CODE /*index_code*/) { if (!ADDR_SPACE_GENERIC_P (as)) { return POINTER_Z_REGS; } + if (AVR_TINY) + // We allow all offsets for all pointer regs. Pass .avr-fuse-add + // will rectify it (register allocation cannot do it). + return POINTER_REGS; + if (!avr_strict_X) return reload_completed ? BASE_POINTER_REGS : POINTER_REGS; @@ -12822,11 +13761,9 @@ avr_mode_code_base_reg_class (machine_mode mode ATTRIBUTE_UNUSED, /* Implement `REGNO_MODE_CODE_OK_FOR_BASE_P'. */ bool -avr_regno_mode_code_ok_for_base_p (int regno, - machine_mode mode ATTRIBUTE_UNUSED, - addr_space_t as ATTRIBUTE_UNUSED, - RTX_CODE outer_code, - RTX_CODE index_code ATTRIBUTE_UNUSED) +avr_regno_mode_code_ok_for_base_p (int regno, machine_mode /*mode*/, + addr_space_t as, RTX_CODE outer_code, + RTX_CODE /*index_code*/) { bool ok = false; @@ -12873,6 +13810,12 @@ avr_regno_mode_code_ok_for_base_p (int regno, } if (avr_strict_X + // On Reduced Tiny, all registers are equal in that they do not + // support PLUS addressing; respective addresses will be fake, + // even for the frame pointer. They must be handled in the + // printers by add-store-sub sequences -- or may be split after + // reload by `avr_split_tiny_move'. + && ! AVR_TINY && PLUS == outer_code && regno == REG_X) { @@ -12920,8 +13863,8 @@ output_reload_in_const (rtx *op, rtx clobber_reg, int *len, bool clear_p) /* (REG:SI 14) is special: It's neither in LD_REGS nor in NO_LD_REGS but has some subregs that are in LD_REGS. Use the MSB (REG:QI 17). */ - if (REGNO (dest) < 16 - && REGNO (dest) + GET_MODE_SIZE (mode) > 16) + if (REGNO (dest) < REG_16 + && REGNO (dest) + GET_MODE_SIZE (mode) > REG_16) { clobber_reg = all_regs_rtx[REGNO (dest) + n_bytes - 1]; } @@ -12948,14 +13891,13 @@ output_reload_in_const (rtx *op, rtx clobber_reg, int *len, bool clear_p) for (int n = 0; n < n_bytes; n++) { - int ldreg_p; bool done_byte = false; rtx xop[3]; /* Crop the n-th destination byte. */ xdest[n] = simplify_gen_subreg (QImode, dest, mode, n); - ldreg_p = test_hard_reg_class (LD_REGS, xdest[n]); + int ldreg_p = test_hard_reg_class (LD_REGS, xdest[n]); if (!CONST_INT_P (src) && !CONST_FIXED_P (src) @@ -13150,8 +14092,6 @@ output_reload_insisf (rtx *op, rtx clobber_reg, int *len) || CONST_FIXED_P (op[1]) || CONST_DOUBLE_P (op[1]))) { - int len_clr, len_noclr; - /* In some cases it is better to clear the destination beforehand, e.g. CLR R2 CLR R3 MOVW R4,R2 INC R2 @@ -13164,6 +14104,7 @@ output_reload_insisf (rtx *op, rtx clobber_reg, int *len) Instead, we call the print function twice to get the lengths of both methods and use the shortest one. */ + int len_clr, len_noclr; output_reload_in_const (op, clobber_reg, &len_clr, true); output_reload_in_const (op, clobber_reg, &len_noclr, false); @@ -13301,7 +14242,7 @@ avr_conditional_register_usage (void) - R0-R15 are not available in Tiny Core devices - R16 and R17 are fixed registers. */ - for (size_t i = 0; i <= 17; i++) + for (size_t i = REG_0; i <= REG_17; i++) { fixed_regs[i] = 1; call_used_regs[i] = 1; @@ -13311,7 +14252,7 @@ avr_conditional_register_usage (void) - R18, R19, R20 and R21 are the callee saved registers in Tiny Core devices */ - for (size_t i = 18; i <= LAST_CALLEE_SAVED_REG; i++) + for (size_t i = REG_18; i <= LAST_CALLEE_SAVED_REG; i++) { call_used_regs[i] = 0; } @@ -13359,8 +14300,7 @@ avr_hard_regno_scratch_ok (unsigned int regno) /* Return nonzero if register OLD_REG can be renamed to register NEW_REG. */ int -avr_hard_regno_rename_ok (unsigned int old_reg, - unsigned int new_reg) +avr_hard_regno_rename_ok (unsigned int old_reg, unsigned int new_reg) { /* Interrupt functions can only use registers that have already been saved by the prologue, even if they would normally be @@ -13455,6 +14395,7 @@ avr_out_sbxx_branch (rtx_insn *insn, rtx operands[]) return ""; } + /* Worker function for `TARGET_ASM_CONSTRUCTOR'. */ static void @@ -13475,10 +14416,10 @@ avr_asm_out_dtor (rtx symbol, int priority) } -/* Worker function for `TARGET_RETURN_IN_MEMORY'. */ +/* Implement `TARGET_RETURN_IN_MEMORY'. */ static bool -avr_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED) +avr_return_in_memory (const_tree type, const_tree /*fntype*/) { HOST_WIDE_INT size = int_size_in_bytes (type); HOST_WIDE_INT ret_size_limit = AVR_TINY ? 4 : 8; @@ -13673,7 +14614,6 @@ avr_addr_space_convert (rtx src, tree type_from, tree type_to) if (as_from != ADDR_SPACE_MEMX && as_to == ADDR_SPACE_MEMX) { - int msb; rtx sym = src; rtx reg = gen_reg_rtx (PSImode); @@ -13694,7 +14634,7 @@ avr_addr_space_convert (rtx src, tree type_from, tree type_to) /* Linearize memory: RAM has bit 23 set. */ - msb = ADDR_SPACE_GENERIC_P (as_from) + int msb = ADDR_SPACE_GENERIC_P (as_from) ? 0x80 : avr_addrspace[as_from].segment; @@ -13728,8 +14668,7 @@ avr_addr_space_convert (rtx src, tree type_from, tree type_to) /* Implement `TARGET_ADDR_SPACE_SUBSET_P'. */ static bool -avr_addr_space_subset_p (addr_space_t subset ATTRIBUTE_UNUSED, - addr_space_t superset ATTRIBUTE_UNUSED) +avr_addr_space_subset_p (addr_space_t /*subset*/, addr_space_t /*superset*/) { /* Allow any kind of pointer mess. */ @@ -13798,7 +14737,6 @@ avr_convert_to_type (tree type, tree expr) /* Implement `TARGET_LEGITIMATE_COMBINED_INSN'. */ - /* PR78883: Filter out paradoxical SUBREGs of MEM which are not handled properly by following passes. As INSN_SCHEDULING is off and hence general_operand accepts such expressions, ditch them now. */ @@ -13945,10 +14883,9 @@ avr_emit3_fix_outputs (rtx (*gen)(rtx,rtx,rtx), rtx *op, bool avr_emit_cpymemhi (rtx *xop) { - HOST_WIDE_INT count; machine_mode loop_mode; addr_space_t as = MEM_ADDR_SPACE (xop[1]); - rtx loop_reg, addr1, a_src, a_dest, insn, xas; + rtx loop_reg, addr1, insn; rtx a_hi8 = NULL_RTX; if (avr_mem_flash_p (xop[0])) @@ -13957,12 +14894,12 @@ avr_emit_cpymemhi (rtx *xop) if (!CONST_INT_P (xop[2])) return false; - count = INTVAL (xop[2]); + HOST_WIDE_INT count = INTVAL (xop[2]); if (count <= 0) return false; - a_src = XEXP (xop[1], 0); - a_dest = XEXP (xop[0], 0); + rtx a_src = XEXP (xop[1], 0); + rtx a_dest = XEXP (xop[0], 0); if (PSImode == GET_MODE (a_src)) { @@ -13996,7 +14933,7 @@ avr_emit_cpymemhi (rtx *xop) loop_reg = copy_to_mode_reg (loop_mode, gen_int_mode (count, loop_mode)); } - xas = GEN_INT (as); + rtx xas = GEN_INT (as); /* FIXME: Register allocator might come up with spill fails if it is left on its own. Thus, we allocate the pointer registers by hand: @@ -14049,20 +14986,16 @@ avr_emit_cpymemhi (rtx *xop) */ const char * -avr_out_cpymem (rtx_insn *insn ATTRIBUTE_UNUSED, rtx *op, int *plen) +avr_out_cpymem (rtx_insn * /*insn*/, rtx *op, int *plen) { addr_space_t as = (addr_space_t) INTVAL (op[0]); machine_mode loop_mode = GET_MODE (op[1]); bool sbiw_p = avr_adiw_reg_p (op[1]); - rtx xop[3]; + rtx xop[3] = { op[0], op[1], tmp_reg_rtx }; if (plen) *plen = 0; - xop[0] = op[0]; - xop[1] = op[1]; - xop[2] = tmp_reg_rtx; - /* Loop label */ avr_asm_len ("0:", xop, plen, 0); @@ -14388,9 +15321,9 @@ avr_map_decompose (unsigned int f, const avr_map_op_t *g, bool val_const_p) fake values. Mimic effect of reloading xop[3]: Unused operands are mapped to 0 and used operands are reloaded to xop[0]. */ - xop[0] = all_regs_rtx[24]; + xop[0] = all_regs_rtx[REG_24]; xop[1] = gen_int_mode (f_ginv.map, SImode); - xop[2] = all_regs_rtx[25]; + xop[2] = all_regs_rtx[REG_25]; xop[3] = val_used_p ? xop[0] : const0_rtx; avr_out_insert_bits (xop, &f_ginv.cost); @@ -14468,7 +15401,6 @@ const char * avr_out_insert_bits (rtx *op, int *plen) { unsigned int map = UINTVAL (op[1]) & GET_MODE_MASK (SImode); - unsigned mask_fixed; bool fixp_p = true; rtx xop[4]; @@ -14486,7 +15418,7 @@ avr_out_insert_bits (rtx *op, int *plen) /* If MAP has fixed points it might be better to initialize the result with the bits to be inserted instead of moving all bits by hand. */ - mask_fixed = avr_map_metric (map, MAP_MASK_FIXED_0_7); + unsigned mask_fixed = avr_map_metric (map, MAP_MASK_FIXED_0_7); if (REGNO (xop[0]) == REGNO (xop[1])) { @@ -14577,7 +15509,7 @@ avr_bdesc[AVR_BUILTIN_COUNT] = /* Implement `TARGET_BUILTIN_DECL'. */ static tree -avr_builtin_decl (unsigned id, bool initialize_p ATTRIBUTE_UNUSED) +avr_builtin_decl (unsigned id, bool /*initialize_p*/) { if (id < AVR_BUILTIN_COUNT) return avr_bdesc[id].fndecl; @@ -14849,10 +15781,8 @@ avr_default_expand_builtin (enum insn_code icode, tree exp, rtx target) IGNORE is nonzero if the value is to be ignored. */ static rtx -avr_expand_builtin (tree exp, rtx target, - rtx subtarget ATTRIBUTE_UNUSED, - machine_mode mode ATTRIBUTE_UNUSED, - int ignore) +avr_expand_builtin (tree exp, rtx target, rtx /*subtarget*/, + machine_mode mode, int ignore) { tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0); const char *bname = IDENTIFIER_POINTER (DECL_NAME (fndecl)); @@ -15005,8 +15935,7 @@ avr_fold_absfx (tree tval) /* Implement `TARGET_FOLD_BUILTIN'. */ static tree -avr_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, tree *arg, - bool ignore ATTRIBUTE_UNUSED) +avr_fold_builtin (tree fndecl, int /*n_args*/, tree *arg, bool /*ignore*/) { unsigned int fcode = DECL_MD_FUNCTION_CODE (fndecl); tree val_type = TREE_TYPE (TREE_TYPE (fndecl)); @@ -15067,9 +15996,7 @@ avr_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, tree *arg, { tree tbits = arg[1]; tree tval = arg[2]; - tree tmap; tree map_type = TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (fndecl))); - unsigned int map; bool changed = false; avr_map_op_t best_g; @@ -15081,8 +16008,8 @@ avr_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, tree *arg, break; } - tmap = wide_int_to_tree (map_type, wi::to_wide (arg[0])); - map = TREE_INT_CST_LOW (tmap); + tree tmap = wide_int_to_tree (map_type, wi::to_wide (arg[0])); + unsigned int map = TREE_INT_CST_LOW (tmap); if (TREE_CODE (tval) != INTEGER_CST && avr_map_metric (map, MAP_MASK_PREIMAGE_F) == 0) @@ -15198,6 +16125,8 @@ avr_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, tree *arg, return NULL_TREE; } + +/* Implement `TARGET_MD_ASM_ADJUST'. */ /* Prepend to CLOBBERS hard registers that are automatically clobbered for an asm. We do this for CC_REGNUM to maintain source compatibility with the original cc0-based compiler. */ diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index ff2738df78c7..56211fa9cd00 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -333,6 +333,10 @@ typedef struct avr_args /* Next available register number */ int regno; + + /* Whether some of the arguments are passed on the stack, + and hence an arg pointer is needed. */ + int has_stack_args; } CUMULATIVE_ARGS; #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \ diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md index 49e586723aba..bc408633eb5d 100644 --- a/gcc/config/avr/avr.md +++ b/gcc/config/avr/avr.md @@ -31,7 +31,7 @@ ;; j Branch condition. ;; k Reverse branch condition. ;;..m..Constant Direct Data memory address. -;; i Print the SFR address quivalent of a CONST_INT or a CONST_INT +;; i Print the SFR address equivalent of a CONST_INT or a CONST_INT ;; RAM address. The resulting address is suitable to be used in IN/OUT. ;; o Displacement for (mem (plus (reg) (const_int))) operands. ;; p POST_INC or PRE_DEC address as a pointer (X, Y, Z) @@ -51,22 +51,33 @@ ;; ~ Output 'r' if not AVR_HAVE_JMP_CALL. ;; ! Output 'e' if AVR_HAVE_EIJMP_EICALL. +;; Used in avr.cc to avoid magic numbers for register numbers. +(define_constants + [(REG_0 0) (REG_1 1) (REG_2 2) + (REG_8 8) (REG_9 9) (REG_10 10) (REG_11 11) + (REG_12 12) (REG_13 13) (REG_14 14) (REG_15 15) + (REG_16 16) (REG_17 17) (REG_18 18) (REG_19 19) + (REG_20 20) (REG_21 21) (REG_22 22) (REG_23 23) + (REG_24 24) (REG_25 25) (REG_26 26) (REG_27 27) + (REG_28 28) (REG_29 29) (REG_30 30) (REG_31 31) + (REG_32 32) (REG_36 36) + ]) (define_constants - [(REG_X 26) - (REG_Y 28) - (REG_Z 30) - (REG_W 24) - (REG_SP 32) - (REG_CC 36) - (LPM_REGNO 0) ; implicit target register of LPM - (TMP_REGNO 0) ; temporary register r0 - (ZERO_REGNO 1) ; zero register r1 + [(REG_X REG_26) + (REG_Y REG_28) + (REG_Z REG_30) + (REG_W REG_24) + (REG_SP REG_32) + (REG_CC REG_36) + (LPM_REGNO REG_0) ; implicit target register of LPM + (TMP_REGNO REG_0) ; temporary register r0 + (ZERO_REGNO REG_1) ; zero register r1 ]) (define_constants - [(TMP_REGNO_TINY 16) ; r16 is temp register for AVR_TINY - (ZERO_REGNO_TINY 17) ; r17 is zero register for AVR_TINY + [(TMP_REGNO_TINY REG_16) ; r16 is temp register for AVR_TINY + (ZERO_REGNO_TINY REG_17) ; r17 is zero register for AVR_TINY ]) (define_c_enum "unspec" @@ -105,10 +116,6 @@ (include "predicates.md") (include "constraints.md") -;; Condition code settings. -(define_attr "cc" "none,set_czn,set_zn,set_vzn,set_n,compare,clobber, - plus,ldi" - (const_string "none")) (define_attr "type" "branch,branch1,arith,xcall" (const_string "arith")) @@ -163,7 +170,7 @@ ashlhi, ashrhi, lshrhi, ashlsi, ashrsi, lshrsi, ashlpsi, ashrpsi, lshrpsi, - insert_bits, insv_notbit, + insert_bits, insv_notbit, insv, add_set_ZN, cmp_uext, cmp_sext, no" (const_string "no")) @@ -370,8 +377,8 @@ rtx offset = gen_int_mode (targetm.starting_frame_offset (), Pmode); emit_move_insn (virtual_stack_vars_rtx, gen_rtx_PLUS (Pmode, hard_frame_pointer_rtx, offset)); - /* ; This might change the hard frame pointer in ways that aren't - ; apparent to early optimization passes, so force a clobber. */ + // This might change the hard frame pointer in ways that aren't + // apparent to early optimization passes, so force a clobber. emit_clobber (hard_frame_pointer_rtx); DONE; }) @@ -468,7 +475,7 @@ // (reg:HI 28))) // (set (mem:HI (post_dec:HI (reg:HI 32 SP)) // (reg:HI **))) - + emit_insn (gen_pushhi1_insn (operands[0])); DONE; } @@ -533,7 +540,7 @@ "#" "&& reload_completed" [(parallel [(set (reg:MOVMODE 22) - (match_dup 0)) + (match_dup 0)) (clobber (reg:CC REG_CC))])] "" [(set_attr "isa" "rjmp,jmp")]) @@ -568,11 +575,10 @@ "&& 1" [(clobber (const_int 0))] { - /* ; Split away the high part of the address. GCC's register allocator - ; in not able to allocate segment registers and reload the resulting - ; expressions. Notice that no address register can hold a PSImode. */ + // Split away the high part of the address. GCC's register allocator + // is not able to allocate segment registers and reload the resulting + // expressions. Notice that no address register can hold a PSImode. - rtx_insn *insn; rtx addr = XEXP (operands[1], 0); rtx hi8 = gen_reg_rtx (QImode); rtx reg_z = gen_rtx_REG (HImode, REG_Z); @@ -580,7 +586,7 @@ emit_move_insn (reg_z, simplify_gen_subreg (HImode, addr, PSImode, 0)); emit_move_insn (hi8, simplify_gen_subreg (QImode, addr, PSImode, 2)); - insn = emit_insn (gen_xload_8 (operands[0], hi8)); + rtx_insn *insn = emit_insn (gen_xload_8 (operands[0], hi8)); set_mem_addr_space (SET_SRC (single_set (insn)), MEM_ADDR_SPACE (operands[1])); DONE; @@ -608,17 +614,16 @@ rtx reg_z = gen_rtx_REG (HImode, REG_Z); rtx addr_hi8 = simplify_gen_subreg (QImode, addr, PSImode, 2); addr_space_t as = MEM_ADDR_SPACE (operands[1]); - rtx_insn *insn; - /* Split the address to R21:Z */ + // Split the address to R21:Z emit_move_insn (reg_z, simplify_gen_subreg (HImode, addr, PSImode, 0)); emit_move_insn (gen_rtx_REG (QImode, 21), addr_hi8); - /* Load with code from libgcc */ - insn = emit_insn (gen_xload__libgcc ()); + // Load with code from libgcc. + rtx_insn *insn = emit_insn (gen_xload__libgcc ()); set_mem_addr_space (SET_SRC (single_set (insn)), as); - /* Move to destination */ + // Move to destination. emit_move_insn (operands[0], gen_rtx_REG (mode, 22)); DONE; @@ -714,7 +719,7 @@ SUBREG_REG (src) = copy_to_mode_reg (GET_MODE (const_addr), const_addr); } - /* One of the operands has to be in a register. */ + // One of the operands has to be in a register. if (!register_operand (dest, mode) && !reg_or_0_operand (src, mode)) { @@ -729,8 +734,8 @@ src = replace_equiv_address (src, copy_to_mode_reg (PSImode, addr)); if (!avr_xload_libgcc_p (mode)) - /* ; No here because gen_xload8_A only iterates over ALL1. - ; insn-emit does not depend on the mode, it's all about operands. */ + // No here because gen_xload8_A only iterates over ALL1. + // insn-emit does not depend on the mode, it's all about operands. emit_insn (gen_xload8qi_A (dest, src)); else emit_insn (gen_xload_A (dest, src)); @@ -740,7 +745,7 @@ if (avr_load_libgcc_p (src)) { - /* For the small devices, do loads per libgcc call. */ + // For the small devices, do loads per libgcc call. emit_insn (gen_load_libgcc (dest, src)); DONE; } @@ -926,6 +931,55 @@ operands[5] = gen_rtx_REG (HImode, REGNO (operands[3])); }) + +;; Register alloc may expand a 3-operand arithmetic X = Y o CST as +;; X = CST +;; X o= Y +;; where it may be better to instead: +;; X = Y +;; X o= CST +;; because 1) the first insn may use MOVW for "X = Y", and 2) the +;; operation may be more efficient when performed with a constant, +;; for example when ADIW or SBIW can be used, or some bytes of +;; the constant are 0x00 or 0xff. +(define_peephole2 + [(parallel [(set (match_operand:HISI 0 "d_register_operand") + (match_operand:HISI 1 "const_int_operand")) + (clobber (reg:CC REG_CC))]) + (parallel [(set (match_dup 0) + (piaop:HISI (match_dup 0) + (match_operand:HISI 2 "register_operand"))) + (clobber (scratch:QI)) + (clobber (reg:CC REG_CC))])] + "! reg_overlap_mentioned_p (operands[0], operands[2])" + [(parallel [(set (match_dup 0) + (match_dup 2)) + (clobber (reg:CC REG_CC))]) + (parallel [(set (match_dup 0) + (piaop:HISI (match_dup 0) + (match_dup 1))) + (clobber (scratch:QI)) + (clobber (reg:CC REG_CC))])]) + +;; Same, but just for plus:HI without a scratch:QI. +(define_peephole2 + [(parallel [(set (match_operand:HI 0 "d_register_operand") + (match_operand:HI 1 "const_int_operand")) + (clobber (reg:CC REG_CC))]) + (parallel [(set (match_dup 0) + (plus:HI (match_dup 0) + (match_operand:HI 2 "register_operand"))) + (clobber (reg:CC REG_CC))])] + "! reg_overlap_mentioned_p (operands[0], operands[2])" + [(parallel [(set (match_dup 0) + (match_dup 2)) + (clobber (reg:CC REG_CC))]) + (parallel [(set (match_dup 0) + (plus:HI (match_dup 0) + (match_dup 1))) + (clobber (reg:CC REG_CC))])]) + + ;; For LPM loads from AS1 we split ;; R = *Z ;; to @@ -956,6 +1010,30 @@ operands[4] = gen_int_mode (-GET_MODE_SIZE (mode), HImode); }) + +;; Legitimate address and stuff allows way more addressing modes than +;; Reduced Tiny actually supports. Split them now so that we get +;; closer to real instructions which may result in some optimization +;; opportunities. +(define_split + [(parallel [(set (match_operand:MOVMODE 0 "nonimmediate_operand") + (match_operand:MOVMODE 1 "general_operand")) + (clobber (reg:CC REG_CC))])] + "AVR_TINY + && reload_completed + && avr_fuse_add > 0 + // Only split this for .split2 when we are before + // pass .avr-fuse-add (which runs after proep). + && ! epilogue_completed + && (MEM_P (operands[0]) || MEM_P (operands[1]))" + [(scratch)] + { + if (avr_split_tiny_move (curr_insn, operands)) + DONE; + FAIL; + }) + + ;;========================================================================== ;; xpointer move (24 bit) @@ -1260,21 +1338,18 @@ (clobber (match_dup 4))])] "" { - rtx addr0; - machine_mode mode; - - /* If value to set is not zero, use the library routine. */ + // If value to set is not zero, use the library routine. if (operands[2] != const0_rtx) FAIL; if (!CONST_INT_P (operands[1])) FAIL; - mode = u8_operand (operands[1], VOIDmode) ? QImode : HImode; + machine_mode mode = u8_operand (operands[1], VOIDmode) ? QImode : HImode; operands[4] = gen_rtx_SCRATCH (mode); operands[1] = copy_to_mode_reg (mode, gen_int_mode (INTVAL (operands[1]), mode)); - addr0 = copy_to_mode_reg (Pmode, XEXP (operands[0], 0)); + rtx addr0 = copy_to_mode_reg (Pmode, XEXP (operands[0], 0)); operands[0] = gen_rtx_MEM (BLKmode, addr0); }) @@ -1361,10 +1436,9 @@ (clobber (scratch:QI))])] "" { - rtx addr; if (operands[2] != const0_rtx) FAIL; - addr = copy_to_mode_reg (Pmode, XEXP (operands[1], 0)); + rtx addr = copy_to_mode_reg (Pmode, XEXP (operands[1], 0)); operands[1] = gen_rtx_MEM (BLKmode, addr); operands[5] = addr; operands[4] = gen_reg_rtx (HImode); @@ -1513,12 +1587,10 @@ "" "#" "&& reload_completed" - [(parallel - [(set (match_dup 0) - (plus:HI - (sign_extend:HI (match_dup 1)) - (match_dup 2))) - (clobber (reg:CC REG_CC))])]) + [(parallel [(set (match_dup 0) + (plus:HI (sign_extend:HI (match_dup 1)) + (match_dup 2))) + (clobber (reg:CC REG_CC))])]) (define_insn "*addhi3.sign_extend1" @@ -1532,7 +1604,8 @@ ? "mov __tmp_reg__,%1\;add %A0,%1\;adc %B0,__zero_reg__\;sbrc __tmp_reg__,7\;dec %B0" : "add %A0,%1\;adc %B0,__zero_reg__\;sbrc %1,7\;dec %B0"; } - [(set_attr "length" "5")]) + [(set (attr "length") + (symbol_ref ("4 + reg_overlap_mentioned_p (operands[0], operands[1])")))]) (define_insn_and_split "*addhi3_zero_extend.const_split" [(set (match_operand:HI 0 "register_operand" "=d") @@ -1555,9 +1628,42 @@ "subi %A0,%n2\;sbc %B0,%B0" [(set_attr "length" "2")]) + +;; Occurs when computing offsets into 16-bit arrays. +;; Saves up to 2 instructions. +(define_insn_and_split "*addhi3_zero_extend.ashift1.split" + [(set (match_operand:HI 0 "register_operand" "=r") + (plus:HI (ashift:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "r")) + (const_int 1)) + (match_operand:HI 2 "register_operand" "0")))] + "" + "#" + "&& reload_completed" + [(parallel [(set (match_dup 0) + (plus:HI (ashift:HI (zero_extend:HI (match_dup 1)) + (const_int 1)) + (match_dup 2))) + (clobber (reg:CC REG_CC))])]) + +(define_insn "*addhi3_zero_extend.ashift1" + [(set (match_operand:HI 0 "register_operand" "=r") + (plus:HI (ashift:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "r")) + (const_int 1)) + (match_operand:HI 2 "register_operand" "0"))) + (clobber (reg:CC REG_CC))] + "reload_completed" + { + return reg_overlap_mentioned_p (operands[1], operands[0]) + ? "mov __tmp_reg__,%1\;add %A0,__tmp_reg__\;adc %B0,__zero_reg__\;add %A0,__tmp_reg__\;adc %B0,__zero_reg__" + : "add %A0,%1\;adc %B0,__zero_reg__\;add %A0,%1\;adc %B0,__zero_reg__"; + } + [(set (attr "length") + (symbol_ref ("4 + reg_overlap_mentioned_p (operands[1], operands[0])")))]) + + (define_insn_and_split "*usum_widenqihi3_split" [(set (match_operand:HI 0 "register_operand" "=r") - (plus:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "0")) + (plus:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "%0")) (zero_extend:HI (match_operand:QI 2 "register_operand" "r"))))] "" "#" @@ -1570,7 +1676,7 @@ (define_insn "*usum_widenqihi3" [(set (match_operand:HI 0 "register_operand" "=r") - (plus:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "0")) + (plus:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "%0")) (zero_extend:HI (match_operand:QI 2 "register_operand" "r")))) (clobber (reg:CC REG_CC))] "reload_completed" @@ -1597,7 +1703,7 @@ "reload_completed" "sub %A0,%2\;sbc %B0,%B0" [(set_attr "length" "2")]) - + (define_insn_and_split "*addhi3_sp" [(set (match_operand:HI 1 "stack_register_operand" "=q") (plus:HI (match_operand:HI 2 "stack_register_operand" "q") @@ -1609,18 +1715,18 @@ "" [(const_int 0)] { - /* Do not attempt to split this pattern. This FAIL is necessary - to prevent the splitter from matching *add3_split, splitting - it, and then failing later because constraints don't match, as split - does not look at constraints. */ + // Do not attempt to split this pattern. This FAIL is necessary + // to prevent the splitter from matching *add3_split, splitting + // it, and then failing later because constraints don't match, as split + // does not look at constraints. FAIL; } [(set_attr "length" "6") (set_attr "adjust_len" "addto_sp")]) -;; "*addhi3" -;; "*addhq3" "*adduhq3" -;; "*addha3" "*adduha3" +;; "*addhi3_split" +;; "*addhq3_split" "*adduhq3_split" +;; "*addha3_split" "*adduha3_split" (define_insn_and_split "*add3_split" [(set (match_operand:ALL2 0 "register_operand" "=??r,d,!w ,d") (plus:ALL2 (match_operand:ALL2 1 "register_operand" "%0,0,0 ,0") @@ -1635,6 +1741,9 @@ "" [(set_attr "isa" "*,*,adiw,*")]) +;; "*addhi3" +;; "*addhq3" "*adduhq3" +;; "*addha3" "*adduha3" (define_insn "*add3" [(set (match_operand:ALL2 0 "register_operand" "=??r,d,!w ,d") (plus:ALL2 (match_operand:ALL2 1 "register_operand" "%0,0,0 ,0") @@ -1706,6 +1815,9 @@ (clobber (match_dup 3)) (clobber (reg:CC REG_CC))])]) +;; "*addhi3_clobber" +;; "*addhq3_clobber" "*adduhq3_clobber" +;; "*addha3_clobber" "*adduha3_clobber" (define_insn "*add3_clobber" [(set (match_operand:ALL2 0 "register_operand" "=!w ,d ,r") (plus:ALL2 (match_operand:ALL2 1 "register_operand" "%0 ,0 ,0") @@ -2056,8 +2168,8 @@ "#" "&& reload_completed" [(parallel [(set (match_dup 0) - (minus:HI (match_dup 1) - (sign_extend:HI (match_dup 2)))) + (minus:HI (match_dup 1) + (sign_extend:HI (match_dup 2)))) (clobber (reg:CC REG_CC))])]) @@ -2072,7 +2184,8 @@ ? "mov __tmp_reg__,%2\;sub %A0,%2\;sbc %B0,__zero_reg__\;sbrc __tmp_reg__,7\;inc %B0" : "sub %A0,%2\;sbc %B0,__zero_reg__\;sbrc %2,7\;inc %B0"; } - [(set_attr "length" "5")]) + [(set (attr "length") + (symbol_ref ("4 + reg_overlap_mentioned_p (operands[0], operands[2])")))]) ;; "subsi3" ;; "subsq3" "subusq3" @@ -2392,7 +2505,7 @@ "&& reload_completed" [(parallel [(set (reg:HI 24) (mult:HI (zero_extend:HI (reg:QI 22)) - (zero_extend:HI (reg:QI 24)))) + (zero_extend:HI (reg:QI 24)))) (clobber (reg:QI 21)) (clobber (reg:HI 22)) (clobber (reg:CC REG_CC))])]) @@ -2776,7 +2889,7 @@ ;; Special case of a += 2*b as frequently seen with accesses to int arrays. ;; This is shorter, faster than MUL and has lower register pressure. - +;; See also "*addhi3_zero_extend.ashift1". (define_insn_and_split "*umaddqihi4.2" [(set (match_operand:HI 0 "register_operand" "=r") (plus:HI (mult:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "r")) @@ -3190,10 +3303,10 @@ DONE; } - /* ; For small constants we can do better by extending them on the fly. - ; The constant can be loaded in one instruction and the widening - ; multiplication is shorter. First try the unsigned variant because it - ; allows constraint "d" instead of "a" for the signed version. */ + // For small constants we can do better by extending them on the fly. + // The constant can be loaded in one instruction and the widening + // multiplication is shorter. First try the unsigned variant because it + // allows constraint "d" instead of "a" for the signed version. */ if (s9_operand (operands[2], HImode)) { @@ -3242,12 +3355,14 @@ ? "mul %A1,%A1\;movw %0,r0\;mul %A1,%B1\;add %B0,r0\;add %B0,r0\;clr r1" : "mul %A1,%A2\;movw %0,r0\;mul %A1,%B2\;add %B0,r0\;mul %B1,%A2\;add %B0,r0\;clr r1"; } - [(set_attr "length" "7")]) + [(set (attr "length") + (symbol_ref ("7 - (REGNO (operands[1]) == REGNO (operands[2]))")))]) (define_expand "mulhi3_call" [(set (reg:HI 24) (match_operand:HI 1 "register_operand" "")) (set (reg:HI 22) (match_operand:HI 2 "register_operand" "")) - (parallel [(set (reg:HI 24) (mult:HI (reg:HI 24) (reg:HI 22))) + (parallel [(set (reg:HI 24) + (mult:HI (reg:HI 24) (reg:HI 22))) (clobber (reg:HI 22)) (clobber (reg:QI 21))]) (set (match_operand:HI 0 "register_operand" "") @@ -3259,19 +3374,22 @@ (define_insn_and_split "*mulhi3_call_split" - [(set (reg:HI 24) (mult:HI (reg:HI 24) (reg:HI 22))) + [(set (reg:HI 24) + (mult:HI (reg:HI 24) (reg:HI 22))) (clobber (reg:HI 22)) (clobber (reg:QI 21))] "!AVR_HAVE_MUL" "#" "&& reload_completed" - [(parallel [(set (reg:HI 24) (mult:HI (reg:HI 24) (reg:HI 22))) + [(parallel [(set (reg:HI 24) + (mult:HI (reg:HI 24) (reg:HI 22))) (clobber (reg:HI 22)) (clobber (reg:QI 21)) (clobber (reg:CC REG_CC))])]) (define_insn "*mulhi3_call" - [(set (reg:HI 24) (mult:HI (reg:HI 24) (reg:HI 22))) + [(set (reg:HI 24) + (mult:HI (reg:HI 24) (reg:HI 22))) (clobber (reg:HI 22)) (clobber (reg:QI 21)) (clobber (reg:CC REG_CC))] @@ -3384,8 +3502,8 @@ (set (match_dup 0) (reg:SI 22))] { - /* Do the QI -> HI extension explicitely before the multiplication. */ - /* Do the HI -> SI extension implicitely and after the multiplication. */ + // Do the QI -> HI extension explicitely before the multiplication. + // Do the HI -> SI extension implicitely and after the multiplication. if (QImode == mode) operands[1] = gen_rtx_ZERO_EXTEND (HImode, operands[1]); @@ -3436,8 +3554,8 @@ (set (match_dup 0) (reg:SI 22))] { - /* Do the QI -> HI extension explicitely before the multiplication. */ - /* Do the HI -> SI extension implicitely and after the multiplication. */ + // Do the QI -> HI extension explicitly before the multiplication. + // Do the HI -> SI extension implicitly and after the multiplication. if (QImode == mode) operands[1] = gen_rtx_SIGN_EXTEND (HImode, operands[1]); @@ -3550,8 +3668,8 @@ rtx xop1 = operands[1]; rtx xop2 = operands[2]; - /* Do the QI -> HI extension explicitely before the multiplication. */ - /* Do the HI -> SI extension implicitely and after the multiplication. */ + // Do the QI -> HI extension explicitly before the multiplication. + // Do the HI -> SI extension implicitly and after the multiplication. if (QImode == mode) xop1 = gen_rtx_fmt_e (, HImode, xop1); @@ -3569,8 +3687,8 @@ } else { - /* = SIGN_EXTEND */ - /* = ZERO_EXTEND */ + // = SIGN_EXTEND + // = ZERO_EXTEND operands[1] = xop2; operands[2] = xop1; @@ -4238,7 +4356,7 @@ (match_operand:SI 2 "pseudo_register_operand"))) (set (match_operand:SI 3 "pseudo_register_operand") (mod:SI (match_dup 1) - (match_dup 2))) + (match_dup 2))) (clobber (reg:SI 18)) (clobber (reg:SI 22)) (clobber (reg:HI 26)) @@ -4354,10 +4472,10 @@ [(set_attr "length" "1,1,2")]) (define_insn_and_split "andhi3" - [(set (match_operand:HI 0 "register_operand" "=??r,d,d,r ,r") - (and:HI (match_operand:HI 1 "register_operand" "%0,0,0,0 ,0") - (match_operand:HI 2 "nonmemory_operand" "r,s,n,Ca2,n"))) - (clobber (match_scratch:QI 3 "=X,X,X,X ,&d"))] + [(set (match_operand:HI 0 "register_operand" "=??r,d,d,r ,r ,r") + (and:HI (match_operand:HI 1 "register_operand" "%0,0,0,0 ,r ,0") + (match_operand:HI 2 "nonmemory_operand" "r,s,n,Ca2,Cb2,n"))) + (clobber (match_scratch:QI 3 "=X,X,X,X ,X ,&d"))] "" "#" "&& reload_completed" @@ -4368,10 +4486,10 @@ (clobber (reg:CC REG_CC))])]) (define_insn "*andhi3" - [(set (match_operand:HI 0 "register_operand" "=??r,d,d,r ,r") - (and:HI (match_operand:HI 1 "register_operand" "%0,0,0,0 ,0") - (match_operand:HI 2 "nonmemory_operand" "r,s,n,Ca2,n"))) - (clobber (match_scratch:QI 3 "=X,X,X,X ,&d")) + [(set (match_operand:HI 0 "register_operand" "=??r,d,d,r ,r ,r") + (and:HI (match_operand:HI 1 "register_operand" "%0,0,0,0 ,r ,0") + (match_operand:HI 2 "nonmemory_operand" "r,s,n,Ca2,Cb2,n"))) + (clobber (match_scratch:QI 3 "=X,X,X,X ,X ,&d")) (clobber (reg:CC REG_CC))] "reload_completed" { @@ -4379,17 +4497,19 @@ return "and %A0,%A2\;and %B0,%B2"; else if (which_alternative == 1) return "andi %A0,lo8(%2)\;andi %B0,hi8(%2)"; + else if (which_alternative == 4) + return avr_out_insv (insn, operands, NULL); return avr_out_bitop (insn, operands, NULL); } - [(set_attr "length" "2,2,2,4,4") - (set_attr "adjust_len" "*,*,out_bitop,out_bitop,out_bitop")]) + [(set_attr "length" "2,2,2,4,4,4") + (set_attr "adjust_len" "*,*,out_bitop,out_bitop,insv,out_bitop")]) (define_insn_and_split "andpsi3" - [(set (match_operand:PSI 0 "register_operand" "=??r,d,r ,r") - (and:PSI (match_operand:PSI 1 "register_operand" "%0,0,0 ,0") - (match_operand:PSI 2 "nonmemory_operand" "r,n,Ca3,n"))) - (clobber (match_scratch:QI 3 "=X,X,X ,&d"))] + [(set (match_operand:PSI 0 "register_operand" "=??r,d,r ,r ,r") + (and:PSI (match_operand:PSI 1 "register_operand" "%0,0,0 ,r ,0") + (match_operand:PSI 2 "nonmemory_operand" "r,n,Ca3,Cb3,n"))) + (clobber (match_scratch:QI 3 "=X,X,X ,X ,&d"))] "" "#" "&& reload_completed" @@ -4400,10 +4520,10 @@ (clobber (reg:CC REG_CC))])]) (define_insn "*andpsi3" - [(set (match_operand:PSI 0 "register_operand" "=??r,d,r ,r") - (and:PSI (match_operand:PSI 1 "register_operand" "%0,0,0 ,0") - (match_operand:PSI 2 "nonmemory_operand" "r,n,Ca3,n"))) - (clobber (match_scratch:QI 3 "=X,X,X ,&d")) + [(set (match_operand:PSI 0 "register_operand" "=??r,d,r ,r ,r") + (and:PSI (match_operand:PSI 1 "register_operand" "%0,0,0 ,r ,0") + (match_operand:PSI 2 "nonmemory_operand" "r,n,Ca3,Cb3,n"))) + (clobber (match_scratch:QI 3 "=X,X,X ,X ,&d")) (clobber (reg:CC REG_CC))] "reload_completed" { @@ -4412,16 +4532,19 @@ "and %B0,%B2" CR_TAB "and %C0,%C2"; + if (which_alternative == 3) + return avr_out_insv (insn, operands, NULL); + return avr_out_bitop (insn, operands, NULL); } - [(set_attr "length" "3,3,6,6") - (set_attr "adjust_len" "*,out_bitop,out_bitop,out_bitop")]) + [(set_attr "length" "3,3,6,5,6") + (set_attr "adjust_len" "*,out_bitop,out_bitop,insv,out_bitop")]) (define_insn_and_split "andsi3" - [(set (match_operand:SI 0 "register_operand" "=??r,d,r ,r") - (and:SI (match_operand:SI 1 "register_operand" "%0,0,0 ,0") - (match_operand:SI 2 "nonmemory_operand" "r,n,Ca4,n"))) - (clobber (match_scratch:QI 3 "=X,X,X ,&d"))] + [(set (match_operand:SI 0 "register_operand" "=??r,d,r ,r ,r") + (and:SI (match_operand:SI 1 "register_operand" "%0,0,0 ,r ,0") + (match_operand:SI 2 "nonmemory_operand" "r,n,Ca4,Cb4,n"))) + (clobber (match_scratch:QI 3 "=X,X,X ,X ,&d"))] "" "#" "&& reload_completed" @@ -4432,10 +4555,10 @@ (clobber (reg:CC REG_CC))])]) (define_insn "*andsi3" - [(set (match_operand:SI 0 "register_operand" "=??r,d,r ,r") - (and:SI (match_operand:SI 1 "register_operand" "%0,0,0 ,0") - (match_operand:SI 2 "nonmemory_operand" "r,n,Ca4,n"))) - (clobber (match_scratch:QI 3 "=X,X,X ,&d")) + [(set (match_operand:SI 0 "register_operand" "=??r,d,r ,r ,r") + (and:SI (match_operand:SI 1 "register_operand" "%0,0,0 ,r ,0") + (match_operand:SI 2 "nonmemory_operand" "r,n,Ca4,Cb4,n"))) + (clobber (match_scratch:QI 3 "=X,X,X ,X ,&d")) (clobber (reg:CC REG_CC))] "reload_completed" { @@ -4445,10 +4568,13 @@ "and %C0,%C2" CR_TAB "and %D0,%D2"; + if (which_alternative == 3) + return avr_out_insv (insn, operands, NULL); + return avr_out_bitop (insn, operands, NULL); } - [(set_attr "length" "4,4,8,8") - (set_attr "adjust_len" "*,out_bitop,out_bitop,out_bitop")]) + [(set_attr "length" "4,4,8,6,8") + (set_attr "adjust_len" "*,out_bitop,out_bitop,insv,out_bitop")]) (define_peephole2 ; andi [(parallel [(set (match_operand:QI 0 "d_register_operand" "") @@ -4730,7 +4856,7 @@ operands[4] = lo_first ? dst_hi : dst_lo; operands[5] = lo_first ? src_hi : src_lo; }) - + (define_split [(set (match_operand:HI 0 "register_operand") (match_operand:HI 1 "reg_or_0_operand"))] @@ -4778,7 +4904,7 @@ ;; by ;; $1 = $1 const ;; $0 = $1 -;; This transorms constraint alternative "r,0,n,&d" of the first operation +;; This transforms constraint alternative "r,0,n,&d" of the first operation ;; to alternative "d,0,n,X". ;; "*addhi3_clobber" "*addpsi3" "*addsi3" ;; "*addhq3" "*adduhq3" "*addha3" "*adduha3" @@ -4878,12 +5004,10 @@ (clobber (match_dup 3))])] "" { - int offset; - if (!CONST_INT_P (operands[2])) FAIL; - offset = INTVAL (operands[2]); + int offset = INTVAL (operands[2]); if (0 == offset % 8) { @@ -4895,7 +5019,7 @@ else if (offset == 1 || offset == GET_MODE_BITSIZE (mode) -1) { - /*; Support rotate left/right by 1 */ + // Support rotate left/right by 1. emit_move_insn (operands[0], gen_rtx_ROTATE (mode, operands[1], operands[2])); @@ -5695,7 +5819,7 @@ (lshiftrt:ALL1 (match_operand:ALL1 1 "register_operand" "") (match_operand:QI 2 "nop_general_operand" "")))]) -(define_split ; lshrqi3_const4 +(define_split ; lshrqi3_const4 [(set (match_operand:ALL1 0 "d_register_operand" "") (lshiftrt:ALL1 (match_dup 0) (const_int 4)))] @@ -5710,7 +5834,7 @@ operands[1] = avr_to_int_mode (operands[0]); }) -(define_split ; lshrqi3_const5 +(define_split ; lshrqi3_const5 [(set (match_operand:ALL1 0 "d_register_operand" "") (lshiftrt:ALL1 (match_dup 0) (const_int 5)))] @@ -5722,7 +5846,7 @@ operands[1] = avr_to_int_mode (operands[0]); }) -(define_split ; lshrqi3_const6 +(define_split ; lshrqi3_const6 [(set (match_operand:QI 0 "d_register_operand" "") (lshiftrt:QI (match_dup 0) (const_int 6)))] @@ -6129,17 +6253,17 @@ (define_insn_and_split "negsf2" [(set (match_operand:SF 0 "register_operand" "=d,r") - (neg:SF (match_operand:SF 1 "register_operand" "0,0")))] + (neg:SF (match_operand:SF 1 "register_operand" "0,0")))] "" "#" "&& reload_completed" [(parallel [(set (match_dup 0) - (neg:SF (match_dup 1))) + (neg:SF (match_dup 1))) (clobber (reg:CC REG_CC))])]) (define_insn "*negsf2" [(set (match_operand:SF 0 "register_operand" "=d,r") - (neg:SF (match_operand:SF 1 "register_operand" "0,0"))) + (neg:SF (match_operand:SF 1 "register_operand" "0,0"))) (clobber (reg:CC REG_CC))] "reload_completed" "@ @@ -6704,6 +6828,11 @@ (match_operand:HISI 1 "const_int_operand"))) (clobber (match_operand:QI 2 "scratch_operand"))])]) +(define_expand "gen_move_clobbercc" + [(parallel [(set (match_operand 0) + (match_operand 1)) + (clobber (reg:CC REG_CC))])]) + ;; ---------------------------------------------------------------------- ;; JUMP INSTRUCTIONS ;; ---------------------------------------------------------------------- @@ -6895,8 +7024,8 @@ ;; Test a single bit in a QI/HI/SImode register. -;; Combine will create zero extract patterns for single bit tests. -;; permit any mode in source pattern by using VOIDmode. +;; Combine will create zero-extract patterns for single-bit tests. +;; Permit any mode in source pattern by using VOIDmode. (define_insn_and_split "*sbrx_branch_split" [(set (pc) @@ -6948,8 +7077,8 @@ (const_int 2) (const_int 4))))]) -;; Same test based on bitwise AND. Keep this in case gcc changes patterns. -;; or for old peepholes. +;; Same test based on bitwise AND. Keep this in case gcc changes patterns +;; or for text peepholes. ;; Fixme - bitwise Mask will not work for DImode (define_insn_and_split "*sbrx_and_branch_split" @@ -7096,7 +7225,7 @@ : "rjmp %x0"; } [(set (attr "length") - (if_then_else (match_operand 0 "symbol_ref_operand" "") + (if_then_else (match_operand 0 "symbol_ref_operand" "") (if_then_else (match_test "!AVR_HAVE_JMP_CALL") (const_int 1) (const_int 2)) @@ -7147,10 +7276,10 @@ ;; Operand 2 is 1 for tail-call, 0 otherwise. "" "@ - %!icall - %~call %x0 - %!ijmp - %~jmp %x0" + %!icall + %~call %x0 + %!ijmp + %~jmp %x0" [(set_attr "length" "1,*,1,*") (set_attr "adjust_len" "*,call,*,call")]) @@ -7163,10 +7292,10 @@ ;; Operand 3 is 1 for tail-call, 0 otherwise. "" "@ - %!icall - %~call %x1 - %!ijmp - %~jmp %x1" + %!icall + %~call %x1 + %!ijmp + %~jmp %x1" [(set_attr "length" "1,*,1,*") (set_attr "adjust_len" "*,call,*,call")]) @@ -7300,7 +7429,7 @@ ;; "casesi__sequence" (used to recog + extract casesi ;; sequences in pass .avr-casesi) and propagate all adjustments ;; also to that pattern and the code of the extra pass. - + (define_expand "casesi" [(parallel [(set (match_dup 5) (plus:SI (match_operand:SI 0 "register_operand") @@ -7616,8 +7745,6 @@ (pc)))] "dead_or_set_regno_p (insn, REG_CC)" { - const char *op; - int jump_mode; if (avr_adiw_reg_p (operands[0])) output_asm_insn ("sbiw %0,1" CR_TAB "sbc %C0,__zero_reg__" CR_TAB @@ -7628,8 +7755,8 @@ "sbc %C0,__zero_reg__" CR_TAB "sbc %D0,__zero_reg__", operands); - jump_mode = avr_jump_mode (operands[2], insn); - op = ((EQ == ) ^ (jump_mode == 1)) ? "brcc" : "brcs"; + int jump_mode = avr_jump_mode (operands[2], insn); + const char *op = ((EQ == ) ^ (jump_mode == 1)) ? "brcc" : "brcs"; operands[1] = gen_rtx_CONST_STRING (VOIDmode, op); switch (jump_mode) @@ -7659,16 +7786,14 @@ (pc)))] "dead_or_set_regno_p (insn, REG_CC)" { - const char *op; - int jump_mode; if (avr_adiw_reg_p (operands[0])) output_asm_insn ("sbiw %0,1", operands); else output_asm_insn ("subi %A0,1" CR_TAB "sbc %B0,__zero_reg__", operands); - jump_mode = avr_jump_mode (operands[2], insn); - op = ((EQ == ) ^ (jump_mode == 1)) ? "brcc" : "brcs"; + int jump_mode = avr_jump_mode (operands[2], insn); + const char *op = ((EQ == ) ^ (jump_mode == 1)) ? "brcc" : "brcs"; operands[1] = gen_rtx_CONST_STRING (VOIDmode, op); switch (jump_mode) @@ -7700,16 +7825,14 @@ (pc)))] "dead_or_set_regno_p (insn, REG_CC)" { - const char *op; - int jump_mode; if (avr_adiw_reg_p (operands[0])) output_asm_insn ("sbiw %0,1", operands); else output_asm_insn ("subi %A0,1" CR_TAB "sbc %B0,__zero_reg__", operands); - jump_mode = avr_jump_mode (operands[2], insn); - op = ((EQ == ) ^ (jump_mode == 1)) ? "brcc" : "brcs"; + int jump_mode = avr_jump_mode (operands[2], insn); + const char *op = ((EQ == ) ^ (jump_mode == 1)) ? "brcc" : "brcs"; operands[1] = gen_rtx_CONST_STRING (VOIDmode, op); switch (jump_mode) @@ -7741,14 +7864,12 @@ (pc)))] "dead_or_set_regno_p (insn, REG_CC)" { - const char *op; - int jump_mode; output_asm_insn ("ldi %3,1" CR_TAB "sub %A0,%3" CR_TAB "sbc %B0,__zero_reg__", operands); - jump_mode = avr_jump_mode (operands[2], insn); - op = ((EQ == ) ^ (jump_mode == 1)) ? "brcc" : "brcs"; + int jump_mode = avr_jump_mode (operands[2], insn); + const char *op = ((EQ == ) ^ (jump_mode == 1)) ? "brcc" : "brcs"; operands[1] = gen_rtx_CONST_STRING (VOIDmode, op); switch (jump_mode) @@ -7777,13 +7898,10 @@ (pc)))] "dead_or_set_regno_p (insn, REG_CC)" { - const char *op; - int jump_mode; - output_asm_insn ("subi %A0,1", operands); - jump_mode = avr_jump_mode (operands[1], insn); - op = ((EQ == ) ^ (jump_mode == 1)) ? "brcc" : "brcs"; + int jump_mode = avr_jump_mode (operands[1], insn); + const char *op = ((EQ == ) ^ (jump_mode == 1)) ? "brcc" : "brcs"; operands[0] = gen_rtx_CONST_STRING (VOIDmode, op); switch (jump_mode) @@ -7891,7 +8009,7 @@ [(unspec_volatile [(match_operand:QI 0 "const_int_operand" "L,P")] UNSPECV_ENABLE_IRQS) (set (match_operand:BLK 1 "" "") - (unspec_volatile:BLK [(match_dup 1)] UNSPECV_MEMORY_BARRIER))] + (unspec_volatile:BLK [(match_dup 1)] UNSPECV_MEMORY_BARRIER))] "" "@ cli @@ -8031,7 +8149,7 @@ (const_int 1)] UNSPECV_DELAY_CYCLES) (set (match_operand:BLK 1 "" "") - (unspec_volatile:BLK [(match_dup 1)] UNSPECV_MEMORY_BARRIER)) + (unspec_volatile:BLK [(match_dup 1)] UNSPECV_MEMORY_BARRIER)) (clobber (match_scratch:QI 2 "=&d"))] "" "#" @@ -8049,7 +8167,7 @@ (const_int 1)] UNSPECV_DELAY_CYCLES) (set (match_operand:BLK 1 "" "") - (unspec_volatile:BLK [(match_dup 1)] UNSPECV_MEMORY_BARRIER)) + (unspec_volatile:BLK [(match_dup 1)] UNSPECV_MEMORY_BARRIER)) (clobber (match_scratch:QI 2 "=&d")) (clobber (reg:CC REG_CC))] "reload_completed" @@ -8063,7 +8181,7 @@ (const_int 2)] UNSPECV_DELAY_CYCLES) (set (match_operand:BLK 1 "" "") - (unspec_volatile:BLK [(match_dup 1)] UNSPECV_MEMORY_BARRIER)) + (unspec_volatile:BLK [(match_dup 1)] UNSPECV_MEMORY_BARRIER)) (clobber (match_scratch:HI 2 "=&w,&d"))] "" "#" @@ -8083,7 +8201,7 @@ (const_int 2)] UNSPECV_DELAY_CYCLES) (set (match_operand:BLK 1 "" "") - (unspec_volatile:BLK [(match_dup 1)] UNSPECV_MEMORY_BARRIER)) + (unspec_volatile:BLK [(match_dup 1)] UNSPECV_MEMORY_BARRIER)) (clobber (match_scratch:HI 2 "=&w,&d")) (clobber (reg:CC REG_CC))] "reload_completed" @@ -8098,7 +8216,7 @@ (const_int 3)] UNSPECV_DELAY_CYCLES) (set (match_operand:BLK 1 "" "") - (unspec_volatile:BLK [(match_dup 1)] UNSPECV_MEMORY_BARRIER)) + (unspec_volatile:BLK [(match_dup 1)] UNSPECV_MEMORY_BARRIER)) (clobber (match_scratch:QI 2 "=&d")) (clobber (match_scratch:QI 3 "=&d")) (clobber (match_scratch:QI 4 "=&d"))] @@ -8120,7 +8238,7 @@ (const_int 3)] UNSPECV_DELAY_CYCLES) (set (match_operand:BLK 1 "" "") - (unspec_volatile:BLK [(match_dup 1)] UNSPECV_MEMORY_BARRIER)) + (unspec_volatile:BLK [(match_dup 1)] UNSPECV_MEMORY_BARRIER)) (clobber (match_scratch:QI 2 "=&d")) (clobber (match_scratch:QI 3 "=&d")) (clobber (match_scratch:QI 4 "=&d")) @@ -8140,7 +8258,7 @@ (const_int 4)] UNSPECV_DELAY_CYCLES) (set (match_operand:BLK 1 "" "") - (unspec_volatile:BLK [(match_dup 1)] UNSPECV_MEMORY_BARRIER)) + (unspec_volatile:BLK [(match_dup 1)] UNSPECV_MEMORY_BARRIER)) (clobber (match_scratch:QI 2 "=&d")) (clobber (match_scratch:QI 3 "=&d")) (clobber (match_scratch:QI 4 "=&d")) @@ -8164,7 +8282,7 @@ (const_int 4)] UNSPECV_DELAY_CYCLES) (set (match_operand:BLK 1 "" "") - (unspec_volatile:BLK [(match_dup 1)] UNSPECV_MEMORY_BARRIER)) + (unspec_volatile:BLK [(match_dup 1)] UNSPECV_MEMORY_BARRIER)) (clobber (match_scratch:QI 2 "=&d")) (clobber (match_scratch:QI 3 "=&d")) (clobber (match_scratch:QI 4 "=&d")) @@ -8745,7 +8863,7 @@ [(unspec_volatile [(match_operand:SI 0 "const_int_operand" "P,K")] UNSPECV_NOP) (set (match_operand:BLK 1 "" "") - (unspec_volatile:BLK [(match_dup 1)] UNSPECV_MEMORY_BARRIER))] + (unspec_volatile:BLK [(match_dup 1)] UNSPECV_MEMORY_BARRIER))] "" "@ nop @@ -8767,7 +8885,7 @@ (define_insn "*sleep" [(unspec_volatile [(const_int 0)] UNSPECV_SLEEP) (set (match_operand:BLK 0 "" "") - (unspec_volatile:BLK [(match_dup 0)] UNSPECV_MEMORY_BARRIER))] + (unspec_volatile:BLK [(match_dup 0)] UNSPECV_MEMORY_BARRIER))] "" "sleep" [(set_attr "length" "1")]) @@ -8787,7 +8905,7 @@ (define_insn "*wdr" [(unspec_volatile [(const_int 0)] UNSPECV_WDR) (set (match_operand:BLK 0 "" "") - (unspec_volatile:BLK [(match_dup 0)] UNSPECV_MEMORY_BARRIER))] + (unspec_volatile:BLK [(match_dup 0)] UNSPECV_MEMORY_BARRIER))] "" "wdr" [(set_attr "length" "1")]) @@ -9829,6 +9947,12 @@ (const_int 1) (const_int 7)))]) +;; This insn serves as a combine bridge because insn combine will only +;; combine so much (3) insns at most. It's not actually an open coded +;; bit-insertion but just a part of it. It may occur in other contexts +;; than INSV though, and in such a case the code may be worse than without +;; this pattern. We still have to emit code for it in that case because +;; we cannot roll back. (define_insn_and_split "*insv.any_shift._split" [(set (match_operand:QISI 0 "register_operand" "=r") (and:QISI (any_shift:QISI (match_operand:QISI 1 "register_operand" "r") @@ -9851,27 +9975,9 @@ (clobber (reg:CC REG_CC))] "reload_completed" { - int shift = == ASHIFT ? INTVAL (operands[2]) : -INTVAL (operands[2]); - int mask = GET_MODE_MASK (mode) & INTVAL (operands[3]); - // Position of the output / input bit, respectively. - int obit = exact_log2 (mask); - int ibit = obit - shift; - gcc_assert (IN_RANGE (obit, 0, )); - gcc_assert (IN_RANGE (ibit, 0, )); - operands[3] = GEN_INT (obit); - operands[2] = GEN_INT (ibit); - - if ( == 1) return "bst %T1%T2\;clr %0\;" "bld %T0%T3"; - if ( == 2) return "bst %T1%T2\;clr %A0\;clr %B0\;" "bld %T0%T3"; - if ( == 3) return "bst %T1%T2\;clr %A0\;clr %B0\;clr %C0\;bld %T0%T3"; - return AVR_HAVE_MOVW - ? "bst %T1%T2\;clr %A0\;clr %B0\;movw %C0,%A0\;" "bld %T0%T3" - : "bst %T1%T2\;clr %A0\;clr %B0\;clr %C0\;clr %D0\;bld %T0%T3"; + return avr_out_insv (insn, operands, nullptr); } - [(set (attr "length") - (minus (symbol_ref "2 + ") - ; One less if we can use a MOVW to clear. - (symbol_ref " == 4 && AVR_HAVE_MOVW")))]) + [(set_attr "adjust_len" "insv")]) (define_insn_and_split "*extzv.hi2" diff --git a/gcc/config/avr/avr.opt b/gcc/config/avr/avr.opt index c9f2b4d2fe55..c3ca8379ee3a 100644 --- a/gcc/config/avr/avr.opt +++ b/gcc/config/avr/avr.opt @@ -19,28 +19,28 @@ ; . mcall-prologues -Target Mask(CALL_PROLOGUES) -Use subroutines for function prologues and epilogues. +Target Mask(CALL_PROLOGUES) Optimization +Optimization. Use subroutines for function prologues and epilogues. mmcu= Target RejectNegative Joined Var(avr_mmcu) MissingArgError(missing device or architecture after %qs) --mmcu=MCU Select the target MCU. +-mmcu= Select the target MCU. mgas-isr-prologues Target Var(avr_gasisr_prologues) UInteger Init(0) Optimization -Allow usage of __gcc_isr pseudo instructions in ISR prologues and epilogues. +Optimization. Allow usage of __gcc_isr pseudo instructions in ISR prologues and epilogues. mn-flash= Target RejectNegative Joined Var(avr_n_flash) UInteger Init(-1) -Set the number of 64 KiB flash segments. +This option is used internally. Set the number of 64 KiB flash segments. mskip-bug Target Mask(SKIP_BUG) -Indicate presence of a processor erratum. +This option is used internally. Indicate presence of a processor erratum. Do not skip 32-bit instructions. mrmw Target Mask(RMW) -Enable Read-Modify-Write (RMW) instructions support/use. +This option is used internally. Enable Read-Modify-Write (RMW) instructions support/use. mdeb Target Undocumented Mask(ALL_DEBUG) @@ -50,7 +50,7 @@ Target RejectNegative Joined Undocumented Var(avr_log_details) mshort-calls Target RejectNegative Mask(SHORT_CALLS) -Use RJMP / RCALL even though CALL / JMP are available. +This option is used internally for multilib generation and selection. Assume RJMP / RCALL can target all program memory. mint8 Target Mask(INT8) @@ -62,11 +62,11 @@ Change the stack pointer without disabling interrupts. mbranch-cost= Target Joined RejectNegative UInteger Var(avr_branch_cost) Init(0) Optimization -Set the branch costs for conditional branch instructions. Reasonable values are small, non-negative integers. The default branch cost is 0. +-mbranch-cost= Optimization. Set the branch costs for conditional branch instructions. Reasonable values are small, non-negative integers. The default branch cost is 0. mmain-is-OS_task Target Mask(MAIN_IS_OS_TASK) Optimization -Treat main as if it had attribute OS_task. +Optimization. Treat main as if it had attribute OS_task. morder1 Target Undocumented Mask(ORDER_1) @@ -79,24 +79,24 @@ Target Mask(TINY_STACK) Change only the low 8 bits of the stack pointer. mrelax -Target -Relax branches. +Target Optimization +Optimization. Relax branches. mpmem-wrap-around Target Make the linker relaxation machine assume that a program counter wrap-around occurs. maccumulate-args -Target Mask(ACCUMULATE_OUTGOING_ARGS) -Accumulate outgoing function arguments and acquire/release the needed stack space for outgoing function arguments in function prologue/epilogue. Without this option, outgoing arguments are pushed before calling a function and popped afterwards. This option can lead to reduced code size for functions that call many functions that get their arguments on the stack like, for example printf. +Target Mask(ACCUMULATE_OUTGOING_ARGS) Optimization +Optimization. Accumulate outgoing function arguments and acquire/release the needed stack space for outgoing function arguments in function prologue/epilogue. Without this option, outgoing arguments are pushed before calling a function and popped afterwards. This option can lead to reduced code size for functions that call many functions that get their arguments on the stack like, for example printf. mstrict-X -Target Var(avr_strict_X) Init(0) -When accessing RAM, use X as imposed by the hardware, i.e. just use pre-decrement, post-increment and indirect addressing with the X register. Without this option, the compiler may assume that there is an addressing mode X+const similar to Y+const and Z+const and emit instructions to emulate such an addressing mode for X. +Target Var(avr_strict_X) Init(0) Optimization +Optimization. When accessing RAM, use X as imposed by the hardware, i.e. just use pre-decrement, post-increment and indirect addressing with the X register. Without this option, the compiler may assume that there is an addressing mode X+const similar to Y+const and Z+const and emit instructions to emulate such an addressing mode for X. mflmap Target Var(avr_flmap) Init(0) -The device has the bitfield NVMCTRL_CTRLB.FLMAP. This option is used internally. +This option is used internally. The device has the bitfield NVMCTRL_CTRLB.FLMAP. mrodata-in-ram Target Var(avr_rodata_in_ram) Init(-1) @@ -105,7 +105,15 @@ The device has the .rodata section located in the RAM area. ;; For rationale behind -msp8 see explanation in avr.h. msp8 Target RejectNegative Var(avr_sp8) Init(0) -The device has no SPH special function register. This option will be overridden by the compiler driver with the correct setting if presence/absence of SPH can be deduced from -mmcu=MCU. +This option is used internally for multilib generation and selection. The device has no SPH special function register. + +mfuse-add +Target Alias(mfuse-add=, 2, 0) Optimization +Optimization. Split register additions from load/store instructions. Most useful on Reduced Tiny. + +mfuse-add= +Target Joined RejectNegative UInteger Var(avr_fuse_add) Init(0) Optimization IntegerRange(0, 3) +-mfuse-add=<0,2> Optimization. Split register additions from load/store instructions. Most useful on Reduced Tiny. Waddr-space-convert Warning C Var(avr_warn_addr_space_convert) Init(0) @@ -121,7 +129,7 @@ Allow to use truncation instead of rounding towards zero for fractional fixed-po mabsdata Target Mask(ABSDATA) -Assume that all data in static storage can be accessed by LDS / STS. This option is only useful for reduced Tiny devices. +Assume that all data in static storage can be accessed by LDS / STS instructions. This option is only useful for reduced Tiny devices like ATtiny40. mdouble= Target Joined RejectNegative Var(avr_double) Init(0) Enum(avr_bits_e) Save diff --git a/gcc/config/avr/avr.opt.urls b/gcc/config/avr/avr.opt.urls index 7af677199cc4..f38e67384ab1 100644 --- a/gcc/config/avr/avr.opt.urls +++ b/gcc/config/avr/avr.opt.urls @@ -12,6 +12,9 @@ UrlSuffix(gcc/AVR-Options.html#index-mgas-isr-prologues) mn-flash= UrlSuffix(gcc/AVR-Options.html#index-mn-flash) +mskip-bug +UrlSuffix(gcc/AVR-Options.html#index-mskip-bug) + mrmw UrlSuffix(gcc/AVR-Options.html#index-mrmw) @@ -42,9 +45,21 @@ UrlSuffix(gcc/AVR-Options.html#index-maccumulate-args) mstrict-X UrlSuffix(gcc/AVR-Options.html#index-mstrict-X) +mflmap +UrlSuffix(gcc/AVR-Options.html#index-mflmap) + +mrodata-in-ram +UrlSuffix(gcc/AVR-Options.html#index-mrodata-in-ram) + msp8 UrlSuffix(gcc/AVR-Options.html#index-msp8) +mfuse-add +UrlSuffix(gcc/AVR-Options.html#index-mfuse-add) + +mfuse-add= +UrlSuffix(gcc/AVR-Options.html#index-mfuse-add) + Waddr-space-convert UrlSuffix(gcc/AVR-Options.html#index-Waddr-space-convert) diff --git a/gcc/config/avr/constraints.md b/gcc/config/avr/constraints.md index 91d2aa3ff2ba..fac54da17dbd 100644 --- a/gcc/config/avr/constraints.md +++ b/gcc/config/avr/constraints.md @@ -188,6 +188,21 @@ (and (match_code "const_int") (match_test "avr_popcount_each_byte (op, 4, (1<<0) | (1<<1) | (1<<8))"))) +(define_constraint "Cb2" + "Constant 2-byte integer that has exactly 1 bit set." + (and (match_code "const_int") + (match_test "single_one_operand (op, HImode)"))) + +(define_constraint "Cb3" + "Constant 3-byte integer that has exactly 1 bit set." + (and (match_code "const_int") + (match_test "single_one_operand (op, PSImode)"))) + +(define_constraint "Cb4" + "Constant 4-byte integer that has exactly 1 bit set." + (and (match_code "const_int") + (match_test "single_one_operand (op, SImode)"))) + (define_constraint "Cx2" "Constant 2-byte integer that allows XOR without clobber register." (and (match_code "const_int") @@ -239,25 +254,25 @@ (define_constraint "Y01" "Fixed-point or integer constant with bit representation 0x1" (ior (and (match_code "const_fixed") - (match_test "INTVAL (avr_to_int_mode (op)) == 1")) + (match_test "INTVAL (avr_to_int_mode (op)) == 1")) (match_test "satisfies_constraint_P (op)"))) (define_constraint "Ym1" "Fixed-point or integer constant with bit representation -0x1" (ior (and (match_code "const_fixed") - (match_test "INTVAL (avr_to_int_mode (op)) == -1")) + (match_test "INTVAL (avr_to_int_mode (op)) == -1")) (match_test "satisfies_constraint_N (op)"))) (define_constraint "Y02" "Fixed-point or integer constant with bit representation 0x2" (ior (and (match_code "const_fixed") - (match_test "INTVAL (avr_to_int_mode (op)) == 2")) + (match_test "INTVAL (avr_to_int_mode (op)) == 2")) (match_test "satisfies_constraint_K (op)"))) (define_constraint "Ym2" "Fixed-point or integer constant with bit representation -0x2" (ior (and (match_code "const_fixed") - (match_test "INTVAL (avr_to_int_mode (op)) == -2")) + (match_test "INTVAL (avr_to_int_mode (op)) == -2")) (match_test "satisfies_constraint_Cm2 (op)"))) ;; Constraint that's the empty set. Useful with mode and code iterators. diff --git a/gcc/config/avr/predicates.md b/gcc/config/avr/predicates.md index 97fe22200260..12013660ed17 100644 --- a/gcc/config/avr/predicates.md +++ b/gcc/config/avr/predicates.md @@ -50,10 +50,10 @@ ;; Return true if OP is a valid address for lower half of I/O space. (define_special_predicate "low_io_address_operand" (ior (and (match_code "const_int") - (match_test "IN_RANGE (INTVAL (op) - avr_arch->sfr_offset, - 0, 0x1F)")) + (match_test "IN_RANGE (INTVAL (op) - avr_arch->sfr_offset, + 0, 0x1F)")) (and (match_code "symbol_ref") - (match_test "SYMBOL_REF_FLAGS (op) & SYMBOL_FLAG_IO_LOW")))) + (match_test "SYMBOL_REF_FLAGS (op) & SYMBOL_FLAG_IO_LOW")))) ;; Return true if OP is a register_operand or low_io_operand. (define_predicate "reg_or_low_io_operand" @@ -74,10 +74,10 @@ ;; Return true if OP is a valid address of I/O space. (define_special_predicate "io_address_operand" (ior (and (match_code "const_int") - (match_test "IN_RANGE (INTVAL (op) - avr_arch->sfr_offset, - 0, 0x3F)")) + (match_test "IN_RANGE (INTVAL (op) - avr_arch->sfr_offset, + 0, 0x3F)")) (and (match_code "symbol_ref") - (match_test "SYMBOL_REF_FLAGS (op) & SYMBOL_FLAG_IO")))) + (match_test "SYMBOL_REF_FLAGS (op) & SYMBOL_FLAG_IO")))) ;; Return 1 if OP is a general operand not in flash memory (define_predicate "nop_general_operand" @@ -185,8 +185,8 @@ case SYMBOL_REF : return SYMBOL_REF_FUNCTION_P (op); case PLUS : - /* Assume canonical format of symbol + constant. - Fall through. */ + // Assume canonical format of symbol + constant. + // Fall through. case CONST : return text_segment_operand (XEXP (op, 0), VOIDmode); default : diff --git a/gcc/config/bpf/bpf-protos.h b/gcc/config/bpf/bpf-protos.h index 46d950bd990b..ac0c2f4038fa 100644 --- a/gcc/config/bpf/bpf-protos.h +++ b/gcc/config/bpf/bpf-protos.h @@ -35,4 +35,7 @@ const char *bpf_add_core_reloc (rtx *operands, const char *templ); class gimple_opt_pass; gimple_opt_pass *make_pass_lower_bpf_core (gcc::context *ctxt); +bool bpf_expand_cpymem (rtx *, bool); +bool bpf_expand_setmem (rtx *); + #endif /* ! GCC_BPF_PROTOS_H */ diff --git a/gcc/config/bpf/bpf.cc b/gcc/config/bpf/bpf.cc index d6ca47eeecbe..fb60770c170a 100644 --- a/gcc/config/bpf/bpf.cc +++ b/gcc/config/bpf/bpf.cc @@ -195,10 +195,8 @@ bpf_option_override (void) if (TARGET_BPF_CORE && !btf_debuginfo_p ()) error ("BPF CO-RE requires BTF debugging information, use %<-gbtf%>"); - /* To support the portability needs of BPF CO-RE approach, BTF debug - information includes the BPF CO-RE relocations. */ - if (TARGET_BPF_CORE) - write_symbols |= BTF_WITH_CORE_DEBUG; + /* BPF applications always generate .BTF.ext. */ + write_symbols |= BTF_WITH_CORE_DEBUG; /* Unlike much of the other BTF debug information, the information necessary for CO-RE relocations is added to the CTF container by the BPF backend. @@ -218,10 +216,7 @@ bpf_option_override (void) /* -gbtf implies -mcore when using the BPF backend, unless -mno-co-re is specified. */ if (btf_debuginfo_p () && !(target_flags_explicit & MASK_BPF_CORE)) - { - target_flags |= MASK_BPF_CORE; - write_symbols |= BTF_WITH_CORE_DEBUG; - } + target_flags |= MASK_BPF_CORE; /* Determine available features from ISA setting (-mcpu=). */ if (bpf_has_jmpext == -1) @@ -267,7 +262,7 @@ bpf_option_override (void) static void bpf_asm_init_sections (void) { - if (TARGET_BPF_CORE) + if (btf_debuginfo_p () && btf_with_core_debuginfo_p ()) btf_ext_init (); } @@ -279,8 +274,11 @@ bpf_asm_init_sections (void) static void bpf_file_end (void) { - if (TARGET_BPF_CORE) - btf_ext_output (); + if (btf_debuginfo_p () && btf_with_core_debuginfo_p ()) + { + btf_ext_output (); + btf_finalize (); + } } #undef TARGET_ASM_FILE_END @@ -387,6 +385,18 @@ bpf_compute_frame_layout (void) #undef TARGET_COMPUTE_FRAME_LAYOUT #define TARGET_COMPUTE_FRAME_LAYOUT bpf_compute_frame_layout +/* Defined to initialize data for func_info region in .BTF.ext section. */ + +static void +bpf_function_prologue (FILE *f ATTRIBUTE_UNUSED) +{ + if (btf_debuginfo_p ()) + btf_add_func_info_for (cfun->decl, current_function_func_begin_label); +} + +#undef TARGET_ASM_FUNCTION_PROLOGUE +#define TARGET_ASM_FUNCTION_PROLOGUE bpf_function_prologue + /* Expand to the instructions in a function prologue. This function is called when expanding the 'prologue' pattern in bpf.md. */ @@ -1184,6 +1194,211 @@ bpf_use_by_pieces_infrastructure_p (unsigned HOST_WIDE_INT size, #define TARGET_USE_BY_PIECES_INFRASTRUCTURE_P \ bpf_use_by_pieces_infrastructure_p +/* Helper for bpf_expand_cpymem. Emit an unrolled loop moving the bytes + from SRC to DST. */ + +static void +emit_move_loop (rtx src, rtx dst, machine_mode mode, int offset, int inc, + unsigned iters, unsigned remainder) +{ + rtx reg = gen_reg_rtx (mode); + + /* First copy in chunks as large as alignment permits. */ + for (unsigned int i = 0; i < iters; i++) + { + emit_move_insn (reg, adjust_address (src, mode, offset)); + emit_move_insn (adjust_address (dst, mode, offset), reg); + offset += inc; + } + + /* Handle remaining bytes which might be smaller than the chunks + used above. */ + if (remainder & 4) + { + emit_move_insn (reg, adjust_address (src, SImode, offset)); + emit_move_insn (adjust_address (dst, SImode, offset), reg); + offset += (inc < 0 ? -4 : 4); + remainder -= 4; + } + if (remainder & 2) + { + emit_move_insn (reg, adjust_address (src, HImode, offset)); + emit_move_insn (adjust_address (dst, HImode, offset), reg); + offset += (inc < 0 ? -2 : 2); + remainder -= 2; + } + if (remainder & 1) + { + emit_move_insn (reg, adjust_address (src, QImode, offset)); + emit_move_insn (adjust_address (dst, QImode, offset), reg); + } +} + +/* Expand cpymem/movmem, as from __builtin_memcpy/memmove. + OPERANDS are the same as the cpymem/movmem patterns. + IS_MOVE is true if this is a memmove, false for memcpy. + Return true if we successfully expanded, or false if we cannot + and must punt to a libcall. */ + +bool +bpf_expand_cpymem (rtx *operands, bool is_move) +{ + /* Size must be constant for this expansion to work. */ + const char *name = is_move ? "memmove" : "memcpy"; + if (!CONST_INT_P (operands[2])) + { + if (flag_building_libgcc) + warning (0, "could not inline call to %<__builtin_%s%>: " + "size must be constant", name); + else + error ("could not inline call to %<__builtin_%s%>: " + "size must be constant", name); + return false; + } + + /* Alignment is a CONST_INT. */ + gcc_assert (CONST_INT_P (operands[3])); + + rtx dst = operands[0]; + rtx src = operands[1]; + rtx size = operands[2]; + unsigned HOST_WIDE_INT size_bytes = UINTVAL (size); + unsigned align = UINTVAL (operands[3]); + enum machine_mode mode; + switch (align) + { + case 1: mode = QImode; break; + case 2: mode = HImode; break; + case 4: mode = SImode; break; + case 8: mode = DImode; break; + default: + gcc_unreachable (); + } + + /* For sizes above threshold, always use a libcall. */ + if (size_bytes > (unsigned HOST_WIDE_INT) bpf_inline_memops_threshold) + { + if (flag_building_libgcc) + warning (0, "could not inline call to %<__builtin_%s%>: " + "too many bytes, use %<-minline-memops-threshold%>", name); + else + error ("could not inline call to %<__builtin_%s%>: " + "too many bytes, use %<-minline-memops-threshold%>", name); + return false; + } + + unsigned iters = size_bytes >> ceil_log2 (align); + unsigned remainder = size_bytes & (align - 1); + + int inc = GET_MODE_SIZE (mode); + rtx_code_label *fwd_label, *done_label; + if (is_move) + { + /* For memmove, be careful of overlap. It is not a concern for memcpy. + To handle overlap, we check (at runtime) if SRC < DST, and if so do + the move "backwards" starting from SRC + SIZE. */ + fwd_label = gen_label_rtx (); + done_label = gen_label_rtx (); + + rtx dst_addr = copy_to_mode_reg (Pmode, XEXP (dst, 0)); + rtx src_addr = copy_to_mode_reg (Pmode, XEXP (src, 0)); + emit_cmp_and_jump_insns (src_addr, dst_addr, GEU, NULL_RTX, Pmode, + true, fwd_label, profile_probability::even ()); + + /* Emit the "backwards" unrolled loop. */ + emit_move_loop (src, dst, mode, size_bytes, -inc, iters, remainder); + emit_jump_insn (gen_jump (done_label)); + emit_barrier (); + + emit_label (fwd_label); + } + + emit_move_loop (src, dst, mode, 0, inc, iters, remainder); + + if (is_move) + emit_label (done_label); + + return true; +} + +/* Expand setmem, as from __builtin_memset. + OPERANDS are the same as the setmem pattern. + Return true if the expansion was successful, false otherwise. */ + +bool +bpf_expand_setmem (rtx *operands) +{ + /* Size must be constant for this expansion to work. */ + if (!CONST_INT_P (operands[1])) + { + if (flag_building_libgcc) + warning (0, "could not inline call to %<__builtin_memset%>: " + "size must be constant"); + else + error ("could not inline call to %<__builtin_memset%>: " + "size must be constant"); + return false; + } + + /* Alignment is a CONST_INT. */ + gcc_assert (CONST_INT_P (operands[3])); + + rtx dst = operands[0]; + rtx size = operands[1]; + rtx val = operands[2]; + unsigned HOST_WIDE_INT size_bytes = UINTVAL (size); + unsigned align = UINTVAL (operands[3]); + enum machine_mode mode; + switch (align) + { + case 1: mode = QImode; break; + case 2: mode = HImode; break; + case 4: mode = SImode; break; + case 8: mode = DImode; break; + default: + gcc_unreachable (); + } + + /* For sizes above threshold, always use a libcall. */ + if (size_bytes > (unsigned HOST_WIDE_INT) bpf_inline_memops_threshold) + { + if (flag_building_libgcc) + warning (0, "could not inline call to %<__builtin_memset%>: " + "too many bytes, use %<-minline-memops-threshold%>"); + else + error ("could not inline call to %<__builtin_memset%>: " + "too many bytes, use %<-minline-memops-threshold%>"); + return false; + } + + unsigned iters = size_bytes >> ceil_log2 (align); + unsigned remainder = size_bytes & (align - 1); + unsigned inc = GET_MODE_SIZE (mode); + unsigned offset = 0; + + for (unsigned int i = 0; i < iters; i++) + { + emit_move_insn (adjust_address (dst, mode, offset), val); + offset += inc; + } + if (remainder & 4) + { + emit_move_insn (adjust_address (dst, SImode, offset), val); + offset += 4; + remainder -= 4; + } + if (remainder & 2) + { + emit_move_insn (adjust_address (dst, HImode, offset), val); + offset += 2; + remainder -= 2; + } + if (remainder & 1) + emit_move_insn (adjust_address (dst, QImode, offset), val); + + return true; +} + /* Finally, build the GCC target. */ struct gcc_target targetm = TARGET_INITIALIZER; diff --git a/gcc/config/bpf/bpf.md b/gcc/config/bpf/bpf.md index 50df1aaa3e21..ea688aadf91e 100644 --- a/gcc/config/bpf/bpf.md +++ b/gcc/config/bpf/bpf.md @@ -627,4 +627,57 @@ "{ldabs\t%0|r0 = *( *) skb[%0]}" [(set_attr "type" "ld")]) +;;; memmove and memcopy + +;; 0 is dst +;; 1 is src +;; 2 is size of copy in bytes +;; 3 is alignment + +(define_expand "cpymemdi" + [(match_operand:BLK 0 "memory_operand") + (match_operand:BLK 1 "memory_operand") + (match_operand:DI 2 "general_operand") + (match_operand:DI 3 "immediate_operand")] + "" +{ + if (bpf_expand_cpymem (operands, false)) + DONE; + FAIL; +}) + +;; 0 is dst +;; 1 is src +;; 2 is size of copy in bytes +;; 3 is alignment + +(define_expand "movmemdi" + [(match_operand:BLK 0 "memory_operand") + (match_operand:BLK 1 "memory_operand") + (match_operand:DI 2 "general_operand") + (match_operand:DI 3 "immediate_operand")] + "" +{ + if (bpf_expand_cpymem (operands, true)) + DONE; + FAIL; +}) + +;; memset +;; 0 is dst +;; 1 is length +;; 2 is value +;; 3 is alignment +(define_expand "setmemdi" + [(set (match_operand:BLK 0 "memory_operand") + (match_operand:QI 2 "nonmemory_operand")) + (use (match_operand:DI 1 "general_operand")) + (match_operand 3 "immediate_operand")] + "" + { + if (bpf_expand_setmem (operands)) + DONE; + FAIL; +}) + (include "atomic.md") diff --git a/gcc/config/bpf/bpf.opt b/gcc/config/bpf/bpf.opt index acfddebdad71..541ebe4dfc4e 100644 --- a/gcc/config/bpf/bpf.opt +++ b/gcc/config/bpf/bpf.opt @@ -108,3 +108,7 @@ Enum(asm_dialect) String(normal) Value(ASM_NORMAL) EnumValue Enum(asm_dialect) String(pseudoc) Value(ASM_PSEUDOC) + +minline-memops-threshold= +Target RejectNegative Joined UInteger Var(bpf_inline_memops_threshold) Init(1024) +-minline-memops-threshold= Maximum size of memset/memmove/memcpy to inline, larger sizes will use a library call. diff --git a/gcc/config/bpf/btfext-out.cc b/gcc/config/bpf/btfext-out.cc new file mode 100644 index 000000000000..00d2501a976b --- /dev/null +++ b/gcc/config/bpf/btfext-out.cc @@ -0,0 +1,617 @@ +/* BPF Compile Once - Run Everywhere (CO-RE) support. + Copyright (C) 2021-2024 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +#define IN_TARGET_CODE 1 + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "target.h" +#include "memmodel.h" +#include "tm_p.h" +#include "output.h" +#include "dwarf2asm.h" +#include "ctfc.h" +#include "btf.h" +#include "rtl.h" +#include "tree-pretty-print.h" +#include "cgraph.h" + +#include "btfext-out.h" + +/* This file contains data structures and routines for construction and output + of BPF Compile Once - Run Everywhere (BPF CO-RE) information. + + eBPF programs written in C usually include Linux kernel headers, so that + they may interact with kernel data structures in a useful way. This + intrudces two major portability issues: + + 1. Kernel data structures regularly change, with fields added, moved or + deleted between versions. An eBPF program cannot in general be expected + to run on any systems which does not share an identical kernel version to + the system on which it was compiled. + + 2. Included kernel headers (and used data structures) may be internal, not + exposed in an userspace API, and therefore target-specific. An eBPF + program compiled on an x86_64 machine will include x86_64 kernel headers. + The resulting program may not run well (or at all) in machines of + another architecture. + + BPF CO-RE is designed to solve the first issue by leveraging the BPF loader + to adjust references to kernel data structures made by the program as-needed + according to versions of structures actually present on the host kernel. + + To achieve this, additional information is placed in a ".BTF.ext" section. + This information tells the loader which references will require adjusting, + and how to perform each necessary adjustment. + + For any access to a data structure which may require load-time adjustment, + the following information is recorded (making up a CO-RE relocation record): + - The BTF type ID of the outermost structure which is accessed. + - An access string encoding the accessed member via a series of member and + array indexes. These indexes are used to look up detailed BTF information + about the member. + - The offset of the appropriate instruction to patch in the BPF program. + - An integer specifying what kind of relocation to perform. + + A CO-RE-capable BPF loader reads this information together with the BTF + information of the program, compares it against BTF information of the host + kernel, and determines the appropriate way to patch the specified + instruction. + + Once all CO-RE relocations are resolved, the program is loaded and verified + as usual. The process can be summarized with the following diagram: + + +------------+ + | C compiler | + +-----+------+ + | BPF + BTF + CO-RE relocations + v + +------------+ + +--->| BPF loader | + | +-----+------+ + | | BPF (adapted) + BTF | v + | +------------+ + +----+ Kernel | + +------------+ + + Note that a single ELF object may contain multiple eBPF programs. As a + result, a single .BTF.ext section can contain CO-RE relocations for multiple + programs in distinct sections. */ + +/* BTF.ext debug info section. */ +static GTY (()) section * btf_ext_info_section; + +#ifndef BTF_EXT_INFO_SECTION_NAME +#define BTF_EXT_INFO_SECTION_NAME ".BTF.ext" +#endif +#define BTF_EXT_INFO_SECTION_FLAGS (SECTION_DEBUG) + +#ifndef BTF_EXT_INFO_SECTION_LABEL +#define BTF_EXT_INFO_SECTION_LABEL "Lbtfext" +#endif + +#define MAX_BTF_EXT_LABEL_BYTES 40 +static char btf_ext_info_section_label[MAX_BTF_EXT_LABEL_BYTES]; + +/* A funcinfo record, in the .BTF.ext funcinfo section. */ +struct GTY ((chain_next ("%h.next"))) btf_ext_funcinfo +{ + uint32_t type; /* Type ID of a BTF_KIND_FUNC type. */ + const char *fnname; + const char *label; + + struct btf_ext_funcinfo *next; /* Linked list to collect func_info elems. */ +}; + +/* A lineinfo record, in the .BTF.ext lineinfo section. */ +struct GTY ((chain_next ("%h.next"))) btf_ext_lineinfo +{ + uint32_t insn_off; /* Offset of the instruction. */ + uint32_t file_name_off; /* Offset of file name in BTF string table. */ + uint32_t line_off; /* Offset of source line in BTF string table. */ + uint32_t line_col; /* Line number (bits 31-11) and column (11-0). */ + + struct btf_ext_lineinfo *next; /* Linked list to collect line_info elems. */ +}; + +/* Internal representation of a BPF CO-RE relocation record. */ +struct GTY ((chain_next ("%h.next"))) btf_ext_core_reloc { + unsigned int bpfcr_type; /* BTF type ID of container. */ + unsigned int bpfcr_astr_off; /* Offset of access string in .BTF + string table. */ + rtx_code_label * bpfcr_insn_label; /* RTX label attached to instruction + to patch. */ + enum btf_core_reloc_kind bpfcr_kind; /* Kind of relocation to perform. */ + + struct { + const char *accessor_str; + tree type; + } info; + + struct btf_ext_core_reloc *next; +}; + +/* Main data structure to keep .BTF.ext section data. */ +struct GTY ((chain_next ("%h.next"))) btf_ext_info_sec { + const char *sec_name; + uint32_t sec_name_off; /* offset to section name. */ + + struct { + uint32_t num_info; + struct btf_ext_funcinfo *head; + } func_info; + struct { + uint32_t num_info; + struct btf_ext_lineinfo *head; + } line_info; + struct { + uint32_t num_info; + struct btf_ext_core_reloc *head; + } core_info; + + struct btf_ext_info_sec *next; +}; + +static GTY (()) struct btf_ext_info_sec *btf_ext = NULL; + +/* Helper function to add a section structure to the linked list with entry + point in info static variable. */ + +static struct btf_ext_info_sec * +btfext_info_sec_find_or_add (const char *sec_name, bool add) +{ + struct btf_ext_info_sec **tmp = &btf_ext; + + while (*tmp != NULL) + { + if (strcmp ((*tmp)->sec_name, sec_name) == 0) + return *tmp; + tmp = &((*tmp)->next); + } + + if (add == false) + return NULL; + + struct btf_ext_info_sec *ret = ggc_cleared_alloc (); + *tmp = ret; + + /* Set data for section info. */ + ret->sec_name = sec_name; + ret->sec_name_off = btf_ext_add_string (sec_name); + + return ret; +} + +#define SEARCH_NODE_AND_RETURN(TYPE, FIELD, CONDITION) __extension__ ({ \ + TYPE **head = &(FIELD); \ + while (*head != NULL) \ + { \ + if (CONDITION) \ + return (*head); \ + head = &((*head)->next); \ + } \ + head; \ +}) + +/* Function to create or find a funcinfo node in info. */ + +static struct btf_ext_funcinfo * +bpf_create_or_find_funcinfo (const char *fnname, const char *sec_name, + btf_ext_info_sec **in_sec = NULL) +{ + struct btf_ext_info_sec *sec_elem = + btfext_info_sec_find_or_add (sec_name, true); + + if (in_sec != NULL) + *in_sec = sec_elem; + + struct btf_ext_funcinfo **head = + SEARCH_NODE_AND_RETURN(struct btf_ext_funcinfo, + sec_elem->func_info.head, + strcmp ((*head)->fnname, fnname) == 0); + + *head = ggc_cleared_alloc (); + (*head)->fnname = fnname; + (*head)->label = NULL; + + return *head; +} + +/* Function to create a core_reloc node in info. */ + +static struct btf_ext_core_reloc * +bpf_create_core_reloc (const char *sec_name, + struct btf_ext_info_sec **in_sec = NULL) +{ + struct btf_ext_info_sec *sec_elem = + btfext_info_sec_find_or_add (sec_name, true); + + if (in_sec != NULL) + *in_sec = sec_elem; + + struct btf_ext_core_reloc **head = + SEARCH_NODE_AND_RETURN(struct btf_ext_core_reloc, + sec_elem->core_info.head, + false); + + *head = ggc_cleared_alloc (); + + return *head; +} + +/* String caching to avoid repeated strings added to BTF string table. */ +struct GTY((chain_next ("%h.next"))) string_cache { + const char *str; + unsigned int offset; + struct string_cache *next; +}; +static GTY(()) struct string_cache *btf_ext_strings = NULL; + +unsigned int +btf_ext_add_string (const char *str) +{ + ctf_container_ref ctfc = ctf_get_tu_ctfc (); + struct string_cache **tmp = &btf_ext_strings; + while (*tmp != NULL) + { + if (strcmp ((*tmp)->str, str) == 0) + return (*tmp)->offset; + tmp = &((*tmp)->next); + } + + *tmp = ggc_cleared_alloc (); + (*tmp)->str = ggc_strdup (str); + ctf_add_string (ctfc, (*tmp)->str, &((*tmp)->offset), CTF_AUX_STRTAB); + + return (*tmp)->offset; +} + +/* Create a new BPF CO-RE relocation record, and add it to the appropriate + CO-RE section. */ +void +bpf_core_reloc_add (const tree type, const char * section_name, + const char *accessor, + rtx_code_label *label, + enum btf_core_reloc_kind kind) +{ + struct btf_ext_info_sec *sec = NULL; + struct btf_ext_core_reloc *bpfcr = bpf_create_core_reloc (section_name, &sec); + + ctf_container_ref ctfc = ctf_get_tu_ctfc (); + + /* Buffer the access string in the auxiliary strtab. */ + bpfcr->bpfcr_astr_off = 0; + if (accessor != NULL) + bpfcr->bpfcr_astr_off = btf_ext_add_string (accessor); + bpfcr->bpfcr_type = get_btf_id (ctf_lookup_tree_type (ctfc, type)); + bpfcr->bpfcr_insn_label = label; + bpfcr->bpfcr_kind = kind; + + bpfcr->info.accessor_str = accessor; + bpfcr->info.type = type; + + sec->core_info.num_info += 1; +} + +/* Return the 0-based index of the field NODE in its containing struct or union + type. */ + +int +bpf_core_get_sou_member_index (ctf_container_ref ctfc, const tree node) +{ + if (TREE_CODE (node) == FIELD_DECL) + { + const tree container = DECL_CONTEXT (node); + + /* Lookup the CTF type info for the containing type. */ + dw_die_ref die = lookup_type_die (container); + if (die == NULL) + return -1; + + ctf_dtdef_ref dtd = ctf_dtd_lookup (ctfc, die); + if (dtd == NULL) + return -1; + + unsigned int kind = CTF_V2_INFO_KIND (dtd->dtd_data.ctti_info); + if (kind != CTF_K_STRUCT && kind != CTF_K_UNION) + return -1; + + tree field = TYPE_FIELDS (container); + int i = 0; + ctf_dmdef_t * dmd; + for (dmd = dtd->dtd_u.dtu_members; + dmd != NULL; dmd = (ctf_dmdef_t *) ctf_dmd_list_next (dmd)) + { + bool field_has_btf = get_btf_id (dmd->dmd_type) <= BTF_MAX_TYPE; + + if (field == node) + return field_has_btf ? i : -1; + + if (field_has_btf) + i++; + + field = DECL_CHAIN (field); + } + } + return -1; +} + +/* Helper function to check if a particular named function exists as a + BTF_KIND_FUNC type record. */ + +static bool +btf_funcinfo_type_callback (ctf_dtdef_ref func, void *data) +{ + struct btf_ext_funcinfo *info = (struct btf_ext_funcinfo *) data; + if (strcmp (func->dtd_name, info->fnname) == 0) + { + uint32_t type = func->dtd_type; + info->type = type; + return true; + } + return false; +} + +/* Entry point function to add a func_info in local data structures + represented by info static variable. + This function is used in bpf.cc. */ + +struct btf_ext_funcinfo * +btf_add_func_info_for (tree decl, const char *label) +{ + const char *fnname = IDENTIFIER_POINTER (DECL_NAME (decl)); + const char *sec_name = decl_section_name (decl); + + /* Recover the original function name, which may have been mangled by + optimizations. */ + const char *cp_ptr = strstr (fnname, "."); + if (cp_ptr != NULL) + { + char new_name[100]; + strcpy (new_name, fnname); + int pos = cp_ptr - fnname; + new_name[pos] = 0; + fnname = ggc_strdup (new_name); + } + + if (sec_name == NULL) + sec_name = ".text"; + + struct btf_ext_info_sec *sec = NULL; + struct btf_ext_funcinfo *info = + bpf_create_or_find_funcinfo (fnname, sec_name, &sec); + + info->label = label; + return info; +} + +/* This function traverses all func_info entries and verified they do have a + BTF_KIND_FUNC type record associated. If they do not it is marked as + invalided by clearing the associated label. */ + +static void +btf_validate_funcinfo (btf_ext_info_sec *sec) +{ + while (sec != NULL) + { + struct btf_ext_funcinfo *funcinfo = sec->func_info.head; + while (funcinfo != NULL) + { + bool found = traverse_btf_func_types (btf_funcinfo_type_callback, + funcinfo); + if (found == true) + sec->func_info.num_info += 1; + else + funcinfo->label = NULL; + + funcinfo = funcinfo->next; + } + sec = sec->next; + } +} + +/* Compute the section size in section for func_info, line_info and core_info + regions of .BTF.ext. */ + +static void +btf_ext_info_len (uint32_t *fi_len, uint32_t *li_len, uint32_t *cr_len) +{ + *fi_len = *li_len = *cr_len = 0; + struct btf_ext_info_sec *tmp = btf_ext; + if (tmp != NULL) + while (tmp != NULL) + { + /* Size computation does 8 bytes per section entry plus num_info of the + * respective structure size: + - 8 bytes for func_info, + - 16 bytes for both line_info and core_info. */ + if (tmp->func_info.num_info > 0) + *fi_len += 8 + (8 * tmp->func_info.num_info); + if (tmp->line_info.num_info > 0) + *li_len += 8 + (16 * tmp->line_info.num_info); + if (tmp->core_info.num_info > 0) + *cr_len += 8 + (16 * tmp->core_info.num_info); + tmp = tmp->next; + } + + /* If there are entries within the regions, add 4 bytes to set the header of + the respective sections that contains the size for each of the entry. */ + *fi_len += *fi_len != 0 ? 4 : 0; + *li_len += *li_len != 0 ? 4 : 0; + *cr_len += *cr_len != 0 ? 4 : 0; +} + +/* Compute and output the header of a .BTF.ext debug info section. */ + +static void +output_btfext_header (void) +{ + switch_to_section (btf_ext_info_section); + ASM_OUTPUT_LABEL (asm_out_file, btf_ext_info_section_label); + + dw2_asm_output_data (2, BTF_MAGIC, "btf_magic"); + dw2_asm_output_data (1, BTF_VERSION, "btfext_version"); + dw2_asm_output_data (1, 0, "btfext_flags"); + dw2_asm_output_data (4, sizeof (struct btf_ext_header), "btfext_hdr_len"); + + btf_validate_funcinfo (btf_ext); + + uint32_t func_info_len = 0; + uint32_t line_info_len = 0; + uint32_t core_info_len = 0; + btf_ext_info_len (&func_info_len, &line_info_len, &core_info_len); + + if (!TARGET_BPF_CORE) + core_info_len = 0; + + uint32_t func_info_off = 0; + uint32_t line_info_off = func_info_len; + uint32_t core_info_off = line_info_off + line_info_len; + + dw2_asm_output_data (4, func_info_off, "func_info_offset"); + dw2_asm_output_data (4, func_info_len, "func_info_len"); + + dw2_asm_output_data (4, line_info_off, "line_info_offset"); + dw2_asm_output_data (4, line_info_len, "line_info_len"); + + dw2_asm_output_data (4, core_info_off, "core_relo_offset"); + dw2_asm_output_data (4, core_info_len, "core_relo_len"); +} + +/* Outputs func_info region on .BTF.ext. */ + +static void +output_btfext_func_info (struct btf_ext_info_sec *sec) +{ + unsigned int str_aux_off = ctfc_get_strtab_len (ctf_get_tu_ctfc (), + CTF_STRTAB); + bool executed = false; + while (sec != NULL) + { + uint32_t count = 0; + if (sec->func_info.num_info > 0) + { + if (executed == false && (executed = true)) + dw2_asm_output_data (4, 8, "FuncInfo entry size"); + dw2_asm_output_data (4, sec->sec_name_off + str_aux_off, + "FuncInfo section string for %s", + sec->sec_name); + dw2_asm_output_data (4, sec->func_info.num_info, "Number of entries"); + + struct btf_ext_funcinfo *elem = sec->func_info.head; + while (elem != NULL) + { + if (elem->label != NULL) + { + count += 1; + dw2_asm_output_offset (4, elem->label, + NULL, "label for function %s", elem->fnname); + dw2_asm_output_data (4, elem->type, "btf_type_id"); + } + elem = elem->next; + } + } + + gcc_assert (count == sec->func_info.num_info); + sec = sec->next; + } +} + +/* Output all CO-RE relocation sections. */ + +static void +output_btfext_core_sections (void) +{ + struct btf_ext_info_sec *sec = btf_ext; + unsigned int str_aux_off = ctfc_get_strtab_len (ctf_get_tu_ctfc (), + CTF_STRTAB); + bool executed = false; + while (sec != NULL) + { + uint32_t count = 0; + if (sec->core_info.num_info > 0) + { + if (executed == false && (executed = true)) + dw2_asm_output_data (4, 16, "CoreInfo entry size"); + dw2_asm_output_data (4, sec->sec_name_off + str_aux_off, + "CoreInfo section string for %s", + sec->sec_name); + dw2_asm_output_data (4, sec->core_info.num_info, "Number of entries"); + + struct btf_ext_core_reloc *bpfcr = sec->core_info.head; + while (bpfcr != NULL) + { + count += 1; + dw2_assemble_integer (4, + gen_rtx_LABEL_REF (Pmode, bpfcr->bpfcr_insn_label)); + fprintf (asm_out_file, "\t%s%s\n", + flag_debug_asm ? ASM_COMMENT_START : "", + (flag_debug_asm ? " bpfcr_insn" : "")); + + /* Extract the pretty print for the type expression. */ + pretty_printer pp; + dump_generic_node (&pp, bpfcr->info.type, 0, + TDF_VOPS|TDF_MEMSYMS|TDF_SLIM, + false); + char *str = xstrdup (pp_formatted_text (&pp)); + + dw2_asm_output_data (4, bpfcr->bpfcr_type, "bpfcr_type (%s)", + str); + dw2_asm_output_data (4, bpfcr->bpfcr_astr_off + str_aux_off, + "bpfcr_astr_off (\"%s\")", + bpfcr->info.accessor_str); + dw2_asm_output_data (4, bpfcr->bpfcr_kind, "bpfcr_kind"); + bpfcr = bpfcr->next; + } + } + + gcc_assert (count == sec->core_info.num_info); + sec = sec->next; + } +} + +/* Initialize sections, labels, and data structures for BTF.ext output. */ + +void +btf_ext_init (void) +{ + btf_ext_info_section = get_section (BTF_EXT_INFO_SECTION_NAME, + BTF_EXT_INFO_SECTION_FLAGS, NULL); + + ASM_GENERATE_INTERNAL_LABEL (btf_ext_info_section_label, + "Lbtfext", 0); +} + +/* Output the entire .BTF.ext section. */ + +void +btf_ext_output (void) +{ + output_btfext_header (); + output_btfext_func_info (btf_ext); + if (TARGET_BPF_CORE) + output_btfext_core_sections (); + + /* Extra padding required by BPF code, in case all structures are empty. */ + dw2_asm_output_data (4, 0, "Required padding by libbpf structs"); +} + +#include "gt-btfext-out.h" diff --git a/gcc/config/bpf/coreout.h b/gcc/config/bpf/btfext-out.h similarity index 82% rename from gcc/config/bpf/coreout.h rename to gcc/config/bpf/btfext-out.h index 8a209f26e94b..b36309475c97 100644 --- a/gcc/config/bpf/coreout.h +++ b/gcc/config/bpf/btfext-out.h @@ -1,4 +1,4 @@ -/* coreout.h - Declarations and definitions related to +/* btfext-out.h - Declarations and definitions related to BPF Compile Once - Run Everywhere (CO-RE) support. Copyright (C) 2021-2024 Free Software Foundation, Inc. @@ -38,22 +38,6 @@ struct btf_ext_section_header uint32_t num_records; }; -/* A funcinfo record, in the .BTF.ext funcinfo section. */ -struct btf_ext_funcinfo -{ - uint32_t insn_off; /* Offset of the first instruction of the function. */ - uint32_t type; /* Type ID of a BTF_KIND_FUNC type. */ -}; - -/* A lineinfo record, in the .BTF.ext lineinfo section. */ -struct btf_ext_lineinfo -{ - uint32_t insn_off; /* Offset of the instruction. */ - uint32_t file_name_off; /* Offset of file name in BTF string table. */ - uint32_t line_off; /* Offset of source line in BTF string table. */ - uint32_t line_col; /* Line number (bits 31-11) and column (11-0). */ -}; - enum btf_core_reloc_kind { BPF_RELO_INVALID = -1, @@ -113,6 +97,10 @@ bpf_core_reloc_add (const tree type, const char * section_name, extern int bpf_core_get_sou_member_index (ctf_container_ref, const tree); +struct btf_ext_funcinfo *btf_add_func_info_for (tree decl, + const char *label); +unsigned int btf_ext_add_string (const char *str); + #ifdef __cplusplus } #endif diff --git a/gcc/config/bpf/core-builtins.cc b/gcc/config/bpf/core-builtins.cc index aa75fd68cae6..8d8c54c1fb3d 100644 --- a/gcc/config/bpf/core-builtins.cc +++ b/gcc/config/bpf/core-builtins.cc @@ -45,7 +45,7 @@ along with GCC; see the file COPYING3. If not see #include "ctfc.h" #include "btf.h" -#include "coreout.h" +#include "btfext-out.h" #include "core-builtins.h" /* BPF CO-RE builtins definition. diff --git a/gcc/config/bpf/core-builtins.h b/gcc/config/bpf/core-builtins.h index c54f6ddac812..e56b55b94e0c 100644 --- a/gcc/config/bpf/core-builtins.h +++ b/gcc/config/bpf/core-builtins.h @@ -1,7 +1,7 @@ #ifndef BPF_CORE_BUILTINS_H #define BPF_CORE_BUILTINS_H -#include "coreout.h" +#include "btfext-out.h" enum bpf_builtins { diff --git a/gcc/config/bpf/coreout.cc b/gcc/config/bpf/coreout.cc deleted file mode 100644 index 2f06ec2a0f29..000000000000 --- a/gcc/config/bpf/coreout.cc +++ /dev/null @@ -1,383 +0,0 @@ -/* BPF Compile Once - Run Everywhere (CO-RE) support. - Copyright (C) 2021-2024 Free Software Foundation, Inc. - - This file is part of GCC. - - GCC is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - GCC is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GCC; see the file COPYING3. If not see - . */ - -#define IN_TARGET_CODE 1 - -#include "config.h" -#include "system.h" -#include "coretypes.h" -#include "target.h" -#include "memmodel.h" -#include "tm_p.h" -#include "output.h" -#include "dwarf2asm.h" -#include "ctfc.h" -#include "btf.h" -#include "rtl.h" -#include "tree-pretty-print.h" - -#include "coreout.h" - -/* This file contains data structures and routines for construction and output - of BPF Compile Once - Run Everywhere (BPF CO-RE) information. - - eBPF programs written in C usually include Linux kernel headers, so that - they may interact with kernel data structures in a useful way. This - intrudces two major portability issues: - - 1. Kernel data structures regularly change, with fields added, moved or - deleted between versions. An eBPF program cannot in general be expected - to run on any systems which does not share an identical kernel version to - the system on which it was compiled. - - 2. Included kernel headers (and used data structures) may be internal, not - exposed in an userspace API, and therefore target-specific. An eBPF - program compiled on an x86_64 machine will include x86_64 kernel headers. - The resulting program may not run well (or at all) in machines of - another architecture. - - BPF CO-RE is designed to solve the first issue by leveraging the BPF loader - to adjust references to kernel data structures made by the program as-needed - according to versions of structures actually present on the host kernel. - - To achieve this, additional information is placed in a ".BTF.ext" section. - This information tells the loader which references will require adjusting, - and how to perform each necessary adjustment. - - For any access to a data structure which may require load-time adjustment, - the following information is recorded (making up a CO-RE relocation record): - - The BTF type ID of the outermost structure which is accessed. - - An access string encoding the accessed member via a series of member and - array indexes. These indexes are used to look up detailed BTF information - about the member. - - The offset of the appropriate instruction to patch in the BPF program. - - An integer specifying what kind of relocation to perform. - - A CO-RE-capable BPF loader reads this information together with the BTF - information of the program, compares it against BTF information of the host - kernel, and determines the appropriate way to patch the specified - instruction. - - Once all CO-RE relocations are resolved, the program is loaded and verified - as usual. The process can be summarized with the following diagram: - - +------------+ - | C compiler | - +-----+------+ - | BPF + BTF + CO-RE relocations - v - +------------+ - +--->| BPF loader | - | +-----+------+ - | | BPF (adapted) - BTF | v - | +------------+ - +----+ Kernel | - +------------+ - - Note that a single ELF object may contain multiple eBPF programs. As a - result, a single .BTF.ext section can contain CO-RE relocations for multiple - programs in distinct sections. */ - -/* Internal representation of a BPF CO-RE relocation record. */ - -typedef struct GTY (()) bpf_core_reloc { - unsigned int bpfcr_type; /* BTF type ID of container. */ - unsigned int bpfcr_astr_off; /* Offset of access string in .BTF - string table. */ - rtx_code_label * bpfcr_insn_label; /* RTX label attached to instruction - to patch. */ - enum btf_core_reloc_kind bpfcr_kind; /* Kind of relocation to perform. */ -} bpf_core_reloc_t; - -typedef bpf_core_reloc_t * bpf_core_reloc_ref; - -/* Internal representation of a CO-RE relocation (sub)section of the - .BTF.ext information. One such section is generated for each ELF section - in the output object having relocations that a BPF loader must resolve. */ - -typedef struct GTY (()) bpf_core_section { - /* Name of ELF section to which these CO-RE relocations apply. */ - const char * name; - - /* Offset of section name in .BTF string table. */ - uint32_t name_offset; - - /* Relocations in the section. */ - vec * GTY (()) relocs; -} bpf_core_section_t; - -typedef bpf_core_section_t * bpf_core_section_ref; - -/* BTF.ext debug info section. */ - -static GTY (()) section * btf_ext_info_section; - -static int btf_ext_label_num; - -#ifndef BTF_EXT_INFO_SECTION_NAME -#define BTF_EXT_INFO_SECTION_NAME ".BTF.ext" -#endif - -#define BTF_EXT_INFO_SECTION_FLAGS (SECTION_DEBUG) - -#define MAX_BTF_EXT_LABEL_BYTES 40 - -static char btf_ext_info_section_label[MAX_BTF_EXT_LABEL_BYTES]; - -#ifndef BTF_EXT_INFO_SECTION_LABEL -#define BTF_EXT_INFO_SECTION_LABEL "Lbtfext" -#endif - -static GTY (()) vec *bpf_core_sections; - -struct GTY(()) bpf_core_extra { - const char *accessor_str; - tree type; -}; -typedef struct bpf_core_extra *bpf_core_extra_ref; -static GTY(()) hash_map *bpf_comment_info; - -/* Create a new BPF CO-RE relocation record, and add it to the appropriate - CO-RE section. */ -void -bpf_core_reloc_add (const tree type, const char * section_name, - const char *accessor, - rtx_code_label *label, - enum btf_core_reloc_kind kind) -{ - bpf_core_reloc_ref bpfcr = ggc_cleared_alloc (); - bpf_core_extra_ref info = ggc_cleared_alloc (); - ctf_container_ref ctfc = ctf_get_tu_ctfc (); - - /* Buffer the access string in the auxiliary strtab. */ - ctf_add_string (ctfc, accessor, &(bpfcr->bpfcr_astr_off), CTF_AUX_STRTAB); - bpfcr->bpfcr_type = get_btf_id (ctf_lookup_tree_type (ctfc, type)); - bpfcr->bpfcr_insn_label = label; - bpfcr->bpfcr_kind = kind; - - info->accessor_str = accessor; - info->type = type; - bpf_comment_info->put (bpfcr, info); - - /* Add the CO-RE reloc to the appropriate section. */ - bpf_core_section_ref sec; - int i; - FOR_EACH_VEC_ELT (*bpf_core_sections, i, sec) - if (strcmp (sec->name, section_name) == 0) - { - vec_safe_push (sec->relocs, bpfcr); - return; - } - - /* If the CO-RE section does not yet exist, create it. */ - sec = ggc_cleared_alloc (); - - ctf_add_string (ctfc, section_name, &sec->name_offset, CTF_AUX_STRTAB); - if (strcmp (section_name, "")) - ctfc->ctfc_aux_strlen += strlen (section_name) + 1; - - sec->name = section_name; - vec_alloc (sec->relocs, 1); - vec_safe_push (sec->relocs, bpfcr); - - vec_safe_push (bpf_core_sections, sec); -} - -/* Return the 0-based index of the field NODE in its containing struct or union - type. */ - -int -bpf_core_get_sou_member_index (ctf_container_ref ctfc, const tree node) -{ - if (TREE_CODE (node) == FIELD_DECL) - { - const tree container = DECL_CONTEXT (node); - - /* Lookup the CTF type info for the containing type. */ - dw_die_ref die = lookup_type_die (container); - if (die == NULL) - return -1; - - ctf_dtdef_ref dtd = ctf_dtd_lookup (ctfc, die); - if (dtd == NULL) - return -1; - - unsigned int kind = CTF_V2_INFO_KIND (dtd->dtd_data.ctti_info); - if (kind != CTF_K_STRUCT && kind != CTF_K_UNION) - return -1; - - tree field = TYPE_FIELDS (container); - int i = 0; - ctf_dmdef_t * dmd; - for (dmd = dtd->dtd_u.dtu_members; - dmd != NULL; dmd = (ctf_dmdef_t *) ctf_dmd_list_next (dmd)) - { - bool field_has_btf = get_btf_id (dmd->dmd_type) <= BTF_MAX_TYPE; - - if (field == node) - return field_has_btf ? i : -1; - - if (field_has_btf) - i++; - - field = DECL_CHAIN (field); - } - } - return -1; -} - -/* Compute and output the header of a .BTF.ext debug info section. */ - -static void -output_btfext_header (void) -{ - switch_to_section (btf_ext_info_section); - ASM_OUTPUT_LABEL (asm_out_file, btf_ext_info_section_label); - - dw2_asm_output_data (2, BTF_MAGIC, "btf_magic"); - dw2_asm_output_data (1, BTF_VERSION, "btfext_version"); - dw2_asm_output_data (1, 0, "btfext_flags"); - dw2_asm_output_data (4, sizeof (struct btf_ext_header), "btfext_hdr_len"); - - uint32_t func_info_off = 0, func_info_len = 0; - uint32_t line_info_off = 0, line_info_len = 0; - uint32_t core_relo_off = 0, core_relo_len = 0; - - /* Header core_relo_len is the sum total length in bytes of all CO-RE - relocation sections, plus the 4 byte record size. */ - size_t i; - bpf_core_section_ref sec; - core_relo_len += vec_safe_length (bpf_core_sections) - * sizeof (struct btf_ext_section_header); - - FOR_EACH_VEC_ELT (*bpf_core_sections, i, sec) - core_relo_len += - vec_safe_length (sec->relocs) * sizeof (struct btf_ext_reloc); - - if (core_relo_len) - core_relo_len += sizeof (uint32_t); - - dw2_asm_output_data (4, func_info_off, "func_info_offset"); - dw2_asm_output_data (4, func_info_len, "func_info_len"); - - dw2_asm_output_data (4, line_info_off, "line_info_offset"); - dw2_asm_output_data (4, line_info_len, "line_info_len"); - - dw2_asm_output_data (4, core_relo_off, "core_relo_offset"); - dw2_asm_output_data (4, core_relo_len, "core_relo_len"); -} - -/* Output a single CO-RE relocation record. */ - -static void -output_asm_btfext_core_reloc (bpf_core_reloc_ref bpfcr) -{ - bpf_core_extra_ref *info = bpf_comment_info->get (bpfcr); - gcc_assert (info != NULL); - - bpfcr->bpfcr_astr_off += ctfc_get_strtab_len (ctf_get_tu_ctfc (), - CTF_STRTAB); - - dw2_assemble_integer (4, gen_rtx_LABEL_REF (Pmode, bpfcr->bpfcr_insn_label)); - fprintf (asm_out_file, "\t%s%s\n", - flag_debug_asm ? ASM_COMMENT_START : "", - (flag_debug_asm ? " bpfcr_insn" : "")); - - /* Extract the pretty print for the type expression. */ - pretty_printer pp; - dump_generic_node (&pp, (*info)->type, 0, TDF_VOPS|TDF_MEMSYMS|TDF_SLIM, - false); - char *str = xstrdup (pp_formatted_text (&pp)); - - dw2_asm_output_data (4, bpfcr->bpfcr_type, "bpfcr_type (%s)", str); - dw2_asm_output_data (4, bpfcr->bpfcr_astr_off, "bpfcr_astr_off (\"%s\")", - (*info)->accessor_str); - dw2_asm_output_data (4, bpfcr->bpfcr_kind, "bpfcr_kind"); -} - -/* Output all CO-RE relocation records for a section. */ - -static void -output_btfext_core_relocs (bpf_core_section_ref sec) -{ - size_t i; - bpf_core_reloc_ref bpfcr; - FOR_EACH_VEC_ELT (*(sec->relocs), i, bpfcr) - output_asm_btfext_core_reloc (bpfcr); -} - -/* Output all CO-RE relocation sections. */ - -static void -output_btfext_core_sections (void) -{ - size_t i; - bpf_core_section_ref sec; - - /* BTF Ext section info. */ - dw2_asm_output_data (4, sizeof (struct btf_ext_reloc), - "btfext_core_info_rec_size"); - - FOR_EACH_VEC_ELT (*bpf_core_sections, i, sec) - { - /* Section name offset, refers to the offset of a string with the name of - the section to which these CORE relocations refer, e.g. '.text'. - The string is buffered in the BTF strings table. */ - - /* BTF specific strings are in CTF_AUX_STRTAB, which is concatenated - after CTF_STRTAB. Add the length of STRTAB to the final offset. */ - sec->name_offset += ctfc_get_strtab_len (ctf_get_tu_ctfc (), CTF_STRTAB); - - dw2_asm_output_data (4, sec->name_offset, "btfext_secinfo_sec_name_off"); - dw2_asm_output_data (4, vec_safe_length (sec->relocs), - "btfext_secinfo_num_recs"); - - output_btfext_core_relocs (sec); - } -} - -/* Initialize sections, labels, and data structures for BTF.ext output. */ - -void -btf_ext_init (void) -{ - btf_ext_info_section = get_section (BTF_EXT_INFO_SECTION_NAME, - BTF_EXT_INFO_SECTION_FLAGS, NULL); - - ASM_GENERATE_INTERNAL_LABEL (btf_ext_info_section_label, - BTF_EXT_INFO_SECTION_LABEL, - btf_ext_label_num++); - - vec_alloc (bpf_core_sections, 1); - bpf_comment_info = hash_map::create_ggc (); -} - -/* Output the entire .BTF.ext section. */ - -void -btf_ext_output (void) -{ - output_btfext_header (); - output_btfext_core_sections (); - - bpf_core_sections = NULL; -} - -#include "gt-coreout.h" diff --git a/gcc/config/bpf/t-bpf b/gcc/config/bpf/t-bpf index 18f1fa67794d..dc50332350c4 100644 --- a/gcc/config/bpf/t-bpf +++ b/gcc/config/bpf/t-bpf @@ -1,7 +1,7 @@ -TM_H += $(srcdir)/config/bpf/coreout.h $(srcdir)/config/bpf/core-builtins.h +TM_H += $(srcdir)/config/bpf/btfext-out.h $(srcdir)/config/bpf/core-builtins.h -coreout.o: $(srcdir)/config/bpf/coreout.cc +btfext-out.o: $(srcdir)/config/bpf/btfext-out.cc $(COMPILE) $< $(POSTCOMPILE) diff --git a/gcc/config/i386/amxtileintrin.h b/gcc/config/i386/amxtileintrin.h index d1a26e0fea5b..5081b3264984 100644 --- a/gcc/config/i386/amxtileintrin.h +++ b/gcc/config/i386/amxtileintrin.h @@ -39,14 +39,14 @@ extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _tile_loadconfig (const void *__config) { - __asm__ volatile ("ldtilecfg\t%X0" :: "m" (*((const void **)__config))); + __builtin_ia32_ldtilecfg (__config); } extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _tile_storeconfig (void *__config) { - __asm__ volatile ("sttilecfg\t%X0" : "=m" (*((void **)__config))); + __builtin_ia32_sttilecfg (__config); } extern __inline void diff --git a/gcc/config/i386/constraints.md b/gcc/config/i386/constraints.md index 64702d9c0a88..7508d7a58bd7 100644 --- a/gcc/config/i386/constraints.md +++ b/gcc/config/i386/constraints.md @@ -280,7 +280,7 @@ (and (match_code "const_int") (ior (match_test "ival == 0xff") (match_test "ival == 0xffff") - (match_test "ival == (HOST_WIDE_INT) 0xffffffff")))) + (match_test "ival == HOST_WIDE_INT_C (0xffffffff)")))) (define_constraint "M" "0, 1, 2, or 3 (shifts for the @code{lea} instruction)." diff --git a/gcc/config/i386/i386-builtin.def b/gcc/config/i386/i386-builtin.def index 729355230b86..ab73e20121aa 100644 --- a/gcc/config/i386/i386-builtin.def +++ b/gcc/config/i386/i386-builtin.def @@ -126,6 +126,10 @@ BDESC (OPTION_MASK_ISA_XSAVES | OPTION_MASK_ISA_64BIT, 0, CODE_FOR_nothing, "__b BDESC (OPTION_MASK_ISA_XSAVES | OPTION_MASK_ISA_64BIT, 0, CODE_FOR_nothing, "__builtin_ia32_xrstors64", IX86_BUILTIN_XRSTORS64, UNKNOWN, (int) VOID_FTYPE_PVOID_INT64) BDESC (OPTION_MASK_ISA_XSAVEC | OPTION_MASK_ISA_64BIT, 0, CODE_FOR_nothing, "__builtin_ia32_xsavec64", IX86_BUILTIN_XSAVEC64, UNKNOWN, (int) VOID_FTYPE_PVOID_INT64) +/* LDFILECFG and STFILECFG. */ +BDESC (OPTION_MASK_ISA_64BIT, OPTION_MASK_ISA2_AMX_TILE, CODE_FOR_nothing, "__builtin_ia32_ldtilecfg", IX86_BUILTIN_LDTILECFG, UNKNOWN, (int) VOID_FTYPE_PCVOID) +BDESC (OPTION_MASK_ISA_64BIT, OPTION_MASK_ISA2_AMX_TILE, CODE_FOR_nothing, "__builtin_ia32_sttilecfg", IX86_BUILTIN_STTILECFG, UNKNOWN, (int) VOID_FTYPE_PVOID) + /* SSE */ BDESC (OPTION_MASK_ISA_SSE, 0, CODE_FOR_movv4sf_internal, "__builtin_ia32_storeups", IX86_BUILTIN_STOREUPS, UNKNOWN, (int) VOID_FTYPE_PFLOAT_V4SF) BDESC (OPTION_MASK_ISA_SSE, 0, CODE_FOR_sse_movntv4sf, "__builtin_ia32_movntps", IX86_BUILTIN_MOVNTPS, UNKNOWN, (int) VOID_FTYPE_PFLOAT_V4SF) diff --git a/gcc/config/i386/i386-builtins.cc b/gcc/config/i386/i386-builtins.cc index d5b83e9d90fc..8b79d335c882 100644 --- a/gcc/config/i386/i386-builtins.cc +++ b/gcc/config/i386/i386-builtins.cc @@ -82,6 +82,8 @@ along with GCC; see the file COPYING3. If not see #include "intl.h" #include "ifcvt.h" #include "symbol-summary.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "wide-int-bitmask.h" diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc index 50f9fe2c0d73..2210e6f7cc85 100644 --- a/gcc/config/i386/i386-expand.cc +++ b/gcc/config/i386/i386-expand.cc @@ -82,6 +82,8 @@ along with GCC; see the file COPYING3. If not see #include "intl.h" #include "ifcvt.h" #include "symbol-summary.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "wide-int-bitmask.h" @@ -449,15 +451,29 @@ ix86_expand_move (machine_mode mode, rtx operands[]) && GET_MODE (SUBREG_REG (op1)) == DImode && SUBREG_BYTE (op1) == 0) op1 = gen_rtx_ZERO_EXTEND (TImode, SUBREG_REG (op1)); + /* As not all values in XFmode are representable in real_value, + we might be called with unfoldable SUBREGs of constants. */ + if (mode == XFmode + && CONSTANT_P (SUBREG_REG (op1)) + && can_create_pseudo_p ()) + { + machine_mode imode = GET_MODE (SUBREG_REG (op1)); + rtx r = force_const_mem (imode, SUBREG_REG (op1)); + if (r) + r = validize_mem (r); + else + r = force_reg (imode, SUBREG_REG (op1)); + op1 = simplify_gen_subreg (mode, r, imode, SUBREG_BYTE (op1)); + } break; } if ((flag_pic || MACHOPIC_INDIRECT) && symbolic_operand (op1, mode)) { +#if TARGET_MACHO if (TARGET_MACHO && !TARGET_64BIT) { -#if TARGET_MACHO /* dynamic-no-pic */ if (MACHOPIC_INDIRECT) { @@ -474,33 +490,18 @@ ix86_expand_move (machine_mode mode, rtx operands[]) emit_insn (insn); return; } - if (GET_CODE (op0) == MEM) - op1 = force_reg (Pmode, op1); - else - { - rtx temp = op0; - if (GET_CODE (temp) != REG) - temp = gen_reg_rtx (Pmode); - temp = legitimize_pic_address (op1, temp); - if (temp == op0) - return; - op1 = temp; - } - /* dynamic-no-pic */ -#endif } - else +#endif + + if (MEM_P (op0)) + op1 = force_reg (mode, op1); + else if (!(TARGET_64BIT && x86_64_movabs_operand (op1, DImode))) { - if (MEM_P (op0)) - op1 = force_reg (mode, op1); - else if (!(TARGET_64BIT && x86_64_movabs_operand (op1, DImode))) - { - rtx reg = can_create_pseudo_p () ? NULL_RTX : op0; - op1 = legitimize_pic_address (op1, reg); - if (op0 == op1) - return; - op1 = convert_to_mode (mode, op1, 1); - } + rtx reg = can_create_pseudo_p () ? NULL_RTX : op0; + op1 = legitimize_pic_address (op1, reg); + if (op0 == op1) + return; + op1 = convert_to_mode (mode, op1, 1); } } else @@ -14150,6 +14151,25 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget, emit_insn (pat); return 0; + case IX86_BUILTIN_LDTILECFG: + case IX86_BUILTIN_STTILECFG: + arg0 = CALL_EXPR_ARG (exp, 0); + op0 = expand_normal (arg0); + + if (!address_operand (op0, VOIDmode)) + { + op0 = convert_memory_address (Pmode, op0); + op0 = copy_addr_to_reg (op0); + } + op0 = gen_rtx_MEM (XImode, op0); + if (fcode == IX86_BUILTIN_LDTILECFG) + icode = CODE_FOR_ldtilecfg; + else + icode = CODE_FOR_sttilecfg; + pat = GEN_FCN (icode) (op0); + emit_insn (pat); + return 0; + case IX86_BUILTIN_LLWPCB: arg0 = CALL_EXPR_ARG (exp, 0); op0 = expand_normal (arg0); diff --git a/gcc/config/i386/i386-features.cc b/gcc/config/i386/i386-features.cc index f1b1cf242337..1de2a07ed75c 100644 --- a/gcc/config/i386/i386-features.cc +++ b/gcc/config/i386/i386-features.cc @@ -82,6 +82,8 @@ along with GCC; see the file COPYING3. If not see #include "intl.h" #include "ifcvt.h" #include "symbol-summary.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "wide-int-bitmask.h" @@ -2688,6 +2690,7 @@ rest_of_handle_insert_vzeroupper (void) } } + df_remove_problem (df_note); df_analyze (); return 0; } diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc index 8f5ce817630c..3cc147fa70c3 100644 --- a/gcc/config/i386/i386-options.cc +++ b/gcc/config/i386/i386-options.cc @@ -82,6 +82,8 @@ along with GCC; see the file COPYING3. If not see #include "intl.h" #include "ifcvt.h" #include "symbol-summary.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "wide-int-bitmask.h" @@ -3382,23 +3384,34 @@ ix86_set_func_type (tree fndecl) { /* No need to save and restore callee-saved registers for a noreturn function with nothrow or compiled with -fno-exceptions unless when - compiling with -O0 or -Og. + compiling with -O0 or -Og, except that it interferes with debugging + of callers. So that backtrace works for those at least + in most cases, save the bp register if it is used, because it often + is used in callers to compute CFA. NB: Can't use just TREE_THIS_VOLATILE to check if this is a noreturn function. The local-pure-const pass turns an interrupt function into a noreturn function by setting TREE_THIS_VOLATILE. Normally the local-pure-const pass is run after ix86_set_func_type is called. When the local-pure-const pass is enabled for LTO, the interrupt - function is marked as noreturn in the IR output, which leads the - incompatible attribute error in LTO1. */ - bool has_no_callee_saved_registers - = ((TREE_THIS_VOLATILE (fndecl) - && lookup_attribute ("noreturn", DECL_ATTRIBUTES (fndecl)) - && optimize - && !optimize_debug - && (TREE_NOTHROW (fndecl) || !flag_exceptions)) - || lookup_attribute ("no_callee_saved_registers", - TYPE_ATTRIBUTES (TREE_TYPE (fndecl)))); + function is marked with TREE_THIS_VOLATILE in the IR output, which + leads to the incompatible attribute error in LTO1. Ignore the + interrupt function in this case. */ + enum call_saved_registers_type no_callee_saved_registers + = TYPE_DEFAULT_CALL_SAVED_REGISTERS; + if (lookup_attribute ("no_callee_saved_registers", + TYPE_ATTRIBUTES (TREE_TYPE (fndecl)))) + no_callee_saved_registers = TYPE_NO_CALLEE_SAVED_REGISTERS; + else if (ix86_noreturn_no_callee_saved_registers + && TREE_THIS_VOLATILE (fndecl) + && optimize + && !optimize_debug + && (TREE_NOTHROW (fndecl) || !flag_exceptions) + && !lookup_attribute ("interrupt", + TYPE_ATTRIBUTES (TREE_TYPE (fndecl))) + && !lookup_attribute ("no_caller_saved_registers", + TYPE_ATTRIBUTES (TREE_TYPE (fndecl)))) + no_callee_saved_registers = TYPE_NO_CALLEE_SAVED_REGISTERS_EXCEPT_BP; if (cfun->machine->func_type == TYPE_UNKNOWN) { @@ -3409,7 +3422,7 @@ ix86_set_func_type (tree fndecl) error_at (DECL_SOURCE_LOCATION (fndecl), "interrupt and naked attributes are not compatible"); - if (has_no_callee_saved_registers) + if (no_callee_saved_registers) error_at (DECL_SOURCE_LOCATION (fndecl), "%qs and %qs attributes are not compatible", "interrupt", "no_callee_saved_registers"); @@ -3438,7 +3451,7 @@ ix86_set_func_type (tree fndecl) TYPE_ATTRIBUTES (TREE_TYPE (fndecl)))) cfun->machine->call_saved_registers = TYPE_NO_CALLER_SAVED_REGISTERS; - if (has_no_callee_saved_registers) + if (no_callee_saved_registers) { if (cfun->machine->call_saved_registers == TYPE_NO_CALLER_SAVED_REGISTERS) @@ -3447,7 +3460,7 @@ ix86_set_func_type (tree fndecl) "no_caller_saved_registers", "no_callee_saved_registers"); cfun->machine->call_saved_registers - = TYPE_NO_CALLEE_SAVED_REGISTERS; + = no_callee_saved_registers; } } } diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index 46f238651a6b..4b6b665e5997 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -86,6 +86,8 @@ along with GCC; see the file COPYING3. If not see #include "intl.h" #include "ifcvt.h" #include "symbol-summary.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "wide-int-bitmask.h" @@ -982,8 +984,9 @@ ix86_function_ok_for_sibcall (tree decl, tree exp) /* Sibling call isn't OK if callee has no callee-saved registers and the calling function has callee-saved registers. */ - if ((cfun->machine->call_saved_registers - != TYPE_NO_CALLEE_SAVED_REGISTERS) + if (cfun->machine->call_saved_registers != TYPE_NO_CALLEE_SAVED_REGISTERS + && (cfun->machine->call_saved_registers + != TYPE_NO_CALLEE_SAVED_REGISTERS_EXCEPT_BP) && lookup_attribute ("no_callee_saved_registers", TYPE_ATTRIBUTES (type))) return false; @@ -6647,6 +6650,11 @@ ix86_save_reg (unsigned int regno, bool maybe_eh_return, bool ignore_outlined) case TYPE_NO_CALLEE_SAVED_REGISTERS: return false; + + case TYPE_NO_CALLEE_SAVED_REGISTERS_EXCEPT_BP: + if (regno != HARD_FRAME_POINTER_REGNUM) + return false; + break; } if (regno == REAL_PIC_OFFSET_TABLE_REGNUM @@ -22907,7 +22915,7 @@ x86_function_profiler (FILE *file, int labelno ATTRIBUTE_UNUSED) if (!ix86_direct_extern_access) { if (ASSEMBLER_DIALECT == ASM_INTEL) - fprintf (file, "1:\tcall\t[QWORD PTR %s@GOTPCREL[rip]]", + fprintf (file, "1:\tcall\t[QWORD PTR %s@GOTPCREL[rip]]\n", mcount_name); else fprintf (file, "1:\tcall\t*%s@GOTPCREL(%%rip)\n", @@ -25775,13 +25783,11 @@ ix86_get_excess_precision (enum excess_precision_type type) bool ix86_bitint_type_info (int n, struct bitint_info *info) { - if (!TARGET_64BIT) - return false; if (n <= 8) info->limb_mode = QImode; else if (n <= 16) info->limb_mode = HImode; - else if (n <= 32) + else if (n <= 32 || (!TARGET_64BIT && n > 64)) info->limb_mode = SImode; else info->limb_mode = DImode; diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 35ce8b00d362..efd46a143136 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2730,9 +2730,12 @@ enum call_saved_registers_type /* The current function is a function specified with the "interrupt" or "no_caller_saved_registers" attribute. */ TYPE_NO_CALLER_SAVED_REGISTERS, + /* The current function is a function specified with the + "no_callee_saved_registers" attribute. */ + TYPE_NO_CALLEE_SAVED_REGISTERS, /* The current function is a function specified with the "noreturn" - or "no_callee_saved_registers" attribute. */ - TYPE_NO_CALLEE_SAVED_REGISTERS + attribute. */ + TYPE_NO_CALLEE_SAVED_REGISTERS_EXCEPT_BP, }; enum queued_insn_type diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index d5db538bb6a1..df97a2d6270d 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -353,6 +353,10 @@ ;; For USER_MSR support UNSPECV_URDMSR UNSPECV_UWRMSR + + ;; For AMX-TILE + UNSPECV_LDTILECFG + UNSPECV_STTILECFG ]) ;; Constants to represent rounding modes in the ROUND instruction @@ -2689,7 +2693,7 @@ && !x86_64_immediate_operand (operands[1], DImode) && !x86_64_zext_immediate_operand (operands[1], DImode) && !((UINTVAL (operands[1]) >> ctz_hwi (UINTVAL (operands[1]))) - & ~(HOST_WIDE_INT) 0xffffffff) + & ~HOST_WIDE_INT_C (0xffffffff)) && peep2_regno_dead_p (0, FLAGS_REG)" [(set (match_dup 0) (match_dup 1)) (parallel [(set (match_dup 0) (ashift:DI (match_dup 0) (match_dup 2))) @@ -3542,7 +3546,7 @@ [(set (match_operand:SWI48 0 "general_reg_operand") (match_dup 4))] { - HOST_WIDE_INT tmp = INTVAL (operands[1]) & ~(HOST_WIDE_INT)0xff00; + HOST_WIDE_INT tmp = INTVAL (operands[1]) & ~HOST_WIDE_INT_C (0xff00); tmp |= (INTVAL (operands[3]) & 0xff) << 8; operands[4] = gen_int_mode (tmp, mode); }) @@ -28152,6 +28156,26 @@ [(set_attr "prefix" "vex") (set_attr "type" "other")]) +(define_insn "ldtilecfg" + [(unspec_volatile [(match_operand:XI 0 "memory_operand" "m")] + UNSPECV_LDTILECFG)] + "TARGET_AMX_TILE" + "ldtilecfg\t%0" + [(set_attr "type" "other") + (set_attr "prefix" "maybe_evex") + (set_attr "memory" "load") + (set_attr "mode" "XI")]) + +(define_insn "sttilecfg" + [(set (match_operand:XI 0 "memory_operand" "=m") + (unspec_volatile:XI [(const_int 0)] UNSPECV_STTILECFG))] + "TARGET_AMX_TILE" + "sttilecfg\t%0" + [(set_attr "type" "other") + (set_attr "prefix" "maybe_evex") + (set_attr "memory" "store") + (set_attr "mode" "XI")]) + (include "mmx.md") (include "sse.md") (include "sync.md") diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt index 5b4f1bff25f4..d5f793a9e8b0 100644 --- a/gcc/config/i386/i386.opt +++ b/gcc/config/i386/i386.opt @@ -659,6 +659,10 @@ mstore-max= Target RejectNegative Joined Var(ix86_store_max) Enum(prefer_vector_width) Init(PVW_NONE) Save Maximum number of bits that can be stored to memory efficiently. +mnoreturn-no-callee-saved-registers +Target Var(ix86_noreturn_no_callee_saved_registers) +Optimize noreturn functions by not saving callee-saved registers used in the function. + ;; ISA support m32 diff --git a/gcc/config/i386/i386.opt.urls b/gcc/config/i386/i386.opt.urls index 9b988fd6996f..fa821eba2006 100644 --- a/gcc/config/i386/i386.opt.urls +++ b/gcc/config/i386/i386.opt.urls @@ -146,7 +146,7 @@ miamcu UrlSuffix(gcc/x86-Options.html#index-miamcu) mabi= -UrlSuffix(gcc/x86-Options.html#index-mabi-6) +UrlSuffix(gcc/x86-Options.html#index-mabi-7) mcall-ms2sysv-xlogues UrlSuffix(gcc/x86-Options.html#index-mcall-ms2sysv-xlogues) @@ -184,6 +184,9 @@ UrlSuffix(gcc/x86-Options.html#index-mmove-max) mstore-max= UrlSuffix(gcc/x86-Options.html#index-mstore-max) +mnoreturn-no-callee-saved-registers +UrlSuffix(gcc/x86-Options.html#index-mnoreturn-no-callee-saved-registers) + m32 UrlSuffix(gcc/x86-Options.html#index-m32-2) @@ -597,6 +600,12 @@ UrlSuffix(gcc/x86-Options.html#index-msm4) mapxf UrlSuffix(gcc/x86-Options.html#index-mapxf) +mapx-inline-asm-use-gpr32 +UrlSuffix(gcc/x86-Options.html#index-mapx-inline-asm-use-gpr32) + +mevex512 +UrlSuffix(gcc/x86-Options.html#index-mevex512) + musermsr UrlSuffix(gcc/x86-Options.html#index-musermsr) diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md index 075309cca9f6..9a8d6030d8b3 100644 --- a/gcc/config/i386/mmx.md +++ b/gcc/config/i386/mmx.md @@ -85,9 +85,9 @@ (define_mode_iterator V24FI [V2SF V2SI V4HF V4HI]) -(define_mode_iterator V248FI [V2SF V2SI V4HF V4HI V8QI]) +(define_mode_iterator V248FI [V2SF V2SI V4HF V4BF V4HI V8QI]) -(define_mode_iterator V24FI_32 [V2HF V2HI V4QI]) +(define_mode_iterator V24FI_32 [V2HF V2BF V2HI V4QI]) ;; Mapping from integer vector mode to mnemonic suffix (define_mode_attr mmxvecsize @@ -2874,11 +2874,18 @@ (neg:V2QI (match_operand:V2QI 1 "register_operand" "0,Yw"))) (clobber (reg:CC FLAGS_REG))] - "!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" + "!TARGET_PARTIAL_REG_STALL || optimize_size || TARGET_SSE2" "#" [(set_attr "isa" "*,sse2") (set_attr "type" "multi") - (set_attr "mode" "QI,TI")]) + (set_attr "mode" "QI,TI") + (set (attr "enabled") + (cond [(and (eq_attr "alternative" "0") + (and (match_test "TARGET_PARTIAL_REG_STALL") + (not (match_test "optimize_function_for_size_p (cfun)")))) + (symbol_ref "false") + ] + (const_string "*")))]) (define_split [(set (match_operand:V2QI 0 "general_reg_operand") @@ -2912,8 +2919,7 @@ (neg:V2QI (match_operand:V2QI 1 "sse_reg_operand"))) (clobber (reg:CC FLAGS_REG))] - "(!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)) - && TARGET_SSE2 && reload_completed" + "TARGET_SSE2 && reload_completed" [(set (match_dup 0) (match_dup 2)) (set (match_dup 0) (minus:V16QI (match_dup 0) (match_dup 1)))] @@ -2975,11 +2981,18 @@ (match_operand:V2QI 1 "register_operand" "0,0,Yw") (match_operand:V2QI 2 "register_operand" "Q,x,Yw"))) (clobber (reg:CC FLAGS_REG))] - "!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" + "!TARGET_PARTIAL_REG_STALL || optimize_size || TARGET_SSE2" "#" [(set_attr "isa" "*,sse2_noavx,avx") (set_attr "type" "multi,sseadd,sseadd") - (set_attr "mode" "QI,TI,TI")]) + (set_attr "mode" "QI,TI,TI") + (set (attr "enabled") + (cond [(and (eq_attr "alternative" "0") + (and (match_test "TARGET_PARTIAL_REG_STALL") + (not (match_test "optimize_function_for_size_p (cfun)")))) + (symbol_ref "false") + ] + (const_string "*")))]) (define_split [(set (match_operand:V2QI 0 "general_reg_operand") @@ -3021,8 +3034,7 @@ (match_operand:V2QI 1 "sse_reg_operand") (match_operand:V2QI 2 "sse_reg_operand"))) (clobber (reg:CC FLAGS_REG))] - "(!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)) - && TARGET_SSE2 && reload_completed" + "TARGET_SSE2 && reload_completed" [(set (match_dup 0) (plusminus:V16QI (match_dup 1) (match_dup 2)))] { @@ -3684,9 +3696,10 @@ (match_operand:V2QI 1 "register_operand" "0") (match_operand:QI 2 "nonmemory_operand" "cI"))) (clobber (reg:CC FLAGS_REG))] - "!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)" + "!TARGET_PARTIAL_REG_STALL || optimize_size" "#" - "&& reload_completed" + "(!TARGET_PARTIAL_REG_STALL || optimize_function_for_size_p (cfun)) + && reload_completed" [(parallel [(set (zero_extract:HI (match_dup 3) (const_int 8) (const_int 8)) (subreg:HI diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md index 4c1aedd7e70a..2a97776fc320 100644 --- a/gcc/config/i386/predicates.md +++ b/gcc/config/i386/predicates.md @@ -309,7 +309,7 @@ switch (GET_CODE (op)) { case CONST_INT: - return !(INTVAL (op) & ~(HOST_WIDE_INT) 0xffffffff); + return !(INTVAL (op) & ~HOST_WIDE_INT_C (0xffffffff)); case SYMBOL_REF: /* TLS symbols are not constant. */ @@ -839,7 +839,7 @@ (define_predicate "const_32bit_mask" (and (match_code "const_int") (match_test "trunc_int_for_mode (INTVAL (op), DImode) - == (HOST_WIDE_INT) 0xffffffff"))) + == HOST_WIDE_INT_C (0xffffffff)"))) ;; Match 2, 4, or 8. Used for leal multiplicands. (define_predicate "const248_operand" @@ -2299,10 +2299,14 @@ ;; Return true if OP is a memory operand which can be used in APX NDD ;; ADD with register source operand. UNSPEC_GOTNTPOFF memory operand -;; isn't allowed with APX NDD ADD. +;; is allowed with APX NDD ADD only if R_X86_64_CODE_6_GOTTPOFF works. (define_predicate "apx_ndd_add_memory_operand" (match_operand 0 "memory_operand") { + /* OK if "add %reg1, name@gottpoff(%rip), %reg2" is supported. */ + if (HAVE_AS_R_X86_64_CODE_6_GOTTPOFF) + return true; + op = XEXP (op, 0); /* Disallow APX NDD ADD with UNSPEC_GOTNTPOFF. */ diff --git a/gcc/config/loongarch/linux.h b/gcc/config/loongarch/linux.h index 17d9f87537b1..40d9ba6d405c 100644 --- a/gcc/config/loongarch/linux.h +++ b/gcc/config/loongarch/linux.h @@ -21,7 +21,9 @@ along with GCC; see the file COPYING3. If not see * This ensures that a compiler configured with --disable-multilib * can work in a multilib environment. */ -#if defined(LA_DISABLE_MULTILIB) && defined(LA_DISABLE_MULTIARCH) +#if !defined(LA_DEFAULT_TARGET_MUSL) \ + && defined(LA_DISABLE_MULTILIB) \ + && defined(LA_DISABLE_MULTIARCH) #if DEFAULT_ABI_BASE == ABI_BASE_LP64D #define ABI_LIBDIR "lib64" diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc index 0428b6e65d59..70e31bb831c7 100644 --- a/gcc/config/loongarch/loongarch.cc +++ b/gcc/config/loongarch/loongarch.cc @@ -4981,7 +4981,7 @@ loongarch_output_move (rtx dest, rtx src) if (type == SYMBOL_TLS_LE) return "lu12i.w\t%0,%h1"; else - return "pcalau12i\t%0,%h1"; + return "%Q1pcalau12i\t%0,%h1"; } if (src_code == CONST_INT) @@ -6145,6 +6145,7 @@ loongarch_print_operand_reloc (FILE *file, rtx op, bool hi64_part, 'L' Print the low-part relocation associated with OP. 'm' Print one less than CONST_INT OP in decimal. 'N' Print the inverse of the integer branch condition for comparison OP. + 'Q' Print R_LARCH_RELAX for TLS IE. 'r' Print address 12-31bit relocation associated with OP. 'R' Print address 32-51bit relocation associated with OP. 'T' Print 'f' for (eq:CC ...), 't' for (ne:CC ...), @@ -6282,6 +6283,18 @@ loongarch_print_operand (FILE *file, rtx op, int letter) letter); break; + case 'Q': + if (!TARGET_LINKER_RELAXATION) + break; + + if (code == HIGH) + op = XEXP (op, 0); + + if (loongarch_classify_symbolic_expression (op) == SYMBOL_TLS_IE) + fprintf (file, ".reloc\t.,R_LARCH_RELAX\n\t"); + + break; + case 'r': loongarch_print_operand_reloc (file, op, false /* hi64_part */, true /* lo_reloc */); diff --git a/gcc/config/loongarch/loongarch.h b/gcc/config/loongarch/loongarch.h index 8b453ab3140d..bf2351f0968f 100644 --- a/gcc/config/loongarch/loongarch.h +++ b/gcc/config/loongarch/loongarch.h @@ -931,6 +931,7 @@ typedef struct { { "t8", 20 + GP_REG_FIRST }, \ { "x", 21 + GP_REG_FIRST }, \ { "fp", 22 + GP_REG_FIRST }, \ + { "s9", 22 + GP_REG_FIRST }, \ { "s0", 23 + GP_REG_FIRST }, \ { "s1", 24 + GP_REG_FIRST }, \ { "s2", 25 + GP_REG_FIRST }, \ diff --git a/gcc/config/loongarch/loongarch.md b/gcc/config/loongarch/loongarch.md index dffa41b0bf5d..525e1e82183f 100644 --- a/gcc/config/loongarch/loongarch.md +++ b/gcc/config/loongarch/loongarch.md @@ -2620,7 +2620,7 @@ (match_operand:P 2 "symbolic_operand")))] UNSPEC_LOAD_FROM_GOT))] "" - "ld.\t%0,%1,%L2" + "%Q2ld.\t%0,%1,%L2" [(set_attr "type" "move")] ) @@ -4251,24 +4251,27 @@ (define_mode_iterator QHSD [QI HI SI DI]) +(define_int_iterator CRC [UNSPEC_CRC UNSPEC_CRCC]) +(define_int_attr crc [(UNSPEC_CRC "crc") (UNSPEC_CRCC "crcc")]) -(define_insn "loongarch_crc_w__w" +(define_insn "loongarch__w__w" [(set (match_operand:SI 0 "register_operand" "=r") (unspec:SI [(match_operand:QHSD 1 "register_operand" "r") (match_operand:SI 2 "register_operand" "r")] - UNSPEC_CRC))] + CRC))] "" - "crc.w..w\t%0,%1,%2" + ".w..w\t%0,%1,%2" [(set_attr "type" "unknown") (set_attr "mode" "")]) -(define_insn "loongarch_crcc_w__w" - [(set (match_operand:SI 0 "register_operand" "=r") - (unspec:SI [(match_operand:QHSD 1 "register_operand" "r") - (match_operand:SI 2 "register_operand" "r")] - UNSPEC_CRCC))] - "" - "crcc.w..w\t%0,%1,%2" +(define_insn "loongarch__w__w_extended" + [(set (match_operand:DI 0 "register_operand" "=r") + (sign_extend:DI + (unspec:SI [(match_operand:QHSD 1 "register_operand" "r") + (match_operand:SI 2 "register_operand" "r")] + CRC)))] + "TARGET_64BIT" + ".w..w\t%0,%1,%2" [(set_attr "type" "unknown") (set_attr "mode" "")]) diff --git a/gcc/config/loongarch/musl.h b/gcc/config/loongarch/musl.h new file mode 100644 index 000000000000..fa43bc866064 --- /dev/null +++ b/gcc/config/loongarch/musl.h @@ -0,0 +1,23 @@ +/* Definitions for MUSL C library support. + Copyright (C) 2024 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + + +#ifndef LA_DEFAULT_TARGET_MUSL +#define LA_DEFAULT_TARGET_MUSL +#endif diff --git a/gcc/config/loongarch/sync.md b/gcc/config/loongarch/sync.md index 8f35a5b48d25..d41c2d26811a 100644 --- a/gcc/config/loongarch/sync.md +++ b/gcc/config/loongarch/sync.md @@ -245,18 +245,42 @@ (clobber (match_scratch:GPR 5 "=&r"))] "" { - return "1:\\n\\t" - "ll.\\t%0,%1\\n\\t" - "bne\\t%0,%z2,2f\\n\\t" - "or%i3\\t%5,$zero,%3\\n\\t" - "sc.\\t%5,%1\\n\\t" - "beqz\\t%5,1b\\n\\t" - "b\\t3f\\n\\t" - "2:\\n\\t" - "%G4\\n\\t" - "3:\\n\\t"; + output_asm_insn ("1:", operands); + output_asm_insn ("ll.\t%0,%1", operands); + + /* Like the test case atomic-cas-int.C, in loongarch64, O1 and higher, the + return value of the val_without_const_folding will not be truncated and + will be passed directly to the function compare_exchange_strong. + However, the instruction 'bne' does not distinguish between 32-bit and + 64-bit operations. so if the upper 32 bits of the register are not + extended by the 32nd bit symbol, then the comparison may not be valid + here. This will affect the result of the operation. */ + + if (TARGET_64BIT && REG_P (operands[2]) + && GET_MODE (operands[2]) == SImode) + { + output_asm_insn ("addi.w\t%5,%2,0", operands); + output_asm_insn ("bne\t%0,%5,2f", operands); + } + else + output_asm_insn ("bne\t%0,%z2,2f", operands); + + output_asm_insn ("or%i3\t%5,$zero,%3", operands); + output_asm_insn ("sc.\t%5,%1", operands); + output_asm_insn ("beqz\t%5,1b", operands); + output_asm_insn ("b\t3f", operands); + output_asm_insn ("2:", operands); + output_asm_insn ("%G4", operands); + output_asm_insn ("3:", operands); + + return ""; } - [(set (attr "length") (const_int 28))]) + [(set (attr "length") + (if_then_else + (and (match_test "GET_MODE (operands[2]) == SImode") + (match_test "REG_P (operands[2])")) + (const_int 32) + (const_int 28)))]) (define_insn "atomic_cas_value_strong_amcas" [(set (match_operand:QHWD 0 "register_operand" "=&r") diff --git a/gcc/config/mips/mips.opt.urls b/gcc/config/mips/mips.opt.urls index ff2f0aee0e37..96aba041026a 100644 --- a/gcc/config/mips/mips.opt.urls +++ b/gcc/config/mips/mips.opt.urls @@ -6,7 +6,8 @@ UrlSuffix(gcc/MIPS-Options.html#index-EB-2) EL UrlSuffix(gcc/MIPS-Options.html#index-EL-2) -; skipping UrlSuffix for 'mabi=' due to finding no URLs +mabi= +UrlSuffix(gcc/MIPS-Options.html#index-mabi-3) mabicalls UrlSuffix(gcc/MIPS-Options.html#index-mabicalls) @@ -65,9 +66,15 @@ UrlSuffix(gcc/MIPS-Options.html#index-membedded-data) meva UrlSuffix(gcc/MIPS-Options.html#index-meva) +mexplicit-relocs= +UrlSuffix(gcc/MIPS-Options.html#index-mexplicit-relocs-2) + mexplicit-relocs UrlSuffix(gcc/MIPS-Options.html#index-mexplicit-relocs-2) +mno-explicit-relocs +UrlSuffix(gcc/MIPS-Options.html#index-mno-explicit-relocs-2) + mextern-sdata UrlSuffix(gcc/MIPS-Options.html#index-mextern-sdata) @@ -173,7 +180,8 @@ UrlSuffix(gcc/MIPS-Options.html#index-mno-float) mmcu UrlSuffix(gcc/MIPS-Options.html#index-mmcu-1) -; skipping UrlSuffix for 'mno-flush-func' due to finding no URLs +mno-flush-func +UrlSuffix(gcc/MIPS-Options.html#index-mno-flush-func-1) mno-mdmx UrlSuffix(gcc/MIPS-Options.html#index-mno-mdmx) diff --git a/gcc/config/pru/pru.opt.urls b/gcc/config/pru/pru.opt.urls index 373b02d5aedc..1f8a26a0db5f 100644 --- a/gcc/config/pru/pru.opt.urls +++ b/gcc/config/pru/pru.opt.urls @@ -13,5 +13,5 @@ mloop UrlSuffix(gcc/PRU-Options.html#index-mloop) mabi= -UrlSuffix(gcc/PRU-Options.html#index-mabi-3) +UrlSuffix(gcc/PRU-Options.html#index-mabi-4) diff --git a/gcc/config/riscv/arch-canonicalize b/gcc/config/riscv/arch-canonicalize index 629bed853471..8f7d040cdeb9 100755 --- a/gcc/config/riscv/arch-canonicalize +++ b/gcc/config/riscv/arch-canonicalize @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Tool for canonical RISC-V architecture string. # Copyright (C) 2011-2024 Free Software Foundation, Inc. diff --git a/gcc/config/riscv/generic-ooo.md b/gcc/config/riscv/generic-ooo.md index a22f8a3e0791..e70df63d91f8 100644 --- a/gcc/config/riscv/generic-ooo.md +++ b/gcc/config/riscv/generic-ooo.md @@ -1,5 +1,5 @@ ;; RISC-V generic out-of-order core scheduling model. -;; Copyright (C) 2017-2024 Free Software Foundation, Inc. +;; Copyright (C) 2023-2024 Free Software Foundation, Inc. ;; ;; This file is part of GCC. ;; @@ -48,9 +48,6 @@ ;; Integer/float issue queues. (define_cpu_unit "issue0,issue1,issue2,issue3,issue4" "generic_ooo") -;; Separate issue queue for vector instructions. -(define_cpu_unit "generic_ooo_vxu_issue" "generic_ooo") - ;; Integer/float execution units. (define_cpu_unit "ixu0,ixu1,ixu2,ixu3" "generic_ooo") (define_cpu_unit "fxu0,fxu1" "generic_ooo") @@ -58,12 +55,6 @@ ;; Integer subunit for division. (define_cpu_unit "generic_ooo_div" "generic_ooo") -;; Vector execution unit. -(define_cpu_unit "generic_ooo_vxu_alu" "generic_ooo") - -;; Vector subunit that does mult/div/sqrt. -(define_cpu_unit "generic_ooo_vxu_multicycle" "generic_ooo") - ;; Shortcuts (define_reservation "generic_ooo_issue" "issue0|issue1|issue2|issue3|issue4") (define_reservation "generic_ooo_ixu_alu" "ixu0|ixu1|ixu2|ixu3") @@ -92,32 +83,24 @@ (eq_attr "type" "fpstore")) "generic_ooo_issue,generic_ooo_fxu") -;; Vector load/store -(define_insn_reservation "generic_ooo_vec_load" 6 - (and (eq_attr "tune" "generic_ooo") - (eq_attr "type" "vlde,vldm,vlds,vldux,vldox,vldff,vldr")) - "generic_ooo_vxu_issue,generic_ooo_vxu_alu") - -(define_insn_reservation "generic_ooo_vec_store" 6 - (and (eq_attr "tune" "generic_ooo") - (eq_attr "type" "vste,vstm,vsts,vstux,vstox,vstr")) - "generic_ooo_vxu_issue,generic_ooo_vxu_alu") - -;; Vector segment loads/stores. -(define_insn_reservation "generic_ooo_vec_loadstore_seg" 10 - (and (eq_attr "tune" "generic_ooo") - (eq_attr "type" "vlsegde,vlsegds,vlsegdux,vlsegdox,vlsegdff,\ - vssegte,vssegts,vssegtux,vssegtox")) - "generic_ooo_vxu_issue,generic_ooo_vxu_alu") - - ;; Generic integer instructions. (define_insn_reservation "generic_ooo_alu" 1 (and (eq_attr "tune" "generic_ooo") (eq_attr "type" "unknown,const,arith,shift,slt,multi,auipc,nop,logical,\ - move,bitmanip,min,max,minu,maxu,clz,ctz")) + move,bitmanip,rotate,min,max,minu,maxu,clz,ctz,atomic,\ + condmove,mvpair,zicond")) "generic_ooo_issue,generic_ooo_ixu_alu") +(define_insn_reservation "generic_ooo_sfb_alu" 2 + (and (eq_attr "tune" "generic_ooo") + (eq_attr "type" "sfb_alu")) + "generic_ooo_issue,generic_ooo_ixu_alu") + +;; Branch instructions +(define_insn_reservation "generic_ooo_branch" 1 + (and (eq_attr "tune" "generic_ooo") + (eq_attr "type" "branch,jump,call,jalr,ret,trap")) + "generic_ooo_issue,generic_ooo_ixu_alu") ;; Float move, convert and compare. (define_insn_reservation "generic_ooo_float_move" 3 @@ -180,103 +163,6 @@ (eq_attr "type" "cpop,clmul")) "generic_ooo_issue,generic_ooo_ixu_alu") -;; Regular vector operations and integer comparisons. -(define_insn_reservation "generic_ooo_vec_alu" 3 - (and (eq_attr "tune" "generic_ooo") - (eq_attr "type" "vialu,viwalu,vext,vicalu,vshift,vnshift,viminmax,vicmp,\ - vimov,vsalu,vaalu,vsshift,vnclip,vmov,vfmov")) - "generic_ooo_vxu_issue,generic_ooo_vxu_alu") - -;; Vector float comparison, conversion etc. -(define_insn_reservation "generic_ooo_vec_fcmp" 3 - (and (eq_attr "tune" "generic_ooo") - (eq_attr "type" "vfrecp,vfminmax,vfcmp,vfsgnj,vfclass,vfcvtitof,\ - vfcvtftoi,vfwcvtitof,vfwcvtftoi,vfwcvtftof,vfncvtitof,\ - vfncvtftoi,vfncvtftof")) - "generic_ooo_vxu_issue,generic_ooo_vxu_alu") - -;; Vector integer multiplication. -(define_insn_reservation "generic_ooo_vec_imul" 4 - (and (eq_attr "tune" "generic_ooo") - (eq_attr "type" "vimul,viwmul,vimuladd,viwmuladd,vsmul")) - "generic_ooo_vxu_issue,generic_ooo_vxu_alu") - -;; Vector float addition. -(define_insn_reservation "generic_ooo_vec_fadd" 4 - (and (eq_attr "tune" "generic_ooo") - (eq_attr "type" "vfalu,vfwalu")) - "generic_ooo_vxu_issue,generic_ooo_vxu_alu") - -;; Vector float multiplication and FMA. -(define_insn_reservation "generic_ooo_vec_fmul" 6 - (and (eq_attr "tune" "generic_ooo") - (eq_attr "type" "vfmul,vfwmul,vfmuladd,vfwmuladd")) - "generic_ooo_vxu_issue,generic_ooo_vxu_alu") - -;; Vector crypto, assumed to be a generic operation for now. -(define_insn_reservation "generic_ooo_crypto" 4 - (and (eq_attr "tune" "generic_ooo") - (eq_attr "type" "crypto")) - "generic_ooo_vxu_issue,generic_ooo_vxu_alu") - -;; Vector permute. -(define_insn_reservation "generic_ooo_perm" 3 - (and (eq_attr "tune" "generic_ooo") - (eq_attr "type" "vimerge,vfmerge,vslideup,vslidedown,vislide1up,\ - vislide1down,vfslide1up,vfslide1down,vgather,vcompress")) - "generic_ooo_vxu_issue,generic_ooo_vxu_alu") - -;; Vector reduction. -(define_insn_reservation "generic_ooo_vec_reduction" 8 - (and (eq_attr "tune" "generic_ooo") - (eq_attr "type" "vired,viwred,vfredu,vfwredu")) - "generic_ooo_vxu_issue,generic_ooo_vxu_multicycle") - -;; Vector ordered reduction, assume the latency number is for -;; a 128-bit vector. It is scaled in riscv_sched_adjust_cost -;; for larger vectors. -(define_insn_reservation "generic_ooo_vec_ordered_reduction" 10 - (and (eq_attr "tune" "generic_ooo") - (eq_attr "type" "vfredo,vfwredo")) - "generic_ooo_vxu_issue,generic_ooo_vxu_multicycle*3") - -;; Vector integer division, assume not pipelined. -(define_insn_reservation "generic_ooo_vec_idiv" 16 - (and (eq_attr "tune" "generic_ooo") - (eq_attr "type" "vidiv")) - "generic_ooo_vxu_issue,generic_ooo_vxu_multicycle*3") - -;; Vector float divisions and sqrt, assume not pipelined. -(define_insn_reservation "generic_ooo_vec_float_divsqrt" 16 - (and (eq_attr "tune" "generic_ooo") - (eq_attr "type" "vfdiv,vfsqrt")) - "generic_ooo_vxu_issue,generic_ooo_vxu_multicycle*3") - -;; Vector mask operations. -(define_insn_reservation "generic_ooo_vec_mask" 2 - (and (eq_attr "tune" "generic_ooo") - (eq_attr "type" "vmalu,vmpop,vmffs,vmsfs,vmiota,vmidx,vimovvx,vimovxv,\ - vfmovvf,vfmovfv")) - "generic_ooo_vxu_issue,generic_ooo_vxu_alu") - -;; Vector vsetvl. -(define_insn_reservation "generic_ooo_vec_vesetvl" 1 - (and (eq_attr "tune" "generic_ooo") - (eq_attr "type" "vsetvl,vsetvl_pre")) - "generic_ooo_vxu_issue") - -;; Vector rounding mode setters, assume pipeline barrier. -(define_insn_reservation "generic_ooo_vec_setrm" 20 - (and (eq_attr "tune" "generic_ooo") - (eq_attr "type" "wrvxrm,wrfrm")) - "generic_ooo_vxu_issue,generic_ooo_vxu_issue*3") - -;; Vector read vlen/vlenb. -(define_insn_reservation "generic_ooo_vec_readlen" 4 - (and (eq_attr "tune" "generic_ooo") - (eq_attr "type" "rdvlenb,rdvl")) - "generic_ooo_vxu_issue,generic_ooo_vxu_issue") - ;; Transfer from/to coprocessor. Assume not pipelined. (define_insn_reservation "generic_ooo_xfer" 4 (and (eq_attr "tune" "generic_ooo") diff --git a/gcc/config/riscv/generic-vector-ooo.md b/gcc/config/riscv/generic-vector-ooo.md new file mode 100644 index 000000000000..96cb1a0be297 --- /dev/null +++ b/gcc/config/riscv/generic-vector-ooo.md @@ -0,0 +1,143 @@ +;; Copyright (C) 2024-2024 Free Software Foundation, Inc. + +;; This file is part of GCC. + +;; GCC is free software; you can redistribute it and/or modify it +;; under the terms of the GNU General Public License as published +;; by the Free Software Foundation; either version 3, or (at your +;; option) any later version. + +;; GCC is distributed in the hope that it will be useful, but WITHOUT +;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +;; License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GCC; see the file COPYING3. If not see +;; . +;; Vector load/store + +(define_automaton "vector_ooo") + +;; Separate issue queue for vector instructions. +(define_cpu_unit "vxu_ooo_issue" "vector_ooo") + +;; Vector execution unit. +(define_cpu_unit "vxu_ooo_alu" "vector_ooo") + +;; Vector subunit that does mult/div/sqrt. +(define_cpu_unit "vxu_ooo_multicycle" "vector_ooo") + +(define_insn_reservation "vec_load" 6 + (eq_attr "type" "vlde,vldm,vlds,vldux,vldox,vldff,vldr") + "vxu_ooo_issue,vxu_ooo_alu") + +(define_insn_reservation "vec_store" 6 + (eq_attr "type" "vste,vstm,vsts,vstux,vstox,vstr") + "vxu_ooo_issue,vxu_ooo_alu") + +;; Vector segment loads/stores. +(define_insn_reservation "vec_loadstore_seg" 10 + (eq_attr "type" "vlsegde,vlsegds,vlsegdux,vlsegdox,vlsegdff,\ + vssegte,vssegts,vssegtux,vssegtox") + "vxu_ooo_issue,vxu_ooo_alu") + +;; Regular vector operations and integer comparisons. +(define_insn_reservation "vec_alu" 3 + (eq_attr "type" "vialu,viwalu,vext,vicalu,vshift,vnshift,viminmax,vicmp,\ + vimov,vsalu,vaalu,vsshift,vnclip,vmov,vfmov,vector,\ + vandn,vbrev,vbrev8,vrev8,vclz,vctz,vrol,vror,vwsll") + "vxu_ooo_issue,vxu_ooo_alu") + +;; Vector float comparison, conversion etc. +(define_insn_reservation "vec_fcmp" 3 + (eq_attr "type" "vfrecp,vfminmax,vfcmp,vfsgnj,vfclass,vfcvtitof,\ + vfcvtftoi,vfwcvtitof,vfwcvtftoi,vfwcvtftof,vfncvtitof,\ + vfncvtftoi,vfncvtftof") + "vxu_ooo_issue,vxu_ooo_alu") + +;; Vector integer multiplication. +(define_insn_reservation "vec_imul" 4 + (eq_attr "type" "vimul,viwmul,vimuladd,viwmuladd,vsmul,vclmul,vclmulh,\ + vghsh,vgmul") + "vxu_ooo_issue,vxu_ooo_alu") + +;; Vector float addition. +(define_insn_reservation "vec_fadd" 4 + (eq_attr "type" "vfalu,vfwalu") + "vxu_ooo_issue,vxu_ooo_alu") + +;; Vector float multiplication and FMA. +(define_insn_reservation "vec_fmul" 6 + (eq_attr "type" "vfmul,vfwmul,vfmuladd,vfwmuladd") + "vxu_ooo_issue,vxu_ooo_alu") + +;; Vector crypto, assumed to be a generic operation for now. +(define_insn_reservation "vec_crypto" 4 + (eq_attr "type" "crypto") + "vxu_ooo_issue,vxu_ooo_alu") + +;; Vector crypto, AES +(define_insn_reservation "vec_crypto_aes" 4 + (eq_attr "type" "vaesef,vaesem,vaesdf,vaesdm,vaeskf1,vaeskf2,vaesz") + "vxu_ooo_issue,vxu_ooo_alu") + +;; Vector crypto, sha +(define_insn_reservation "vec_crypto_sha" 4 + (eq_attr "type" "vsha2ms,vsha2ch,vsha2cl") + "vxu_ooo_issue,vxu_ooo_alu") + +;; Vector crypto, SM3/4 +(define_insn_reservation "vec_crypto_sm" 4 + (eq_attr "type" "vsm4k,vsm4r,vsm3me,vsm3c") + "vxu_ooo_issue,vxu_ooo_alu") + +;; Vector permute. +(define_insn_reservation "vec_perm" 3 + (eq_attr "type" "vimerge,vfmerge,vslideup,vslidedown,vislide1up,\ + vislide1down,vfslide1up,vfslide1down,vgather,vcompress") + "vxu_ooo_issue,vxu_ooo_alu") + +;; Vector reduction. +(define_insn_reservation "vec_reduction" 8 + (eq_attr "type" "vired,viwred,vfredu,vfwredu") + "vxu_ooo_issue,vxu_ooo_multicycle") + +;; Vector ordered reduction, assume the latency number is for +;; a 128-bit vector. It is scaled in riscv_sched_adjust_cost +;; for larger vectors. +(define_insn_reservation "vec_ordered_reduction" 10 + (eq_attr "type" "vfredo,vfwredo") + "vxu_ooo_issue,vxu_ooo_multicycle*3") + +;; Vector integer division, assume not pipelined. +(define_insn_reservation "vec_idiv" 16 + (eq_attr "type" "vidiv") + "vxu_ooo_issue,vxu_ooo_multicycle*3") + +;; Vector float divisions and sqrt, assume not pipelined. +(define_insn_reservation "vec_float_divsqrt" 16 + (eq_attr "type" "vfdiv,vfsqrt") + "vxu_ooo_issue,vxu_ooo_multicycle*3") + +;; Vector mask operations. +(define_insn_reservation "vec_mask" 2 + (eq_attr "type" "vmalu,vmpop,vmffs,vmsfs,vmiota,vmidx,vimovvx,vimovxv,\ + vfmovvf,vfmovfv") + "vxu_ooo_issue,vxu_ooo_alu") + +;; Vector vsetvl. +(define_insn_reservation "vec_vesetvl" 1 + (eq_attr "type" "vsetvl,vsetvl_pre") + "vxu_ooo_issue") + +;; Vector rounding mode setters, assume pipeline barrier. +(define_insn_reservation "vec_setrm" 20 + (eq_attr "type" "wrvxrm,wrfrm") + "vxu_ooo_issue,vxu_ooo_issue*3") + +;; Vector read vlen/vlenb. +(define_insn_reservation "vec_readlen" 4 + (eq_attr "type" "rdvlenb,rdvl") + "vxu_ooo_issue,vxu_ooo_issue") + diff --git a/gcc/config/riscv/generic.md b/gcc/config/riscv/generic.md index 3f0eaa2ea084..4f6e63bff572 100644 --- a/gcc/config/riscv/generic.md +++ b/gcc/config/riscv/generic.md @@ -27,7 +27,9 @@ (define_insn_reservation "generic_alu" 1 (and (eq_attr "tune" "generic") - (eq_attr "type" "unknown,const,arith,shift,slt,multi,auipc,nop,logical,move,bitmanip,min,max,minu,maxu,clz,ctz,cpop")) + (eq_attr "type" "unknown,const,arith,shift,slt,multi,auipc,nop,logical,\ + move,bitmanip,min,max,minu,maxu,clz,ctz,rotate,atomic,\ + condmove,crypto,mvpair,zicond")) "alu") (define_insn_reservation "generic_load" 3 @@ -47,12 +49,17 @@ (define_insn_reservation "generic_branch" 1 (and (eq_attr "tune" "generic") - (eq_attr "type" "branch,jump,call,jalr")) + (eq_attr "type" "branch,jump,call,jalr,ret,trap")) + "alu") + +(define_insn_reservation "generic_sfb_alu" 2 + (and (eq_attr "tune" "generic") + (eq_attr "type" "sfb_alu")) "alu") (define_insn_reservation "generic_imul" 10 (and (eq_attr "tune" "generic") - (eq_attr "type" "imul,clmul")) + (eq_attr "type" "imul,clmul,cpop")) "imuldiv*10") (define_insn_reservation "generic_idivsi" 34 @@ -67,6 +74,12 @@ (eq_attr "mode" "DI"))) "imuldiv*66") +(define_insn_reservation "generic_fmul_half" 5 + (and (eq_attr "tune" "generic") + (and (eq_attr "type" "fadd,fmul,fmadd") + (eq_attr "mode" "HF"))) + "alu") + (define_insn_reservation "generic_fmul_single" 5 (and (eq_attr "tune" "generic") (and (eq_attr "type" "fadd,fmul,fmadd") @@ -88,3 +101,4 @@ (and (eq_attr "tune" "generic") (eq_attr "type" "fsqrt")) "fdivsqrt*25") + diff --git a/gcc/config/riscv/multilib-generator b/gcc/config/riscv/multilib-generator index 1a957878d0cb..25cb6762ea73 100755 --- a/gcc/config/riscv/multilib-generator +++ b/gcc/config/riscv/multilib-generator @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # RISC-V multilib list generator. # Copyright (C) 2011-2024 Free Software Foundation, Inc. diff --git a/gcc/config/riscv/riscv-avlprop.cc b/gcc/config/riscv/riscv-avlprop.cc index 893b83957fd5..4ae15f25ca2a 100644 --- a/gcc/config/riscv/riscv-avlprop.cc +++ b/gcc/config/riscv/riscv-avlprop.cc @@ -506,7 +506,7 @@ pass_avlprop::execute (function *fn) simplify_replace_vlmax_avl (rinsn, prop.second); } - if (riscv_autovec_preference == RVV_FIXED_VLMAX) + if (rvv_vector_bits == RVV_VECTOR_BITS_ZVL) { /* Simplify VLMAX AVL into immediate AVL. E.g. Simplify this following case: diff --git a/gcc/config/riscv/riscv-c.cc b/gcc/config/riscv/riscv-c.cc index 3ef06dcfd2d2..3755ec0b8ef3 100644 --- a/gcc/config/riscv/riscv-c.cc +++ b/gcc/config/riscv/riscv-c.cc @@ -139,7 +139,7 @@ riscv_cpu_cpp_builtins (cpp_reader *pfile) { builtin_define ("__riscv_vector"); builtin_define_with_int_value ("__riscv_v_intrinsic", - riscv_ext_version_value (0, 11)); + riscv_ext_version_value (0, 12)); } if (TARGET_XTHEADVECTOR) diff --git a/gcc/config/riscv/riscv-opts.h b/gcc/config/riscv/riscv-opts.h index 4edddbadc37b..281dd068c55f 100644 --- a/gcc/config/riscv/riscv-opts.h +++ b/gcc/config/riscv/riscv-opts.h @@ -72,13 +72,6 @@ enum stack_protector_guard { SSP_GLOBAL /* global canary */ }; -/* RISC-V auto-vectorization preference. */ -enum riscv_autovec_preference_enum { - NO_AUTOVEC, - RVV_SCALABLE, - RVV_FIXED_VLMAX -}; - /* RISC-V auto-vectorization RVV LMUL. */ enum riscv_autovec_lmul_enum { RVV_M1 = 1, @@ -129,6 +122,14 @@ enum vsetvl_strategy_enum { VSETVL_OPT_NO_FUSION, }; +/* RVV vector bits for option -mrvv-vector-bits, default is scalable. */ +enum rvv_vector_bits_enum { + /* scalable indicates taking the value of zvl*b as the minimal vlen. */ + RVV_VECTOR_BITS_SCALABLE, + /* zvl indicates taking the value of zvl*b as the exactly vlen. */ + RVV_VECTOR_BITS_ZVL, +}; + #define TARGET_ZICOND_LIKE (TARGET_ZICOND || (TARGET_XVENTANACONDOPS && TARGET_64BIT)) /* Bit of riscv_zvl_flags will set contintuly, N-1 bit will set if N-bit is diff --git a/gcc/config/riscv/riscv-protos.h b/gcc/config/riscv/riscv-protos.h index 80efdf2b7e51..b87355938052 100644 --- a/gcc/config/riscv/riscv-protos.h +++ b/gcc/config/riscv/riscv-protos.h @@ -603,7 +603,7 @@ bool simm5_p (rtx); bool neg_simm5_p (rtx); #ifdef RTX_CODE bool has_vi_variant_p (rtx_code, rtx); -void expand_vec_cmp (rtx, rtx_code, rtx, rtx); +void expand_vec_cmp (rtx, rtx_code, rtx, rtx, rtx = nullptr, rtx = nullptr); bool expand_vec_cmp_float (rtx, rtx_code, rtx, rtx, bool); void expand_cond_len_unop (unsigned, rtx *); void expand_cond_len_binop (unsigned, rtx *); diff --git a/gcc/config/riscv/riscv-selftests.cc b/gcc/config/riscv/riscv-selftests.cc index 289916b999e2..34d01ac76b75 100644 --- a/gcc/config/riscv/riscv-selftests.cc +++ b/gcc/config/riscv/riscv-selftests.cc @@ -378,7 +378,7 @@ riscv_run_selftests (void) compile-time unknown POLY value. Since we never need to compute a compile-time unknown POLY value - when --param=riscv-autovec-preference=fixed-vlmax, disable poly + when -mrvv-vector-bits=zvl, disable poly selftests in such situation. */ run_poly_int_selftests (); run_const_vector_selftests (); diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc index 0cfbd21ce6f9..967f4e382875 100644 --- a/gcc/config/riscv/riscv-v.cc +++ b/gcc/config/riscv/riscv-v.cc @@ -443,6 +443,7 @@ class rvv_builder : public rtx_vector_builder } bool can_duplicate_repeating_sequence_p (); + bool is_repeating_sequence (); rtx get_merged_repeating_sequence (); bool repeating_sequence_use_merge_profitable_p (); @@ -483,7 +484,8 @@ rvv_builder::can_duplicate_repeating_sequence_p () { poly_uint64 new_size = exact_div (full_nelts (), npatterns ()); unsigned int new_inner_size = m_inner_bits_size * npatterns (); - if (!int_mode_for_size (new_inner_size, 0).exists (&m_new_inner_mode) + if (m_inner_mode == Pmode + || !int_mode_for_size (new_inner_size, 0).exists (&m_new_inner_mode) || GET_MODE_SIZE (m_new_inner_mode) > UNITS_PER_WORD || !get_vector_mode (m_new_inner_mode, new_size).exists (&m_new_mode)) return false; @@ -492,6 +494,18 @@ rvv_builder::can_duplicate_repeating_sequence_p () return nelts_per_pattern () == 1; } +/* Return true if the vector is a simple sequence with one pattern and all + elements the same. */ +bool +rvv_builder::is_repeating_sequence () +{ + if (npatterns () > 1) + return false; + if (full_nelts ().is_constant ()) + return repeating_sequence_p (0, full_nelts ().to_constant (), 1); + return nelts_per_pattern () == 1; +} + /* Return true if it is a repeating sequence that using merge approach has better codegen than using default approach (slide1down). @@ -898,14 +912,14 @@ calculate_ratio (unsigned int sew, enum vlmul_type vlmul) } /* SCALABLE means that the vector-length is agnostic (run-time invariant and - compile-time unknown). FIXED meands that the vector-length is specific - (compile-time known). Both RVV_SCALABLE and RVV_FIXED_VLMAX are doing + compile-time unknown). ZVL meands that the vector-length is specific + (compile-time known by march like zvl*b). Both SCALABLE and ZVL are doing auto-vectorization using VLMAX vsetvl configuration. */ static bool autovec_use_vlmax_p (void) { - return (riscv_autovec_preference == RVV_SCALABLE - || riscv_autovec_preference == RVV_FIXED_VLMAX); + return rvv_vector_bits == RVV_VECTOR_BITS_SCALABLE + || rvv_vector_bits == RVV_VECTOR_BITS_ZVL; } /* This function emits VLMAX vrgather instruction. Emit vrgather.vx/vi when sel @@ -2544,6 +2558,15 @@ expand_vec_init (rtx target, rtx vals) v.quick_push (XVECEXP (vals, 0, i)); v.finalize (); + /* If the sequence is v = { a, a, a, a } just broadcast an element. */ + if (v.is_repeating_sequence ()) + { + machine_mode mode = GET_MODE (target); + rtx dup = expand_vector_broadcast (mode, v.elt (0)); + emit_move_insn (target, dup); + return; + } + if (nelts > 3) { /* Case 1: Convert v = { a, b, a, b } into v = { ab, ab }. */ @@ -2752,7 +2775,8 @@ vectorize_related_mode (machine_mode vector_mode, scalar_mode element_mode, /* Expand an RVV comparison. */ void -expand_vec_cmp (rtx target, rtx_code code, rtx op0, rtx op1) +expand_vec_cmp (rtx target, rtx_code code, rtx op0, rtx op1, rtx mask, + rtx maskoff) { machine_mode mask_mode = GET_MODE (target); machine_mode data_mode = GET_MODE (op0); @@ -2762,8 +2786,8 @@ expand_vec_cmp (rtx target, rtx_code code, rtx op0, rtx op1) { rtx lt = gen_reg_rtx (mask_mode); rtx gt = gen_reg_rtx (mask_mode); - expand_vec_cmp (lt, LT, op0, op1); - expand_vec_cmp (gt, GT, op0, op1); + expand_vec_cmp (lt, LT, op0, op1, mask, maskoff); + expand_vec_cmp (gt, GT, op0, op1, mask, maskoff); icode = code_for_pred (IOR, mask_mode); rtx ops[] = {target, lt, gt}; emit_vlmax_insn (icode, BINARY_MASK_OP, ops); @@ -2771,33 +2795,16 @@ expand_vec_cmp (rtx target, rtx_code code, rtx op0, rtx op1) } rtx cmp = gen_rtx_fmt_ee (code, mask_mode, op0, op1); - rtx ops[] = {target, cmp, op0, op1}; - emit_vlmax_insn (icode, COMPARE_OP, ops); -} - -void -expand_vec_cmp (rtx target, rtx_code code, rtx mask, rtx maskoff, rtx op0, - rtx op1) -{ - machine_mode mask_mode = GET_MODE (target); - machine_mode data_mode = GET_MODE (op0); - insn_code icode = get_cmp_insn_code (code, data_mode); - - if (code == LTGT) + if (!mask && !maskoff) { - rtx lt = gen_reg_rtx (mask_mode); - rtx gt = gen_reg_rtx (mask_mode); - expand_vec_cmp (lt, LT, mask, maskoff, op0, op1); - expand_vec_cmp (gt, GT, mask, maskoff, op0, op1); - icode = code_for_pred (IOR, mask_mode); - rtx ops[] = {target, lt, gt}; - emit_vlmax_insn (icode, BINARY_MASK_OP, ops); - return; + rtx ops[] = {target, cmp, op0, op1}; + emit_vlmax_insn (icode, COMPARE_OP, ops); + } + else + { + rtx ops[] = {target, mask, maskoff, cmp, op0, op1}; + emit_vlmax_insn (icode, COMPARE_OP_MU, ops); } - - rtx cmp = gen_rtx_fmt_ee (code, mask_mode, op0, op1); - rtx ops[] = {target, mask, maskoff, cmp, op0, op1}; - emit_vlmax_insn (icode, COMPARE_OP_MU, ops); } /* Expand an RVV floating-point comparison: @@ -2875,7 +2882,7 @@ expand_vec_cmp_float (rtx target, rtx_code code, rtx op0, rtx op1, else { /* vmfeq.vv v0, vb, vb, v0.t */ - expand_vec_cmp (eq0, EQ, eq0, eq0, op1, op1); + expand_vec_cmp (eq0, EQ, op1, op1, eq0, eq0); } break; default: @@ -2893,7 +2900,7 @@ expand_vec_cmp_float (rtx target, rtx_code code, rtx op0, rtx op1, if (code == ORDERED) emit_move_insn (target, eq0); else - expand_vec_cmp (eq0, code, eq0, eq0, op0, op1); + expand_vec_cmp (eq0, code, op0, op1, eq0, eq0); if (can_invert_p) { @@ -4408,7 +4415,7 @@ vls_mode_valid_p (machine_mode vls_mode) if (!TARGET_VECTOR || TARGET_XTHEADVECTOR) return false; - if (riscv_autovec_preference == RVV_SCALABLE) + if (rvv_vector_bits == RVV_VECTOR_BITS_SCALABLE) { if (GET_MODE_CLASS (vls_mode) != MODE_VECTOR_BOOL && !ordered_p (TARGET_MAX_LMUL * BITS_PER_RISCV_VECTOR, @@ -4425,7 +4432,7 @@ vls_mode_valid_p (machine_mode vls_mode) return true; } - if (riscv_autovec_preference == RVV_FIXED_VLMAX) + if (rvv_vector_bits == RVV_VECTOR_BITS_ZVL) { machine_mode inner_mode = GET_MODE_INNER (vls_mode); int precision = GET_MODE_PRECISION (inner_mode).to_constant (); @@ -5100,13 +5107,13 @@ estimated_poly_value (poly_int64 val, unsigned int kind) unsigned int width_source = BITS_PER_RISCV_VECTOR.is_constant () ? (unsigned int) BITS_PER_RISCV_VECTOR.to_constant () - : (unsigned int) RVV_SCALABLE; + : (unsigned int) RVV_VECTOR_BITS_SCALABLE; /* If there is no core-specific information then the minimum and likely values are based on TARGET_MIN_VLEN vectors and the maximum is based on the architectural maximum of 65536 bits. */ unsigned int min_vlen_bytes = TARGET_MIN_VLEN / 8 - 1; - if (width_source == RVV_SCALABLE) + if (width_source == RVV_VECTOR_BITS_SCALABLE) switch (kind) { case POLY_VALUE_MIN: diff --git a/gcc/config/riscv/riscv-vector-costs.cc b/gcc/config/riscv/riscv-vector-costs.cc index 7c9840df4e95..5ac8655b4d87 100644 --- a/gcc/config/riscv/riscv-vector-costs.cc +++ b/gcc/config/riscv/riscv-vector-costs.cc @@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see #include "backend.h" #include "tree-data-ref.h" #include "tree-ssa-loop-niter.h" +#include "tree-hash-traits.h" /* This file should be included last. */ #include "riscv-vector-costs.h" @@ -413,6 +414,8 @@ compute_local_live_ranges ( auto *r = get_live_range (live_ranges, arg); gcc_assert (r); (*r).second = MAX (point, (*r).second); + biggest_mode = get_biggest_mode ( + biggest_mode, TYPE_MODE (TREE_TYPE (arg))); } } else @@ -1047,18 +1050,81 @@ costs::better_main_loop_than_p (const vector_costs *uncast_other) const top of riscv_builtin_vectorization_cost handling which doesn't have any information on statement operation codes etc. */ -static unsigned -adjust_stmt_cost (enum vect_cost_for_stmt kind, tree vectype, int stmt_cost) +unsigned +costs::adjust_stmt_cost (enum vect_cost_for_stmt kind, loop_vec_info loop, + stmt_vec_info stmt_info, + slp_tree, tree vectype, int stmt_cost) { const cpu_vector_cost *costs = get_vector_costs (); switch (kind) { case scalar_to_vec: - return stmt_cost += (FLOAT_TYPE_P (vectype) ? costs->regmove->FR2VR - : costs->regmove->GR2VR); + stmt_cost += (FLOAT_TYPE_P (vectype) ? costs->regmove->FR2VR + : costs->regmove->GR2VR); + break; case vec_to_scalar: - return stmt_cost += (FLOAT_TYPE_P (vectype) ? costs->regmove->VR2FR - : costs->regmove->VR2GR); + stmt_cost += (FLOAT_TYPE_P (vectype) ? costs->regmove->VR2FR + : costs->regmove->VR2GR); + break; + case vector_load: + case vector_store: + { + /* Unit-stride vector loads and stores do not have offset addressing + as opposed to scalar loads and stores. + If the address depends on a variable we need an additional + add/sub for each load/store in the worst case. */ + if (stmt_info && stmt_info->stmt) + { + data_reference *dr = STMT_VINFO_DATA_REF (stmt_info); + class loop *father = stmt_info->stmt->bb->loop_father; + if (!loop && father && !father->inner && father->superloops) + { + tree ref; + if (TREE_CODE (dr->ref) != MEM_REF + || !(ref = TREE_OPERAND (dr->ref, 0)) + || TREE_CODE (ref) != SSA_NAME) + break; + + if (SSA_NAME_IS_DEFAULT_DEF (ref)) + break; + + if (memrefs.contains ({ref, cst0})) + break; + + memrefs.add ({ref, cst0}); + + /* In case we have not seen REF before and the base address + is a pointer operation try a bit harder. */ + tree base = DR_BASE_ADDRESS (dr); + if (TREE_CODE (base) == POINTER_PLUS_EXPR + || TREE_CODE (base) == POINTER_DIFF_EXPR) + { + /* Deconstruct BASE's first operand. If it is a binary + operation, i.e. a base and an "offset" store this + pair. Only increase the stmt_cost if we haven't seen + it before. */ + tree argp = TREE_OPERAND (base, 1); + typedef std::pair addr_pair; + addr_pair pair; + if (TREE_CODE_CLASS (TREE_CODE (argp)) == tcc_binary) + { + tree argp0 = tree_strip_nop_conversions + (TREE_OPERAND (argp, 0)); + tree argp1 = TREE_OPERAND (argp, 1); + pair = addr_pair (argp0, argp1); + if (memrefs.contains (pair)) + break; + + memrefs.add (pair); + stmt_cost += builtin_vectorization_cost (scalar_stmt, + NULL_TREE, 0); + } + } + } + } + break; + } + default: break; } @@ -1067,7 +1133,7 @@ adjust_stmt_cost (enum vect_cost_for_stmt kind, tree vectype, int stmt_cost) unsigned costs::add_stmt_cost (int count, vect_cost_for_stmt kind, - stmt_vec_info stmt_info, slp_tree, tree vectype, + stmt_vec_info stmt_info, slp_tree node, tree vectype, int misalign, vect_cost_model_location where) { int stmt_cost @@ -1080,6 +1146,7 @@ costs::add_stmt_cost (int count, vect_cost_for_stmt kind, if (loop_vinfo) analyze_loop_vinfo (loop_vinfo); + memrefs.empty (); m_analyzed_vinfo = true; } @@ -1092,11 +1159,12 @@ costs::add_stmt_cost (int count, vect_cost_for_stmt kind, as one iteration of the VLA loop. */ if (where == vect_body && m_unrolled_vls_niters) m_unrolled_vls_stmts += count * m_unrolled_vls_niters; - - if (vectype) - stmt_cost = adjust_stmt_cost (kind, vectype, stmt_cost); } + if (vectype) + stmt_cost = adjust_stmt_cost (kind, loop_vinfo, stmt_info, node, vectype, + stmt_cost); + return record_stmt_cost (stmt_info, where, count * stmt_cost); } diff --git a/gcc/config/riscv/riscv-vector-costs.h b/gcc/config/riscv/riscv-vector-costs.h index 4e2bbfd5ca98..ca0ef1199b2f 100644 --- a/gcc/config/riscv/riscv-vector-costs.h +++ b/gcc/config/riscv/riscv-vector-costs.h @@ -85,6 +85,12 @@ class costs : public vector_costs unsigned HOST_WIDE_INT m_unrolled_vls_niters = 0; unsigned HOST_WIDE_INT m_unrolled_vls_stmts = 0; + tree cst0 = build_int_cst (integer_type_node, 0); + + /* Store the memory references already processed. */ + typedef pair_hash tree_pair_hash; + hash_set memrefs; + void analyze_loop_vinfo (loop_vec_info); void record_potential_vls_unrolling (loop_vec_info); bool prefer_unrolled_loop () const; @@ -98,6 +104,10 @@ class costs : public vector_costs void record_potential_unexpected_spills (loop_vec_info); void adjust_vect_cost_per_loop (loop_vec_info); + unsigned adjust_stmt_cost (enum vect_cost_for_stmt kind, + loop_vec_info, + stmt_vec_info stmt_info, slp_tree, + tree vectype, int stmt_cost); }; } // namespace riscv_vector diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 4100abc9dd17..680c4a728e92 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -537,24 +537,52 @@ static tree riscv_handle_fndecl_attribute (tree *, tree, tree, int, bool *); static tree riscv_handle_type_attribute (tree *, tree, tree, int, bool *); /* Defining target-specific uses of __attribute__. */ -TARGET_GNU_ATTRIBUTES (riscv_attribute_table, +static const attribute_spec riscv_gnu_attributes[] = { /* Syntax: { name, min_len, max_len, decl_required, type_required, function_type_required, affects_type_identity, handler, exclude } */ /* The attribute telling no prologue/epilogue. */ - { "naked", 0, 0, true, false, false, false, - riscv_handle_fndecl_attribute, NULL }, + {"naked", 0, 0, true, false, false, false, riscv_handle_fndecl_attribute, + NULL}, /* This attribute generates prologue/epilogue for interrupt handlers. */ - { "interrupt", 0, 1, false, true, true, false, - riscv_handle_type_attribute, NULL }, + {"interrupt", 0, 1, false, true, true, false, riscv_handle_type_attribute, + NULL}, /* The following two are used for the built-in properties of the Vector type and are not used externally */ {"RVV sizeless type", 4, 4, false, true, false, true, NULL, NULL}, - {"RVV type", 0, 0, false, true, false, true, NULL, NULL} -}); + {"RVV type", 0, 0, false, true, false, true, NULL, NULL}, + /* This attribute is used to declare a function, forcing it to use the + standard vector calling convention variant. Syntax: + __attribute__((riscv_vector_cc)). */ + {"riscv_vector_cc", 0, 0, false, true, true, true, NULL, NULL} +}; + +static const scoped_attribute_specs riscv_gnu_attribute_table = +{ + "gnu", {riscv_gnu_attributes} +}; + +static const attribute_spec riscv_attributes[] = +{ + /* This attribute is used to declare a function, forcing it to use the + standard vector calling convention variant. Syntax: + [[riscv::vector_cc]]. */ + {"vector_cc", 0, 0, false, true, true, true, NULL, NULL} +}; + +static const scoped_attribute_specs riscv_nongnu_attribute_table = +{ + "riscv", {riscv_attributes} +}; + +static const scoped_attribute_specs *const riscv_attribute_table[] = +{ + &riscv_gnu_attribute_table, + &riscv_nongnu_attribute_table +}; /* Order for the CLOBBERs/USEs of gpr_save. */ static const unsigned gpr_save_reg_order[] = { @@ -1499,10 +1527,6 @@ riscv_v_adjust_bytesize (machine_mode mode, int scale) return BYTES_PER_RISCV_VECTOR; poly_int64 nunits = GET_MODE_NUNITS (mode); - poly_int64 mode_size = GET_MODE_SIZE (mode); - - if (maybe_eq (mode_size, (uint16_t) -1)) - mode_size = riscv_vector_chunks * scale; if (nunits.coeffs[0] > 8) return exact_div (nunits, 8); @@ -4609,8 +4633,6 @@ riscv_expand_conditional_move (rtx dest, rtx op, rtx cons, rtx alt) || (code == NE && rtx_equal_p (alt, op0))) { rtx cond = gen_rtx_fmt_ee (code, GET_MODE (op0), op0, op1); - if (!rtx_equal_p (cons, op0)) - std::swap (alt, cons); alt = force_reg (mode, alt); emit_insn (gen_rtx_SET (dest, gen_rtx_IF_THEN_ELSE (mode, cond, @@ -5425,6 +5447,16 @@ riscv_arguments_is_vector_type_p (const_tree fntype) return false; } +/* Return true if FUNC is a riscv_vector_cc function. + For more details please reference the below link. + https://github.com/riscv-non-isa/riscv-c-api-doc/pull/67 */ +static bool +riscv_vector_cc_function_p (const_tree fntype) +{ + return lookup_attribute ("vector_cc", TYPE_ATTRIBUTES (fntype)) != NULL_TREE + || lookup_attribute ("riscv_vector_cc", TYPE_ATTRIBUTES (fntype)) != NULL_TREE; +} + /* Implement TARGET_FNTYPE_ABI. */ static const predefined_function_abi & @@ -5434,7 +5466,8 @@ riscv_fntype_abi (const_tree fntype) reference the below link. https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/389 */ if (riscv_return_value_is_vector_type_p (fntype) - || riscv_arguments_is_vector_type_p (fntype)) + || riscv_arguments_is_vector_type_p (fntype) + || riscv_vector_cc_function_p (fntype)) return riscv_v_abi (); return default_function_abi; @@ -8269,9 +8302,7 @@ riscv_sched_variable_issue (FILE *, int, rtx_insn *insn, int more) /* If we ever encounter an insn without an insn reservation, trip an assert so we can find and fix this problem. */ -#if 0 gcc_assert (insn_has_dfa_reservation_p (insn)); -#endif return more - 1; } @@ -8803,10 +8834,10 @@ riscv_init_machine_status (void) return ggc_cleared_alloc (); } -/* Return the VLEN value associated with -march. +/* Return the VLEN value associated with -march and -mwrvv-vector-bits. TODO: So far we only support length-agnostic value. */ static poly_uint16 -riscv_convert_vector_bits (struct gcc_options *opts) +riscv_convert_vector_chunks (struct gcc_options *opts) { int chunk_num; int min_vlen = TARGET_MIN_VLEN_OPTS (opts); @@ -8849,10 +8880,15 @@ riscv_convert_vector_bits (struct gcc_options *opts) compile-time constant if TARGET_VECTOR is disabled. */ if (TARGET_VECTOR_OPTS_P (opts)) { - if (opts->x_riscv_autovec_preference == RVV_FIXED_VLMAX) - return (int) min_vlen / (riscv_bytes_per_vector_chunk * 8); - else - return poly_uint16 (chunk_num, chunk_num); + switch (opts->x_rvv_vector_bits) + { + case RVV_VECTOR_BITS_SCALABLE: + return poly_uint16 (chunk_num, chunk_num); + case RVV_VECTOR_BITS_ZVL: + return (int) min_vlen / (riscv_bytes_per_vector_chunk * 8); + default: + gcc_unreachable (); + } } else return 1; @@ -8922,8 +8958,8 @@ riscv_override_options_internal (struct gcc_options *opts) if (TARGET_VECTOR && TARGET_BIG_ENDIAN) sorry ("Current RISC-V GCC does not support RVV in big-endian mode"); - /* Convert -march to a chunks count. */ - riscv_vector_chunks = riscv_convert_vector_bits (opts); + /* Convert -march and -mrvv-vector-bits to a chunks count. */ + riscv_vector_chunks = riscv_convert_vector_chunks (opts); } /* Implement TARGET_OPTION_OVERRIDE. */ diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md index 3f7a023d9410..b16ed97909c0 100644 --- a/gcc/config/riscv/riscv.md +++ b/gcc/config/riscv/riscv.md @@ -328,9 +328,7 @@ ;; rotate rotation instructions ;; atomic atomic instructions ;; condmove conditional moves -;; cbo cache block instructions ;; crypto cryptography instructions -;; pushpop zc push and pop instructions ;; mvpair zc move pair instructions ;; zicond zicond instructions ;; Classification of RVV instructions which will be added to each RVV .md pattern and used by scheduler. @@ -470,7 +468,7 @@ mtc,mfc,const,arith,logical,shift,slt,imul,idiv,move,fmove,fadd,fmul, fmadd,fdiv,fcmp,fcvt,fcvt_i2f,fcvt_f2i,fsqrt,multi,auipc,sfb_alu,nop,trap, ghost,bitmanip,rotate,clmul,min,max,minu,maxu,clz,ctz,cpop, - atomic,condmove,cbo,crypto,pushpop,mvpair,zicond,rdvlenb,rdvl,wrvxrm,wrfrm, + atomic,condmove,crypto,mvpair,zicond,rdvlenb,rdvl,wrvxrm,wrfrm, rdfrm,vsetvl,vsetvl_pre,vlde,vste,vldm,vstm,vlds,vsts, vldux,vldox,vstux,vstox,vldff,vldr,vstr, vlsegde,vssegte,vlsegds,vssegts,vlsegdux,vlsegdox,vssegtux,vssegtox,vlsegdff, @@ -1838,7 +1836,7 @@ andi\t%0,%1,0xff lbu\t%0,%1" [(set_attr "move_type" "andi,load") - (set_attr "type" "multi") + (set_attr "type" "arith,load") (set_attr "mode" "")]) ;; @@ -1863,7 +1861,7 @@ sext.w\t%0,%1 lw\t%0,%1" [(set_attr "move_type" "move,load") - (set_attr "type" "multi") + (set_attr "type" "move,load") (set_attr "mode" "DI")]) (define_expand "extend2" @@ -1940,7 +1938,7 @@ || reg_or_0_operand (operands[1], HFmode))" { return riscv_output_move (operands[0], operands[1]); } [(set_attr "move_type" "fmove,fmove,mtc,fpload,fpstore,store,mtc,mfc,move,load,store") - (set_attr "type" "fmove") + (set_attr "type" "fmove,fmove,mtc,fpload,fpstore,store,mtc,mfc,move,load,store") (set_attr "mode" "HF")]) (define_insn "*movhf_softfloat" @@ -1951,7 +1949,7 @@ || reg_or_0_operand (operands[1], HFmode))" { return riscv_output_move (operands[0], operands[1]); } [(set_attr "move_type" "fmove,move,load,store,mtc,mfc") - (set_attr "type" "fmove") + (set_attr "type" "fmove,move,load,store,mtc,mfc") (set_attr "mode" "HF")]) (define_insn "*movhf_softfloat_boxing" @@ -2184,7 +2182,7 @@ { return riscv_output_move (operands[0], operands[1]); } [(set_attr "move_type" "move,const,load,store,mtc,fpload,mfc,fmove,fpstore,rdvlenb") (set_attr "mode" "DI") - (set_attr "type" "move") + (set_attr "type" "move,move,load,store,move,fpload,move,fmove,fpstore,move") (set_attr "ext" "base,base,base,base,d,d,d,d,d,vector")]) (define_insn "*movdi_64bit" @@ -2196,7 +2194,7 @@ { return riscv_output_move (operands[0], operands[1]); } [(set_attr "move_type" "move,const,load,store,mtc,fpload,mfc,fmove,fpstore,rdvlenb") (set_attr "mode" "DI") - (set_attr "type" "move") + (set_attr "type" "move,move,load,store,mtc,fpload,mfc,fmove,fpstore,move") (set_attr "ext" "base,base,base,base,d,d,d,d,d,vector")]) ;; 32-bit Integer moves @@ -2219,7 +2217,7 @@ { return riscv_output_move (operands[0], operands[1]); } [(set_attr "move_type" "move,const,load,store,mtc,fpload,mfc,fpstore,rdvlenb") (set_attr "mode" "SI") - (set_attr "type" "move") + (set_attr "type" "move,move,load,store,mtc,fpload,mfc,fpstore,move") (set_attr "ext" "base,base,base,base,f,f,f,f,vector")]) ;; 16-bit Integer moves @@ -2246,7 +2244,7 @@ { return riscv_output_move (operands[0], operands[1]); } [(set_attr "move_type" "move,const,load,store,mtc,mfc,rdvlenb") (set_attr "mode" "HI") - (set_attr "type" "move") + (set_attr "type" "move,move,load,store,mtc,mfc,move") (set_attr "ext" "base,base,base,base,f,f,vector")]) ;; HImode constant generation; see riscv_move_integer for details. @@ -2290,7 +2288,7 @@ { return riscv_output_move (operands[0], operands[1]); } [(set_attr "move_type" "move,const,load,store,mtc,mfc,rdvlenb") (set_attr "mode" "QI") - (set_attr "type" "move") + (set_attr "type" "move,move,load,store,mtc,mfc,move") (set_attr "ext" "base,base,base,base,f,f,vector")]) ;; 32-bit floating point moves @@ -2312,7 +2310,7 @@ || reg_or_0_operand (operands[1], SFmode))" { return riscv_output_move (operands[0], operands[1]); } [(set_attr "move_type" "fmove,fmove,mtc,fpload,fpstore,store,mtc,mfc,move,load,store") - (set_attr "type" "fmove") + (set_attr "type" "fmove,fmove,mtc,fpload,fpstore,store,mtc,mfc,move,load,store") (set_attr "mode" "SF")]) (define_insn "*movsf_softfloat" @@ -2323,7 +2321,7 @@ || reg_or_0_operand (operands[1], SFmode))" { return riscv_output_move (operands[0], operands[1]); } [(set_attr "move_type" "move,load,store") - (set_attr "type" "fmove") + (set_attr "type" "move,load,store") (set_attr "mode" "SF")]) ;; 64-bit floating point moves @@ -2348,7 +2346,7 @@ || reg_or_0_operand (operands[1], DFmode))" { return riscv_output_move (operands[0], operands[1]); } [(set_attr "move_type" "fmove,fmove,mtc,fpload,fpstore,store,mtc,mfc,move,load,store") - (set_attr "type" "fmove") + (set_attr "type" "fmove,fmove,mtc,fpload,fpstore,store,mtc,mfc,move,load,store") (set_attr "mode" "DF")]) (define_insn "*movdf_hardfloat_rv64" @@ -2359,7 +2357,7 @@ || reg_or_0_operand (operands[1], DFmode))" { return riscv_output_move (operands[0], operands[1]); } [(set_attr "move_type" "fmove,fmove,mtc,fpload,fpstore,store,mtc,mfc,move,load,store") - (set_attr "type" "fmove") + (set_attr "type" "fmove,fmove,mtc,fpload,fpstore,store,mtc,mfc,move,load,store") (set_attr "mode" "DF")]) (define_insn "*movdf_softfloat" @@ -2370,7 +2368,7 @@ || reg_or_0_operand (operands[1], DFmode))" { return riscv_output_move (operands[0], operands[1]); } [(set_attr "move_type" "move,load,store") - (set_attr "type" "fmove") + (set_attr "type" "fmove,fpload,fpstore") (set_attr "mode" "DF")]) (define_insn "movsidf2_low_rv32" @@ -3675,7 +3673,7 @@ UNSPECV_CLEAN)] "TARGET_ZICBOM" "cbo.clean\t%a0" - [(set_attr "type" "cbo")] + [(set_attr "type" "store")] ) (define_insn "riscv_flush_" @@ -3683,7 +3681,7 @@ UNSPECV_FLUSH)] "TARGET_ZICBOM" "cbo.flush\t%a0" - [(set_attr "type" "cbo")] + [(set_attr "type" "store")] ) (define_insn "riscv_inval_" @@ -3691,7 +3689,7 @@ UNSPECV_INVAL)] "TARGET_ZICBOM" "cbo.inval\t%a0" - [(set_attr "type" "cbo")] + [(set_attr "type" "store")] ) (define_insn "riscv_zero_" @@ -3699,7 +3697,7 @@ UNSPECV_ZERO)] "TARGET_ZICBOZ" "cbo.zero\t%a0" - [(set_attr "type" "cbo")] + [(set_attr "type" "store")] ) (define_insn "prefetch" @@ -3715,7 +3713,7 @@ default: gcc_unreachable (); } } - [(set_attr "type" "cbo")]) + [(set_attr "type" "store")]) (define_insn "riscv_prefetchi_" [(unspec_volatile:X [(match_operand:X 0 "address_operand" "r") @@ -3723,7 +3721,7 @@ UNSPECV_PREI)] "TARGET_ZICBOP" "prefetch.i\t%a0" - [(set_attr "type" "cbo")]) + [(set_attr "type" "store")]) (define_expand "extv" [(set (match_operand:GPR 0 "register_operand" "=r") @@ -3853,6 +3851,7 @@ (include "sifive-p400.md") (include "sifive-p600.md") (include "thead.md") +(include "generic-vector-ooo.md") (include "generic-ooo.md") (include "vector.md") (include "vector-crypto.md") diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt index 20685c42aed5..45a95177af38 100644 --- a/gcc/config/riscv/riscv.opt +++ b/gcc/config/riscv/riscv.opt @@ -528,23 +528,6 @@ Inline strlen calls if possible. Target RejectNegative Joined UInteger Var(riscv_strcmp_inline_limit) Init(64) Max number of bytes to compare as part of inlined strcmp/strncmp routines (default: 64). -Enum -Name(riscv_autovec_preference) Type(enum riscv_autovec_preference_enum) -Valid arguments to -param=riscv-autovec-preference=: - -EnumValue -Enum(riscv_autovec_preference) String(none) Value(NO_AUTOVEC) - -EnumValue -Enum(riscv_autovec_preference) String(scalable) Value(RVV_SCALABLE) - -EnumValue -Enum(riscv_autovec_preference) String(fixed-vlmax) Value(RVV_FIXED_VLMAX) - --param=riscv-autovec-preference= -Target RejectNegative Joined Enum(riscv_autovec_preference) Var(riscv_autovec_preference) Init(RVV_SCALABLE) --param=riscv-autovec-preference= Set the preference of auto-vectorization in the RISC-V port. - Enum Name(riscv_autovec_lmul) Type(enum riscv_autovec_lmul_enum) The RVV possible LMUL (-param=riscv-autovec-lmul=): @@ -607,3 +590,17 @@ Enum(stringop_strategy) String(vector) Value(STRATEGY_VECTOR) mstringop-strategy= Target RejectNegative Joined Enum(stringop_strategy) Var(stringop_strategy) Init(STRATEGY_AUTO) Specify stringop expansion strategy. + +Enum +Name(rvv_vector_bits) Type(enum rvv_vector_bits_enum) +The possible RVV vector register lengths: + +EnumValue +Enum(rvv_vector_bits) String(scalable) Value(RVV_VECTOR_BITS_SCALABLE) + +EnumValue +Enum(rvv_vector_bits) String(zvl) Value(RVV_VECTOR_BITS_ZVL) + +mrvv-vector-bits= +Target RejectNegative Joined Enum(rvv_vector_bits) Var(rvv_vector_bits) Init(RVV_VECTOR_BITS_SCALABLE) +-mrvv-vector-bits= Set the kind of bits for an RVV vector register. diff --git a/gcc/config/riscv/riscv.opt.urls b/gcc/config/riscv/riscv.opt.urls index e1ab96658ea6..f40795866cfb 100644 --- a/gcc/config/riscv/riscv.opt.urls +++ b/gcc/config/riscv/riscv.opt.urls @@ -12,7 +12,7 @@ UrlSuffix(gcc/RISC-V-Options.html#index-mbranch-cost-4) ; skipping UrlSuffix for 'mplt' due to finding no URLs mabi= -UrlSuffix(gcc/RISC-V-Options.html#index-mabi-4) +UrlSuffix(gcc/RISC-V-Options.html#index-mabi-5) mpreferred-stack-boundary= UrlSuffix(gcc/RISC-V-Options.html#index-mpreferred-stack-boundary) diff --git a/gcc/config/riscv/sifive-7.md b/gcc/config/riscv/sifive-7.md index 48bdba481906..c20854108893 100644 --- a/gcc/config/riscv/sifive-7.md +++ b/gcc/config/riscv/sifive-7.md @@ -34,7 +34,7 @@ (define_insn_reservation "sifive_7_branch" 1 (and (eq_attr "tune" "sifive_7") - (eq_attr "type" "branch")) + (eq_attr "type" "branch,ret,trap")) "sifive_7_B") (define_insn_reservation "sifive_7_sfb_alu" 2 @@ -59,7 +59,8 @@ (define_insn_reservation "sifive_7_alu" 2 (and (eq_attr "tune" "sifive_7") - (eq_attr "type" "unknown,arith,shift,slt,multi,logical,move")) + (eq_attr "type" "unknown,arith,shift,slt,multi,logical,move,bitmanip,\ + rotate,min,max,minu,maxu,clz,ctz,atomic,condmove,mvpair,zicond")) "sifive_7_A|sifive_7_B") (define_insn_reservation "sifive_7_load_immediate" 1 @@ -67,6 +68,12 @@ (eq_attr "type" "nop,const,auipc")) "sifive_7_A|sifive_7_B") +(define_insn_reservation "sifive_7_hfma" 5 + (and (eq_attr "tune" "sifive_7") + (and (eq_attr "type" "fadd,fmul,fmadd") + (eq_attr "mode" "HF"))) + "sifive_7_B") + (define_insn_reservation "sifive_7_sfma" 5 (and (eq_attr "tune" "sifive_7") (and (eq_attr "type" "fadd,fmul,fmadd") @@ -106,6 +113,12 @@ (eq_attr "type" "mfc")) "sifive_7_A") +;; Popcount and clmul. +(define_insn_reservation "sifive_7_popcount" 2 + (and (eq_attr "tune" "sifive_7") + (eq_attr "type" "cpop,clmul")) + "sifive_7_A") + (define_bypass 1 "sifive_7_load,sifive_7_alu,sifive_7_mul,sifive_7_f2i,sifive_7_sfb_alu" "sifive_7_alu,sifive_7_branch") diff --git a/gcc/config/riscv/sifive-p400.md b/gcc/config/riscv/sifive-p400.md index cc244d3c3e68..ed8b8ec9da7b 100644 --- a/gcc/config/riscv/sifive-p400.md +++ b/gcc/config/riscv/sifive-p400.md @@ -89,7 +89,7 @@ (define_insn_reservation "sifive_p400_branch" 1 (and (eq_attr "tune" "sifive_p400") - (eq_attr "type" "branch,jump,call")) + (eq_attr "type" "branch,jump,call,jalr,ret,trap")) "sifive_p400_B+sifive_p400_bru") (define_insn_reservation "sifive_p400_sfb_alu" 1 @@ -114,7 +114,8 @@ (define_insn_reservation "sifive_p400_alu" 1 (and (eq_attr "tune" "sifive_p400") - (eq_attr "type" "unknown,arith,logical,shift,slt,multi,bitmanip,clz,ctz,rotate")) + (eq_attr "type" "unknown,arith,logical,shift,slt,multi,bitmanip,\ + clz,ctz,rotate,min,max,minu,maxu,condmove,mvpair,zicond")) "p400_int_pipe+sifive_p400_ialu") (define_insn_reservation "sifive_p400_cpop" 3 @@ -122,6 +123,11 @@ (eq_attr "type" "cpop")) "p400_int_pipe,sifive_p400_ialu*2") +(define_insn_reservation "sifive_p400_clmul" 3 + (and (eq_attr "tune" "sifive_p400") + (eq_attr "type" "clmul")) + "p400_int_pipe,sifive_p400_ialu*2") + (define_insn_reservation "sifive_p400_load_immediate" 1 (and (eq_attr "tune" "sifive_p400") (eq_attr "type" "nop,const,auipc,move")) diff --git a/gcc/config/riscv/sifive-p600.md b/gcc/config/riscv/sifive-p600.md index c0486491d462..240134976fa1 100644 --- a/gcc/config/riscv/sifive-p600.md +++ b/gcc/config/riscv/sifive-p600.md @@ -93,7 +93,7 @@ (define_insn_reservation "sifive_p600_branch" 1 (and (eq_attr "tune" "sifive_p600") - (eq_attr "type" "branch,jump,call")) + (eq_attr "type" "branch,jump,call,jalr,ret,trap")) "branch_pipe+sifive_p600_bru") (define_insn_reservation "sifive_p600_sfb_alu" 1 @@ -118,7 +118,8 @@ (define_insn_reservation "sifive_p600_alu" 1 (and (eq_attr "tune" "sifive_p600") - (eq_attr "type" "unknown,arith,logical,shift,slt,multi,bitmanip,clz,ctz,rotate")) + (eq_attr "type" "unknown,arith,logical,shift,slt,multi,bitmanip,\ + clz,ctz,rotate,min,max,minu,maxu,condmove,mvpair,zicond")) "int_pipe+sifive_p600_ialu") (define_insn_reservation "sifive_p600_cpop" 3 @@ -126,6 +127,11 @@ (eq_attr "type" "cpop")) "int_pipe,sifive_p600_ialu*2") +(define_insn_reservation "sifive_p600_clmul" 3 + (and (eq_attr "tune" "sifive_p600") + (eq_attr "type" "clmul")) + "int_pipe,sifive_p600_ialu*2") + (define_insn_reservation "sifive_p600_load_immediate" 1 (and (eq_attr "tune" "sifive_p600") (eq_attr "type" "nop,const,auipc,move")) diff --git a/gcc/config/riscv/sync.md b/gcc/config/riscv/sync.md index 54bb0a66518a..6f0b5aae08dc 100644 --- a/gcc/config/riscv/sync.md +++ b/gcc/config/riscv/sync.md @@ -353,6 +353,15 @@ (match_operand:SI 7 "const_int_operand" "")] ;; mod_f "TARGET_ATOMIC" { + if (word_mode != mode && operands[3] != const0_rtx) + { + /* We don't have SI mode compare on RV64, so we need to make sure expected + value is sign-extended. */ + rtx tmp0 = gen_reg_rtx (word_mode); + emit_insn (gen_extend_insn (tmp0, operands[3], word_mode, mode, 0)); + operands[3] = simplify_gen_subreg (mode, tmp0, word_mode, 0); + } + emit_insn (gen_atomic_cas_value_strong (operands[1], operands[2], operands[3], operands[4], operands[6], operands[7])); diff --git a/gcc/config/riscv/vector.md b/gcc/config/riscv/vector.md index ab6e099852dc..8b1c24c5d79f 100644 --- a/gcc/config/riscv/vector.md +++ b/gcc/config/riscv/vector.md @@ -1054,7 +1054,7 @@ (reg:SI FRM_REGNUM))] "TARGET_VECTOR" "frrm\t%0" - [(set_attr "type" "rdfrm") + [(set_attr "type" "fmove") (set_attr "mode" "SI")] ) @@ -5351,10 +5351,10 @@ "@ vmadd.vv\t%0,%4,%5%p1 vmacc.vv\t%0,%3,%4%p1 - vmv.v.v\t%0,%4\;vmacc.vv\t%0,%3,%4%p1 + vmv%m4r.v\t%0,%4\;vmacc.vv\t%0,%3,%4%p1 vmadd.vv\t%0,%4,%5%p1 vmacc.vv\t%0,%3,%4%p1 - vmv.v.v\t%0,%5\;vmacc.vv\t%0,%3,%4%p1" + vmv%m5r.v\t%0,%5\;vmacc.vv\t%0,%3,%4%p1" [(set_attr "type" "vimuladd") (set_attr "mode" "")]) @@ -5378,9 +5378,9 @@ "TARGET_VECTOR" "@ vmadd.vv\t%0,%3,%4%p1 - vmv.v.v\t%0,%2\;vmadd.vv\t%0,%3,%4%p1 + vmv%m2r.v\t%0,%2\;vmadd.vv\t%0,%3,%4%p1 vmadd.vv\t%0,%3,%4%p1 - vmv.v.v\t%0,%2\;vmadd.vv\t%0,%3,%4%p1" + vmv%m2r.v\t%0,%2\;vmadd.vv\t%0,%3,%4%p1" [(set_attr "type" "vimuladd") (set_attr "mode" "") (set_attr "merge_op_idx" "2") @@ -5409,9 +5409,9 @@ "TARGET_VECTOR" "@ vmacc.vv\t%0,%2,%3%p1 - vmv.v.v\t%0,%4\;vmacc.vv\t%0,%2,%3%p1 + vmv%m4r.v\t%0,%4;vmacc.vv\t%0,%2,%3%p1 vmacc.vv\t%0,%2,%3%p1 - vmv.v.v\t%0,%4\;vmacc.vv\t%0,%2,%3%p1" + vmv%m4r.v\t%0,%4\;vmacc.vv\t%0,%2,%3%p1" [(set_attr "type" "vimuladd") (set_attr "mode" "") (set_attr "merge_op_idx" "4") @@ -5462,9 +5462,9 @@ "TARGET_VECTOR" "@ vmadd.vx\t%0,%2,%4%p1 - vmv.v.v\t%0,%3\;vmadd.vx\t%0,%2,%4%p1 + vmv%m3r.v\t%0,%3\;vmadd.vx\t%0,%2,%4%p1 vmadd.vx\t%0,%2,%4%p1 - vmv.v.v\t%0,%3\;vmadd.vx\t%0,%2,%4%p1" + vmv%m3r.v\t%0,%3\;vmadd.vx\t%0,%2,%4%p1" [(set_attr "type" "vimuladd") (set_attr "mode" "") (set_attr "merge_op_idx" "3") @@ -5494,9 +5494,9 @@ "TARGET_VECTOR" "@ vmacc.vx\t%0,%2,%3%p1 - vmv.v.v\t%0,%4\;vmacc.vx\t%0,%2,%3%p1 + vmv%m4r.v\t%0,%4\;vmacc.vx\t%0,%2,%3%p1 vmacc.vx\t%0,%2,%3%p1 - vmv.v.v\t%0,%4\;vmacc.vx\t%0,%2,%3%p1" + vmv%m4r.v\t%0,%4\;vmacc.vx\t%0,%2,%3%p1" [(set_attr "type" "vimuladd") (set_attr "mode" "") (set_attr "merge_op_idx" "4") @@ -5562,9 +5562,9 @@ "TARGET_VECTOR && !TARGET_64BIT" "@ vmadd.vx\t%0,%2,%4%p1 - vmv.v.v\t%0,%2\;vmadd.vx\t%0,%2,%4%p1 + vmv%m2r.v\t%0,%2\;vmadd.vx\t%0,%2,%4%p1 vmadd.vx\t%0,%2,%4%p1 - vmv.v.v\t%0,%2\;vmadd.vx\t%0,%2,%4%p1" + vmv%m2r.v\t%0,%2\;vmadd.vx\t%0,%2,%4%p1" [(set_attr "type" "vimuladd") (set_attr "mode" "") (set_attr "merge_op_idx" "3") @@ -5595,9 +5595,9 @@ "TARGET_VECTOR && !TARGET_64BIT" "@ vmacc.vx\t%0,%2,%3%p1 - vmv.v.v\t%0,%4\;vmacc.vx\t%0,%2,%3%p1 + vmv%m4r.v\t%0,%4\;vmacc.vx\t%0,%2,%3%p1 vmacc.vx\t%0,%2,%3%p1 - vmv.v.v\t%0,%4\;vmacc.vx\t%0,%2,%3%p1" + vmv%m4r.v\t%0,%4\;vmacc.vx\t%0,%2,%3%p1" [(set_attr "type" "vimuladd") (set_attr "mode" "") (set_attr "merge_op_idx" "4") @@ -5649,10 +5649,10 @@ "@ vnmsub.vv\t%0,%4,%5%p1 vnmsac.vv\t%0,%3,%4%p1 - vmv.v.v\t%0,%3\;vnmsub.vv\t%0,%4,%5%p1 + vmv%m3r.v\t%0,%3\;vnmsub.vv\t%0,%4,%5%p1 vnmsub.vv\t%0,%4,%5%p1 vnmsac.vv\t%0,%3,%4%p1 - vmv.v.v\t%0,%3\;vnmsub.vv\t%0,%4,%5%p1" + vmv%m3r.v\t%0,%3\;vnmsub.vv\t%0,%4,%5%p1" [(set_attr "type" "vimuladd") (set_attr "mode" "")]) @@ -5676,9 +5676,9 @@ "TARGET_VECTOR" "@ vnmsub.vv\t%0,%3,%4%p1 - vmv.v.v\t%0,%2\;vnmsub.vv\t%0,%3,%4%p1 + vmv%m2r.v\t%0,%2\;vnmsub.vv\t%0,%3,%4%p1 vnmsub.vv\t%0,%3,%4%p1 - vmv.v.v\t%0,%2\;vnmsub.vv\t%0,%3,%4%p1" + vmv%m2r.v\t%0,%2\;vnmsub.vv\t%0,%3,%4%p1" [(set_attr "type" "vimuladd") (set_attr "mode" "") (set_attr "merge_op_idx" "2") @@ -5707,9 +5707,9 @@ "TARGET_VECTOR" "@ vnmsac.vv\t%0,%2,%3%p1 - vmv.v.v\t%0,%4\;vnmsac.vv\t%0,%2,%3%p1 + vmv%m4r.v\t%0,%4\;vnmsac.vv\t%0,%2,%3%p1 vnmsac.vv\t%0,%2,%3%p1 - vmv.v.v\t%0,%4\;vnmsac.vv\t%0,%2,%3%p1" + vmv%m4r.v\t%0,%4\;vnmsac.vv\t%0,%2,%3%p1" [(set_attr "type" "vimuladd") (set_attr "mode" "") (set_attr "merge_op_idx" "4") @@ -5760,9 +5760,9 @@ "TARGET_VECTOR" "@ vnmsub.vx\t%0,%2,%4%p1 - vmv.v.v\t%0,%3\;vnmsub.vx\t%0,%2,%4%p1 + vmv%m3r.v\t%0,%3\;vnmsub.vx\t%0,%2,%4%p1 vnmsub.vx\t%0,%2,%4%p1 - vmv.v.v\t%0,%3\;vnmsub.vx\t%0,%2,%4%p1" + vmv%m3r.v\t%0,%3\;vnmsub.vx\t%0,%2,%4%p1" [(set_attr "type" "vimuladd") (set_attr "mode" "") (set_attr "merge_op_idx" "3") @@ -5792,9 +5792,9 @@ "TARGET_VECTOR" "@ vnmsac.vx\t%0,%2,%3%p1 - vmv.v.v\t%0,%4\;vnmsac.vx\t%0,%2,%3%p1 + vmv%m4r.v\t%0,%4\;vnmsac.vx\t%0,%2,%3%p1 vnmsac.vx\t%0,%2,%3%p1 - vmv.v.v\t%0,%4\;vnmsac.vx\t%0,%2,%3%p1" + vmv%m4r.v\t%0,%4\;vnmsac.vx\t%0,%2,%3%p1" [(set_attr "type" "vimuladd") (set_attr "mode" "") (set_attr "merge_op_idx" "4") @@ -5860,9 +5860,9 @@ "TARGET_VECTOR && !TARGET_64BIT" "@ vnmsub.vx\t%0,%2,%4%p1 - vmv.v.v\t%0,%3\;vnmsub.vx\t%0,%2,%4%p1 + vmv%m3r.v\t%0,%3\;vnmsub.vx\t%0,%2,%4%p1 vnmsub.vx\t%0,%2,%4%p1 - vmv.v.v\t%0,%3\;vnmsub.vx\t%0,%2,%4%p1" + vmv%m3r.v\t%0,%3\;vnmsub.vx\t%0,%2,%4%p1" [(set_attr "type" "vimuladd") (set_attr "mode" "") (set_attr "merge_op_idx" "3") @@ -5893,9 +5893,9 @@ "TARGET_VECTOR && !TARGET_64BIT" "@ vnmsac.vx\t%0,%2,%3%p1 - vmv.v.v\t%0,%4\;vnmsac.vx\t%0,%2,%3%p1 + vmv%m4r.v\t%0,%4\;vnmsac.vx\t%0,%2,%3%p1 vnmsac.vx\t%0,%2,%3%p1 - vmv.v.v\t%0,%4\;vnmsac.vx\t%0,%2,%3%p1" + vmv%m4r.v\t%0,%4\;vnmsac.vx\t%0,%2,%3%p1" [(set_attr "type" "vimuladd") (set_attr "mode" "") (set_attr "merge_op_idx" "4") @@ -6555,10 +6555,10 @@ "@ vf.vv\t%0,%4,%5%p1 vf.vv\t%0,%3,%4%p1 - vmv.v.v\t%0,%3\;vf.vv\t%0,%4,%5%p1 + vmv%m3r.v\t%0,%3\;vf.vv\t%0,%4,%5%p1 vf.vv\t%0,%4,%5%p1 vf.vv\t%0,%3,%4%p1 - vmv.v.v\t%0,%3\;vf.vv\t%0,%4,%5%p1" + vmv%m3r.v\t%0,%3\;vf.vv\t%0,%4,%5%p1" [(set_attr "type" "vfmuladd") (set_attr "mode" "") (set (attr "frm_mode") @@ -6586,9 +6586,9 @@ "TARGET_VECTOR" "@ vf.vv\t%0,%3,%4%p1 - vmv.v.v\t%0,%2\;vf.vv\t%0,%3,%4%p1 + vmv%m2r.v\t%0,%2\;vf.vv\t%0,%3,%4%p1 vf.vv\t%0,%3,%4%p1 - vmv.v.v\t%0,%2\;vf.vv\t%0,%3,%4%p1" + vmv%m2r.v\t%0,%2\;vf.vv\t%0,%3,%4%p1" [(set_attr "type" "vfmuladd") (set_attr "mode" "") (set_attr "merge_op_idx" "2") @@ -6621,9 +6621,9 @@ "TARGET_VECTOR" "@ vf.vv\t%0,%2,%3%p1 - vmv.v.v\t%0,%4\;vf.vv\t%0,%2,%3%p1 + vmv%m4r.v\t%0,%4\;vf.vv\t%0,%2,%3%p1 vf.vv\t%0,%2,%3%p1 - vmv.v.v\t%0,%4\;vf.vv\t%0,%2,%3%p1" + vmv%m4r.v\t%0,%4\;vf.vv\t%0,%2,%3%p1" [(set_attr "type" "vfmuladd") (set_attr "mode" "") (set_attr "merge_op_idx" "4") @@ -6680,9 +6680,9 @@ "TARGET_VECTOR" "@ vf.vf\t%0,%2,%4%p1 - vmv.v.v\t%0,%3\;vf.vf\t%0,%2,%4%p1 + vmv%m3r.v\t%0,%3\;vf.vf\t%0,%2,%4%p1 vf.vf\t%0,%2,%4%p1 - vmv.v.v\t%0,%3\;vf.vf\t%0,%2,%4%p1" + vmv%m3r.v\t%0,%3\;vf.vf\t%0,%2,%4%p1" [(set_attr "type" "vfmuladd") (set_attr "mode" "") (set_attr "merge_op_idx" "3") @@ -6716,9 +6716,9 @@ "TARGET_VECTOR" "@ vf.vf\t%0,%2,%3%p1 - vmv.v.v\t%0,%4\;vf.vf\t%0,%2,%3%p1 + vmv%m4r.v\t%0,%4\;vf.vf\t%0,%2,%3%p1 vf.vf\t%0,%2,%3%p1 - vmv.v.v\t%0,%4\;vf.vf\t%0,%2,%3%p1" + vmv%m4r.v\t%0,%4\;vf.vf\t%0,%2,%3%p1" [(set_attr "type" "vfmuladd") (set_attr "mode" "") (set_attr "merge_op_idx" "4") @@ -6778,10 +6778,10 @@ "@ vf.vv\t%0,%4,%5%p1 vf.vv\t%0,%3,%4%p1 - vmv.v.v\t%0,%3\;vf.vv\t%0,%4,%5%p1 + vmv%m3r.v\t%0,%3\;vf.vv\t%0,%4,%5%p1 vf.vv\t%0,%4,%5%p1 vf.vv\t%0,%3,%4%p1 - vmv.v.v\t%0,%3\;vf.vv\t%0,%4,%5%p1" + vmv%m3r.v\t%0,%3\;vf.vv\t%0,%4,%5%p1" [(set_attr "type" "vfmuladd") (set_attr "mode" "") (set (attr "frm_mode") @@ -6810,9 +6810,9 @@ "TARGET_VECTOR" "@ vf.vv\t%0,%3,%4%p1 - vmv.v.v\t%0,%2\;vf.vv\t%0,%3,%4%p1 + vmv%m2r.v\t%0,%2\;vf.vv\t%0,%3,%4%p1 vf.vv\t%0,%3,%4%p1 - vmv.v.v\t%0,%2\;vf.vv\t%0,%3,%4%p1" + vmv%m2r.v\t%0,%2\;vf.vv\t%0,%3,%4%p1" [(set_attr "type" "vfmuladd") (set_attr "mode" "") (set_attr "merge_op_idx" "2") @@ -6846,9 +6846,9 @@ "TARGET_VECTOR" "@ vf.vv\t%0,%2,%3%p1 - vmv.v.v\t%0,%4\;vf.vv\t%0,%2,%3%p1 + vmv%m4r.v\t%0,%4\;vf.vv\t%0,%2,%3%p1 vf.vv\t%0,%2,%3%p1 - vmv.v.v\t%0,%4\;vf.vv\t%0,%2,%3%p1" + vmv%m4r.v\t%0,%4\;vf.vv\t%0,%2,%3%p1" [(set_attr "type" "vfmuladd") (set_attr "mode" "") (set_attr "merge_op_idx" "4") @@ -6907,9 +6907,9 @@ "TARGET_VECTOR" "@ vf.vf\t%0,%2,%4%p1 - vmv.v.v\t%0,%3\;vf.vf\t%0,%2,%4%p1 + vmv%m3r.v\t%0,%3\;vf.vf\t%0,%2,%4%p1 vf.vf\t%0,%2,%4%p1 - vmv.v.v\t%0,%3\;vf.vf\t%0,%2,%4%p1" + vmv%m3r.v\t%0,%3\;vf.vf\t%0,%2,%4%p1" [(set_attr "type" "vfmuladd") (set_attr "mode" "") (set_attr "merge_op_idx" "3") @@ -6944,9 +6944,9 @@ "TARGET_VECTOR" "@ vf.vf\t%0,%2,%3%p1 - vmv.v.v\t%0,%4\;vf.vf\t%0,%2,%3%p1 + vmv%m4r.v\t%0,%4\;vf.vf\t%0,%2,%3%p1 vf.vf\t%0,%2,%3%p1 - vmv.v.v\t%0,%4\;vf.vf\t%0,%2,%3%p1" + vmv%m4r.v\t%0,%4\;vf.vf\t%0,%2,%3%p1" [(set_attr "type" "vfmuladd") (set_attr "mode" "") (set_attr "merge_op_idx" "4") diff --git a/gcc/config/riscv/zc.md b/gcc/config/riscv/zc.md index 216232cb9f2f..462ab37569e3 100644 --- a/gcc/config/riscv/zc.md +++ b/gcc/config/riscv/zc.md @@ -27,7 +27,7 @@ (const_int ))))] "TARGET_ZCMP" "cm.pop {ra}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_pop_up_to_s0_" [(set (reg:X SP_REGNUM) @@ -41,7 +41,7 @@ (const_int ))))] "TARGET_ZCMP" "cm.pop {ra, s0}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_pop_up_to_s1_" [(set (reg:X SP_REGNUM) @@ -58,7 +58,7 @@ (const_int ))))] "TARGET_ZCMP" "cm.pop {ra, s0-s1}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_pop_up_to_s2_" [(set (reg:X SP_REGNUM) @@ -78,7 +78,7 @@ (const_int ))))] "TARGET_ZCMP" "cm.pop {ra, s0-s2}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_pop_up_to_s3_" [(set (reg:X SP_REGNUM) @@ -101,7 +101,7 @@ (const_int ))))] "TARGET_ZCMP" "cm.pop {ra, s0-s3}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_pop_up_to_s4_" [(set (reg:X SP_REGNUM) @@ -127,7 +127,7 @@ (const_int ))))] "TARGET_ZCMP" "cm.pop {ra, s0-s4}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_pop_up_to_s5_" [(set (reg:X SP_REGNUM) @@ -156,7 +156,7 @@ (const_int ))))] "TARGET_ZCMP" "cm.pop {ra, s0-s5}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_pop_up_to_s6_" [(set (reg:X SP_REGNUM) @@ -188,7 +188,7 @@ (const_int ))))] "TARGET_ZCMP" "cm.pop {ra, s0-s6}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_pop_up_to_s7_" [(set (reg:X SP_REGNUM) @@ -223,7 +223,7 @@ (const_int ))))] "TARGET_ZCMP" "cm.pop {ra, s0-s7}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_pop_up_to_s8_" [(set (reg:X SP_REGNUM) @@ -261,7 +261,7 @@ (const_int ))))] "TARGET_ZCMP" "cm.pop {ra, s0-s8}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_pop_up_to_s9_" [(set (reg:X SP_REGNUM) @@ -302,7 +302,7 @@ (const_int ))))] "TARGET_ZCMP" "cm.pop {ra, s0-s9}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_pop_up_to_s11_" [(set (reg:X SP_REGNUM) @@ -349,7 +349,7 @@ (const_int ))))] "TARGET_ZCMP" "cm.pop {ra, s0-s11}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popret_up_to_ra_" [(set (reg:X SP_REGNUM) @@ -362,7 +362,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popret {ra}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popret_up_to_s0_" [(set (reg:X SP_REGNUM) @@ -378,7 +378,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popret {ra, s0}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popret_up_to_s1_" [(set (reg:X SP_REGNUM) @@ -397,7 +397,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popret {ra, s0-s1}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popret_up_to_s2_" [(set (reg:X SP_REGNUM) @@ -419,7 +419,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popret {ra, s0-s2}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popret_up_to_s3_" [(set (reg:X SP_REGNUM) @@ -444,7 +444,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popret {ra, s0-s3}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popret_up_to_s4_" [(set (reg:X SP_REGNUM) @@ -472,7 +472,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popret {ra, s0-s4}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popret_up_to_s5_" [(set (reg:X SP_REGNUM) @@ -503,7 +503,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popret {ra, s0-s5}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popret_up_to_s6_" [(set (reg:X SP_REGNUM) @@ -537,7 +537,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popret {ra, s0-s6}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popret_up_to_s7_" [(set (reg:X SP_REGNUM) @@ -574,7 +574,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popret {ra, s0-s7}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popret_up_to_s8_" [(set (reg:X SP_REGNUM) @@ -614,7 +614,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popret {ra, s0-s8}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popret_up_to_s9_" [(set (reg:X SP_REGNUM) @@ -657,7 +657,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popret {ra, s0-s9}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popret_up_to_s11_" [(set (reg:X SP_REGNUM) @@ -706,7 +706,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popret {ra, s0-s11}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popretz_up_to_ra_" [(set (reg:X SP_REGNUM) @@ -722,7 +722,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popretz {ra}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popretz_up_to_s0_" [(set (reg:X SP_REGNUM) @@ -741,7 +741,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popretz {ra, s0}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popretz_up_to_s1_" [(set (reg:X SP_REGNUM) @@ -763,7 +763,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popretz {ra, s0-s1}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popretz_up_to_s2_" [(set (reg:X SP_REGNUM) @@ -788,7 +788,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popretz {ra, s0-s2}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popretz_up_to_s3_" [(set (reg:X SP_REGNUM) @@ -816,7 +816,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popretz {ra, s0-s3}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popretz_up_to_s4_" [(set (reg:X SP_REGNUM) @@ -847,7 +847,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popretz {ra, s0-s4}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popretz_up_to_s5_" [(set (reg:X SP_REGNUM) @@ -881,7 +881,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popretz {ra, s0-s5}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popretz_up_to_s6_" [(set (reg:X SP_REGNUM) @@ -918,7 +918,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popretz {ra, s0-s6}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popretz_up_to_s7_" [(set (reg:X SP_REGNUM) @@ -958,7 +958,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popretz {ra, s0-s7}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popretz_up_to_s8_" [(set (reg:X SP_REGNUM) @@ -1001,7 +1001,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popretz {ra, s0-s8}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popretz_up_to_s9_" [(set (reg:X SP_REGNUM) @@ -1047,7 +1047,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popretz {ra, s0-s9}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_popretz_up_to_s11_" [(set (reg:X SP_REGNUM) @@ -1099,7 +1099,7 @@ (use (reg:SI RETURN_ADDR_REGNUM))] "TARGET_ZCMP" "cm.popretz {ra, s0-s11}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "load")]) (define_insn "@gpr_multi_push_up_to_ra_" [(set (mem:X (plus:X (reg:X SP_REGNUM) @@ -1110,7 +1110,7 @@ (match_operand 0 "stack_push_up_to_ra_operand" "I")))] "TARGET_ZCMP" "cm.push {ra}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "store")]) (define_insn "@gpr_multi_push_up_to_s0_" [(set (mem:X (plus:X (reg:X SP_REGNUM) @@ -1124,7 +1124,7 @@ (match_operand 0 "stack_push_up_to_s0_operand" "I")))] "TARGET_ZCMP" "cm.push {ra, s0}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "store")]) (define_insn "@gpr_multi_push_up_to_s1_" [(set (mem:X (plus:X (reg:X SP_REGNUM) @@ -1141,7 +1141,7 @@ (match_operand 0 "stack_push_up_to_s1_operand" "I")))] "TARGET_ZCMP" "cm.push {ra, s0-s1}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "store")]) (define_insn "@gpr_multi_push_up_to_s2_" [(set (mem:X (plus:X (reg:X SP_REGNUM) @@ -1161,7 +1161,7 @@ (match_operand 0 "stack_push_up_to_s2_operand" "I")))] "TARGET_ZCMP" "cm.push {ra, s0-s2}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "store")]) (define_insn "@gpr_multi_push_up_to_s3_" [(set (mem:X (plus:X (reg:X SP_REGNUM) @@ -1184,7 +1184,7 @@ (match_operand 0 "stack_push_up_to_s3_operand" "I")))] "TARGET_ZCMP" "cm.push {ra, s0-s3}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "store")]) (define_insn "@gpr_multi_push_up_to_s4_" [(set (mem:X (plus:X (reg:X SP_REGNUM) @@ -1210,7 +1210,7 @@ (match_operand 0 "stack_push_up_to_s4_operand" "I")))] "TARGET_ZCMP" "cm.push {ra, s0-s4}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "store")]) (define_insn "@gpr_multi_push_up_to_s5_" [(set (mem:X (plus:X (reg:X SP_REGNUM) @@ -1239,7 +1239,7 @@ (match_operand 0 "stack_push_up_to_s5_operand" "I")))] "TARGET_ZCMP" "cm.push {ra, s0-s5}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "store")]) (define_insn "@gpr_multi_push_up_to_s6_" [(set (mem:X (plus:X (reg:X SP_REGNUM) @@ -1271,7 +1271,7 @@ (match_operand 0 "stack_push_up_to_s6_operand" "I")))] "TARGET_ZCMP" "cm.push {ra, s0-s6}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "store")]) (define_insn "@gpr_multi_push_up_to_s7_" [(set (mem:X (plus:X (reg:X SP_REGNUM) @@ -1306,7 +1306,7 @@ (match_operand 0 "stack_push_up_to_s7_operand" "I")))] "TARGET_ZCMP" "cm.push {ra, s0-s7}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "store")]) (define_insn "@gpr_multi_push_up_to_s8_" [(set (mem:X (plus:X (reg:X SP_REGNUM) @@ -1344,7 +1344,7 @@ (match_operand 0 "stack_push_up_to_s8_operand" "I")))] "TARGET_ZCMP" "cm.push {ra, s0-s8}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "store")]) (define_insn "@gpr_multi_push_up_to_s9_" [(set (mem:X (plus:X (reg:X SP_REGNUM) @@ -1385,7 +1385,7 @@ (match_operand 0 "stack_push_up_to_s9_operand" "I")))] "TARGET_ZCMP" "cm.push {ra, s0-s9}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "store")]) (define_insn "@gpr_multi_push_up_to_s11_" [(set (mem:X (plus:X (reg:X SP_REGNUM) @@ -1432,7 +1432,7 @@ (match_operand 0 "stack_push_up_to_s11_operand" "I")))] "TARGET_ZCMP" "cm.push {ra, s0-s11}, %0" -[(set_attr "type" "pushpop")]) +[(set_attr "type" "store")]) ;; ZCMP mv (define_insn "*mva01s" diff --git a/gcc/config/rs6000/constraints.md b/gcc/config/rs6000/constraints.md index c99997bf82bd..369a7b75042d 100644 --- a/gcc/config/rs6000/constraints.md +++ b/gcc/config/rs6000/constraints.md @@ -78,8 +78,8 @@ ;; It is currently used for that purpose in LLVM. (define_register_constraint "we" "rs6000_constraints[RS6000_CONSTRAINT_we]" - "@internal Like @code{wa}, if @option{-mpower9-vector} and @option{-m64} are - used; otherwise, @code{NO_REGS}.") + "@internal Like @code{wa}, if this is a POWER9 or later and @option{-mvsx} + and @option{-m64} are used; otherwise, @code{NO_REGS}.") ;; NO_REGs register constraint, used to merge mov{sd,sf}, since movsd can use ;; direct move directly, and movsf can't to move between the register sets. diff --git a/gcc/config/rs6000/driver-rs6000.cc b/gcc/config/rs6000/driver-rs6000.cc index 244b3388c2ad..3ebbaa42622a 100644 --- a/gcc/config/rs6000/driver-rs6000.cc +++ b/gcc/config/rs6000/driver-rs6000.cc @@ -476,13 +476,13 @@ static const struct asm_name asm_names[] = { { "power6", "-mpower6 %{!mvsx:%{!maltivec:-maltivec}}" }, { "power6x", "-mpower6 %{!mvsx:%{!maltivec:-maltivec}}" }, { "power7", "-mpower7" }, - { "power8", "%{mpower9-vector:-mpower9;:-mpower8}" }, + { "power8", "-mpower8" }, { "power9", "-mpower9" }, { "power10", "-mpower10" }, { "a2", "-ma2" }, { "powerpc", "-mppc" }, { "powerpc64", "-mppc64" }, - { "powerpc64le", "%{mpower9-vector:-mpower9;:-mpower8}" }, + { "powerpc64le", "-mpower8" }, { "rs64", "-mppc64" }, { "401", "-mppc" }, { "403", "-m403" }, @@ -526,8 +526,7 @@ static const struct asm_name asm_names[] = { { "e6500", "-me6500" }, { "titan", "-mtitan" }, { NULL, "\ -%{mpower9-vector: -mpower9; \ - mpower8-vector|mcrypto|mdirect-move|mhtm: -mpower8; \ +%{mcrypto|mdirect-move|mhtm: -mpower8; \ mvsx: -mpower7; \ mpowerpc64: -mppc64; \ : %(asm_default)}" }, diff --git a/gcc/config/rs6000/rs6000-cpus.def b/gcc/config/rs6000/rs6000-cpus.def index 276f3cdecaf1..28249600318f 100644 --- a/gcc/config/rs6000/rs6000-cpus.def +++ b/gcc/config/rs6000/rs6000-cpus.def @@ -86,21 +86,15 @@ | OPTION_MASK_POWER10 \ | OTHER_POWER10_MASKS) -/* Flags that need to be turned off if -mno-power9-vector. */ -#define OTHER_P9_VECTOR_MASKS (OPTION_MASK_FLOAT128_HW \ - | OPTION_MASK_P9_MINMAX) - -/* Flags that need to be turned off if -mno-power8-vector. */ -#define OTHER_P8_VECTOR_MASKS (OTHER_P9_VECTOR_MASKS \ - | OPTION_MASK_P9_VECTOR \ - | OPTION_MASK_DIRECT_MOVE \ - | OPTION_MASK_CRYPTO) - /* Flags that need to be turned off if -mno-vsx. */ -#define OTHER_VSX_VECTOR_MASKS (OTHER_P8_VECTOR_MASKS \ - | OPTION_MASK_EFFICIENT_UNALIGNED_VSX \ +#define OTHER_VSX_VECTOR_MASKS (OPTION_MASK_EFFICIENT_UNALIGNED_VSX \ | OPTION_MASK_FLOAT128_KEYWORD \ - | OPTION_MASK_P8_VECTOR) + | OPTION_MASK_P8_VECTOR \ + | OPTION_MASK_DIRECT_MOVE \ + | OPTION_MASK_CRYPTO \ + | OPTION_MASK_P9_VECTOR \ + | OPTION_MASK_FLOAT128_HW \ + | OPTION_MASK_P9_MINMAX) /* Flags that need to be turned off if -mno-altivec. */ #define OTHER_ALTIVEC_MASKS (OTHER_VSX_VECTOR_MASKS \ diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index 5d975dab9216..6ba9df4f02e7 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -72,6 +72,8 @@ #include "context.h" #include "tree-pass.h" #include "symbol-summary.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "except.h" @@ -3864,8 +3866,8 @@ rs6000_option_override_internal (bool global_init_p) dwarf_offset_size = POINTER_SIZE_UNITS; #endif - /* Handle explicit -mno-{altivec,vsx,power8-vector,power9-vector} and turn - off all of the options that depend on those flags. */ + /* Handle explicit -mno-{altivec,vsx} and turn off all of + the options that depend on those flags. */ ignore_masks = rs6000_disable_incompatible_switches (); /* For the newer switches (vsx, dfp, etc.) set some of the older options, @@ -3945,31 +3947,10 @@ rs6000_option_override_internal (bool global_init_p) } if (TARGET_P8_VECTOR && !TARGET_ALTIVEC) - { - if (rs6000_isa_flags_explicit & OPTION_MASK_P8_VECTOR) - error ("%qs requires %qs", "-mpower8-vector", "-maltivec"); - rs6000_isa_flags &= ~OPTION_MASK_P8_VECTOR; - } + rs6000_isa_flags &= ~OPTION_MASK_P8_VECTOR; if (TARGET_P8_VECTOR && !TARGET_VSX) - { - if ((rs6000_isa_flags_explicit & OPTION_MASK_P8_VECTOR) - && (rs6000_isa_flags_explicit & OPTION_MASK_VSX)) - error ("%qs requires %qs", "-mpower8-vector", "-mvsx"); - else if ((rs6000_isa_flags_explicit & OPTION_MASK_P8_VECTOR) == 0) - { - rs6000_isa_flags &= ~OPTION_MASK_P8_VECTOR; - if (rs6000_isa_flags_explicit & OPTION_MASK_VSX) - rs6000_isa_flags_explicit |= OPTION_MASK_P8_VECTOR; - } - else - { - /* OPTION_MASK_P8_VECTOR is explicit, and OPTION_MASK_VSX is - not explicit. */ - rs6000_isa_flags |= OPTION_MASK_VSX; - rs6000_isa_flags_explicit |= OPTION_MASK_VSX; - } - } + rs6000_isa_flags &= ~OPTION_MASK_P8_VECTOR; if (TARGET_DFP && !TARGET_HARD_FLOAT) { @@ -4056,28 +4037,7 @@ rs6000_option_override_internal (bool global_init_p) /* ISA 3.0 vector instructions include ISA 2.07. */ if (TARGET_P9_VECTOR && !TARGET_P8_VECTOR) - { - /* We prefer to not mention undocumented options in - error messages. However, if users have managed to select - power9-vector without selecting power8-vector, they - already know about undocumented flags. */ - if ((rs6000_isa_flags_explicit & OPTION_MASK_P9_VECTOR) && - (rs6000_isa_flags_explicit & OPTION_MASK_P8_VECTOR)) - error ("%qs requires %qs", "-mpower9-vector", "-mpower8-vector"); - else if ((rs6000_isa_flags_explicit & OPTION_MASK_P9_VECTOR) == 0) - { - rs6000_isa_flags &= ~OPTION_MASK_P9_VECTOR; - if (rs6000_isa_flags_explicit & OPTION_MASK_P8_VECTOR) - rs6000_isa_flags_explicit |= OPTION_MASK_P9_VECTOR; - } - else - { - /* OPTION_MASK_P9_VECTOR is explicit and - OPTION_MASK_P8_VECTOR is not explicit. */ - rs6000_isa_flags |= OPTION_MASK_P8_VECTOR; - rs6000_isa_flags_explicit |= OPTION_MASK_P8_VECTOR; - } - } + rs6000_isa_flags &= ~OPTION_MASK_P9_VECTOR; /* Set -mallow-movmisalign to explicitly on if we have full ISA 2.07 support. If we only have ISA 2.06 support, and the user did not specify @@ -25188,12 +25148,6 @@ rs6000_print_isa_options (FILE *file, int indent, const char *string, 2.07, and 3.0 options that relate to the vector unit (-mdirect-move, -mupper-regs-df, etc.). - If the user used -mno-power8-vector, we need to turn off all of the implicit - ISA 2.07 and 3.0 options that relate to the vector unit. - - If the user used -mno-power9-vector, we need to turn off all of the implicit - ISA 3.0 options that relate to the vector unit. - This function does not handle explicit options such as the user specifying -mdirect-move. These are handled in rs6000_option_override_internal, and the appropriate error is given if needed. @@ -25212,8 +25166,6 @@ rs6000_disable_incompatible_switches (void) const HOST_WIDE_INT dep_flags; /* flags that depend on this option. */ const char *const name; /* name of the switch. */ } flags[] = { - { OPTION_MASK_P9_VECTOR, OTHER_P9_VECTOR_MASKS, "power9-vector" }, - { OPTION_MASK_P8_VECTOR, OTHER_P8_VECTOR_MASKS, "power8-vector" }, { OPTION_MASK_VSX, OTHER_VSX_VECTOR_MASKS, "vsx" }, { OPTION_MASK_ALTIVEC, OTHER_ALTIVEC_MASKS, "altivec" }, }; diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 2291fe8d3a34..68bc45d65baa 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -103,13 +103,12 @@ /* Common ASM definitions used by ASM_SPEC among the various targets for handling -mcpu=xxx switches. There is a parallel list in driver-rs6000.cc to provide the default assembler options if the user uses -mcpu=native, so if - you make changes here, make them also there. PR63177: Do not pass -mpower8 - to the assembler if -mpower9-vector was also used. */ + you make changes here, make them also there. */ #define ASM_CPU_SPEC \ "%{mcpu=native: %(asm_cpu_native); \ mcpu=power10: -mpower10; \ mcpu=power9: -mpower9; \ - mcpu=power8|mcpu=powerpc64le: %{mpower9-vector: -mpower9;: -mpower8}; \ + mcpu=power8|mcpu=powerpc64le: -mpower8; \ mcpu=power7: -mpower7; \ mcpu=power6x: -mpower6 %{!mvsx:%{!maltivec:-maltivec}}; \ mcpu=power6: -mpower6 %{!mvsx:%{!maltivec:-maltivec}}; \ @@ -163,8 +162,7 @@ mcpu=e5500: -me5500; \ mcpu=e6500: -me6500; \ mcpu=titan: -mtitan; \ - !mcpu*: %{mpower9-vector: -mpower9; \ - mpower8-vector|mcrypto|mdirect-move|mhtm: -mpower8; \ + !mcpu*: %{mcrypto|mdirect-move|mhtm: -mpower8; \ mvsx: -mpower7; \ mpowerpc64: -mppc64;: %(asm_default)}; \ :%eMissing -mcpu option in ASM_CPU_SPEC?\n} \ diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt index 5e32ee9b685d..83197681b661 100644 --- a/gcc/config/rs6000/rs6000.opt +++ b/gcc/config/rs6000/rs6000.opt @@ -479,7 +479,7 @@ Target Undocumented Mask(P8_FUSION_SIGN) Var(rs6000_isa_flags) Allow sign extension in fusion operations. mpower8-vector -Target Mask(P8_VECTOR) Var(rs6000_isa_flags) +Target Undocumented Mask(P8_VECTOR) Var(rs6000_isa_flags) WarnRemoved Use vector and scalar instructions added in ISA 2.07. mpower10-fusion @@ -522,7 +522,7 @@ Target Undocumented Mask(P9_MISC) Var(rs6000_isa_flags) Use certain scalar instructions added in ISA 3.0. mpower9-vector -Target Undocumented Mask(P9_VECTOR) Var(rs6000_isa_flags) +Target Undocumented Mask(P9_VECTOR) Var(rs6000_isa_flags) WarnRemoved Use vector instructions added in ISA 3.0. mpower9-minmax diff --git a/gcc/config/rs6000/rs6000.opt.urls b/gcc/config/rs6000/rs6000.opt.urls index 28bf073c6cfd..c7c1cefe22cd 100644 --- a/gcc/config/rs6000/rs6000.opt.urls +++ b/gcc/config/rs6000/rs6000.opt.urls @@ -162,9 +162,6 @@ UrlSuffix(gcc/RS_002f6000-and-PowerPC-Options.html#index-msave-toc-indirect) mpower8-fusion UrlSuffix(gcc/RS_002f6000-and-PowerPC-Options.html#index-mpower8-fusion) -mpower8-vector -UrlSuffix(gcc/RS_002f6000-and-PowerPC-Options.html#index-mpower8-vector) - mcrypto UrlSuffix(gcc/RS_002f6000-and-PowerPC-Options.html#index-mcrypto) diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md index 6111cc90eb74..f135fa079bd8 100644 --- a/gcc/config/rs6000/vsx.md +++ b/gcc/config/rs6000/vsx.md @@ -4666,8 +4666,8 @@ rtx op1 = operands[1]; if (MEM_P (op1)) operands[1] = rs6000_force_indexed_or_indirect_mem (op1); - else if (!REG_P (op1)) - op1 = force_reg (mode, op1); + else + operands[1] = force_reg (mode, op1); }) (define_insn "vsx_splat__reg" diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc index f182c26e78bc..c857b2028f2e 100644 --- a/gcc/config/s390/s390.cc +++ b/gcc/config/s390/s390.cc @@ -83,6 +83,8 @@ along with GCC; see the file COPYING3. If not see #include "tm-constrs.h" #include "tree-vrp.h" #include "symbol-summary.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "sched-int.h" diff --git a/gcc/config/sh/sh.cc b/gcc/config/sh/sh.cc index 27777c411c3c..ef3c2e6791d7 100644 --- a/gcc/config/sh/sh.cc +++ b/gcc/config/sh/sh.cc @@ -11767,7 +11767,8 @@ sh_insn_operands_modified_between_p (rtx_insn* operands_insn, bool sh_is_nott_insn (const rtx_insn* i) { - return i != NULL && GET_CODE (PATTERN (i)) == SET + return i != NULL_RTX && PATTERN (i) != NULL_RTX + && GET_CODE (PATTERN (i)) == SET && t_reg_operand (XEXP (PATTERN (i), 0), VOIDmode) && negt_reg_operand (XEXP (PATTERN (i), 1), VOIDmode); } diff --git a/gcc/configure b/gcc/configure index 41b978b0380b..266ab8f84b2a 100755 --- a/gcc/configure +++ b/gcc/configure @@ -29834,6 +29834,74 @@ cat >>confdefs.h <<_ACEOF _ACEOF + # Check if gas and gld support "addq %r23,foo@GOTTPOFF(%rip), %r15" + # with R_X86_64_CODE_6_GOTTPOFF relocation. + if echo "$ld_ver" | grep GNU > /dev/null; then + if $gcc_cv_ld -V 2>/dev/null | grep elf_x86_64_sol2 > /dev/null; then + ld_ix86_gld_64_opt="-melf_x86_64_sol2" + else + ld_ix86_gld_64_opt="-melf_x86_64" + fi + fi + # Enforce 64-bit output with gas and gld. + if test x$gas = xyes; then + as_ix86_gas_64_opt="--64" + fi + conftest_s=' + .text + .globl _start + .type _start, @function +_start: + addq %r23,foo@GOTTPOFF(%rip), %r15 + .section .tdata,"awT",@progbits + .type foo, @object +foo: + .quad 0' + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for R_X86_64_CODE_6_GOTTPOFF reloc" >&5 +$as_echo_n "checking assembler for R_X86_64_CODE_6_GOTTPOFF reloc... " >&6; } +if ${gcc_cv_as_x86_64_code_6_gottpoff+:} false; then : + $as_echo_n "(cached) " >&6 +else + gcc_cv_as_x86_64_code_6_gottpoff=no + if test x$gcc_cv_as != x; then + $as_echo "$conftest_s" > conftest.s + if { ac_try='$gcc_cv_as $gcc_cv_as_flags $as_ix86_gas_64_opt -o conftest.o conftest.s >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } + then + if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \ + && test x$gcc_cv_readelf != x \ + && $gcc_cv_readelf --relocs --wide conftest.o 2>&1 \ + | grep R_X86_64_CODE_6_GOTTPOFF > /dev/null 2>&1 \ + && $gcc_cv_ld $ld_ix86_gld_64_opt -o conftest conftest.o > /dev/null 2>&1; then + if $gcc_cv_objdump -dw conftest 2>&1 \ + | grep "add \+\$0xf\+8,%r23,%r15" > /dev/null 2>&1; then + gcc_cv_as_x86_64_code_6_gottpoff=yes + else + gcc_cv_as_x86_64_code_6_gottpoff=no + fi + fi + rm -f conftest + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_x86_64_code_6_gottpoff" >&5 +$as_echo "$gcc_cv_as_x86_64_code_6_gottpoff" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define HAVE_AS_R_X86_64_CODE_6_GOTTPOFF `if test x"$gcc_cv_as_x86_64_code_6_gottpoff" = xyes; then echo 1; else echo 0; fi` +_ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for GOTOFF in data" >&5 $as_echo_n "checking assembler for GOTOFF in data... " >&6; } if ${gcc_cv_as_ix86_gotoff_in_data+:} false; then : @@ -31136,7 +31204,7 @@ else nop .endr beq $a0,$a1,a' > conftest.s - if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' + if { ac_try='$gcc_cv_as $gcc_cv_as_flags --fatal-warnings -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? diff --git a/gcc/configure.ac b/gcc/configure.ac index 72012d61e671..a5aec1bc9672 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -5057,6 +5057,50 @@ _start: [`if test x"$gcc_cv_as_ix86_got32x" = xyes; then echo 1; else echo 0; fi`], [Define 0/1 if your assembler and linker support @GOT.]) + # Check if gas and gld support "addq %r23,foo@GOTTPOFF(%rip), %r15" + # with R_X86_64_CODE_6_GOTTPOFF relocation. + if echo "$ld_ver" | grep GNU > /dev/null; then + if $gcc_cv_ld -V 2>/dev/null | grep elf_x86_64_sol2 > /dev/null; then + ld_ix86_gld_64_opt="-melf_x86_64_sol2" + else + ld_ix86_gld_64_opt="-melf_x86_64" + fi + fi + # Enforce 64-bit output with gas and gld. + if test x$gas = xyes; then + as_ix86_gas_64_opt="--64" + fi + conftest_s=' + .text + .globl _start + .type _start, @function +_start: + addq %r23,foo@GOTTPOFF(%rip), %r15 + .section .tdata,"awT",@progbits + .type foo, @object +foo: + .quad 0' + gcc_GAS_CHECK_FEATURE([R_X86_64_CODE_6_GOTTPOFF reloc], + gcc_cv_as_x86_64_code_6_gottpoff, + [$as_ix86_gas_64_opt], + [$conftest_s], + [if test x$gcc_cv_ld != x && test x$gcc_cv_objdump != x \ + && test x$gcc_cv_readelf != x \ + && $gcc_cv_readelf --relocs --wide conftest.o 2>&1 \ + | grep R_X86_64_CODE_6_GOTTPOFF > /dev/null 2>&1 \ + && $gcc_cv_ld $ld_ix86_gld_64_opt -o conftest conftest.o > /dev/null 2>&1; then + if $gcc_cv_objdump -dw conftest 2>&1 \ + | grep "add \+\$0xf\+8,%r23,%r15" > /dev/null 2>&1; then + gcc_cv_as_x86_64_code_6_gottpoff=yes + else + gcc_cv_as_x86_64_code_6_gottpoff=no + fi + fi + rm -f conftest]) + AC_DEFINE_UNQUOTED(HAVE_AS_R_X86_64_CODE_6_GOTTPOFF, + [`if test x"$gcc_cv_as_x86_64_code_6_gottpoff" = xyes; then echo 1; else echo 0; fi`], + [Define 0/1 if your assembler and linker support R_X86_64_CODE_6_GOTTPOFF.]) + gcc_GAS_CHECK_FEATURE([GOTOFF in data], gcc_cv_as_ix86_gotoff_in_data, [$as_ix86_gas_32_opt], @@ -5486,7 +5530,7 @@ x: [Define if your assembler supports -mrelax option.])]) gcc_GAS_CHECK_FEATURE([conditional branch relaxation support], gcc_cv_as_loongarch_cond_branch_relax, - [], + [--fatal-warnings], [a: .rept 32769 nop diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 387e41e9033c..85751b0e3151 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,225 @@ +2024-03-08 Jakub Jelinek + + * pt.cc (tsubst_expr): Handle MEM_REF. + +2024-03-08 Jakub Jelinek + + PR debug/113918 + * cp-objcp-common.cc (cp_type_dwarf_attribute): Return 1 + for DW_AT_export_symbols on anonymous structs or unions. + +2024-03-08 Jakub Jelinek + + PR c++/113802 + * parser.cc (cp_parser_parameter_declaration): Move the xobj_param_p + pack diagnostics after ellipsis handling and if an error is reported, + pretend this specifier didn't appear. Formatting fix. + +2024-03-07 Nathaniel Shead + + PR c++/114229 + * module.cc (trees_out::core_bools): Redetermine + DECL_INTERFACE_KNOWN on stream-in for vtables and tinfo. + * decl2.cc (import_export_decl): Add fixme for ABI changes with + module vtables and tinfo. + +2024-03-07 Patrick Palka + + PR c++/103994 + * cp-tree.h (add_mergeable_specialization): Remove second + parameter. + * module.cc (depset::disc_bits::DB_ALIAS_TMPL_INST_BIT): Remove. + (depset::disc_bits::DB_ALIAS_SPEC_BIT): Remove. + (depset::is_alias_tmpl_inst): Remove. + (depset::is_alias): Remove. + (merge_kind::MK_tmpl_alias_mask): Remove. + (merge_kind::MK_alias_spec): Remove. + (merge_kind_name): Remove entries for alias specializations. + (trees_out::core_vals) : Adjust after + removing is_alias_tmpl_inst. + (trees_in::decl_value): Adjust add_mergeable_specialization + calls. + (trees_out::get_merge_kind) : + Use MK_decl_spec for alias template specializations. + (trees_out::key_mergeable): Simplify after MK_tmpl_alias_mask + removal. + (depset::hash::make_dependency): Adjust after removing + DB_ALIAS_TMPL_INST_BIT. + (specialization_add): Don't allow alias templates when !decl_p. + (depset::hash::add_specializations): Remove now-dead code + accomodating alias template specializations in the type table. + * pt.cc (lookup_template_class): Dispatch early to + instantiate_alias_template for alias templates. Simplify + accordingly. + (add_mergeable_specialization): Remove alias_p parameter and + simplify accordingly. + +2024-03-07 Patrick Palka + + PR c++/110730 + PR c++/105512 + * module.cc (module_state::write_namespaces): Stream the + abi_tag attribute of an inline namespace. + (module_state::read_namespaces): Likewise. + +2024-03-07 Marek Polacek + + PR c++/110031 + * pt.cc (lookup_and_finish_template_variable): Pass complain to + mark_used. + +2024-03-07 Nathaniel Shead + + PR c++/98356 + * typeck2.cc (cxx_incomplete_type_diagnostic): Don't assume + 'member' will be a FUNCTION_DECL (or something like it). + +2024-03-07 Nathaniel Shead + + PR c++/98881 + * module.cc (trees_out::tpl_parms_fini): Stream out DECL_CONTEXT + for template template parameters. + (trees_in::tpl_parms_fini): Read it. + +2024-03-06 Marek Polacek + + PR c++/114114 + * pt.cc (maybe_instantiate_noexcept): Save/restore + cp_unevaluated_operand, c_inhibit_evaluation_warnings, and + cp_noexcept_operand around the tsubst_expr call. + +2024-03-06 Nathaniel Shead + + PR c++/113629 + * pt.cc (type_unification_real): Only use DEDUCE_CONV for the + return type of a conversion function. + +2024-03-06 Patrick Palka + + * module.cc (trees_out::get_merge_kind) : + Accomodate class-scope DECL_UNINSTANTIATED_TEMPLATE_FRIEND_P + TEMPLATE_DECL. Consolidate IDENTIFIER_ANON_P cases. + +2024-03-05 Patrick Palka + + * parser.cc (cp_parser_translation_unit): Relax GMF contents + error into a pedwarn. + +2024-03-04 Nathaniel Shead + + * name-lookup.cc (walk_module_binding): Remove completed FIXME. + (do_nonmember_using_decl): Mark redeclared entities as exported + when needed. Check for re-exporting internal linkage types. + +2024-03-01 Patrick Palka + + PR c++/104919 + PR c++/106009 + * module.cc (depset::hash::sneakoscope): Remove. + (trees_out::decl_node): Always add a dependency on a local type. + (depset::hash::find_dependencies): Remove sneakoscope stuff. + +2024-03-01 Nathaniel Shead + + PR c++/114170 + * module.cc (has_definition): Fall back to DECL_INITIALIZED_P + when DECL_INITIAL is not set on a template. + (module_state::write_inits): Only increment count when + initializers are actually written. + +2024-03-01 Nathaniel Shead + + PR c++/114005 + * init.cc (create_temporary_var): Use current_scope instead of + current_function_decl. + +2024-03-01 Patrick Palka + + * decl.cc (maybe_register_incomplete_var): Restrict second + branch to static data members from a not-yet-complete class. + +2024-03-01 Marek Polacek + + PR c++/110358 + PR c++/109642 + * call.cc (no_dangling_p): New. + (reference_like_class_p): Use it. + (do_warn_dangling_reference): Use it. Don't warn when the function + or its enclosing class has attribute gnu::no_dangling. + * tree.cc (cxx_gnu_attributes): Add gnu::no_dangling. + (handle_no_dangling_attribute): New. + +2024-03-01 Patrick Palka + + PR c++/110025 + PR c++/114138 + * cp-tree.h (make_cast_auto): Declare. + * parser.cc (cp_parser_functional_cast): If the type is an auto, + replace it with a level-less one via make_cast_auto. + * pt.cc (find_parameter_packs_r): Don't treat level-less auto + as a type parameter pack. + (tsubst) : Generalize CTAD placeholder + auto handling to all level-less autos. + (make_cast_auto): Define. + (do_auto_deduction): Handle replacement of a level-less auto. + +2024-03-01 Jakub Jelinek + + PR c++/92687 + * decl.cc (lookup_decomp_type): Return NULL_TREE if decomp_type_table + doesn't have entry for V. + * semantics.cc (finish_decltype_type): If ptds.saved, assert + DECL_HAS_VALUE_EXPR_P is true and decide on tuple vs. non-tuple based + on if lookup_decomp_type is NULL or not. + +2024-02-29 Marek Polacek + + PR c++/113987 + * call.cc (conv_binds_to_reference_parm_p): New. + * cp-tree.h (conv_binds_to_reference_parm_p): Declare. + * init.cc (find_uninit_fields_r): Call it. + +2024-02-29 Nathaniel Shead + + PR c++/111710 + * cp-tree.h (DECL_MODULE_KEYED_DECLS_P): Remove tree checking. + (struct lang_decl_base): Update comments and fix whitespace. + * module.cc (trees_out::lang_decl_bools): Always write + module_keyed_decls_p flag... + (trees_in::lang_decl_bools): ...and always read it. + (trees_out::decl_value): Handle all kinds of keyed decls. + (trees_in::decl_value): Likewise. + (trees_in::tree_value): Deduplicate LAMBDA_EXPRs. + (maybe_key_decl): Also support lambdas attached to fields, + parameters, and types. Key lambdas attached to fields to their + class. + (trees_out::get_merge_kind): Likewise. + (trees_out::key_mergeable): Likewise. + (trees_in::key_mergeable): Support keyed decls in a TYPE_DECL + container. + * parser.cc (cp_parser_class_head): Start a lambda scope when + parsing base classes. + +2024-02-28 Jakub Jelinek + Patrick Palka + + PR c++/113976 + * decl.cc (grokdeclarator): Don't call cp_apply_type_quals_to_decl + on DECL_TEMPLATE_INSTANTIATED VAR_DECLs. + +2024-02-28 Nathaniel Shead + + PR c++/113970 + PR c++/114013 + * decl.cc (make_rtl_for_nonlocal_decl): Don't defer inline + variables. + +2024-02-23 Jakub Jelinek + + PR c++/113083 + * cp-gimplify.cc (cp_fold): For targetm.cxx.cdtor_returns_this () + wrap r into a COMPOUND_EXPR and return folded CALL_EXPR_ARG (x, 0). + 2024-02-19 Patrick Palka PR c++/113966 diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc index 1dac1470d3be..9e4c80736007 100644 --- a/gcc/cp/call.cc +++ b/gcc/cp/call.cc @@ -14033,11 +14033,7 @@ std_pair_ref_ref_p (tree t) return true; } -/* Return true if a class CTYPE is either std::reference_wrapper or - std::ref_view, or a reference wrapper class. We consider a class - a reference wrapper class if it has a reference member. We no - longer check that it has a constructor taking the same reference type - since that approach still generated too many false positives. */ +/* Return true if a class T has a reference member. */ static bool class_has_reference_member_p (tree t) @@ -14061,12 +14057,41 @@ class_has_reference_member_p_r (tree binfo, void *) ? integer_one_node : NULL_TREE); } + +/* Return true if T (either a class or a function) has been marked as + not-dangling. */ + +static bool +no_dangling_p (tree t) +{ + t = lookup_attribute ("no_dangling", TYPE_ATTRIBUTES (t)); + if (!t) + return false; + + t = TREE_VALUE (t); + if (!t) + return true; + + t = build_converted_constant_bool_expr (TREE_VALUE (t), tf_warning_or_error); + t = cxx_constant_value (t); + return t == boolean_true_node; +} + +/* Return true if a class CTYPE is either std::reference_wrapper or + std::ref_view, or a reference wrapper class. We consider a class + a reference wrapper class if it has a reference member. We no + longer check that it has a constructor taking the same reference type + since that approach still generated too many false positives. */ + static bool reference_like_class_p (tree ctype) { if (!CLASS_TYPE_P (ctype)) return false; + if (no_dangling_p (ctype)) + return true; + /* Also accept a std::pair. */ if (std_pair_ref_ref_p (ctype)) return true; @@ -14173,7 +14198,8 @@ do_warn_dangling_reference (tree expr, bool arg_p) but probably not to one of its arguments. */ || (DECL_OBJECT_MEMBER_FUNCTION_P (fndecl) && DECL_OVERLOADED_OPERATOR_P (fndecl) - && DECL_OVERLOADED_OPERATOR_IS (fndecl, INDIRECT_REF))) + && DECL_OVERLOADED_OPERATOR_IS (fndecl, INDIRECT_REF)) + || no_dangling_p (TREE_TYPE (fndecl))) return NULL_TREE; tree rettype = TREE_TYPE (TREE_TYPE (fndecl)); @@ -14551,4 +14577,28 @@ maybe_show_nonconverting_candidate (tree to, tree from, tree arg, int flags) "function was not considered"); } +/* We're converting EXPR to TYPE. If that conversion involves a conversion + function and we're binding EXPR to a reference parameter of that function, + return true. */ + +bool +conv_binds_to_reference_parm_p (tree type, tree expr) +{ + conversion_obstack_sentinel cos; + conversion *c = implicit_conversion (type, TREE_TYPE (expr), expr, + /*c_cast_p=*/false, LOOKUP_NORMAL, + tf_none); + if (c && !c->bad_p && c->user_conv_p) + for (; c; c = next_conversion (c)) + if (c->kind == ck_user) + for (z_candidate *cand = c->cand; cand; cand = cand->next) + if (cand->viable == 1) + for (size_t i = 0; i < cand->num_convs; ++i) + if (cand->convs[i]->kind == ck_ref_bind + && conv_get_original_expr (cand->convs[i]) == expr) + return true; + + return false; +} + #include "gt-cp-call.h" diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc index 30e94797f9fd..f3baae6ade75 100644 --- a/gcc/cp/cp-gimplify.cc +++ b/gcc/cp/cp-gimplify.cc @@ -3412,9 +3412,15 @@ cp_fold (tree x, fold_flags_t flags) if (DECL_CONSTRUCTOR_P (callee)) { loc = EXPR_LOCATION (x); - tree s = build_fold_indirect_ref_loc (loc, - CALL_EXPR_ARG (x, 0)); + tree a = CALL_EXPR_ARG (x, 0); + bool return_this = targetm.cxx.cdtor_returns_this (); + if (return_this) + a = cp_save_expr (a); + tree s = build_fold_indirect_ref_loc (loc, a); r = cp_build_init_expr (s, r); + if (return_this) + r = build2_loc (loc, COMPOUND_EXPR, TREE_TYPE (x), r, + fold_convert_loc (loc, TREE_TYPE (x), a)); } x = r; break; diff --git a/gcc/cp/cp-objcp-common.cc b/gcc/cp/cp-objcp-common.cc index 85dde0459faa..86e0b49d46b8 100644 --- a/gcc/cp/cp-objcp-common.cc +++ b/gcc/cp/cp-objcp-common.cc @@ -410,6 +410,11 @@ cp_type_dwarf_attribute (const_tree type, int attr) return 1; break; + case DW_AT_export_symbols: + if (ANON_AGGR_TYPE_P (type)) + return 1; + break; + default: break; } diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 334c11396c24..14895bc65850 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -1773,9 +1773,8 @@ check_constraint_info (tree t) (DECL_LANG_SPECIFIC (DECL_MODULE_CHECK (NODE))->u.base.module_entity_p) /* DECL that has attached decls for ODR-relatedness. */ -#define DECL_MODULE_KEYED_DECLS_P(NODE) \ - (DECL_LANG_SPECIFIC (TREE_CHECK2(NODE,FUNCTION_DECL,VAR_DECL))\ - ->u.base.module_keyed_decls_p) +#define DECL_MODULE_KEYED_DECLS_P(NODE) \ + (DECL_LANG_SPECIFIC (DECL_MODULE_CHECK (NODE))->u.base.module_keyed_decls_p) /* Whether this is an exported DECL. Held on any decl that can appear at namespace scope (function, var, type, template, const or @@ -2887,21 +2886,20 @@ struct GTY(()) lang_decl_base { unsigned friend_or_tls : 1; /* var, fn, type or template */ unsigned unknown_bound_p : 1; /* var */ unsigned odr_used : 1; /* var or fn */ - unsigned concept_p : 1; /* applies to vars and functions */ + unsigned concept_p : 1; /* applies to vars and functions */ unsigned var_declared_inline_p : 1; /* var */ unsigned dependent_init_p : 1; /* var */ - /* The following apply to VAR, FUNCTION, TYPE, CONCEPT, & NAMESPACE + /* The following four apply to VAR, FUNCTION, TYPE, CONCEPT, & NAMESPACE decls. */ - unsigned module_purview_p : 1; // in named-module purview - unsigned module_attach_p : 1; // attached to named module - unsigned module_import_p : 1; /* from an import */ - unsigned module_entity_p : 1; /* is in the entitity ary & - hash. */ - /* VAR_DECL or FUNCTION_DECL has keyed decls. */ - unsigned module_keyed_decls_p : 1; - - /* 12 spare bits. */ + unsigned module_purview_p : 1; /* in named-module purview */ + unsigned module_attach_p : 1; /* attached to named module */ + unsigned module_import_p : 1; /* from an import */ + unsigned module_entity_p : 1; /* is in the entitity ary & hash */ + + unsigned module_keyed_decls_p : 1; /* has keys, applies to all decls */ + + /* 11 spare bits. */ }; /* True for DECL codes which have template info and access. */ @@ -6845,6 +6843,7 @@ extern void cp_warn_deprecated_use_scopes (tree); extern tree get_function_version_dispatcher (tree); extern bool any_template_arguments_need_structural_equality_p (tree); extern void maybe_show_nonconverting_candidate (tree, tree, tree, int); +extern bool conv_binds_to_reference_parm_p (tree, tree); /* in class.cc */ extern tree build_vfield_ref (tree, tree); @@ -7478,6 +7477,7 @@ extern tree make_decltype_auto (void); extern tree make_constrained_auto (tree, tree); extern tree make_constrained_decltype_auto (tree, tree); extern tree make_template_placeholder (tree); +extern tree make_cast_auto (void); extern bool template_placeholder_p (tree); extern bool ctad_template_p (tree); extern bool unparenthesized_id_or_class_member_access_p (tree); @@ -7642,8 +7642,7 @@ extern void walk_specializations (bool, void *); extern tree match_mergeable_specialization (bool is_decl, spec_entry *); extern unsigned get_mergeable_specialization_flags (tree tmpl, tree spec); -extern void add_mergeable_specialization (bool is_decl, bool is_alias, - spec_entry *, +extern void add_mergeable_specialization (bool is_decl, spec_entry *, tree outer, unsigned); extern tree add_to_template_args (tree, tree); extern tree add_outermost_template_args (tree, tree); diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index e47f694e4e56..dbc3df24e77f 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -7954,10 +7954,6 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const char* asmspec) && DECL_IMPLICIT_INSTANTIATION (decl)) defer_p = 1; - /* Defer vague-linkage variables. */ - if (DECL_INLINE_VAR_P (decl)) - defer_p = 1; - /* If we're not deferring, go ahead and assemble the variable. */ if (!defer_p) rest_of_decl_compilation (decl, toplev, at_eof); @@ -9266,7 +9262,9 @@ static GTY((cache)) decl_tree_cache_map *decomp_type_table; tree lookup_decomp_type (tree v) { - return *decomp_type_table->get (v); + if (tree *slot = decomp_type_table->get (v)) + return *slot; + return NULL_TREE; } /* Mangle a decomposition declaration if needed. Arguments like @@ -15263,7 +15261,12 @@ grokdeclarator (const cp_declarator *declarator, /* Record constancy and volatility on the DECL itself . There's no need to do this when processing a template; we'll do this for the instantiated declaration based on the type of DECL. */ - if (!processing_template_decl) + if (!processing_template_decl + /* Don't do it for instantiated variable templates either, + cp_apply_type_quals_to_decl should have been called on it + already and might have been overridden in cp_finish_decl + if initializer needs runtime initialization. */ + && (!VAR_P (decl) || !DECL_TEMPLATE_INSTANTIATED (decl))) cp_apply_type_quals_to_decl (type_quals, decl); return decl; @@ -18976,6 +18979,8 @@ maybe_register_incomplete_var (tree var) vec_safe_push (incomplete_vars, iv); } else if (!(DECL_LANG_SPECIFIC (var) && DECL_TEMPLATE_INFO (var)) + && DECL_CLASS_SCOPE_P (var) + && TYPE_BEING_DEFINED (DECL_CONTEXT (var)) && decl_constant_var_p (var) && (TYPE_PTRMEM_P (inner_type) || CLASS_TYPE_P (inner_type))) { diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc index 1dddbaab38b0..6c9fd415d40e 100644 --- a/gcc/cp/decl2.cc +++ b/gcc/cp/decl2.cc @@ -3398,6 +3398,10 @@ import_export_decl (tree decl) unit. */ import_p = false; + /* FIXME: Since https://github.com/itanium-cxx-abi/cxx-abi/pull/171, + the ABI specifies that classes attached to named modules should + have their vtables uniquely emitted in the object for the module + unit in which it is defined. And similarly for RTTI structures. */ if (VAR_P (decl) && DECL_VTABLE_OR_VTT_P (decl)) { class_type = DECL_CONTEXT (decl); diff --git a/gcc/cp/init.cc b/gcc/cp/init.cc index ac37330527e6..d2586fad86b1 100644 --- a/gcc/cp/init.cc +++ b/gcc/cp/init.cc @@ -906,7 +906,8 @@ find_uninit_fields_r (tree *tp, int *walk_subtrees, void *data) warning_at (EXPR_LOCATION (init), OPT_Wuninitialized, "reference %qD is not yet bound to a value when used " "here", field); - else if (!INDIRECT_TYPE_P (type) || is_this_parameter (d->member)) + else if ((!INDIRECT_TYPE_P (type) || is_this_parameter (d->member)) + && !conv_binds_to_reference_parm_p (type, init)) warning_at (EXPR_LOCATION (init), OPT_Wuninitialized, "member %qD is used uninitialized", field); *walk_subtrees = false; @@ -4257,7 +4258,7 @@ create_temporary_var (tree type) TREE_USED (decl) = 1; DECL_ARTIFICIAL (decl) = 1; DECL_IGNORED_P (decl) = 1; - DECL_CONTEXT (decl) = current_function_decl; + DECL_CONTEXT (decl) = current_scope (); return decl; } diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 106af7bdb3e9..99055523d915 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -2305,11 +2305,7 @@ class depset { DB_HIDDEN_BIT, /* A hidden binding. */ /* The following bits are not independent, but enumerating them is awkward. */ - DB_ALIAS_TMPL_INST_BIT, /* An alias template instantiation. */ - DB_ALIAS_SPEC_BIT, /* Specialization of an alias template - (in both spec tables). */ - DB_TYPE_SPEC_BIT, /* Specialization in the type table. - */ + DB_TYPE_SPEC_BIT, /* Specialization in the type table. */ DB_FRIEND_SPEC_BIT, /* An instantiated template friend. */ }; @@ -2400,14 +2396,6 @@ class depset { { return get_flag_bit (); } - bool is_alias_tmpl_inst () const - { - return get_flag_bit (); - } - bool is_alias () const - { - return get_flag_bit (); - } bool is_hidden () const { return get_flag_bit (); @@ -2522,13 +2510,12 @@ class depset { hash *chain; /* Original table. */ depset *current; /* Current depset being depended. */ unsigned section; /* When writing out, the section. */ - bool sneakoscope; /* Detecting dark magic (of a voldemort). */ bool reached_unreached; /* We reached an unreached entity. */ public: hash (size_t size, hash *c = NULL) : parent (size), chain (c), current (NULL), section (0), - sneakoscope (false), reached_unreached (false) + reached_unreached (false) { worklist.create (size); } @@ -2782,13 +2769,11 @@ enum merge_kind MK_template_mask = 0x10, /* A template specialization. */ MK_tmpl_decl_mask = 0x4, /* In decl table. */ - MK_tmpl_alias_mask = 0x2, /* Also in type table */ MK_tmpl_tmpl_mask = 0x1, /* We want TEMPLATE_DECL. */ MK_type_spec = MK_template_mask, MK_decl_spec = MK_template_mask | MK_tmpl_decl_mask, - MK_alias_spec = MK_decl_spec | MK_tmpl_alias_mask, MK_hwm = 0x20 }; @@ -2806,7 +2791,7 @@ static char const *const merge_kind_name[MK_hwm] = NULL, NULL, "decl spec", "decl tmpl spec", /* 20,21 decl (template). */ - "alias spec", "alias tmpl spec", /* 22,23 alias (template). */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, }; @@ -5391,7 +5376,17 @@ trees_out::core_bools (tree t) WB (t->decl_common.lang_flag_2); WB (t->decl_common.lang_flag_3); WB (t->decl_common.lang_flag_4); - WB (t->decl_common.lang_flag_5); + + { + /* This is DECL_INTERFACE_KNOWN: We should redetermine whether + we need to import or export any vtables or typeinfo objects + on stream-in. */ + bool interface_known = t->decl_common.lang_flag_5; + if (VAR_P (t) && (DECL_VTABLE_OR_VTT_P (t) || DECL_TINFO_P (t))) + interface_known = false; + WB (interface_known); + } + WB (t->decl_common.lang_flag_6); WB (t->decl_common.lang_flag_7); WB (t->decl_common.lang_flag_8); @@ -5664,8 +5659,7 @@ trees_out::lang_decl_bools (tree t) want to mark them as in module purview. */ WB (lang->u.base.module_purview_p && !header_module_p ()); WB (lang->u.base.module_attach_p); - if (VAR_OR_FUNCTION_DECL_P (t)) - WB (lang->u.base.module_keyed_decls_p); + WB (lang->u.base.module_keyed_decls_p); switch (lang->u.base.selector) { default: @@ -5738,8 +5732,7 @@ trees_in::lang_decl_bools (tree t) RB (lang->u.base.dependent_init_p); RB (lang->u.base.module_purview_p); RB (lang->u.base.module_attach_p); - if (VAR_OR_FUNCTION_DECL_P (t)) - RB (lang->u.base.module_keyed_decls_p); + RB (lang->u.base.module_keyed_decls_p); switch (lang->u.base.selector) { default: @@ -6353,8 +6346,7 @@ trees_out::core_vals (tree t) gcc_checking_assert (TREE_VISITED (((lang_tree_node *)t)->template_decl.arguments)); gcc_checking_assert - (TREE_VISITED (((lang_tree_node *)t)->template_decl.result) - || dep_hash->find_dependency (t)->is_alias_tmpl_inst ()); + (TREE_VISITED (((lang_tree_node *)t)->template_decl.result)); if (DECL_UNINSTANTIATED_TEMPLATE_FRIEND_P (t)) WT (DECL_CHAIN (t)); break; @@ -7871,8 +7863,7 @@ trees_out::decl_value (tree decl, depset *dep) install_entity (decl, dep); } - if (VAR_OR_FUNCTION_DECL_P (inner) - && DECL_LANG_SPECIFIC (inner) + if (DECL_LANG_SPECIFIC (inner) && DECL_MODULE_KEYED_DECLS_P (inner) && !is_key_order ()) { @@ -8172,8 +8163,7 @@ trees_in::decl_value () bool installed = install_entity (existing); bool is_new = existing == decl; - if (VAR_OR_FUNCTION_DECL_P (inner) - && DECL_LANG_SPECIFIC (inner) + if (DECL_LANG_SPECIFIC (inner) && DECL_MODULE_KEYED_DECLS_P (inner)) { /* Read and maybe install the attached entities. */ @@ -8275,16 +8265,13 @@ trees_in::decl_value () { bool is_type = TREE_CODE (inner) == TYPE_DECL; spec.spec = is_type ? type : inner; - add_mergeable_specialization (!is_type, false, - &spec, decl, spec_flags); + add_mergeable_specialization (!is_type, &spec, decl, spec_flags); } else if (mk & MK_template_mask) { bool is_type = !(mk & MK_tmpl_decl_mask); spec.spec = is_type ? type : mk & MK_tmpl_tmpl_mask ? inner : decl; - add_mergeable_specialization (!is_type, - !is_type && mk & MK_tmpl_alias_mask, - &spec, decl, spec_flags); + add_mergeable_specialization (!is_type, &spec, decl, spec_flags); } if (NAMESPACE_SCOPE_P (decl) @@ -8361,7 +8348,7 @@ trees_in::decl_value () if (!e) { spec.spec = inner; - add_mergeable_specialization (true, false, &spec, decl, spec_flags); + add_mergeable_specialization (true, &spec, decl, spec_flags); } else if (e != existing) set_overrun (); @@ -8757,7 +8744,7 @@ trees_out::decl_node (tree decl, walk_kind ref) dep = dep_hash->find_dependency (decl); else if (TREE_CODE (ctx) != FUNCTION_DECL || TREE_CODE (decl) == TEMPLATE_DECL - || (dep_hash->sneakoscope && DECL_IMPLICIT_TYPEDEF_P (decl)) + || DECL_IMPLICIT_TYPEDEF_P (decl) || (DECL_LANG_SPECIFIC (decl) && DECL_MODULE_IMPORT_P (decl))) { @@ -9187,6 +9174,13 @@ trees_in::tree_value () return NULL_TREE; } + if (TREE_CODE (t) == LAMBDA_EXPR + && CLASSTYPE_LAMBDA_EXPR (TREE_TYPE (t))) + { + existing = CLASSTYPE_LAMBDA_EXPR (TREE_TYPE (t)); + back_refs[~tag] = existing; + } + dump (dumper::TREE) && dump ("Read tree:%d %C:%N", tag, TREE_CODE (t), t); if (TREE_CODE (existing) == INTEGER_CST && !TREE_OVERFLOW (existing)) @@ -10124,23 +10118,12 @@ trees_out::tpl_parms_fini (tree tmpl, unsigned tpl_levels) tree dflt = TREE_PURPOSE (parm); tree_node (dflt); - if (streaming_p ()) - { - tree decl = TREE_VALUE (parm); - if (TREE_CODE (decl) == TEMPLATE_DECL) - { - tree ctx = DECL_CONTEXT (decl); - tree inner = DECL_TEMPLATE_RESULT (decl); - tree tpi = (TREE_CODE (inner) == TYPE_DECL - ? TEMPLATE_TYPE_PARM_INDEX (TREE_TYPE (decl)) - : DECL_INITIAL (inner)); - bool original = (TEMPLATE_PARM_LEVEL (tpi) - == TEMPLATE_PARM_ORIG_LEVEL (tpi)); - /* Original template template parms have a context - of their owning template. Reduced ones do not. */ - gcc_checking_assert (original ? ctx == tmpl : !ctx); - } - } + /* Template template parameters need a context of their owning + template. This is quite tricky to infer correctly on stream-in + (see PR c++/98881) so we'll just provide it directly. */ + tree decl = TREE_VALUE (parm); + if (TREE_CODE (decl) == TEMPLATE_DECL) + tree_node (DECL_CONTEXT (decl)); } } } @@ -10158,24 +10141,14 @@ trees_in::tpl_parms_fini (tree tmpl, unsigned tpl_levels) { tree parm = TREE_VEC_ELT (vec, ix); tree dflt = tree_node (); - if (get_overrun ()) - return false; TREE_PURPOSE (parm) = dflt; tree decl = TREE_VALUE (parm); if (TREE_CODE (decl) == TEMPLATE_DECL) - { - tree inner = DECL_TEMPLATE_RESULT (decl); - tree tpi = (TREE_CODE (inner) == TYPE_DECL - ? TEMPLATE_TYPE_PARM_INDEX (TREE_TYPE (decl)) - : DECL_INITIAL (inner)); - bool original = (TEMPLATE_PARM_LEVEL (tpi) - == TEMPLATE_PARM_ORIG_LEVEL (tpi)); - /* Original template template parms have a context - of their owning template. Reduced ones do not. */ - if (original) - DECL_CONTEXT (decl) = tmpl; - } + DECL_CONTEXT (decl) = tree_node (); + + if (get_overrun ()) + return false; } } return true; @@ -10484,28 +10457,32 @@ trees_out::get_merge_kind (tree decl, depset *dep) if (tree scope = LAMBDA_EXPR_EXTRA_SCOPE (CLASSTYPE_LAMBDA_EXPR (TREE_TYPE (decl)))) - if (TREE_CODE (scope) == VAR_DECL - && DECL_MODULE_KEYED_DECLS_P (scope)) - { - mk = MK_keyed; - break; - } + { + /* Lambdas attached to fields are keyed to its class. */ + if (TREE_CODE (scope) == FIELD_DECL) + scope = TYPE_NAME (DECL_CONTEXT (scope)); + if (DECL_LANG_SPECIFIC (scope) + && DECL_MODULE_KEYED_DECLS_P (scope)) + { + mk = MK_keyed; + break; + } + } - if (RECORD_OR_UNION_TYPE_P (ctx)) + if (TREE_CODE (decl) == TEMPLATE_DECL + && DECL_UNINSTANTIATED_TEMPLATE_FRIEND_P (decl)) { - if (IDENTIFIER_ANON_P (DECL_NAME (decl))) - mk = MK_field; + mk = MK_local_friend; break; } - if (TREE_CODE (decl) == TEMPLATE_DECL - && DECL_UNINSTANTIATED_TEMPLATE_FRIEND_P (decl)) - mk = MK_local_friend; - else if (IDENTIFIER_ANON_P (DECL_NAME (decl))) + if (IDENTIFIER_ANON_P (DECL_NAME (decl))) { - if (DECL_IMPLICIT_TYPEDEF_P (decl) - && UNSCOPED_ENUM_P (TREE_TYPE (decl)) - && TYPE_VALUES (TREE_TYPE (decl))) + if (RECORD_OR_UNION_TYPE_P (ctx)) + mk = MK_field; + else if (DECL_IMPLICIT_TYPEDEF_P (decl) + && UNSCOPED_ENUM_P (TREE_TYPE (decl)) + && TYPE_VALUES (TREE_TYPE (decl))) /* Keyed by first enum value, and underlying type. */ mk = MK_enum; else @@ -10529,8 +10506,6 @@ trees_out::get_merge_kind (tree decl, depset *dep) mk = MK_friend_spec; else if (dep->is_type_spec ()) mk = MK_type_spec; - else if (dep->is_alias ()) - mk = MK_alias_spec; else mk = MK_decl_spec; @@ -10641,11 +10616,6 @@ trees_out::key_mergeable (int tag, merge_kind mk, tree decl, tree inner, gcc_assert (existing); if (mk & MK_tmpl_decl_mask) { - if (mk & MK_tmpl_alias_mask) - /* It should be in both tables. */ - gcc_checking_assert - (same_type_p (match_mergeable_specialization (false, entry), - TREE_TYPE (existing))); if (mk & MK_tmpl_tmpl_mask) existing = DECL_TI_TEMPLATE (existing); } @@ -10789,7 +10759,13 @@ trees_out::key_mergeable (int tag, merge_kind mk, tree decl, tree inner, gcc_checking_assert (LAMBDA_TYPE_P (TREE_TYPE (inner))); tree scope = LAMBDA_EXPR_EXTRA_SCOPE (CLASSTYPE_LAMBDA_EXPR (TREE_TYPE (inner))); - gcc_checking_assert (TREE_CODE (scope) == VAR_DECL); + gcc_checking_assert (TREE_CODE (scope) == VAR_DECL + || TREE_CODE (scope) == FIELD_DECL + || TREE_CODE (scope) == PARM_DECL + || TREE_CODE (scope) == TYPE_DECL); + /* Lambdas attached to fields are keyed to the class. */ + if (TREE_CODE (scope) == FIELD_DECL) + scope = TYPE_NAME (DECL_CONTEXT (scope)); auto *root = keyed_table->get (scope); unsigned ix = root->length (); /* If we don't find it, we'll write a really big number @@ -11067,6 +11043,26 @@ trees_in::key_mergeable (int tag, merge_kind mk, tree decl, tree inner, } } } + else if (mk == MK_keyed + && DECL_LANG_SPECIFIC (name) + && DECL_MODULE_KEYED_DECLS_P (name)) + { + gcc_checking_assert (TREE_CODE (container) == NAMESPACE_DECL + || TREE_CODE (container) == TYPE_DECL); + if (auto *set = keyed_table->get (name)) + if (key.index < set->length ()) + { + existing = (*set)[key.index]; + if (existing) + { + gcc_checking_assert + (DECL_IMPLICIT_TYPEDEF_P (existing)); + if (inner != decl) + existing + = CLASSTYPE_TI_TEMPLATE (TREE_TYPE (existing)); + } + } + } else switch (TREE_CODE (container)) { @@ -11074,27 +11070,8 @@ trees_in::key_mergeable (int tag, merge_kind mk, tree decl, tree inner, gcc_unreachable (); case NAMESPACE_DECL: - if (mk == MK_keyed) - { - if (DECL_LANG_SPECIFIC (name) - && VAR_OR_FUNCTION_DECL_P (name) - && DECL_MODULE_KEYED_DECLS_P (name)) - if (auto *set = keyed_table->get (name)) - if (key.index < set->length ()) - { - existing = (*set)[key.index]; - if (existing) - { - gcc_checking_assert - (DECL_IMPLICIT_TYPEDEF_P (existing)); - if (inner != decl) - existing - = CLASSTYPE_TI_TEMPLATE (TREE_TYPE (existing)); - } - } - } - else if (is_attached - && !(state->is_module () || state->is_partition ())) + if (is_attached + && !(state->is_module () || state->is_partition ())) kind = "unique"; else { @@ -11570,9 +11547,11 @@ has_definition (tree decl) break; case VAR_DECL: + /* DECL_INITIALIZED_P might not be set on a dependent VAR_DECL. */ if (DECL_LANG_SPECIFIC (decl) - && DECL_TEMPLATE_INFO (decl)) - return DECL_INITIAL (decl); + && DECL_TEMPLATE_INFO (decl) + && DECL_INITIAL (decl)) + return true; else { if (!DECL_INITIALIZED_P (decl)) @@ -12722,17 +12701,12 @@ depset::hash::make_dependency (tree decl, entity_kind ek) bindings. */ *slot = dep = make_entity (decl, ek, has_def); - if (TREE_CODE (decl) == TEMPLATE_DECL) - { - if (DECL_ALIAS_TEMPLATE_P (decl) && DECL_TEMPLATE_INFO (decl)) - dep->set_flag_bit (); - else if (CHECKING_P) - /* The template_result should otherwise not be in the - table, or be an empty redirect (created above). */ - if (auto *eslot = entity_slot (DECL_TEMPLATE_RESULT (decl), false)) - gcc_checking_assert ((*eslot)->get_entity_kind () == EK_REDIRECT - && !(*eslot)->deps.length ()); - } + if (CHECKING_P && TREE_CODE (decl) == TEMPLATE_DECL) + /* The template_result should otherwise not be in the + table, or be an empty redirect (created above). */ + if (auto *eslot = entity_slot (DECL_TEMPLATE_RESULT (decl), false)) + gcc_checking_assert ((*eslot)->get_entity_kind () == EK_REDIRECT + && !(*eslot)->deps.length ()); if (ek != EK_USING) { @@ -13120,16 +13094,10 @@ specialization_add (bool decl_p, spec_entry *entry, void *data_) heuristic. We don't attempt to replicate that algorithm, but observe its behaviour and reproduce it upon read back. */ - gcc_checking_assert (DECL_ALIAS_TEMPLATE_P (entry->tmpl) - || TREE_CODE (entry->spec) == ENUMERAL_TYPE + gcc_checking_assert (TREE_CODE (entry->spec) == ENUMERAL_TYPE || DECL_CLASS_TEMPLATE_P (entry->tmpl)); - /* Only alias templates can appear in both tables (and - if they're in the type table they must also be in the decl - table). */ - gcc_checking_assert - (!match_mergeable_specialization (true, entry) - == !DECL_ALIAS_TEMPLATE_P (entry->tmpl)); + gcc_checking_assert (!match_mergeable_specialization (true, entry)); } else if (VAR_OR_FUNCTION_DECL_P (entry->spec)) gcc_checking_assert (!DECL_LOCAL_DECL_P (entry->spec)); @@ -13185,7 +13153,6 @@ depset::hash::add_specializations (bool decl_p) spec_entry *entry = data.pop (); tree spec = entry->spec; int use_tpl = 0; - bool is_alias = false; bool is_friend = false; if (decl_p && DECL_UNINSTANTIATED_TEMPLATE_FRIEND_P (entry->tmpl)) @@ -13193,13 +13160,7 @@ depset::hash::add_specializations (bool decl_p) instantiation. */ is_friend = true; - if (!decl_p && DECL_ALIAS_TEMPLATE_P (entry->tmpl)) - { - spec = TYPE_NAME (spec); - is_alias = true; - } - - if (decl_p || is_alias) + if (decl_p) { if (tree ti = DECL_TEMPLATE_INFO (spec)) { @@ -13284,20 +13245,9 @@ depset::hash::add_specializations (bool decl_p) gcc_checking_assert (!TREE_VISITED (spec)); depset *dep = make_dependency (spec, depset::EK_SPECIALIZATION); if (dep->is_special ()) - { - /* An already located specialization, this must be the TYPE - corresponding to an alias_decl we found in the decl - table. */ - spec_entry *other = reinterpret_cast (dep->deps[0]); - gcc_checking_assert (!decl_p && is_alias && !dep->is_type_spec ()); - gcc_checking_assert (other->tmpl == entry->tmpl - && template_args_equal (other->args, entry->args) - && TREE_TYPE (other->spec) == entry->spec); - dep->set_flag_bit (); - } + gcc_unreachable (); else { - gcc_checking_assert (decl_p || !is_alias); if (dep->get_entity_kind () == depset::EK_REDIRECT) dep = dep->deps[0]; else if (dep->get_entity_kind () == depset::EK_SPECIALIZATION) @@ -13415,14 +13365,7 @@ depset::hash::find_dependencies (module_state *module) add_namespace_context (item, ns); } - // FIXME: Perhaps p1815 makes this redundant? Or at - // least simplifies it. Voldemort types are only - // ever emissable when containing (inline) function - // definition is emitted? - /* Turn the Sneakoscope on when depending the decl. */ - sneakoscope = true; walker.decl_value (decl, current); - sneakoscope = false; if (current->has_defn ()) walker.write_definition (decl); } @@ -15289,6 +15232,19 @@ module_state::write_namespaces (elf_out *to, vec spaces, sec.u (flags); write_location (sec, DECL_SOURCE_LOCATION (ns)); + + if (DECL_NAMESPACE_INLINE_P (ns)) + { + if (tree attr = lookup_attribute ("abi_tag", DECL_ATTRIBUTES (ns))) + { + tree tags = TREE_VALUE (attr); + sec.u (list_length (tags)); + for (tree tag = tags; tag; tag = TREE_CHAIN (tag)) + sec.str (TREE_STRING_POINTER (TREE_VALUE (tag))); + } + else + sec.u (0); + } } sec.end (to, to->name (MOD_SNAME_PFX ".nms"), crc_p); @@ -15319,11 +15275,22 @@ module_state::read_namespaces (unsigned num) /* See comment in write_namespace about why not bits. */ unsigned flags = sec.u (); location_t src_loc = read_location (sec); + unsigned tags_count = (flags & 2) ? sec.u () : 0; if (entity_index >= entity_num || !parent || (flags & 0xc) == 0x8) sec.set_overrun (); + + tree tags = NULL_TREE; + while (tags_count--) + { + size_t len; + const char *str = sec.str (&len); + tags = tree_cons (NULL_TREE, build_string (len + 1, str), tags); + tags = nreverse (tags); + } + if (sec.get_overrun ()) break; @@ -15355,6 +15322,10 @@ module_state::read_namespaces (unsigned num) DECL_MODULE_EXPORT_P (inner) = true; } + if (tags) + DECL_ATTRIBUTES (inner) + = tree_cons (get_identifier ("abi_tag"), tags, DECL_ATTRIBUTES (inner)); + /* Install the namespace. */ (*entity_ary)[entity_lwm + entity_index] = inner; if (DECL_MODULE_IMPORT_P (inner)) @@ -17513,13 +17484,14 @@ module_state::write_inits (elf_out *to, depset::hash &table, unsigned *crc_ptr) tree list = static_aggregates; for (int passes = 0; passes != 2; passes++) { - for (tree init = list; init; init = TREE_CHAIN (init), count++) + for (tree init = list; init; init = TREE_CHAIN (init)) if (TREE_LANG_FLAG_0 (init)) { tree decl = TREE_VALUE (init); dump ("Initializer:%u for %N", count, decl); sec.tree_node (decl); + ++count; } list = tls_aggregates; @@ -18984,11 +18956,19 @@ maybe_key_decl (tree ctx, tree decl) if (!modules_p ()) return; - // FIXME: For now just deal with lambdas attached to var decls. - // This might be sufficient? - if (TREE_CODE (ctx) != VAR_DECL) + /* We only need to deal with lambdas attached to var, field, + parm, or type decls. */ + if (TREE_CODE (ctx) != VAR_DECL + && TREE_CODE (ctx) != FIELD_DECL + && TREE_CODE (ctx) != PARM_DECL + && TREE_CODE (ctx) != TYPE_DECL) return; + /* For fields, key it to the containing type to handle deduplication + correctly. */ + if (TREE_CODE (ctx) == FIELD_DECL) + ctx = TYPE_NAME (DECL_CONTEXT (ctx)); + if (!keyed_table) keyed_table = new keyed_map_t (EXPERIMENT (1, 400)); diff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc index 6444db3f0ebf..dce4caf89819 100644 --- a/gcc/cp/name-lookup.cc +++ b/gcc/cp/name-lookup.cc @@ -4189,7 +4189,7 @@ walk_module_binding (tree binding, bitmap partitions, void *data) { // FIXME: We don't quite deal with using decls naming stat hack - // type. Also using decls exporting something from the same scope. + // type. tree current = binding; unsigned count = 0; @@ -5238,13 +5238,36 @@ do_nonmember_using_decl (name_lookup &lookup, bool fn_scope_p, } else if (insert_p) { - value = lookup.value; - if (revealing_p && module_exporting_p ()) - check_can_export_using_decl (value); + if (revealing_p + && module_exporting_p () + && check_can_export_using_decl (lookup.value) + && lookup.value == value + && !DECL_MODULE_EXPORT_P (value)) + { + /* We're redeclaring the same value, but this time as + newly exported: make sure to mark it as such. */ + if (TREE_CODE (value) == TEMPLATE_DECL) + { + DECL_MODULE_EXPORT_P (value) = true; + + tree result = DECL_TEMPLATE_RESULT (value); + retrofit_lang_decl (result); + DECL_MODULE_PURVIEW_P (result) = true; + DECL_MODULE_EXPORT_P (result) = true; + } + else + { + retrofit_lang_decl (value); + DECL_MODULE_PURVIEW_P (value) = true; + DECL_MODULE_EXPORT_P (value) = true; + } + } + else + value = lookup.value; } /* Now the type binding. */ - if (lookup.type && lookup.type != type) + if (lookup.type) { if (type && !decls_match (lookup.type, type)) { @@ -5253,9 +5276,20 @@ do_nonmember_using_decl (name_lookup &lookup, bool fn_scope_p, } else if (insert_p) { - type = lookup.type; - if (revealing_p && module_exporting_p ()) - check_can_export_using_decl (type); + if (revealing_p + && module_exporting_p () + && check_can_export_using_decl (lookup.type) + && lookup.type == type + && !DECL_MODULE_EXPORT_P (type)) + { + /* We're redeclaring the same type, but this time as + newly exported: make sure to mark it as such. */ + retrofit_lang_decl (type); + DECL_MODULE_PURVIEW_P (type) = true; + DECL_MODULE_EXPORT_P (type) = true; + } + else + type = lookup.type; } } diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index b2ed2baa3a57..bc3aa9dd6adb 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -5253,9 +5253,9 @@ cp_parser_translation_unit (cp_parser* parser) if (!warned) { warned = true; - error_at (token->location, - "global module fragment contents must be" - " from preprocessor inclusion"); + pedwarn (token->location, OPT_Wglobal_module, + "global module fragment contents must be" + " from preprocessor inclusion"); } } } @@ -25734,22 +25734,6 @@ cp_parser_parameter_declaration (cp_parser *parser, decl_specifiers.locations[ds_this] = 0; } - if (xobj_param_p - && ((declarator && declarator->parameter_pack_p) - || cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS))) - { - location_t xobj_param - = make_location (decl_specifiers.locations[ds_this], - decl_spec_token_start->location, - input_location); - error_at (xobj_param, - "an explicit object parameter cannot " - "be a function parameter pack"); - /* Suppress errors that occur down the line. */ - if (declarator) - declarator->parameter_pack_p = false; - } - /* If a function parameter pack was specified and an implicit template parameter was introduced during cp_parser_parameter_declaration, change any implicit parameters introduced into packs. */ @@ -25762,9 +25746,10 @@ cp_parser_parameter_declaration (cp_parser *parser, (INNERMOST_TEMPLATE_PARMS (current_template_parms)); if (latest_template_parm_idx != template_parm_idx) - decl_specifiers.type = convert_generic_types_to_packs - (decl_specifiers.type, - template_parm_idx, latest_template_parm_idx); + decl_specifiers.type + = convert_generic_types_to_packs (decl_specifiers.type, + template_parm_idx, + latest_template_parm_idx); } if (cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS)) @@ -25794,6 +25779,21 @@ cp_parser_parameter_declaration (cp_parser *parser, } } + if (xobj_param_p + && (declarator ? declarator->parameter_pack_p + : PACK_EXPANSION_P (decl_specifiers.type))) + { + location_t xobj_param + = make_location (decl_specifiers.locations[ds_this], + decl_spec_token_start->location, + input_location); + error_at (xobj_param, + "an explicit object parameter cannot " + "be a function parameter pack"); + xobj_param_p = false; + decl_specifiers.locations[ds_this] = 0; + } + /* The restriction on defining new types applies only to the type of the parameter, not to the default argument. */ parser->type_definition_forbidden_message = saved_message; @@ -27678,10 +27678,16 @@ cp_parser_class_head (cp_parser* parser, if (cp_lexer_next_token_is (parser->lexer, CPP_COLON)) { if (type) - pushclass (type); + { + pushclass (type); + start_lambda_scope (TYPE_NAME (type)); + } bases = cp_parser_base_clause (parser); if (type) - popclass (); + { + finish_lambda_scope (); + popclass (); + } } else bases = NULL_TREE; @@ -33308,6 +33314,17 @@ cp_parser_functional_cast (cp_parser* parser, tree type) if (!type) type = error_mark_node; + if (TREE_CODE (type) == TYPE_DECL + && is_auto (TREE_TYPE (type))) + type = TREE_TYPE (type); + + if (is_auto (type) + && !AUTO_IS_DECLTYPE (type) + && !PLACEHOLDER_TYPE_CONSTRAINTS (type) + && !CLASS_PLACEHOLDER_TEMPLATE (type)) + /* auto(x) and auto{x} need to use a level-less auto. */ + type = make_cast_auto (); + if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE)) { cp_lexer_set_source_position (parser->lexer); diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 2803824d11e1..8cf0d5b7a8d8 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -3921,7 +3921,8 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data) parameter pack (14.6.3), or the type-specifier-seq of a type-id that is a pack expansion, the invented template parameter is a template parameter pack. */ - if (ppd->type_pack_expansion_p && is_auto (t)) + if (ppd->type_pack_expansion_p && is_auto (t) + && TEMPLATE_TYPE_LEVEL (t) != 0) TEMPLATE_TYPE_PARAMETER_PACK (t) = true; if (TEMPLATE_TYPE_PARAMETER_PACK (t)) parameter_pack_p = true; @@ -10054,6 +10055,32 @@ lookup_template_class (tree d1, tree arglist, tree in_decl, tree context, /* Now we should have enough arguments. */ gcc_assert (parm_depth == arg_depth); + if (DECL_ALIAS_TEMPLATE_P (gen_tmpl)) + { + /* The user referred to a specialization of an alias + template represented by GEN_TMPL. + + [temp.alias]/2 says: + + When a template-id refers to the specialization of an + alias template, it is equivalent to the associated + type obtained by substitution of its + template-arguments for the template-parameters in the + type-id of the alias template. */ + + t = instantiate_alias_template (gen_tmpl, arglist, complain); + /* Note that the call above (by indirectly calling + register_specialization in tsubst_decl) registers the + TYPE_DECL representing the specialization of the alias + template. So next time someone substitutes ARGLIST for + the template parms into the alias template (GEN_TMPL), + she'll get that TYPE_DECL back. */ + + if (t == error_mark_node) + return error_mark_node; + return TREE_TYPE (t); + } + /* From here on, we're only interested in the most general template. */ @@ -10119,7 +10146,6 @@ lookup_template_class (tree d1, tree arglist, tree in_decl, tree context, lookup. This prevents redundant checks on previously instantiated specializations. */ if (flag_concepts - && !DECL_ALIAS_TEMPLATE_P (gen_tmpl) && !constraints_satisfied_p (gen_tmpl, arglist)) { if (complain & tf_error) @@ -10188,31 +10214,7 @@ lookup_template_class (tree d1, tree arglist, tree in_decl, tree context, context = global_namespace; /* Create the type. */ - if (DECL_ALIAS_TEMPLATE_P (gen_tmpl)) - { - /* The user referred to a specialization of an alias - template represented by GEN_TMPL. - - [temp.alias]/2 says: - - When a template-id refers to the specialization of an - alias template, it is equivalent to the associated - type obtained by substitution of its - template-arguments for the template-parameters in the - type-id of the alias template. */ - - t = tsubst (TREE_TYPE (gen_tmpl), arglist, complain, in_decl); - /* Note that the call above (by indirectly calling - register_specialization in tsubst_decl) registers the - TYPE_DECL representing the specialization of the alias - template. So next time someone substitutes ARGLIST for - the template parms into the alias template (GEN_TMPL), - she'll get that TYPE_DECL back. */ - - if (t == error_mark_node) - return t; - } - else if (TREE_CODE (template_type) == ENUMERAL_TYPE) + if (TREE_CODE (template_type) == ENUMERAL_TYPE) { if (!is_dependent_type) { @@ -10300,8 +10302,7 @@ lookup_template_class (tree d1, tree arglist, tree in_decl, tree context, } } - if (OVERLOAD_TYPE_P (t) - && !DECL_ALIAS_TEMPLATE_P (gen_tmpl)) + if (OVERLOAD_TYPE_P (t)) { static const char *tags[] = {"abi_tag", "may_alias"}; @@ -10368,7 +10369,7 @@ lookup_template_class (tree d1, tree arglist, tree in_decl, tree context, { TREE_VEC_LENGTH (arglist)--; ++processing_template_decl; - tree tinfo = TYPE_TEMPLATE_INFO_MAYBE_ALIAS (TREE_TYPE (gen_tmpl)); + tree tinfo = TYPE_TEMPLATE_INFO (TREE_TYPE (gen_tmpl)); tree partial_inst_args = tsubst (INNERMOST_TEMPLATE_ARGS (TI_ARGS (tinfo)), arglist, complain, NULL_TREE); @@ -10406,17 +10407,9 @@ lookup_template_class (tree d1, tree arglist, tree in_decl, tree context, TEMPLATE_PARM_LEVEL. */ found = tsubst (gen_tmpl, arglist, tf_none, NULL_TREE); TREE_VEC_LENGTH (arglist)++; - /* FOUND is either a proper class type, or an alias - template specialization. In the later case, it's a - TYPE_DECL, resulting from the substituting of arguments - for parameters in the TYPE_DECL of the alias template - done earlier. So be careful while getting the template - of FOUND. */ found = (TREE_CODE (found) == TEMPLATE_DECL ? found - : (TREE_CODE (found) == TYPE_DECL - ? DECL_TI_TEMPLATE (found) - : CLASSTYPE_TI_TEMPLATE (found))); + : CLASSTYPE_TI_TEMPLATE (found)); if (DECL_CLASS_TEMPLATE_P (found) && CLASSTYPE_TEMPLATE_SPECIALIZATION (TREE_TYPE (found))) @@ -10446,8 +10439,7 @@ lookup_template_class (tree d1, tree arglist, tree in_decl, tree context, DECL_TEMPLATE_INSTANTIATIONS (found)); if (TREE_CODE (template_type) == ENUMERAL_TYPE - && !uses_template_parms (current_nonlambda_scope ()) - && !DECL_ALIAS_TEMPLATE_P (gen_tmpl)) + && !uses_template_parms (current_nonlambda_scope ())) /* Now that the type has been registered on the instantiations list, we set up the enumerators. Because the enumeration constants may involve the enumeration type itself, we make @@ -10532,7 +10524,7 @@ lookup_and_finish_template_variable (tree templ, tree targs, if (var == error_mark_node) return error_mark_node; var = finish_template_variable (var, complain); - mark_used (var); + mark_used (var, complain); return var; } @@ -16297,9 +16289,19 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) } case TEMPLATE_TYPE_PARM: - if (template_placeholder_p (t)) + if (TEMPLATE_TYPE_LEVEL (t) == 0) { + /* This is either an ordinary level-less auto or a CTAD placeholder + auto. These get replaced only via do_auto_deduction which, in the + ordinary case, temporarily overrides its level to 1 before calling + tsubst. CTAD placeholders are replaced via do_class_deduction. */ + gcc_checking_assert (is_auto (t)); tree tmpl = CLASS_PLACEHOLDER_TEMPLATE (t); + if (!tmpl) + /* Ordinary level-less auto has nothing to substitute. */ + return t; + + /* Substitute the template of this CTAD placeholder. */ tmpl = tsubst_expr (tmpl, args, complain, in_decl); if (TREE_CODE (tmpl) == TEMPLATE_TEMPLATE_PARM) tmpl = TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (tmpl); @@ -20088,6 +20090,14 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl) RETURN (r); } + case MEM_REF: + { + tree op0 = RECUR (TREE_OPERAND (t, 0)); + tree op1 = RECUR (TREE_OPERAND (t, 0)); + tree new_type = tsubst (TREE_TYPE (t), args, complain, in_decl); + RETURN (build2_loc (EXPR_LOCATION (t), MEM_REF, new_type, op0, op1)); + } + case NOP_EXPR: { tree type = tsubst (TREE_TYPE (t), args, complain, in_decl); @@ -23301,10 +23311,18 @@ type_unification_real (tree tparms, parameter pack is a non-deduced context. */ continue; + /* [temp.deduct.conv] only applies to the deduction of the return + type, which is always the first argument here. Other arguments + (notably, explicit object parameters) should undergo normal + call-like unification. */ + unification_kind_t kind = strict; + if (strict == DEDUCE_CONV && ia > 0) + kind = DEDUCE_CALL; + arg = args[ia]; ++ia; - if (unify_one_argument (tparms, full_targs, parm, arg, subr, strict, + if (unify_one_argument (tparms, full_targs, parm, arg, subr, kind, explain_p)) return 1; } @@ -23313,6 +23331,8 @@ type_unification_real (tree tparms, && parms != void_list_node && TREE_CODE (TREE_VALUE (parms)) == TYPE_PACK_EXPANSION) { + gcc_assert (strict != DEDUCE_CONV); + /* Unify the remaining arguments with the pack expansion type. */ tree argvec; tree parmvec = make_tree_vec (1); @@ -26858,10 +26878,16 @@ maybe_instantiate_noexcept (tree fn, tsubst_flags_t complain) if (orig_fn) ++processing_template_decl; + ++cp_unevaluated_operand; + ++c_inhibit_evaluation_warnings; + ++cp_noexcept_operand; /* Do deferred instantiation of the noexcept-specifier. */ noex = tsubst_expr (DEFERRED_NOEXCEPT_PATTERN (noex), DEFERRED_NOEXCEPT_ARGS (noex), tf_warning_or_error, fn); + --cp_unevaluated_operand; + --c_inhibit_evaluation_warnings; + --cp_noexcept_operand; /* Build up the noexcept-specification. */ spec = build_noexcept_spec (noex, tf_warning_or_error); @@ -29311,6 +29337,17 @@ template_placeholder_p (tree t) return is_auto (t) && CLASS_PLACEHOLDER_TEMPLATE (t); } +/* Return an auto for an explicit cast expression auto(x). + Like CTAD placeholders, these have level 0 so that they're + not accidentally replaced via tsubst and are always directly + resolved via do_auto_deduction. */ + +tree +make_cast_auto () +{ + return make_auto_1 (auto_identifier, true, /*level=*/0); +} + /* Make a "constrained auto" type-specifier. This is an auto or decltype(auto) type with constraints that must be associated after deduction. The constraint is formed from the given concept CON @@ -31213,6 +31250,16 @@ do_auto_deduction (tree type, tree init, tree auto_node, } } + if (TEMPLATE_TYPE_LEVEL (auto_node) == 0) + { + /* Substitute this level-less auto via tsubst by temporarily + overriding its level to 1. */ + TEMPLATE_TYPE_LEVEL (auto_node) = 1; + type = tsubst (type, targs, complain, NULL_TREE); + TEMPLATE_TYPE_LEVEL (auto_node) = 0; + return type; + } + if (TEMPLATE_TYPE_LEVEL (auto_node) == 1) /* The outer template arguments are already substituted into type (but we still may have used them for constraint checking above). */; @@ -31530,8 +31577,8 @@ get_mergeable_specialization_flags (tree tmpl, tree decl) get_mergeable_specialization_flags. */ void -add_mergeable_specialization (bool decl_p, bool alias_p, spec_entry *elt, - tree decl, unsigned flags) +add_mergeable_specialization (bool decl_p, spec_entry *elt, tree decl, + unsigned flags) { hashval_t hash = spec_hasher::hash (elt); if (decl_p) @@ -31542,15 +31589,8 @@ add_mergeable_specialization (bool decl_p, bool alias_p, spec_entry *elt, auto entry = ggc_alloc (); *entry = *elt; *slot = entry; - - if (alias_p) - { - elt->spec = TREE_TYPE (elt->spec); - gcc_checking_assert (elt->spec); - } } - - if (!decl_p || alias_p) + else { auto *slot = type_specializations->find_slot_with_hash (elt, hash, INSERT); diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc index 57840176863b..adb1ba48d299 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -11804,6 +11804,15 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p, access expression). */ if (DECL_DECOMPOSITION_P (expr)) { + if (ptds.saved) + { + gcc_checking_assert (DECL_HAS_VALUE_EXPR_P (expr)); + /* DECL_HAS_VALUE_EXPR_P is always set if + processing_template_decl. If lookup_decomp_type + returns non-NULL, it is the tuple case. */ + if (tree ret = lookup_decomp_type (expr)) + return ret; + } if (DECL_HAS_VALUE_EXPR_P (expr)) /* Expr is an array or struct subobject proxy, handle bit-fields properly. */ diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc index ad312710f687..e75be9a4e665 100644 --- a/gcc/cp/tree.cc +++ b/gcc/cp/tree.cc @@ -47,6 +47,7 @@ static tree verify_stmt_tree_r (tree *, int *, void *); static tree handle_init_priority_attribute (tree *, tree, tree, int, bool *); static tree handle_abi_tag_attribute (tree *, tree, tree, int, bool *); static tree handle_contract_attribute (tree *, tree, tree, int, bool *); +static tree handle_no_dangling_attribute (tree *, tree, tree, int, bool *); /* If REF is an lvalue, returns the kind of lvalue that REF is. Otherwise, returns clk_none. */ @@ -5102,6 +5103,8 @@ static const attribute_spec cxx_gnu_attributes[] = handle_init_priority_attribute, NULL }, { "abi_tag", 1, -1, false, false, false, true, handle_abi_tag_attribute, NULL }, + { "no_dangling", 0, 1, false, true, false, false, + handle_no_dangling_attribute, NULL }, }; const scoped_attribute_specs cxx_gnu_attribute_table = @@ -5391,6 +5394,29 @@ handle_contract_attribute (tree *ARG_UNUSED (node), tree ARG_UNUSED (name), return NULL_TREE; } +/* Handle a "no_dangling" attribute; arguments as in + struct attribute_spec.handler. */ + +tree +handle_no_dangling_attribute (tree *node, tree name, tree args, int, + bool *no_add_attrs) +{ + if (args && TREE_CODE (TREE_VALUE (args)) == STRING_CST) + { + error ("%qE attribute argument must be an expression that evaluates " + "to true or false", name); + *no_add_attrs = true; + } + else if (!FUNC_OR_METHOD_TYPE_P (*node) + && !RECORD_OR_UNION_TYPE_P (*node)) + { + warning (OPT_Wattributes, "%qE attribute ignored", name); + *no_add_attrs = true; + } + + return NULL_TREE; +} + /* Return a new PTRMEM_CST of the indicated TYPE. The MEMBER is the thing pointed to by the constant. */ diff --git a/gcc/cp/typeck2.cc b/gcc/cp/typeck2.cc index 9608bdccd8b2..31198b2f9f58 100644 --- a/gcc/cp/typeck2.cc +++ b/gcc/cp/typeck2.cc @@ -350,16 +350,15 @@ cxx_incomplete_type_diagnostic (location_t loc, const_tree value, bad_member: { tree member = TREE_OPERAND (value, 1); - if (is_overloaded_fn (member)) - member = get_first_fn (member); - - if (DECL_FUNCTION_MEMBER_P (member) - && ! flag_ms_extensions) + if (is_overloaded_fn (member) && !flag_ms_extensions) { gcc_rich_location richloc (loc); /* If "member" has no arguments (other than "this"), then add a fix-it hint. */ - if (type_num_arguments (TREE_TYPE (member)) == 1) + member = MAYBE_BASELINK_FUNCTIONS (member); + if (TREE_CODE (member) == FUNCTION_DECL + && DECL_OBJECT_MEMBER_FUNCTION_P (member) + && type_num_arguments (TREE_TYPE (member)) == 1) richloc.add_fixit_insert_after ("()"); complained = emit_diagnostic (diag_kind, &richloc, 0, "invalid use of member function %qD " diff --git a/gcc/ctfc.h b/gcc/ctfc.h index 7aac57edac55..fa188bf2f5a4 100644 --- a/gcc/ctfc.h +++ b/gcc/ctfc.h @@ -441,6 +441,9 @@ extern int ctf_add_variable (ctf_container_ref, const char *, ctf_id_t, extern ctf_id_t ctf_lookup_tree_type (ctf_container_ref, const tree); extern ctf_id_t get_btf_id (ctf_id_t); +typedef bool (*funcs_traverse_callback) (ctf_dtdef_ref, void *); +bool traverse_btf_func_types (funcs_traverse_callback, void *); + /* CTF section does not emit location information; at this time, location information is needed for BTF CO-RE use-cases. */ diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog index 06cc55763c5b..595bb5993c44 100644 --- a/gcc/d/ChangeLog +++ b/gcc/d/ChangeLog @@ -1,3 +1,32 @@ +2024-03-03 Iain Buclaw + + * dmd/MERGE: Merge upstream dmd f8bae04558. + * dmd/VERSION: Bump version to v2.108.0-beta.1. + * d-builtins.cc (build_frontend_type): Update for new front-end + interface. + * d-codegen.cc (build_assert_call): Likewise. + * d-convert.cc (d_array_convert): Likewise. + * decl.cc (get_vtable_decl): Likewise. + * expr.cc (ExprVisitor::visit (EqualExp *)): Likewise. + (ExprVisitor::visit (VarExp *)): Likewise. + (ExprVisitor::visit (ArrayLiteralExp *)): Likewise. + (ExprVisitor::visit (AssocArrayLiteralExp)): Likewise. + * intrinsics.cc (build_shuffle_mask_type): Likewise. + (maybe_warn_intrinsic_mismatch): Likewise. + * runtime.cc (get_libcall_type): Likewise. + * typeinfo.cc (TypeInfoVisitor::layout_string): Likewise. + (TypeInfoVisitor::visit(TypeInfoTupleDeclaration *)): Likewise. + +2024-03-03 Iain Buclaw + + PR d/114171 + * d-codegen.cc (lower_struct_comparison): Keep alignment of original + type in reinterpret cast for comparison. + +2024-02-25 Iain Buclaw + + * dmd/MERGE: Merge upstream dmd ceff48bf7d. + 2024-02-17 Iain Buclaw * dmd/MERGE: Merge upstream dmd 9471b25db9. diff --git a/gcc/d/d-builtins.cc b/gcc/d/d-builtins.cc index dc50df4252c4..4546c0e9b563 100644 --- a/gcc/d/d-builtins.cc +++ b/gcc/d/d-builtins.cc @@ -197,8 +197,8 @@ build_frontend_type (tree type) length = size_binop (PLUS_EXPR, size_one_node, convert (sizetype, length)); - dtype = - dmd::addMod (dtype->sarrayOf (TREE_INT_CST_LOW (length)), mod); + dtype = dmd::sarrayOf (dtype, TREE_INT_CST_LOW (length)); + dtype = dmd::addMod (dtype, mod); builtin_converted_decls.safe_push (builtin_data (dtype, type)); return dtype; } @@ -214,7 +214,7 @@ build_frontend_type (tree type) if (!dtype) break; - dtype = dmd::addMod (dtype->sarrayOf (nunits), mod); + dtype = dmd::addMod (dmd::sarrayOf (dtype, nunits), mod); if (target.isVectorTypeSupported (dtype->size (), dtype->nextOf ())) break; diff --git a/gcc/d/d-codegen.cc b/gcc/d/d-codegen.cc index 5bc233928aa8..2b3089b5f6dd 100644 --- a/gcc/d/d-codegen.cc +++ b/gcc/d/d-codegen.cc @@ -1006,6 +1006,7 @@ lower_struct_comparison (tree_code code, StructDeclaration *sd, if (tmode == NULL_TREE) tmode = make_unsigned_type (GET_MODE_BITSIZE (mode.require ())); + tmode = build_aligned_type (tmode, TYPE_ALIGN (stype)); t1ref = build_vconvert (tmode, t1ref); t2ref = build_vconvert (tmode, t2ref); @@ -1905,7 +1906,7 @@ build_assert_call (const Loc &loc, libcall_fn libcall, tree msg) tree str = build_string (len, filename); TREE_TYPE (str) = make_array_type (Type::tchar, len); - file = d_array_value (build_ctype (Type::tchar->arrayOf ()), + file = d_array_value (build_ctype (dmd::arrayOf (Type::tchar)), size_int (len), build_address (str)); } else diff --git a/gcc/d/d-convert.cc b/gcc/d/d-convert.cc index 4ccbf0908b5c..5c79cdf6e1e4 100644 --- a/gcc/d/d-convert.cc +++ b/gcc/d/d-convert.cc @@ -957,7 +957,7 @@ d_array_convert (Expression *exp) if (tb->ty == TY::Tsarray) { - Type *totype = tb->nextOf ()->arrayOf (); + Type *totype = dmd::arrayOf (tb->nextOf ()); return convert_expr (build_expr (exp), exp->type, totype); } @@ -986,7 +986,7 @@ d_array_convert (Type *etype, Expression *exp) expr = compound_expr (modify_expr (var, expr), var); } - return d_array_value (build_ctype (exp->type->arrayOf ()), + return d_array_value (build_ctype (dmd::arrayOf (exp->type)), size_int (1), build_address (expr)); } else diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc index 25398a323818..3b7627d3dfaf 100644 --- a/gcc/d/decl.cc +++ b/gcc/d/decl.cc @@ -2211,7 +2211,7 @@ get_vtable_decl (ClassDeclaration *decl) tree ident = mangle_internal_decl (decl, "__vtbl", "Z"); /* Note: Using a static array type for the VAR_DECL, the DECL_INITIAL value will have a different type. However the back-end seems to accept this. */ - tree type = build_ctype (Type::tvoidptr->sarrayOf (decl->vtbl.length)); + tree type = build_ctype (dmd::sarrayOf (Type::tvoidptr, decl->vtbl.length)); Dsymbol *vtblsym = decl->vtblSymbol (); vtblsym->csym = declare_extern_var (ident, type); diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE index 021149aabc7c..4c0a0bc2aac4 100644 --- a/gcc/d/dmd/MERGE +++ b/gcc/d/dmd/MERGE @@ -1,4 +1,4 @@ -9471b25db9ed44d71e0e27956430c0c6a09c16db +f8bae0455851a1dfc8113d69323415f6de549e39 The first line of this file holds the git revision number of the last merge done from the dlang/dmd repository. diff --git a/gcc/d/dmd/VERSION b/gcc/d/dmd/VERSION index 1880c9808c55..416807683f5a 100644 --- a/gcc/d/dmd/VERSION +++ b/gcc/d/dmd/VERSION @@ -1 +1 @@ -v2.107.1-rc.1 +v2.108.0-beta.1 diff --git a/gcc/d/dmd/arrayop.d b/gcc/d/dmd/arrayop.d index afe6054f4aaa..af3875ea6c5f 100644 --- a/gcc/d/dmd/arrayop.d +++ b/gcc/d/dmd/arrayop.d @@ -22,7 +22,7 @@ import dmd.dsymbol; import dmd.errors; import dmd.expression; import dmd.expressionsem; -import dmd.func; +import dmd.funcsem; import dmd.hdrgen; import dmd.id; import dmd.identifier; diff --git a/gcc/d/dmd/ast_node.h b/gcc/d/dmd/ast_node.h index a24218a86d02..db8608e7cddd 100644 --- a/gcc/d/dmd/ast_node.h +++ b/gcc/d/dmd/ast_node.h @@ -10,7 +10,7 @@ #pragma once -#include "root/object.h" +#include "rootobject.h" class Visitor; diff --git a/gcc/d/dmd/common/file.d b/gcc/d/dmd/common/file.d index 8a284241fc2e..80677f66ff89 100644 --- a/gcc/d/dmd/common/file.d +++ b/gcc/d/dmd/common/file.d @@ -16,24 +16,37 @@ module dmd.common.file; import core.stdc.errno : errno; import core.stdc.stdio : fprintf, remove, rename, stderr; -import core.stdc.stdlib : exit; -import core.stdc.string : strerror, strlen; -import core.sys.windows.winbase; -import core.sys.windows.winnt; -import core.sys.posix.fcntl; -import core.sys.posix.unistd; +import core.stdc.stdlib; +import core.stdc.string : strerror, strlen, memcpy; import dmd.common.smallbuffer; -nothrow: - version (Windows) { + import core.sys.windows.winbase; import core.sys.windows.winnls : CP_ACP; + import core.sys.windows.winnt; + + enum CodePage = CP_ACP; // assume filenames encoded in system default Windows ANSI code page + enum invalidHandle = INVALID_HANDLE_VALUE; +} +else version (Posix) +{ + import core.sys.posix.fcntl; + import core.sys.posix.sys.mman; + import core.sys.posix.sys.stat; + import core.sys.posix.unistd; + import core.sys.posix.utime; - // assume filenames encoded in system default Windows ANSI code page - enum CodePage = CP_ACP; + enum invalidHandle = -1; } +else + static assert(0); + + + + +nothrow: /** Encapsulated management of a memory-mapped file. @@ -48,9 +61,6 @@ struct FileMapping(Datum) static assert(__traits(isPOD, Datum) && Datum.sizeof == 1, "Not tested with other data types yet. Add new types with care."); - version(Posix) enum invalidHandle = -1; - else version(Windows) enum invalidHandle = INVALID_HANDLE_VALUE; - // state { /// Handle of underlying file private auto handle = invalidHandle; @@ -82,9 +92,6 @@ struct FileMapping(Datum) { version (Posix) { - import core.sys.posix.sys.mman; - import core.sys.posix.fcntl : open, O_CREAT, O_RDONLY, O_RDWR, S_IRGRP, S_IROTH, S_IRUSR, S_IWUSR; - handle = open(filename, is(Datum == const) ? O_RDONLY : (O_CREAT | O_RDWR), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); @@ -150,9 +157,6 @@ struct FileMapping(Datum) // Save the name for later. Technically there's no need: on Linux one can use readlink on /proc/self/fd/NNN. // On BSD and OSX one can use fcntl with F_GETPATH. On Windows one can use GetFileInformationByHandleEx. // But just saving the name is simplest, fastest, and most portable... - import core.stdc.string : strlen; - import core.stdc.stdlib : malloc; - import core.stdc.string : memcpy; const totalNameLength = filename.strlen() + 1; auto namex = cast(char*) malloc(totalNameLength); if (!namex) @@ -224,9 +228,6 @@ struct FileMapping(Datum) fakePure({ version (Posix) { - import core.sys.posix.sys.mman : munmap; - import core.sys.posix.unistd : close; - // Cannot call fprintf from inside a destructor, so exiting silently. if (data.ptr && munmap(cast(void*) data.ptr, data.length) != 0) @@ -234,7 +235,7 @@ struct FileMapping(Datum) exit(1); } data = null; - if (handle != invalidHandle && close(handle) != 0) + if (handle != invalidHandle && .close(handle) != 0) { exit(1); } @@ -303,7 +304,6 @@ struct FileMapping(Datum) // In-memory resource freed, now get rid of the underlying temp file. version(Posix) { - import core.sys.posix.unistd : unlink; if (unlink(deleteme) != 0) { fprintf(stderr, "unlink(\"%s\") failed: %s\n", filename, strerror(errno)); @@ -312,7 +312,6 @@ struct FileMapping(Datum) } else version(Windows) { - import core.sys.windows.winbase; if (deleteme[0 .. strlen(deleteme)].extendedPathThen!(p => DeleteFileW(p.ptr)) == 0) { fprintf(stderr, "DeleteFileW error %d\n", GetLastError()); @@ -361,9 +360,6 @@ struct FileMapping(Datum) fakePure({ version(Posix) { - import core.sys.posix.unistd : ftruncate; - import core.sys.posix.sys.mman; - if (data.length) { assert(data.ptr, "Corrupt memory mapping"); @@ -431,7 +427,6 @@ struct FileMapping(Datum) // Fetch the name and then set it to `null` so it doesn't get deallocated auto oldname = name; - import core.stdc.stdlib; scope(exit) free(cast(void*) oldname); name = null; close(); @@ -447,7 +442,6 @@ struct FileMapping(Datum) } else version(Windows) { - import core.sys.windows.winbase; auto r = oldname[0 .. strlen(oldname)].extendedPathThen!( p1 => filename[0 .. strlen(filename)].extendedPathThen!(p2 => MoveFileExW(p1.ptr, p2.ptr, MOVEFILE_REPLACE_EXISTING)) ); @@ -527,8 +521,6 @@ bool touchFile(const char* namez) GetSystemTime(&st); SystemTimeToFileTime(&st, &ft); - import core.stdc.string : strlen; - // get handle to file HANDLE h = namez[0 .. namez.strlen()].extendedPathThen!(p => CreateFile(p.ptr, FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE, @@ -546,7 +538,6 @@ bool touchFile(const char* namez) } else version (Posix) { - import core.sys.posix.utime; return utime(namez, null) == 0; } else @@ -560,24 +551,28 @@ Params: fd = file handle Returns: file size in bytes, or `ulong.max` on any error. */ version (Posix) -private ulong fileSize(int fd) { - import core.sys.posix.sys.stat; - stat_t buf; - if (fstat(fd, &buf) == 0) - return buf.st_size; - return ulong.max; + private ulong fileSize(int fd) + { + stat_t buf; + if (fstat(fd, &buf) == 0) + return buf.st_size; + return ulong.max; + } } - -/// Ditto -version (Windows) -private ulong fileSize(HANDLE fd) +else version (Windows) { - ulong result; - if (GetFileSizeEx(fd, cast(LARGE_INTEGER*) &result) == 0) - return result; - return ulong.max; + /// Ditto + private ulong fileSize(HANDLE fd) + { + ulong result; + if (GetFileSizeEx(fd, cast(LARGE_INTEGER*) &result) == 0) + return result; + return ulong.max; + } } +else + static assert(0); /** Runs a non-pure function or delegate as pure code. Use with caution. diff --git a/gcc/d/dmd/common/smallbuffer.d b/gcc/d/dmd/common/smallbuffer.d index c6aa7abbc604..608ecc8c6b62 100644 --- a/gcc/d/dmd/common/smallbuffer.d +++ b/gcc/d/dmd/common/smallbuffer.d @@ -107,28 +107,30 @@ unittest } /** -(Windows only) Converts a narrow string to a wide string using `buffer` as strorage. Returns a slice managed by -`buffer` containing the converted string. The terminating zero is not part of the returned slice, -but is guaranteed to follow it. + * (Windows only) Converts a narrow string to a wide string using `buffer` as strorage. + * Params: + * narrow = string to be converted + * buffer = where to place the converted string + * Returns: a slice of `buffer` containing the converted string. A zero follows the slice. */ version(Windows) wchar[] toWStringz(scope const(char)[] narrow, ref SmallBuffer!wchar buffer) nothrow { - import core.sys.windows.winnls : MultiByteToWideChar; - import dmd.common.file : CodePage; - if (narrow is null) return null; - size_t length; - int i; - while (1) + size_t charsToWchars(scope const(char)[] narrow, scope wchar[] buffer) { // https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-multibytetowidechar - length = MultiByteToWideChar(CodePage, 0, narrow.ptr, cast(int) narrow.length, buffer.ptr, cast(int) buffer.length); - if (length < buffer.length) - break; - buffer.create(length + 1); - assert(++i == 1); // ensure loop should only execute once or twice + import core.sys.windows.winnls : MultiByteToWideChar, CP_ACP; + return MultiByteToWideChar(CP_ACP, 0, narrow.ptr, cast(int) narrow.length, buffer.ptr, cast(int) buffer.length); + } + + size_t length = charsToWchars(narrow, buffer[]); + if (length >= buffer.length) // not enough room in buffer[] + { + buffer.create(length + 1); // extend buffer length + length = charsToWchars(narrow, buffer[]); // try again + assert(length < buffer.length); } buffer[length] = 0; return buffer[0 .. length]; diff --git a/gcc/d/dmd/constfold.d b/gcc/d/dmd/constfold.d index 0686e1b08251..6ec31d5f9bb4 100644 --- a/gcc/d/dmd/constfold.d +++ b/gcc/d/dmd/constfold.d @@ -36,7 +36,7 @@ import dmd.root.utf; import dmd.sideeffect; import dmd.target; import dmd.tokens; -import dmd.typesem : toDsymbol, equivalent; +import dmd.typesem : toDsymbol, equivalent, sarrayOf; private enum LOG = false; diff --git a/gcc/d/dmd/cparse.d b/gcc/d/dmd/cparse.d index 536a212536da..aeedb493efc3 100644 --- a/gcc/d/dmd/cparse.d +++ b/gcc/d/dmd/cparse.d @@ -1682,9 +1682,12 @@ final class CParser(AST) : Parser!AST AST.ParameterList parameterList; StorageClass stc = 0; const loc = token.loc; + auto symbolsSave = symbols; + symbols = new AST.Dsymbols(); typedefTab.push(null); auto fbody = cparseStatement(ParseStatementFlags.scope_); typedefTab.pop(); // end of function scope + symbols = symbolsSave; // Rewrite last ExpStatement (if there is one) as a ReturnStatement auto ss = fbody.isScopeStatement(); @@ -1693,8 +1696,11 @@ final class CParser(AST) : Parser!AST if (const len = (*cs.statements).length) { auto s = (*cs.statements)[len - 1]; - if (auto es = s.isExpStatement()) - (*cs.statements)[len - 1] = new AST.ReturnStatement(es.loc, es.exp); + if (s) // error recovery should be with ErrorStatement, not null + { + if (auto es = s.isExpStatement()) + (*cs.statements)[len - 1] = new AST.ReturnStatement(es.loc, es.exp); + } } auto tf = new AST.TypeFunction(parameterList, null, LINK.d, stc); @@ -2149,7 +2155,7 @@ final class CParser(AST) : Parser!AST error("function identifier-list cannot end with `...`"); ft.parameterList.varargs = AST.VarArg.KRvariadic; // but C11 allows extra arguments auto plLength = pl.length; - if (symbols.length != plLength) + if (symbols && symbols.length != plLength) error(token.loc, "%d identifiers does not match %d declarations", cast(int)plLength, cast(int)symbols.length); /* Transfer the types and storage classes from symbols[] to pl[] @@ -2170,6 +2176,12 @@ final class CParser(AST) : Parser!AST if (p.type || !(p.storageClass & STC.parameter)) error("storage class and type are not allowed in identifier-list"); + if (!symbols) + { + // Error already given in cparseDeclaration + p.type = AST.Type.terror; + continue; + } foreach (s; (*symbols)[]) // yes, quadratic { auto ad = s.isAttribDeclaration(); @@ -5520,7 +5532,7 @@ final class CParser(AST) : Parser!AST defines.writeByte('#'); defines.writestring(n.ident.toString()); skipToNextLine(defines); - defines.writeByte('\n'); + defines.writeByte(0); // each #define line is 0 terminated return true; } else if (n.ident == Id.__pragma) @@ -5840,7 +5852,8 @@ final class CParser(AST) : Parser!AST const length = buf.length; buf.writeByte(0); auto slice = buf.peekChars()[0 .. length]; - resetDefineLines(slice); // reset lexer + auto scanlocSave = scanloc; + resetDefineLines(slice); // reset lexer auto save = eSink; auto eLatch = new ErrorSinkLatch(); eSink = eLatch; @@ -5865,12 +5878,14 @@ final class CParser(AST) : Parser!AST (*symbols)[*pd] = s; return; } + assert(symbols, "symbols is null"); defineTab[cast(void*)s.ident] = symbols.length; symbols.push(s); } while (p < endp) { + //printf("|%s|\n", p); if (p[0 .. 7] == "#define") { p += 7; @@ -5884,10 +5899,11 @@ final class CParser(AST) : Parser!AST AST.Type t; + Lswitch: switch (token.value) { - case TOK.endOfLine: // #define identifier - nextDefineLine(); + case TOK.endOfFile: // #define identifier + ++p; continue; case TOK.int32Literal: @@ -5901,7 +5917,7 @@ final class CParser(AST) : Parser!AST Linteger: const intvalue = token.intvalue; nextToken(); - if (token.value == TOK.endOfLine) + if (token.value == TOK.endOfFile) { /* Declare manifest constant: * enum id = intvalue; @@ -5909,7 +5925,7 @@ final class CParser(AST) : Parser!AST AST.Expression e = new AST.IntegerExp(scanloc, intvalue, t); auto v = new AST.VarDeclaration(scanloc, t, id, new AST.ExpInitializer(scanloc, e), STC.manifest); addVar(v); - nextDefineLine(); + ++p; continue; } break; @@ -5924,7 +5940,7 @@ final class CParser(AST) : Parser!AST Lfloat: const floatvalue = token.floatvalue; nextToken(); - if (token.value == TOK.endOfLine) + if (token.value == TOK.endOfFile) { /* Declare manifest constant: * enum id = floatvalue; @@ -5932,7 +5948,7 @@ final class CParser(AST) : Parser!AST AST.Expression e = new AST.RealExp(scanloc, floatvalue, t); auto v = new AST.VarDeclaration(scanloc, t, id, new AST.ExpInitializer(scanloc, e), STC.manifest); addVar(v); - nextDefineLine(); + ++p; continue; } break; @@ -5942,7 +5958,7 @@ final class CParser(AST) : Parser!AST const len = token.len; const postfix = token.postfix; nextToken(); - if (token.value == TOK.endOfLine) + if (token.value == TOK.endOfFile) { /* Declare manifest constant: * enum id = "string"; @@ -5950,19 +5966,20 @@ final class CParser(AST) : Parser!AST AST.Expression e = new AST.StringExp(scanloc, str[0 .. len], len, 1, postfix); auto v = new AST.VarDeclaration(scanloc, null, id, new AST.ExpInitializer(scanloc, e), STC.manifest); addVar(v); - nextDefineLine(); + ++p; continue; } break; case TOK.leftParenthesis: + { /* Look for: * #define ID ( expression ) * and rewrite it to a template function: * auto ID()() { return expression; } */ if (params) - break; // no parameters + goto caseFunctionLike; // version with parameters nextToken(); eLatch.sawErrors = false; auto exp = cparseExpression(); @@ -5971,7 +5988,7 @@ final class CParser(AST) : Parser!AST if (token.value != TOK.rightParenthesis) break; nextToken(); - if (token.value != TOK.endOfLine) + if (token.value != TOK.endOfFile) break; auto ret = new AST.ReturnStatement(exp.loc, exp); auto parameterList = AST.ParameterList(new AST.Parameters(), VarArg.none, 0); @@ -5985,26 +6002,115 @@ final class CParser(AST) : Parser!AST AST.Expression constraint = null; auto tempdecl = new AST.TemplateDeclaration(exp.loc, id, tpl, constraint, decldefs, false); addVar(tempdecl); - nextDefineLine(); + ++p; continue; + } + + caseFunctionLike: + { + /* Parse `( a, b ) expression` + * Create template function: + * auto id(__MP1, __MP2)(__MP1 a, __MP1 b) { return expression; } + */ + //printf("functionlike %s\n", id.toChars()); + + // Capture the parameter list + VarArg varargs = VarArg.none; + auto parameters = new AST.Parameters(); + nextToken(); // skip past `(` + Lwhile: + while (1) + { + if (token.value == TOK.rightParenthesis) + break; + if (token.value == TOK.dotDotDot) + { + static if (0) // variadic macros not supported yet + { + varargs = AST.VarArg.variadic; // C-style variadics + nextToken(); + if (token.value == TOK.rightParenthesis) + break Lwhile; + } + break Lswitch; + } + + if (token.value != TOK.identifier) + break Lswitch; + auto param = new AST.Parameter(token.loc, 0, null, token.ident, null, null); + parameters.push(param); + nextToken(); + if (token.value == TOK.comma) + { + nextToken(); + continue; + } + break; + } + if (token.value != TOK.rightParenthesis) + break; + + //auto pstart = p; + nextToken(); + auto parameterList = AST.ParameterList(parameters, varargs, 0); + /* Create a type for each parameter. Add it to the template parameter list, + * and the parameter list. + */ + auto tpl = new AST.TemplateParameters(); + foreach (param; (*parameters)[]) + { + auto idtype = Identifier.generateId("__MP"); + auto loc = param.loc; + auto tp = new AST.TemplateTypeParameter(loc, idtype, null, null); + tpl.push(tp); + + auto at = new AST.TypeIdentifier(loc, idtype); + param.type = at; + } + + eLatch.sawErrors = false; + auto exp = cparseExpression(); + + //printf("exp: %s tok: %s\n", exp.toChars(), Token.toChars(token.value)); + //printf("parsed: '%.*s'\n", cast(int)(p - pstart), pstart); + assert(symbols); + + if (eLatch.sawErrors) // parsing errors + break; // abandon this #define + + if (token.value != TOK.endOfFile) // did not consume the entire line + break; + + // Generate function + auto ret = new AST.ReturnStatement(exp.loc, exp); + StorageClass stc = STC.auto_; + auto tf = new AST.TypeFunction(parameterList, null, LINK.d, stc); + auto fd = new AST.FuncDeclaration(exp.loc, exp.loc, id, stc, tf, 0); + fd.fbody = ret; + + // Wrap it in an eponymous template + AST.Dsymbols* decldefs = new AST.Dsymbols(); + decldefs.push(fd); + auto tempdecl = new AST.TemplateDeclaration(exp.loc, id, tpl, null, decldefs, false); + addVar(tempdecl); + + ++p; + continue; + } default: break; } } - skipToNextLine(); - } - else - { - scan(&token); - if (token.value != TOK.endOfLine) - { - skipToNextLine(); - } } - nextDefineLine(); + // scan to end of line + while (*p) + ++p; + ++p; // advance to start of next line + scanloc.linnum = scanloc.linnum + 1; } + scanloc = scanlocSave; eSink = save; defines = buf; } diff --git a/gcc/d/dmd/cxxfrontend.d b/gcc/d/dmd/cxxfrontend.d index 1b94a69da234..8c0463434686 100644 --- a/gcc/d/dmd/cxxfrontend.d +++ b/gcc/d/dmd/cxxfrontend.d @@ -475,6 +475,18 @@ bool equivalent(Type src, Type t) return dmd.typesem.equivalent(src, t); } +Type sarrayOf(Type type, dinteger_t dim) +{ + import dmd.typesem; + return dmd.typesem.sarrayOf(type, dim); +} + +Type arrayOf(Type type) +{ + import dmd.typesem; + return dmd.typesem.arrayOf(type); +} + Type constOf(Type type) { import dmd.typesem; @@ -535,6 +547,30 @@ Type sharedWildConstOf(Type type) return dmd.typesem.sharedWildConstOf(type); } +Type substWildTo(Type type, uint mod) +{ + import dmd.typesem; + return dmd.typesem.substWildTo(type, mod); +} + +Type unqualify(Type type, uint m) +{ + import dmd.typesem; + return dmd.typesem.unqualify(type, m); +} + +Type toHeadMutable(const(Type) type) +{ + import dmd.typesem; + return dmd.typesem.toHeadMutable(type); +} + +Type aliasthisOf(Type type) +{ + import dmd.typesem; + return dmd.typesem.aliasthisOf(type); +} + Type castMod(Type type, MOD mod) { import dmd.typesem; diff --git a/gcc/d/dmd/denum.d b/gcc/d/dmd/denum.d index 36799766eced..5c739eee6ae1 100644 --- a/gcc/d/dmd/denum.d +++ b/gcc/d/dmd/denum.d @@ -20,7 +20,6 @@ import dmd.astenums; import dmd.attrib; import dmd.gluelayer; import dmd.declaration; -import dmd.dscope; import dmd.dsymbol; import dmd.expression; import dmd.id; diff --git a/gcc/d/dmd/dimport.d b/gcc/d/dmd/dimport.d index b083c03aebee..2efdd31bbba0 100644 --- a/gcc/d/dmd/dimport.d +++ b/gcc/d/dmd/dimport.d @@ -12,21 +12,13 @@ module dmd.dimport; import dmd.arraytypes; -import dmd.astenums; -import dmd.declaration; import dmd.dmodule; -import dmd.dscope; import dmd.dsymbol; -import dmd.dsymbolsem; import dmd.errors; -import dmd.expression; -import dmd.globals; import dmd.identifier; import dmd.location; -import dmd.mtype; import dmd.visitor; -import core.stdc.stdio; /*********************************************************** */ extern (C++) final class Import : Dsymbol @@ -76,6 +68,8 @@ extern (C++) final class Import : Dsymbol assert(id); version (none) { + import core.stdc.stdio; + printf("Import::Import("); foreach (id; packages) { @@ -123,105 +117,6 @@ extern (C++) final class Import : Dsymbol return si; } - /******************************* - * Load this module. - * Returns: - * true for errors, false for success - */ - extern (D) bool load(Scope* sc) - { - //printf("Import::load('%s') %p\n", toPrettyChars(), this); - // See if existing module - const errors = global.errors; - DsymbolTable dst = Package.resolve(packages, null, &pkg); - version (none) - { - if (pkg && pkg.isModule()) - { - .error(loc, "can only import from a module, not from a member of module `%s`. Did you mean `import %s : %s`?", pkg.toChars(), pkg.toPrettyChars(), id.toChars()); - mod = pkg.isModule(); // Error recovery - treat as import of that module - return true; - } - } - Dsymbol s = dst.lookup(id); - if (s) - { - if (s.isModule()) - mod = cast(Module)s; - else - { - if (s.isAliasDeclaration()) - { - .error(loc, "%s `%s` conflicts with `%s`", s.kind(), s.toPrettyChars(), id.toChars()); - } - else if (Package p = s.isPackage()) - { - if (p.isPkgMod == PKG.unknown) - { - uint preverrors = global.errors; - mod = Module.load(loc, packages, id); - if (!mod) - p.isPkgMod = PKG.package_; - else - { - // mod is a package.d, or a normal module which conflicts with the package name. - if (mod.isPackageFile) - mod.tag = p.tag; // reuse the same package tag - else - { - // show error if Module.load does not - if (preverrors == global.errors) - .error(loc, "%s `%s` from file %s conflicts with %s `%s`", mod.kind(), mod.toPrettyChars(), mod.srcfile.toChars, p.kind(), p.toPrettyChars()); - return true; - } - } - } - else - { - mod = p.isPackageMod(); - } - if (!mod) - { - .error(loc, "can only import from a module, not from package `%s.%s`", p.toPrettyChars(), id.toChars()); - } - } - else if (pkg) - { - .error(loc, "can only import from a module, not from package `%s.%s`", pkg.toPrettyChars(), id.toChars()); - } - else - { - .error(loc, "can only import from a module, not from package `%s`", id.toChars()); - } - } - } - if (!mod) - { - // Load module - mod = Module.load(loc, packages, id); - if (mod) - { - // id may be different from mod.ident, if so then insert alias - dst.insert(id, mod); - } - } - if (mod && !mod.importedFrom) - mod.importedFrom = sc ? sc._module.importedFrom : Module.rootModule; - if (!pkg) - { - if (mod && mod.isPackageFile) - { - // one level depth package.d file (import pkg; ./pkg/package.d) - // it's necessary to use the wrapping Package already created - pkg = mod.pkg; - } - else - pkg = mod; - } - //printf("-Import::load('%s'), pkg = %p\n", toChars(), pkg); - return global.errors != errors; - } - /******************************* * Mark the imported packages as accessible from the current * scope. This access check is necessary when using FQN b/c diff --git a/gcc/d/dmd/dinterpret.d b/gcc/d/dmd/dinterpret.d index 467e29f3c3cd..c4924903f25a 100644 --- a/gcc/d/dmd/dinterpret.d +++ b/gcc/d/dmd/dinterpret.d @@ -50,7 +50,7 @@ import dmd.rootobject; import dmd.root.utf; import dmd.statement; import dmd.tokens; -import dmd.typesem : mutableOf, equivalent, pointerTo; +import dmd.typesem : mutableOf, equivalent, pointerTo, sarrayOf, arrayOf; import dmd.utils : arrayCastBigEndian; import dmd.visitor; @@ -3787,7 +3787,7 @@ public: if (v is v2 || !v.isOverlappedWith(v2)) continue; auto e = (*sle.elements)[i]; - if (e.op != EXP.void_) + if (e !is null && e.op != EXP.void_) (*sle.elements)[i] = voidInitLiteral(e.type, v).copy(); } } diff --git a/gcc/d/dmd/dmodule.d b/gcc/d/dmd/dmodule.d index 07d5077ee49c..58bf3fd0757e 100644 --- a/gcc/d/dmd/dmodule.d +++ b/gcc/d/dmd/dmodule.d @@ -16,12 +16,14 @@ module dmd.dmodule; import core.stdc.stdio; import core.stdc.stdlib; import core.stdc.string; + import dmd.aggregate; import dmd.arraytypes; import dmd.astcodegen; import dmd.astenums; +import dmd.common.outbuffer; import dmd.compiler; -import dmd.gluelayer; +import dmd.cparse; import dmd.dimport; import dmd.dmacro; import dmd.doc; @@ -35,25 +37,37 @@ import dmd.expressionsem; import dmd.file_manager; import dmd.func; import dmd.globals; +import dmd.gluelayer; import dmd.id; import dmd.identifier; import dmd.location; import dmd.parse; -import dmd.cparse; import dmd.root.array; import dmd.root.file; import dmd.root.filename; -import dmd.common.outbuffer; import dmd.root.port; import dmd.root.rmem; -import dmd.rootobject; import dmd.root.string; +import dmd.rootobject; import dmd.semantic2; import dmd.semantic3; import dmd.target; import dmd.utils; import dmd.visitor; +version (Windows) +{ + import core.sys.windows.winbase : getpid = GetCurrentProcessId; + enum PathSeparator = '\\'; +} +else version (Posix) +{ + import core.sys.posix.unistd : getpid; + enum PathSeparator = '/'; +} +else + static assert(0); + version (IN_GCC) {} else version (IN_LLVM) {} else version = MARS; @@ -141,11 +155,7 @@ private const(char)[] getFilename(Identifier[] packages, Identifier ident) nothr buf.writestring(p); if (modAliases.length) checkModFileAlias(p); - version (Windows) - enum FileSeparator = '\\'; - else - enum FileSeparator = '/'; - buf.writeByte(FileSeparator); + buf.writeByte(PathSeparator); } buf.writestring(filename); if (modAliases.length) @@ -558,10 +568,6 @@ extern (C++) final class Module : Package OutBuffer buf; if (arg == "__stdin.d") { - version (Posix) - import core.sys.posix.unistd : getpid; - else version (Windows) - import core.sys.windows.winbase : getpid = GetCurrentProcessId; buf.printf("__stdin_%d.d", getpid()); arg = buf[]; } @@ -1388,6 +1394,7 @@ private const(char)[] processSource (const(ubyte)[] src, Module mod) { enum SourceEncoding { utf16, utf32} enum Endian { little, big} + immutable loc = mod.getLoc(); /* * Convert a buffer from UTF32 to UTF8 @@ -1407,7 +1414,7 @@ private const(char)[] processSource (const(ubyte)[] src, Module mod) if (buf.length & 3) { - .error(mod.loc, "%s `%s` odd length of UTF-32 char source %llu", + .error(loc, "%s `%s` odd length of UTF-32 char source %llu", mod.kind, mod.toPrettyChars, cast(ulong) buf.length); return null; } @@ -1424,7 +1431,7 @@ private const(char)[] processSource (const(ubyte)[] src, Module mod) { if (u > 0x10FFFF) { - .error(mod.loc, "%s `%s` UTF-32 value %08x greater than 0x10FFFF", mod.kind, mod.toPrettyChars, u); + .error(loc, "%s `%s` UTF-32 value %08x greater than 0x10FFFF", mod.kind, mod.toPrettyChars, u); return null; } dbuf.writeUTF8(u); @@ -1454,7 +1461,7 @@ private const(char)[] processSource (const(ubyte)[] src, Module mod) if (buf.length & 1) { - .error(mod.loc, "%s `%s` odd length of UTF-16 char source %llu", mod.kind, mod.toPrettyChars, cast(ulong) buf.length); + .error(loc, "%s `%s` odd length of UTF-16 char source %llu", mod.kind, mod.toPrettyChars, cast(ulong) buf.length); return null; } @@ -1474,13 +1481,13 @@ private const(char)[] processSource (const(ubyte)[] src, Module mod) i++; if (i >= eBuf.length) { - .error(mod.loc, "%s `%s` surrogate UTF-16 high value %04x at end of file", mod.kind, mod.toPrettyChars, u); + .error(loc, "%s `%s` surrogate UTF-16 high value %04x at end of file", mod.kind, mod.toPrettyChars, u); return null; } const u2 = readNext(&eBuf[i]); if (u2 < 0xDC00 || 0xE000 <= u2) { - .error(mod.loc, "%s `%s` surrogate UTF-16 low value %04x out of range", mod.kind, mod.toPrettyChars, u2); + .error(loc, "%s `%s` surrogate UTF-16 low value %04x out of range", mod.kind, mod.toPrettyChars, u2); return null; } u = (u - 0xD7C0) << 10; @@ -1488,12 +1495,12 @@ private const(char)[] processSource (const(ubyte)[] src, Module mod) } else if (u >= 0xDC00 && u <= 0xDFFF) { - .error(mod.loc, "%s `%s` unpaired surrogate UTF-16 value %04x", mod.kind, mod.toPrettyChars, u); + .error(loc, "%s `%s` unpaired surrogate UTF-16 value %04x", mod.kind, mod.toPrettyChars, u); return null; } else if (u == 0xFFFE || u == 0xFFFF) { - .error(mod.loc, "%s `%s` illegal UTF-16 value %04x", mod.kind, mod.toPrettyChars, u); + .error(loc, "%s `%s` illegal UTF-16 value %04x", mod.kind, mod.toPrettyChars, u); return null; } dbuf.writeUTF8(u); @@ -1552,7 +1559,6 @@ private const(char)[] processSource (const(ubyte)[] src, Module mod) // It's UTF-8 if (buf[0] >= 0x80) { - auto loc = mod.getLoc(); .error(loc, "%s `%s` source file must start with BOM or ASCII character, not \\x%02X", mod.kind, mod.toPrettyChars, buf[0]); return null; } diff --git a/gcc/d/dmd/dsymbolsem.d b/gcc/d/dmd/dsymbolsem.d index c15d925ce0a9..bb0a1d6e2cc9 100644 --- a/gcc/d/dmd/dsymbolsem.d +++ b/gcc/d/dmd/dsymbolsem.d @@ -6916,6 +6916,103 @@ extern(C++) class ImportAllVisitor : Visitor override void visit(StaticForeachDeclaration _) {} } +/******************************* + * Load module. + * Returns: + * true for errors, false for success + */ +extern (D) bool load(Import imp, Scope* sc) +{ + // See if existing module + const errors = global.errors; + DsymbolTable dst = Package.resolve(imp.packages, null, &imp.pkg); + version (none) + { + if (pkg && pkg.isModule()) + { + .error(loc, "can only import from a module, not from a member of module `%s`. Did you mean `import %s : %s`?", pkg.toChars(), pkg.toPrettyChars(), id.toChars()); + mod = pkg.isModule(); // Error recovery - treat as import of that module + return true; + } + } + Dsymbol s = dst.lookup(imp.id); + if (s) + { + if (s.isModule()) + imp.mod = cast(Module)s; + else + { + if (s.isAliasDeclaration()) + { + .error(imp.loc, "%s `%s` conflicts with `%s`", s.kind(), s.toPrettyChars(), imp.id.toChars()); + } + else if (Package p = s.isPackage()) + { + if (p.isPkgMod == PKG.unknown) + { + uint preverrors = global.errors; + imp.mod = Module.load(imp.loc, imp.packages, imp.id); + if (!imp.mod) + p.isPkgMod = PKG.package_; + else + { + // imp.mod is a package.d, or a normal module which conflicts with the package name. + if (imp.mod.isPackageFile) + imp.mod.tag = p.tag; // reuse the same package tag + else + { + // show error if Module.load does not + if (preverrors == global.errors) + .error(imp.loc, "%s `%s` from file %s conflicts with %s `%s`", imp.mod.kind(), imp.mod.toPrettyChars(), imp.mod.srcfile.toChars, p.kind(), p.toPrettyChars()); + return true; + } + } + } + else + { + imp.mod = p.isPackageMod(); + } + if (!imp.mod) + { + .error(imp.loc, "can only import from a module, not from package `%s.%s`", p.toPrettyChars(), imp.id.toChars()); + } + } + else if (imp.pkg) + { + .error(imp.loc, "can only import from a module, not from package `%s.%s`", imp.pkg.toPrettyChars(), imp.id.toChars()); + } + else + { + .error(imp.loc, "can only import from a module, not from package `%s`", imp.id.toChars()); + } + } + } + if (!imp.mod) + { + // Load module + imp.mod = Module.load(imp.loc, imp.packages, imp.id); + if (imp.mod) + { + // imp.id may be different from mod.ident, if so then insert alias + dst.insert(imp.id, imp.mod); + } + } + if (imp.mod && !imp.mod.importedFrom) + imp.mod.importedFrom = sc ? sc._module.importedFrom : Module.rootModule; + if (!imp.pkg) + { + if (imp.mod && imp.mod.isPackageFile) + { + // one level depth package.d file (import pkg; ./pkg/package.d) + // it's necessary to use the wrapping Package already created + imp.pkg = imp.mod.pkg; + } + else + imp.pkg = imp.mod; + } + return global.errors != errors; +} + void setFieldOffset(Dsymbol d, AggregateDeclaration ad, FieldState* fieldState, bool isunion) { scope v = new SetFieldOffsetVisitor(ad, fieldState, isunion); diff --git a/gcc/d/dmd/expression.d b/gcc/d/dmd/expression.d index bc907cfd2f4e..479ad3ade5f3 100644 --- a/gcc/d/dmd/expression.d +++ b/gcc/d/dmd/expression.d @@ -314,6 +314,7 @@ extern (C++) abstract class Expression : ASTNode Type type; // !=null means that semantic() has been run Loc loc; // file location const EXP op; // to minimize use of dynamic_cast + bool parens; // if this is a parenthesized expression extern (D) this(const ref Loc loc, EXP op) scope @safe { @@ -1310,7 +1311,6 @@ extern (C++) final class ComplexExp : Expression extern (C++) class IdentifierExp : Expression { Identifier ident; - bool parens; // if it appears as (identifier) extern (D) this(const ref Loc loc, Identifier ident) scope @safe { @@ -2432,8 +2432,6 @@ extern (C++) final class CompoundLiteralExp : Expression */ extern (C++) final class TypeExp : Expression { - bool parens; // if this is a parenthesized expression - extern (D) this(const ref Loc loc, Type type) @safe { super(loc, EXP.type); diff --git a/gcc/d/dmd/expression.h b/gcc/d/dmd/expression.h index 3bd8ca7568ef..9cd73a965ba0 100644 --- a/gcc/d/dmd/expression.h +++ b/gcc/d/dmd/expression.h @@ -90,6 +90,7 @@ class Expression : public ASTNode Type *type; // !=NULL means that semantic() has been run Loc loc; // file location EXP op; // to minimize use of dynamic_cast + d_bool parens; // if this is a parenthesized expression size_t size() const; static void _init(); @@ -300,7 +301,6 @@ class IdentifierExp : public Expression { public: Identifier *ident; - d_bool parens; static IdentifierExp *create(const Loc &loc, Identifier *ident); bool isLvalue() override final; diff --git a/gcc/d/dmd/expressionsem.d b/gcc/d/dmd/expressionsem.d index cc589b991d1e..db40ae01decf 100644 --- a/gcc/d/dmd/expressionsem.d +++ b/gcc/d/dmd/expressionsem.d @@ -12357,8 +12357,16 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor return result; } - void handleCatArgument(Expressions *arguments, Expression e) + void handleCatArgument(Expressions *arguments, Expression e, Type catType, bool isRightArg) { + auto tb = e.type.toBasetype(); + + if ((isRightArg && e.parens) || (!isRightArg && !tb.equals(catType))) + { + arguments.push(e); + return; + } + if (auto ce = e.isCatExp()) { Expression lowering = ce.lowering; @@ -12388,8 +12396,8 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor arguments.push(new StringExp(exp.loc, funcname.toDString())); } - handleCatArgument(arguments, exp.e1); - handleCatArgument(arguments, exp.e2); + handleCatArgument(arguments, exp.e1, exp.type.toBasetype(), false); + handleCatArgument(arguments, exp.e2, exp.type.toBasetype(), true); Expression id = new IdentifierExp(exp.loc, Id.empty); id = new DotIdExp(exp.loc, id, Id.object); @@ -16628,3 +16636,100 @@ Expression toBoolean(Expression exp, Scope* sc) return e; } } + +/******************************************** + * Semantically analyze and then evaluate a static condition at compile time. + * This is special because short circuit operators &&, || and ?: at the top + * level are not semantically analyzed if the result of the expression is not + * necessary. + * Params: + * sc = instantiating scope + * original = original expression, for error messages + * e = resulting expression + * errors = set to `true` if errors occurred + * negatives = array to store negative clauses + * Returns: + * true if evaluates to true + */ +bool evalStaticCondition(Scope* sc, Expression original, Expression e, out bool errors, Expressions* negatives = null) +{ + if (negatives) + negatives.setDim(0); + + bool impl(Expression e) + { + if (e.isNotExp()) + { + NotExp ne = cast(NotExp)e; + return !impl(ne.e1); + } + + if (e.op == EXP.andAnd || e.op == EXP.orOr) + { + LogicalExp aae = cast(LogicalExp)e; + bool result = impl(aae.e1); + if (errors) + return false; + if (e.op == EXP.andAnd) + { + if (!result) + return false; + } + else + { + if (result) + return true; + } + result = impl(aae.e2); + return !errors && result; + } + + if (e.op == EXP.question) + { + CondExp ce = cast(CondExp)e; + bool result = impl(ce.econd); + if (errors) + return false; + Expression leg = result ? ce.e1 : ce.e2; + result = impl(leg); + return !errors && result; + } + + Expression before = e; + const uint nerrors = global.errors; + + sc = sc.startCTFE(); + sc.flags |= SCOPE.condition; + + e = e.expressionSemantic(sc); + e = resolveProperties(sc, e); + e = e.toBoolean(sc); + + sc = sc.endCTFE(); + e = e.optimize(WANTvalue); + + if (nerrors != global.errors || + e.isErrorExp() || + e.type.toBasetype() == Type.terror) + { + errors = true; + return false; + } + + e = e.ctfeInterpret(); + + const opt = e.toBool(); + if (opt.isEmpty()) + { + if (!e.type.isTypeError()) + error(e.loc, "expression `%s` is not constant", e.toChars()); + errors = true; + return false; + } + + if (negatives && !opt.get()) + negatives.push(before); + return opt.get(); + } + return impl(e); +} diff --git a/gcc/d/dmd/func.d b/gcc/d/dmd/func.d index 4881ad6c020f..7003c2b11923 100644 --- a/gcc/d/dmd/func.d +++ b/gcc/d/dmd/func.d @@ -34,12 +34,10 @@ import dmd.dmodule; import dmd.dscope; import dmd.dstruct; import dmd.dsymbol; -import dmd.dsymbolsem; import dmd.dtemplate; import dmd.errors; import dmd.escape; import dmd.expression; -import dmd.funcsem; import dmd.globals; import dmd.hdrgen; import dmd.id; @@ -57,8 +55,6 @@ import dmd.semantic2; import dmd.semantic3; import dmd.statement_rewrite_walker; import dmd.statement; -import dmd.statementsem; -import dmd.templatesem; import dmd.tokens; import dmd.typesem; import dmd.visitor; @@ -116,90 +112,6 @@ enum BUILTIN : ubyte toPrecReal } -/* Tweak all return statements and dtor call for nrvo_var, for correct NRVO. - */ -extern (C++) final class NrvoWalker : StatementRewriteWalker -{ - alias visit = typeof(super).visit; -public: - FuncDeclaration fd; - Scope* sc; - - override void visit(ReturnStatement s) - { - // See if all returns are instead to be replaced with a goto returnLabel; - if (fd.returnLabel) - { - /* Rewrite: - * return exp; - * as: - * vresult = exp; goto Lresult; - */ - auto gs = new GotoStatement(s.loc, Id.returnLabel); - gs.label = fd.returnLabel; - - Statement s1 = gs; - if (s.exp) - s1 = new CompoundStatement(s.loc, new ExpStatement(s.loc, s.exp), gs); - - replaceCurrent(s1); - } - } - - override void visit(TryFinallyStatement s) - { - DtorExpStatement des; - if (fd.isNRVO() && s.finalbody && (des = s.finalbody.isDtorExpStatement()) !is null && - fd.nrvo_var == des.var) - { - if (!(global.params.useExceptions && ClassDeclaration.throwable)) - { - /* Don't need to call destructor at all, since it is nrvo - */ - replaceCurrent(s._body); - s._body.accept(this); - return; - } - - /* Normally local variable dtors are called regardless exceptions. - * But for nrvo_var, its dtor should be called only when exception is thrown. - * - * Rewrite: - * try { s.body; } finally { nrvo_var.edtor; } - * // equivalent with: - * // s.body; scope(exit) nrvo_var.edtor; - * as: - * try { s.body; } catch(Throwable __o) { nrvo_var.edtor; throw __o; } - * // equivalent with: - * // s.body; scope(failure) nrvo_var.edtor; - */ - Statement sexception = new DtorExpStatement(Loc.initial, fd.nrvo_var.edtor, fd.nrvo_var); - Identifier id = Identifier.generateId("__o"); - - Statement handler = new PeelStatement(sexception); - if (sexception.blockExit(fd, null) & BE.fallthru) - { - auto ts = new ThrowStatement(Loc.initial, new IdentifierExp(Loc.initial, id)); - ts.internalThrow = true; - handler = new CompoundStatement(Loc.initial, handler, ts); - } - - auto catches = new Catches(); - auto ctch = new Catch(Loc.initial, getThrowable(), id, handler); - ctch.internalCatch = true; - ctch.catchSemantic(sc); // Run semantic to resolve identifier '__o' - catches.push(ctch); - - Statement s2 = new TryCatchStatement(Loc.initial, s._body, catches); - fd.hasNoEH = false; - replaceCurrent(s2); - s2.accept(this); - } - else - StatementRewriteWalker.visit(s); - } -} - private struct FUNCFLAG { bool purityInprocess; /// working on determining purity @@ -2022,44 +1934,6 @@ extern (C++) class FuncDeclaration : Declaration return f && f.nextOf() && f.nextOf().toBasetype().ty != Tvoid; } - /**************************************************** - * Declare result variable lazily. - */ - extern (D) final void buildResultVar(Scope* sc, Type tret) - { - if (!vresult) - { - Loc loc = fensure ? fensure.loc : this.loc; - - /* If inferRetType is true, tret may not be a correct return type yet. - * So, in here it may be a temporary type for vresult, and after - * fbody.dsymbolSemantic() running, vresult.type might be modified. - */ - vresult = new VarDeclaration(loc, tret, Id.result, null); - vresult.storage_class |= STC.nodtor | STC.temp; - if (!isVirtual()) - vresult.storage_class |= STC.const_; - vresult.storage_class |= STC.result; - - // set before the semantic() for checkNestedReference() - vresult.parent = this; - } - - if (sc && vresult.semanticRun == PASS.initial) - { - TypeFunction tf = type.toTypeFunction(); - if (tf.isref) - vresult.storage_class |= STC.ref_; - vresult.type = tret; - - vresult.dsymbolSemantic(sc); - - if (!sc.insert(vresult)) - .error(loc, "%s `%s` out result %s is already defined", kind, toPrettyChars, vresult.toChars()); - assert(vresult.parent == this); - } - } - /**************************************************** * Merge into this function the 'in' contracts of all it overrides. * 'in's are OR'd together, i.e. only one of them needs to pass. @@ -2681,57 +2555,6 @@ extern (C++) class FuncDeclaration : Declaration } } -/******************************************************** - * Generate Expression to call the invariant. - * Input: - * ad aggregate with the invariant - * vthis variable with 'this' - * Returns: - * void expression that calls the invariant - */ -Expression addInvariant(AggregateDeclaration ad, VarDeclaration vthis) -{ - Expression e = null; - // Call invariant directly only if it exists - FuncDeclaration inv = ad.inv; - ClassDeclaration cd = ad.isClassDeclaration(); - - while (!inv && cd) - { - cd = cd.baseClass; - if (!cd) - break; - inv = cd.inv; - } - if (inv) - { - version (all) - { - // Workaround for https://issues.dlang.org/show_bug.cgi?id=13394 - // For the correct mangling, - // run attribute inference on inv if needed. - functionSemantic(inv); - } - - //e = new DsymbolExp(Loc.initial, inv); - //e = new CallExp(Loc.initial, e); - //e = e.semantic(sc2); - - /* https://issues.dlang.org/show_bug.cgi?id=13113 - * Currently virtual invariant calls completely - * bypass attribute enforcement. - * Change the behavior of pre-invariant call by following it. - */ - e = new ThisExp(Loc.initial); - e.type = ad.type.addMod(vthis.type.mod); - e = new DotVarExp(Loc.initial, e, inv, false); - e.type = inv.type; - e = new CallExp(Loc.initial, e); - e.type = Type.tvoid; - } - return e; -} - /*************************************************** * Visit each overloaded function/template in turn, and call dg(s) on it. * Exit when no more, or dg(s) returns nonzero. @@ -2925,395 +2748,6 @@ unittest assert(mismatches.isMutable); } -/// Flag used by $(LREF resolveFuncCall). -enum FuncResolveFlag : ubyte -{ - standard = 0, /// issue error messages, solve the call. - quiet = 1, /// do not issue error message on no match, just return `null`. - overloadOnly = 2, /// only resolve overloads, i.e. do not issue error on ambiguous - /// matches and need explicit this. - ufcs = 4, /// trying to resolve UFCS call -} - -/******************************************* - * Given a symbol that could be either a FuncDeclaration or - * a function template, resolve it to a function symbol. - * Params: - * loc = instantiation location - * sc = instantiation scope - * s = instantiation symbol - * tiargs = initial list of template arguments - * tthis = if !NULL, the `this` argument type - * argumentList = arguments to function - * flags = see $(LREF FuncResolveFlag). - * Returns: - * if match is found, then function symbol, else null - */ -FuncDeclaration resolveFuncCall(const ref Loc loc, Scope* sc, Dsymbol s, - Objects* tiargs, Type tthis, ArgumentList argumentList, FuncResolveFlag flags) -{ - auto fargs = argumentList.arguments; - if (!s) - return null; // no match - - version (none) - { - printf("resolveFuncCall('%s')\n", s.toChars()); - if (tthis) - printf("\tthis: %s\n", tthis.toChars()); - if (fargs) - { - for (size_t i = 0; i < fargs.length; i++) - { - Expression arg = (*fargs)[i]; - assert(arg.type); - printf("\t%s: %s\n", arg.toChars(), arg.type.toChars()); - } - } - printf("\tfnames: %s\n", fnames ? fnames.toChars() : "null"); - } - - if (tiargs && arrayObjectIsError(*tiargs)) - return null; - if (fargs !is null) - foreach (arg; *fargs) - if (isError(arg)) - return null; - - MatchAccumulator m; - functionResolve(m, s, loc, sc, tiargs, tthis, argumentList); - auto orig_s = s; - - if (m.last > MATCH.nomatch && m.lastf) - { - if (m.count == 1) // exactly one match - { - if (!(flags & FuncResolveFlag.quiet)) - functionSemantic(m.lastf); - return m.lastf; - } - if ((flags & FuncResolveFlag.overloadOnly) && !tthis && m.lastf.needThis()) - { - return m.lastf; - } - } - - /* Failed to find a best match. - * Do nothing or print error. - */ - if (m.last == MATCH.nomatch) - { - // error was caused on matched function, not on the matching itself, - // so return the function to produce a better diagnostic - if (m.count == 1) - return m.lastf; - } - - // We are done at this point, as the rest of this function generate - // a diagnostic on invalid match - if (flags & FuncResolveFlag.quiet) - return null; - - auto fd = s.isFuncDeclaration(); - auto od = s.isOverDeclaration(); - auto td = s.isTemplateDeclaration(); - if (td && td.funcroot) - s = fd = td.funcroot; - - OutBuffer tiargsBuf; - arrayObjectsToBuffer(tiargsBuf, tiargs); - - OutBuffer fargsBuf; - fargsBuf.writeByte('('); - argExpTypesToCBuffer(fargsBuf, fargs); - fargsBuf.writeByte(')'); - if (tthis) - tthis.modToBuffer(fargsBuf); - - // The call is ambiguous - if (m.lastf && m.nextf) - { - TypeFunction tf1 = m.lastf.type.toTypeFunction(); - TypeFunction tf2 = m.nextf.type.toTypeFunction(); - const(char)* lastprms = parametersTypeToChars(tf1.parameterList); - const(char)* nextprms = parametersTypeToChars(tf2.parameterList); - - .error(loc, "`%s.%s` called with argument types `%s` matches both:\n%s: `%s%s%s`\nand:\n%s: `%s%s%s`", - s.parent.toPrettyChars(), s.ident.toChars(), - fargsBuf.peekChars(), - m.lastf.loc.toChars(), m.lastf.toPrettyChars(), lastprms, tf1.modToChars(), - m.nextf.loc.toChars(), m.nextf.toPrettyChars(), nextprms, tf2.modToChars()); - return null; - } - - // no match, generate an error messages - if (flags & FuncResolveFlag.ufcs) - { - auto arg = (*fargs)[0]; - .error(loc, "no property `%s` for `%s` of type `%s`", s.ident.toChars(), arg.toChars(), arg.type.toChars()); - .errorSupplemental(loc, "the following error occured while looking for a UFCS match"); - } - - if (!fd) - { - // all of overloads are templates - if (td) - { - if (!od && !td.overnext) - { - .error(loc, "%s `%s` is not callable using argument types `!(%s)%s`", - td.kind(), td.ident.toChars(), tiargsBuf.peekChars(), fargsBuf.peekChars()); - } - else - { - .error(loc, "none of the overloads of %s `%s.%s` are callable using argument types `!(%s)%s`", - td.kind(), td.parent.toPrettyChars(), td.ident.toChars(), - tiargsBuf.peekChars(), fargsBuf.peekChars()); - } - - - if (!global.gag || global.params.v.showGaggedErrors) - printCandidates(loc, td, sc.isDeprecated()); - return null; - } - /* This case used to happen when several ctors are mixed in an agregate. - A (bad) error message is already generated in overloadApply(). - see https://issues.dlang.org/show_bug.cgi?id=19729 - and https://issues.dlang.org/show_bug.cgi?id=17259 - */ - if (!od) - return null; - } - - if (od) - { - .error(loc, "none of the overloads of `%s` are callable using argument types `!(%s)%s`", - od.ident.toChars(), tiargsBuf.peekChars(), fargsBuf.peekChars()); - return null; - } - - // remove when deprecation period of class allocators and deallocators is over - if (fd.isNewDeclaration() && fd.checkDisabled(loc, sc)) - return null; - - bool hasOverloads = fd.overnext !is null; - auto tf = fd.type.isTypeFunction(); - // if type is an error, the original type should be there for better diagnostics - if (!tf) - tf = fd.originalType.toTypeFunction(); - - // modifier mismatch - if (tthis && (fd.isCtorDeclaration() ? - !MODimplicitConv(tf.mod, tthis.mod) : - !MODimplicitConv(tthis.mod, tf.mod))) - { - OutBuffer thisBuf, funcBuf; - MODMatchToBuffer(&thisBuf, tthis.mod, tf.mod); - auto mismatches = MODMatchToBuffer(&funcBuf, tf.mod, tthis.mod); - if (hasOverloads) - { - OutBuffer buf; - buf.argExpTypesToCBuffer(fargs); - if (fd.isCtorDeclaration()) - .error(loc, "none of the overloads of `%s` can construct a %sobject with argument types `(%s)`", - fd.toChars(), thisBuf.peekChars(), buf.peekChars()); - else - .error(loc, "none of the overloads of `%s` are callable using a %sobject with argument types `(%s)`", - fd.toChars(), thisBuf.peekChars(), buf.peekChars()); - - if (!global.gag || global.params.v.showGaggedErrors) - printCandidates(loc, fd, sc.isDeprecated()); - return null; - } - - bool calledHelper; - void errorHelper(const(char)* failMessage) scope - { - .error(loc, "%s `%s%s%s` is not callable using argument types `%s`", - fd.kind(), fd.toPrettyChars(), parametersTypeToChars(tf.parameterList), - tf.modToChars(), fargsBuf.peekChars()); - errorSupplemental(loc, failMessage); - calledHelper = true; - } - - functionResolve(m, orig_s, loc, sc, tiargs, tthis, argumentList, &errorHelper); - if (calledHelper) - return null; - - if (fd.isCtorDeclaration()) - .error(loc, "%s%s `%s` cannot construct a %sobject", - funcBuf.peekChars(), fd.kind(), fd.toPrettyChars(), thisBuf.peekChars()); - else - .error(loc, "%smethod `%s` is not callable using a %sobject", - funcBuf.peekChars(), fd.toPrettyChars(), thisBuf.peekChars()); - - if (mismatches.isNotShared) - .errorSupplemental(fd.loc, "Consider adding `shared` here"); - else if (mismatches.isMutable) - .errorSupplemental(fd.loc, "Consider adding `const` or `inout` here"); - return null; - } - - //printf("tf = %s, args = %s\n", tf.deco, (*fargs)[0].type.deco); - if (hasOverloads) - { - .error(loc, "none of the overloads of `%s` are callable using argument types `%s`", - fd.toChars(), fargsBuf.peekChars()); - if (!global.gag || global.params.v.showGaggedErrors) - printCandidates(loc, fd, sc.isDeprecated()); - return null; - } - - .error(loc, "%s `%s%s%s` is not callable using argument types `%s`", - fd.kind(), fd.toPrettyChars(), parametersTypeToChars(tf.parameterList), - tf.modToChars(), fargsBuf.peekChars()); - - // re-resolve to check for supplemental message - if (!global.gag || global.params.v.showGaggedErrors) - { - if (tthis) - { - if (auto classType = tthis.isTypeClass()) - { - if (auto baseClass = classType.sym.baseClass) - { - if (auto baseFunction = baseClass.search(baseClass.loc, fd.ident)) - { - MatchAccumulator mErr; - functionResolve(mErr, baseFunction, loc, sc, tiargs, baseClass.type, argumentList); - if (mErr.last > MATCH.nomatch && mErr.lastf) - { - errorSupplemental(loc, "%s `%s` hides base class function `%s`", - fd.kind, fd.toPrettyChars(), mErr.lastf.toPrettyChars()); - errorSupplemental(loc, "add `alias %s = %s` to `%s`'s body to merge the overload sets", - fd.toChars(), mErr.lastf.toPrettyChars(), tthis.toChars()); - return null; - } - } - } - } - } - - void errorHelper2(const(char)* failMessage) scope - { - errorSupplemental(loc, failMessage); - } - - functionResolve(m, orig_s, loc, sc, tiargs, tthis, argumentList, &errorHelper2); - } - return null; -} - -/******************************************* - * Prints template and function overload candidates as supplemental errors. - * Params: - * loc = instantiation location - * declaration = the declaration to print overload candidates for - * showDeprecated = If `false`, `deprecated` function won't be shown - */ -private void printCandidates(Decl)(const ref Loc loc, Decl declaration, bool showDeprecated) -if (is(Decl == TemplateDeclaration) || is(Decl == FuncDeclaration)) -{ - // max num of overloads to print (-v or -verror-supplements overrides this). - const uint DisplayLimit = global.params.v.errorSupplementCount(); - const(char)* constraintsTip; - // determine if the first candidate was printed - int printed; - - bool matchSymbol(Dsymbol s, bool print, bool single_candidate = false) - { - if (auto fd = s.isFuncDeclaration()) - { - // Don't print overloads which have errors. - // Not that if the whole overload set has errors, we'll never reach - // this point so there's no risk of printing no candidate - if (fd.errors || fd.type.ty == Terror) - return false; - // Don't print disabled functions, or `deprecated` outside of deprecated scope - if (fd.storage_class & STC.disable || (fd.isDeprecated() && !showDeprecated)) - return false; - if (!print) - return true; - auto tf = cast(TypeFunction) fd.type; - OutBuffer buf; - buf.writestring(fd.toPrettyChars()); - buf.writestring(parametersTypeToChars(tf.parameterList)); - if (tf.mod) - { - buf.writeByte(' '); - buf.MODtoBuffer(tf.mod); - } - .errorSupplemental(fd.loc, - printed ? " `%s`" : - single_candidate ? "Candidate is: `%s`" : "Candidates are: `%s`", buf.peekChars()); - } - else if (auto td = s.isTemplateDeclaration()) - { - import dmd.staticcond; - - if (!print) - return true; - OutBuffer buf; - HdrGenState hgs; - hgs.skipConstraints = true; - toCharsMaybeConstraints(td, buf, hgs); - const tmsg = buf.peekChars(); - const cmsg = td.getConstraintEvalError(constraintsTip); - - // add blank space if there are multiple candidates - // the length of the blank space is `strlen("Candidates are: ")` - - if (cmsg) - { - .errorSupplemental(td.loc, - printed ? " `%s`\n%s" : - single_candidate ? "Candidate is: `%s`\n%s" : "Candidates are: `%s`\n%s", - tmsg, cmsg); - } - else - { - .errorSupplemental(td.loc, - printed ? " `%s`" : - single_candidate ? "Candidate is: `%s`" : "Candidates are: `%s`", - tmsg); - } - } - return true; - } - // determine if there's > 1 candidate - int count = 0; - overloadApply(declaration, (s) { - if (matchSymbol(s, false)) - count++; - return count > 1; - }); - int skipped = 0; - overloadApply(declaration, (s) { - if (global.params.v.verbose || printed < DisplayLimit) - { - if (matchSymbol(s, true, count == 1)) - printed++; - } - else - { - // Too many overloads to sensibly display. - // Just show count of remaining overloads. - if (matchSymbol(s, false)) - skipped++; - } - return 0; - }); - if (skipped > 0) - .errorSupplemental(loc, "... (%d more, -v to show) ...", skipped); - - // Nothing was displayed, all overloads are either disabled or deprecated - if (!printed) - .errorSupplemental(loc, "All possible candidates are marked as `deprecated` or `@disable`"); - // should be only in verbose mode - if (constraintsTip) - .tip(constraintsTip); -} - /************************************** * Returns an indirect type one step from t. */ @@ -4336,9 +3770,9 @@ bool setUnsafePreview(Scope* sc, FeatureState fs, bool gag, Loc loc, const(char) return false; if (sc.func.isSafeBypassingInference()) { - if (!gag) + if (!gag && !sc.isDeprecated()) { - warning(loc, msg, arg0 ? arg0.toChars() : "", arg1 ? arg1.toChars() : "", arg2 ? arg2.toChars() : ""); + deprecation(loc, msg, arg0 ? arg0.toChars() : "", arg1 ? arg1.toChars() : "", arg2 ? arg2.toChars() : ""); } } else if (!sc.func.safetyViolation) diff --git a/gcc/d/dmd/funcsem.d b/gcc/d/dmd/funcsem.d index 49da6b201367..2cadc4019110 100644 --- a/gcc/d/dmd/funcsem.d +++ b/gcc/d/dmd/funcsem.d @@ -60,10 +60,95 @@ import dmd.statement_rewrite_walker; import dmd.statement; import dmd.statementsem; import dmd.target; +import dmd.templatesem; import dmd.tokens; import dmd.typesem; import dmd.visitor; +/* Tweak all return statements and dtor call for nrvo_var, for correct NRVO. + */ +extern (C++) final class NrvoWalker : StatementRewriteWalker +{ + alias visit = typeof(super).visit; +public: + FuncDeclaration fd; + Scope* sc; + + override void visit(ReturnStatement s) + { + // See if all returns are instead to be replaced with a goto returnLabel; + if (fd.returnLabel) + { + /* Rewrite: + * return exp; + * as: + * vresult = exp; goto Lresult; + */ + auto gs = new GotoStatement(s.loc, Id.returnLabel); + gs.label = fd.returnLabel; + + Statement s1 = gs; + if (s.exp) + s1 = new CompoundStatement(s.loc, new ExpStatement(s.loc, s.exp), gs); + + replaceCurrent(s1); + } + } + + override void visit(TryFinallyStatement s) + { + DtorExpStatement des; + if (fd.isNRVO() && s.finalbody && (des = s.finalbody.isDtorExpStatement()) !is null && + fd.nrvo_var == des.var) + { + if (!(global.params.useExceptions && ClassDeclaration.throwable)) + { + /* Don't need to call destructor at all, since it is nrvo + */ + replaceCurrent(s._body); + s._body.accept(this); + return; + } + + /* Normally local variable dtors are called regardless exceptions. + * But for nrvo_var, its dtor should be called only when exception is thrown. + * + * Rewrite: + * try { s.body; } finally { nrvo_var.edtor; } + * // equivalent with: + * // s.body; scope(exit) nrvo_var.edtor; + * as: + * try { s.body; } catch(Throwable __o) { nrvo_var.edtor; throw __o; } + * // equivalent with: + * // s.body; scope(failure) nrvo_var.edtor; + */ + Statement sexception = new DtorExpStatement(Loc.initial, fd.nrvo_var.edtor, fd.nrvo_var); + Identifier id = Identifier.generateId("__o"); + + Statement handler = new PeelStatement(sexception); + if (sexception.blockExit(fd, null) & BE.fallthru) + { + auto ts = new ThrowStatement(Loc.initial, new IdentifierExp(Loc.initial, id)); + ts.internalThrow = true; + handler = new CompoundStatement(Loc.initial, handler, ts); + } + + auto catches = new Catches(); + auto ctch = new Catch(Loc.initial, getThrowable(), id, handler); + ctch.internalCatch = true; + ctch.catchSemantic(sc); // Run semantic to resolve identifier '__o' + catches.push(ctch); + + Statement s2 = new TryCatchStatement(Loc.initial, s._body, catches); + fd.hasNoEH = false; + replaceCurrent(s2); + s2.accept(this); + } + else + StatementRewriteWalker.visit(s); + } +} + /********************************** * Main semantic routine for functions. */ @@ -1365,3 +1450,476 @@ BaseClass* overrideInterface(FuncDeclaration fd) } return null; } + +/// Flag used by $(LREF resolveFuncCall). +enum FuncResolveFlag : ubyte +{ + standard = 0, /// issue error messages, solve the call. + quiet = 1, /// do not issue error message on no match, just return `null`. + overloadOnly = 2, /// only resolve overloads, i.e. do not issue error on ambiguous + /// matches and need explicit this. + ufcs = 4, /// trying to resolve UFCS call +} + +/******************************************* + * Given a symbol that could be either a FuncDeclaration or + * a function template, resolve it to a function symbol. + * Params: + * loc = instantiation location + * sc = instantiation scope + * s = instantiation symbol + * tiargs = initial list of template arguments + * tthis = if !NULL, the `this` argument type + * argumentList = arguments to function + * flags = see $(LREF FuncResolveFlag). + * Returns: + * if match is found, then function symbol, else null + */ +FuncDeclaration resolveFuncCall(const ref Loc loc, Scope* sc, Dsymbol s, + Objects* tiargs, Type tthis, ArgumentList argumentList, FuncResolveFlag flags) +{ + auto fargs = argumentList.arguments; + if (!s) + return null; // no match + + version (none) + { + printf("resolveFuncCall('%s')\n", s.toChars()); + if (tthis) + printf("\tthis: %s\n", tthis.toChars()); + if (fargs) + { + for (size_t i = 0; i < fargs.length; i++) + { + Expression arg = (*fargs)[i]; + assert(arg.type); + printf("\t%s: %s\n", arg.toChars(), arg.type.toChars()); + } + } + printf("\tfnames: %s\n", fnames ? fnames.toChars() : "null"); + } + + if (tiargs && arrayObjectIsError(*tiargs)) + return null; + if (fargs !is null) + foreach (arg; *fargs) + if (isError(arg)) + return null; + + MatchAccumulator m; + functionResolve(m, s, loc, sc, tiargs, tthis, argumentList); + auto orig_s = s; + + if (m.last > MATCH.nomatch && m.lastf) + { + if (m.count == 1) // exactly one match + { + if (!(flags & FuncResolveFlag.quiet)) + functionSemantic(m.lastf); + return m.lastf; + } + if ((flags & FuncResolveFlag.overloadOnly) && !tthis && m.lastf.needThis()) + { + return m.lastf; + } + } + + /* Failed to find a best match. + * Do nothing or print error. + */ + if (m.last == MATCH.nomatch) + { + // error was caused on matched function, not on the matching itself, + // so return the function to produce a better diagnostic + if (m.count == 1) + return m.lastf; + } + + // We are done at this point, as the rest of this function generate + // a diagnostic on invalid match + if (flags & FuncResolveFlag.quiet) + return null; + + auto fd = s.isFuncDeclaration(); + auto od = s.isOverDeclaration(); + auto td = s.isTemplateDeclaration(); + if (td && td.funcroot) + s = fd = td.funcroot; + + OutBuffer tiargsBuf; + arrayObjectsToBuffer(tiargsBuf, tiargs); + + OutBuffer fargsBuf; + fargsBuf.writeByte('('); + argExpTypesToCBuffer(fargsBuf, fargs); + fargsBuf.writeByte(')'); + if (tthis) + tthis.modToBuffer(fargsBuf); + + // The call is ambiguous + if (m.lastf && m.nextf) + { + TypeFunction tf1 = m.lastf.type.toTypeFunction(); + TypeFunction tf2 = m.nextf.type.toTypeFunction(); + const(char)* lastprms = parametersTypeToChars(tf1.parameterList); + const(char)* nextprms = parametersTypeToChars(tf2.parameterList); + + .error(loc, "`%s.%s` called with argument types `%s` matches both:\n%s: `%s%s%s`\nand:\n%s: `%s%s%s`", + s.parent.toPrettyChars(), s.ident.toChars(), + fargsBuf.peekChars(), + m.lastf.loc.toChars(), m.lastf.toPrettyChars(), lastprms, tf1.modToChars(), + m.nextf.loc.toChars(), m.nextf.toPrettyChars(), nextprms, tf2.modToChars()); + return null; + } + + // no match, generate an error messages + if (flags & FuncResolveFlag.ufcs) + { + auto arg = (*fargs)[0]; + .error(loc, "no property `%s` for `%s` of type `%s`", s.ident.toChars(), arg.toChars(), arg.type.toChars()); + .errorSupplemental(loc, "the following error occured while looking for a UFCS match"); + } + + if (!fd) + { + // all of overloads are templates + if (td) + { + if (!od && !td.overnext) + { + .error(loc, "%s `%s` is not callable using argument types `!(%s)%s`", + td.kind(), td.ident.toChars(), tiargsBuf.peekChars(), fargsBuf.peekChars()); + } + else + { + .error(loc, "none of the overloads of %s `%s.%s` are callable using argument types `!(%s)%s`", + td.kind(), td.parent.toPrettyChars(), td.ident.toChars(), + tiargsBuf.peekChars(), fargsBuf.peekChars()); + } + + + if (!global.gag || global.params.v.showGaggedErrors) + printCandidates(loc, td, sc.isDeprecated()); + return null; + } + /* This case used to happen when several ctors are mixed in an agregate. + A (bad) error message is already generated in overloadApply(). + see https://issues.dlang.org/show_bug.cgi?id=19729 + and https://issues.dlang.org/show_bug.cgi?id=17259 + */ + if (!od) + return null; + } + + if (od) + { + .error(loc, "none of the overloads of `%s` are callable using argument types `!(%s)%s`", + od.ident.toChars(), tiargsBuf.peekChars(), fargsBuf.peekChars()); + return null; + } + + // remove when deprecation period of class allocators and deallocators is over + if (fd.isNewDeclaration() && fd.checkDisabled(loc, sc)) + return null; + + bool hasOverloads = fd.overnext !is null; + auto tf = fd.type.isTypeFunction(); + // if type is an error, the original type should be there for better diagnostics + if (!tf) + tf = fd.originalType.toTypeFunction(); + + // modifier mismatch + if (tthis && (fd.isCtorDeclaration() ? + !MODimplicitConv(tf.mod, tthis.mod) : + !MODimplicitConv(tthis.mod, tf.mod))) + { + OutBuffer thisBuf, funcBuf; + MODMatchToBuffer(&thisBuf, tthis.mod, tf.mod); + auto mismatches = MODMatchToBuffer(&funcBuf, tf.mod, tthis.mod); + if (hasOverloads) + { + OutBuffer buf; + buf.argExpTypesToCBuffer(fargs); + if (fd.isCtorDeclaration()) + .error(loc, "none of the overloads of `%s` can construct a %sobject with argument types `(%s)`", + fd.toChars(), thisBuf.peekChars(), buf.peekChars()); + else + .error(loc, "none of the overloads of `%s` are callable using a %sobject with argument types `(%s)`", + fd.toChars(), thisBuf.peekChars(), buf.peekChars()); + + if (!global.gag || global.params.v.showGaggedErrors) + printCandidates(loc, fd, sc.isDeprecated()); + return null; + } + + bool calledHelper; + void errorHelper(const(char)* failMessage) scope + { + .error(loc, "%s `%s%s%s` is not callable using argument types `%s`", + fd.kind(), fd.toPrettyChars(), parametersTypeToChars(tf.parameterList), + tf.modToChars(), fargsBuf.peekChars()); + errorSupplemental(loc, failMessage); + calledHelper = true; + } + + functionResolve(m, orig_s, loc, sc, tiargs, tthis, argumentList, &errorHelper); + if (calledHelper) + return null; + + if (fd.isCtorDeclaration()) + .error(loc, "%s%s `%s` cannot construct a %sobject", + funcBuf.peekChars(), fd.kind(), fd.toPrettyChars(), thisBuf.peekChars()); + else + .error(loc, "%smethod `%s` is not callable using a %sobject", + funcBuf.peekChars(), fd.toPrettyChars(), thisBuf.peekChars()); + + if (mismatches.isNotShared) + .errorSupplemental(fd.loc, "Consider adding `shared` here"); + else if (mismatches.isMutable) + .errorSupplemental(fd.loc, "Consider adding `const` or `inout` here"); + return null; + } + + //printf("tf = %s, args = %s\n", tf.deco, (*fargs)[0].type.deco); + if (hasOverloads) + { + .error(loc, "none of the overloads of `%s` are callable using argument types `%s`", + fd.toChars(), fargsBuf.peekChars()); + if (!global.gag || global.params.v.showGaggedErrors) + printCandidates(loc, fd, sc.isDeprecated()); + return null; + } + + .error(loc, "%s `%s%s%s` is not callable using argument types `%s`", + fd.kind(), fd.toPrettyChars(), parametersTypeToChars(tf.parameterList), + tf.modToChars(), fargsBuf.peekChars()); + + // re-resolve to check for supplemental message + if (!global.gag || global.params.v.showGaggedErrors) + { + if (tthis) + { + if (auto classType = tthis.isTypeClass()) + { + if (auto baseClass = classType.sym.baseClass) + { + if (auto baseFunction = baseClass.search(baseClass.loc, fd.ident)) + { + MatchAccumulator mErr; + functionResolve(mErr, baseFunction, loc, sc, tiargs, baseClass.type, argumentList); + if (mErr.last > MATCH.nomatch && mErr.lastf) + { + errorSupplemental(loc, "%s `%s` hides base class function `%s`", + fd.kind, fd.toPrettyChars(), mErr.lastf.toPrettyChars()); + errorSupplemental(loc, "add `alias %s = %s` to `%s`'s body to merge the overload sets", + fd.toChars(), mErr.lastf.toPrettyChars(), tthis.toChars()); + return null; + } + } + } + } + } + + void errorHelper2(const(char)* failMessage) scope + { + errorSupplemental(loc, failMessage); + } + + functionResolve(m, orig_s, loc, sc, tiargs, tthis, argumentList, &errorHelper2); + } + return null; +} + +/******************************************* + * Prints template and function overload candidates as supplemental errors. + * Params: + * loc = instantiation location + * declaration = the declaration to print overload candidates for + * showDeprecated = If `false`, `deprecated` function won't be shown + */ +private void printCandidates(Decl)(const ref Loc loc, Decl declaration, bool showDeprecated) +if (is(Decl == TemplateDeclaration) || is(Decl == FuncDeclaration)) +{ + // max num of overloads to print (-v or -verror-supplements overrides this). + const uint DisplayLimit = global.params.v.errorSupplementCount(); + const(char)* constraintsTip; + // determine if the first candidate was printed + int printed; + + bool matchSymbol(Dsymbol s, bool print, bool single_candidate = false) + { + if (auto fd = s.isFuncDeclaration()) + { + // Don't print overloads which have errors. + // Not that if the whole overload set has errors, we'll never reach + // this point so there's no risk of printing no candidate + if (fd.errors || fd.type.ty == Terror) + return false; + // Don't print disabled functions, or `deprecated` outside of deprecated scope + if (fd.storage_class & STC.disable || (fd.isDeprecated() && !showDeprecated)) + return false; + if (!print) + return true; + auto tf = cast(TypeFunction) fd.type; + OutBuffer buf; + buf.writestring(fd.toPrettyChars()); + buf.writestring(parametersTypeToChars(tf.parameterList)); + if (tf.mod) + { + buf.writeByte(' '); + buf.MODtoBuffer(tf.mod); + } + .errorSupplemental(fd.loc, + printed ? " `%s`" : + single_candidate ? "Candidate is: `%s`" : "Candidates are: `%s`", buf.peekChars()); + } + else if (auto td = s.isTemplateDeclaration()) + { + import dmd.staticcond; + + if (!print) + return true; + OutBuffer buf; + HdrGenState hgs; + hgs.skipConstraints = true; + toCharsMaybeConstraints(td, buf, hgs); + const tmsg = buf.peekChars(); + const cmsg = td.getConstraintEvalError(constraintsTip); + + // add blank space if there are multiple candidates + // the length of the blank space is `strlen("Candidates are: ")` + + if (cmsg) + { + .errorSupplemental(td.loc, + printed ? " `%s`\n%s" : + single_candidate ? "Candidate is: `%s`\n%s" : "Candidates are: `%s`\n%s", + tmsg, cmsg); + } + else + { + .errorSupplemental(td.loc, + printed ? " `%s`" : + single_candidate ? "Candidate is: `%s`" : "Candidates are: `%s`", + tmsg); + } + } + return true; + } + // determine if there's > 1 candidate + int count = 0; + overloadApply(declaration, (s) { + if (matchSymbol(s, false)) + count++; + return count > 1; + }); + int skipped = 0; + overloadApply(declaration, (s) { + if (global.params.v.verbose || printed < DisplayLimit) + { + if (matchSymbol(s, true, count == 1)) + printed++; + } + else + { + // Too many overloads to sensibly display. + // Just show count of remaining overloads. + if (matchSymbol(s, false)) + skipped++; + } + return 0; + }); + if (skipped > 0) + .errorSupplemental(loc, "... (%d more, -v to show) ...", skipped); + + // Nothing was displayed, all overloads are either disabled or deprecated + if (!printed) + .errorSupplemental(loc, "All possible candidates are marked as `deprecated` or `@disable`"); + // should be only in verbose mode + if (constraintsTip) + .tip(constraintsTip); +} + +/******************************************************** + * Generate Expression to call the invariant. + * Input: + * ad aggregate with the invariant + * vthis variable with 'this' + * Returns: + * void expression that calls the invariant + */ +Expression addInvariant(AggregateDeclaration ad, VarDeclaration vthis) +{ + Expression e = null; + // Call invariant directly only if it exists + FuncDeclaration inv = ad.inv; + ClassDeclaration cd = ad.isClassDeclaration(); + + while (!inv && cd) + { + cd = cd.baseClass; + if (!cd) + break; + inv = cd.inv; + } + if (inv) + { + version (all) + { + // Workaround for https://issues.dlang.org/show_bug.cgi?id=13394 + // For the correct mangling, + // run attribute inference on inv if needed. + functionSemantic(inv); + } + + //e = new DsymbolExp(Loc.initial, inv); + //e = new CallExp(Loc.initial, e); + //e = e.semantic(sc2); + + /* https://issues.dlang.org/show_bug.cgi?id=13113 + * Currently virtual invariant calls completely + * bypass attribute enforcement. + * Change the behavior of pre-invariant call by following it. + */ + e = new ThisExp(Loc.initial); + e.type = ad.type.addMod(vthis.type.mod); + e = new DotVarExp(Loc.initial, e, inv, false); + e.type = inv.type; + e = new CallExp(Loc.initial, e); + e.type = Type.tvoid; + } + return e; +} + +/**************************************************** + * Declare result variable lazily. + */ +void buildResultVar(FuncDeclaration fd, Scope* sc, Type tret) +{ + if (!fd.vresult) + { + Loc loc = fd.fensure ? fd.fensure.loc : fd.loc; + /* If inferRetType is true, tret may not be a correct return type yet. + * So, in here it may be a temporary type for vresult, and after + * fbody.dsymbolSemantic() running, vresult.type might be modified. + */ + fd.vresult = new VarDeclaration(loc, tret, Id.result, null); + fd.vresult.storage_class |= STC.nodtor | STC.temp; + if (!fd.isVirtual()) + fd.vresult.storage_class |= STC.const_; + fd.vresult.storage_class |= STC.result; + // set before the semantic() for checkNestedReference() + fd.vresult.parent = fd; + } + if (sc && fd.vresult.semanticRun == PASS.initial) + { + TypeFunction tf = fd.type.toTypeFunction(); + if (tf.isref) + fd.vresult.storage_class |= STC.ref_; + fd.vresult.type = tret; + fd.vresult.dsymbolSemantic(sc); + if (!sc.insert(fd.vresult)) + .error(fd.loc, "%s `%s` out result %s is already defined", fd.kind, fd.toPrettyChars, fd.vresult.toChars()); + assert(fd.vresult.parent == fd); + } +} diff --git a/gcc/d/dmd/identifier.h b/gcc/d/dmd/identifier.h index afd3664bfa89..4f26801356e7 100644 --- a/gcc/d/dmd/identifier.h +++ b/gcc/d/dmd/identifier.h @@ -11,7 +11,7 @@ #pragma once #include "root/dcompat.h" -#include "root/object.h" +#include "rootobject.h" class Identifier final : public RootObject { diff --git a/gcc/d/dmd/importc.d b/gcc/d/dmd/importc.d index e4d5aa2cae1d..ece56c8d1bcd 100644 --- a/gcc/d/dmd/importc.d +++ b/gcc/d/dmd/importc.d @@ -243,16 +243,15 @@ Expression castCallAmbiguity(Expression e, Scope* sc) case EXP.call: auto ce = (*pe).isCallExp(); - auto ie = ce.e1.isIdentifierExp(); - if (ie && ie.parens) + if (ce.e1.parens) { - ce.e1 = expressionSemantic(ie, sc); + ce.e1 = expressionSemantic(ce.e1, sc); if (ce.e1.op == EXP.type) { const numArgs = ce.arguments ? ce.arguments.length : 0; if (numArgs >= 1) { - ie.parens = false; + ce.e1.parens = false; Expression arg; foreach (a; (*ce.arguments)[]) { diff --git a/gcc/d/dmd/location.d b/gcc/d/dmd/location.d index d71ea588c917..ca6805ee0b68 100644 --- a/gcc/d/dmd/location.d +++ b/gcc/d/dmd/location.d @@ -115,15 +115,7 @@ nothrow: //printf("setting %s\n", name); filenames.push(name); fileIndex = cast(uint)filenames.length; - if (!fileIndex) - { - import dmd.globals : global; - import dmd.errors : error, fatal; - - global.gag = 0; // ensure error message gets printed - error(Loc.initial, "internal compiler error: file name index overflow!"); - fatal(); - } + assert(fileIndex, "internal compiler error: file name index overflow"); } else fileIndex = 0; diff --git a/gcc/d/dmd/mtype.d b/gcc/d/dmd/mtype.d index 09ed630fe8ba..2c9e058bf325 100644 --- a/gcc/d/dmd/mtype.d +++ b/gcc/d/dmd/mtype.d @@ -30,7 +30,6 @@ import dmd.dtemplate; import dmd.enumsem; import dmd.errors; import dmd.expression; -import dmd.func; import dmd.funcsem; import dmd.globals; import dmd.hdrgen; @@ -1186,110 +1185,12 @@ extern (C++) abstract class Type : ASTNode return t; } - final Type arrayOf() - { - if (ty == Terror) - return this; - if (!arrayof) - { - Type t = new TypeDArray(this); - arrayof = t.merge(); - } - return arrayof; - } - - // Make corresponding static array type without semantic - final Type sarrayOf(dinteger_t dim) - { - assert(deco); - Type t = new TypeSArray(this, new IntegerExp(Loc.initial, dim, Type.tsize_t)); - // according to TypeSArray::semantic() - t = t.addMod(mod); - t = t.merge(); - return t; - } - final bool hasDeprecatedAliasThis() { auto ad = isAggregate(this); return ad && ad.aliasthis && (ad.aliasthis.isDeprecated || ad.aliasthis.sym.isDeprecated); } - final Type aliasthisOf() - { - auto ad = isAggregate(this); - if (!ad || !ad.aliasthis) - return null; - - auto s = ad.aliasthis.sym; - if (s.isAliasDeclaration()) - s = s.toAlias(); - - if (s.isTupleDeclaration()) - return null; - - if (auto vd = s.isVarDeclaration()) - { - auto t = vd.type; - if (vd.needThis()) - t = t.addMod(this.mod); - return t; - } - Dsymbol callable = s.isFuncDeclaration(); - callable = callable ? callable : s.isTemplateDeclaration(); - if (callable) - { - auto fd = resolveFuncCall(Loc.initial, null, callable, null, this, ArgumentList(), FuncResolveFlag.quiet); - if (!fd || fd.errors || !functionSemantic(fd)) - return Type.terror; - - auto t = fd.type.nextOf(); - if (!t) // https://issues.dlang.org/show_bug.cgi?id=14185 - return Type.terror; - t = t.substWildTo(mod == 0 ? MODFlags.mutable : mod); - return t; - } - if (auto d = s.isDeclaration()) - { - assert(d.type); - return d.type; - } - if (auto ed = s.isEnumDeclaration()) - { - return ed.type; - } - - //printf("%s\n", s.kind()); - return null; - } - - /** - * Check whether this type has endless `alias this` recursion. - * Returns: - * `true` if this type has an `alias this` that can be implicitly - * converted back to this type itself. - */ - extern (D) final bool checkAliasThisRec() - { - Type tb = toBasetype(); - AliasThisRec* pflag; - if (tb.ty == Tstruct) - pflag = &(cast(TypeStruct)tb).att; - else if (tb.ty == Tclass) - pflag = &(cast(TypeClass)tb).att; - else - return false; - - AliasThisRec flag = cast(AliasThisRec)(*pflag & AliasThisRec.typeMask); - if (flag == AliasThisRec.fwdref) - { - Type att = aliasthisOf(); - flag = att && att.implicitConvTo(this) ? AliasThisRec.yes : AliasThisRec.no; - } - *pflag = cast(AliasThisRec)(flag | (*pflag & ~AliasThisRec.typeMask)); - return flag == AliasThisRec.yes; - } - Type makeConst() { //printf("Type::makeConst() %p, %s\n", this, toChars()); @@ -1452,129 +1353,6 @@ extern (C++) abstract class Type : ASTNode return 0; } - Type substWildTo(uint mod) - { - //printf("+Type::substWildTo this = %s, mod = x%x\n", toChars(), mod); - Type t; - - if (Type tn = nextOf()) - { - // substitution has no effect on function pointer type. - if (ty == Tpointer && tn.ty == Tfunction) - { - t = this; - goto L1; - } - - t = tn.substWildTo(mod); - if (t == tn) - t = this; - else - { - if (ty == Tpointer) - t = t.pointerTo(); - else if (ty == Tarray) - t = t.arrayOf(); - else if (ty == Tsarray) - t = new TypeSArray(t, (cast(TypeSArray)this).dim.syntaxCopy()); - else if (ty == Taarray) - { - t = new TypeAArray(t, (cast(TypeAArray)this).index.syntaxCopy()); - } - else if (ty == Tdelegate) - { - t = new TypeDelegate(t.isTypeFunction()); - } - else - assert(0); - - t = t.merge(); - } - } - else - t = this; - - L1: - if (isWild()) - { - if (mod == MODFlags.immutable_) - { - t = t.immutableOf(); - } - else if (mod == MODFlags.wildconst) - { - t = t.wildConstOf(); - } - else if (mod == MODFlags.wild) - { - if (isWildConst()) - t = t.wildConstOf(); - else - t = t.wildOf(); - } - else if (mod == MODFlags.const_) - { - t = t.constOf(); - } - else - { - if (isWildConst()) - t = t.constOf(); - else - t = t.mutableOf(); - } - } - if (isConst()) - t = t.addMod(MODFlags.const_); - if (isShared()) - t = t.addMod(MODFlags.shared_); - - //printf("-Type::substWildTo t = %s\n", t.toChars()); - return t; - } - - final Type unqualify(uint m) - { - Type t = this.mutableOf().unSharedOf(); - - Type tn = ty == Tenum ? null : nextOf(); - if (tn && tn.ty != Tfunction) - { - Type utn = tn.unqualify(m); - if (utn != tn) - { - if (ty == Tpointer) - t = utn.pointerTo(); - else if (ty == Tarray) - t = utn.arrayOf(); - else if (ty == Tsarray) - t = new TypeSArray(utn, (cast(TypeSArray)this).dim); - else if (ty == Taarray) - { - t = new TypeAArray(utn, (cast(TypeAArray)this).index); - } - else - assert(0); - - t = t.merge(); - } - } - t = t.addMod(mod & ~m); - return t; - } - - /************************** - * Return type with the top level of it being mutable. - */ - inout(Type) toHeadMutable() inout - { - if (!mod) - return this; - Type unqualThis = cast(Type) this; - // `mutableOf` needs a mutable `this` only for caching - return cast(inout(Type)) unqualThis.mutableOf(); - } - inout(ClassDeclaration) isClassHandle() inout { return null; @@ -3397,55 +3175,6 @@ extern (C++) final class TypeFunction : TypeNext return linkage == LINK.d && parameterList.varargs == VarArg.variadic; } - override Type substWildTo(uint) - { - if (!iswild && !(mod & MODFlags.wild)) - return this; - - // Substitude inout qualifier of function type to mutable or immutable - // would break type system. Instead substitude inout to the most weak - // qualifer - const. - uint m = MODFlags.const_; - - assert(next); - Type tret = next.substWildTo(m); - Parameters* params = parameterList.parameters; - if (mod & MODFlags.wild) - params = parameterList.parameters.copy(); - for (size_t i = 0; i < params.length; i++) - { - Parameter p = (*params)[i]; - Type t = p.type.substWildTo(m); - if (t == p.type) - continue; - if (params == parameterList.parameters) - params = parameterList.parameters.copy(); - (*params)[i] = new Parameter(p.loc, p.storageClass, t, null, null, null); - } - if (next == tret && params == parameterList.parameters) - return this; - - // Similar to TypeFunction::syntaxCopy; - auto t = new TypeFunction(ParameterList(params, parameterList.varargs), tret, linkage); - t.mod = ((mod & MODFlags.wild) ? (mod & ~MODFlags.wild) | MODFlags.const_ : mod); - t.isnothrow = isnothrow; - t.isnogc = isnogc; - t.purity = purity; - t.isproperty = isproperty; - t.isref = isref; - t.isreturn = isreturn; - t.isreturnscope = isreturnscope; - t.isScopeQual = isScopeQual; - t.isreturninferred = isreturninferred; - t.isscopeinferred = isscopeinferred; - t.isInOutParam = false; - t.isInOutQual = false; - t.trust = trust; - t.fargs = fargs; - t.isctor = isctor; - return t.merge(); - } - extern(D) static const(char)* getMatchError(A...)(const(char)* format, A args) { if (global.gag && !global.params.v.showGaggedErrors) @@ -4317,7 +4046,7 @@ extern (C++) final class TypeStruct : Type MATCH m; if (!(ty == to.ty && sym == (cast(TypeStruct)to).sym) && sym.aliasthis && !(att & AliasThisRec.tracing)) { - if (auto ato = aliasthisOf()) + if (auto ato = aliasthisOf(this)) { att = cast(AliasThisRec)(att | AliasThisRec.tracing); m = ato.implicitConvTo(to); @@ -4354,7 +4083,7 @@ extern (C++) final class TypeStruct : Type if (t.hasWild() && sym.aliasthis && !(att & AliasThisRec.tracing)) { - if (auto ato = aliasthisOf()) + if (auto ato = aliasthisOf(this)) { att = cast(AliasThisRec)(att | AliasThisRec.tracing); wm = ato.deduceWild(t, isRef); @@ -4365,11 +4094,6 @@ extern (C++) final class TypeStruct : Type return wm; } - override inout(Type) toHeadMutable() inout - { - return this; - } - override void accept(Visitor v) { v.visit(this); @@ -4596,7 +4320,7 @@ extern (C++) final class TypeClass : Type MATCH m; if (sym.aliasthis && !(att & AliasThisRec.tracing)) { - if (auto ato = aliasthisOf()) + if (auto ato = aliasthisOf(this)) { att = cast(AliasThisRec)(att | AliasThisRec.tracing); m = ato.implicitConvTo(to); @@ -4645,7 +4369,7 @@ extern (C++) final class TypeClass : Type if (t.hasWild() && sym.aliasthis && !(att & AliasThisRec.tracing)) { - if (auto ato = aliasthisOf()) + if (auto ato = aliasthisOf(this)) { att = cast(AliasThisRec)(att | AliasThisRec.tracing); wm = ato.deduceWild(t, isRef); @@ -4656,11 +4380,6 @@ extern (C++) final class TypeClass : Type return wm; } - override inout(Type) toHeadMutable() inout - { - return this; - } - override bool isZeroInit(const ref Loc loc) { return true; @@ -5853,36 +5572,3 @@ TypeIdentifier getException() tid.addIdent(Id.Exception); return tid; } - -/************************************** - * Check and set 'att' if 't' is a recursive 'alias this' type - * - * The goal is to prevent endless loops when there is a cycle in the alias this chain. - * Since there is no multiple `alias this`, the chain either ends in a leaf, - * or it loops back on itself as some point. - * - * Example: S0 -> (S1 -> S2 -> S3 -> S1) - * - * `S0` is not a recursive alias this, so this returns `false`, and a rewrite to `S1` can be tried. - * `S1` is a recursive alias this type, but since `att` is initialized to `null`, - * this still returns `false`, but `att1` is set to `S1`. - * A rewrite to `S2` and `S3` can be tried, but when we want to try a rewrite to `S1` again, - * we notice `att == t`, so we're back at the start of the loop, and this returns `true`. - * - * Params: - * att = type reference used to detect recursion. Should be initialized to `null`. - * t = type of 'alias this' rewrite to attempt - * - * Returns: - * `false` if the rewrite is safe, `true` if it would loop back around - */ -bool isRecursiveAliasThis(ref Type att, Type t) -{ - //printf("+isRecursiveAliasThis(att = %s, t = %s)\n", att ? att.toChars() : "null", t.toChars()); - auto tb = t.toBasetype(); - if (att && tb.equivalent(att)) - return true; - else if (!att && tb.checkAliasThisRec()) - att = tb; - return false; -} diff --git a/gcc/d/dmd/mtype.h b/gcc/d/dmd/mtype.h index 57f4ec6e0d25..2f8bfa68d221 100644 --- a/gcc/d/dmd/mtype.h +++ b/gcc/d/dmd/mtype.h @@ -257,7 +257,6 @@ class Type : public ASTNode Type *arrayOf(); Type *sarrayOf(dinteger_t dim); bool hasDeprecatedAliasThis(); - Type *aliasthisOf(); virtual Type *makeConst(); virtual Type *makeImmutable(); virtual Type *makeShared(); @@ -271,11 +270,7 @@ class Type : public ASTNode virtual MATCH implicitConvTo(Type *to); virtual MATCH constConv(Type *to); virtual unsigned char deduceWild(Type *t, bool isRef); - virtual Type *substWildTo(unsigned mod); - Type *unqualify(unsigned m); - - virtual Type *toHeadMutable(); virtual ClassDeclaration *isClassHandle(); virtual structalign_t alignment(); virtual Expression *defaultInitLiteral(const Loc &loc); @@ -580,7 +575,6 @@ class TypeFunction final : public TypeNext bool hasLazyParameters(); bool isDstyleVariadic() const; - Type *substWildTo(unsigned mod) override; MATCH constConv(Type *to) override; bool isnothrow() const; @@ -751,7 +745,6 @@ class TypeStruct final : public Type MATCH implicitConvTo(Type *to) override; MATCH constConv(Type *to) override; unsigned char deduceWild(Type *t, bool isRef) override; - Type *toHeadMutable() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -804,7 +797,6 @@ class TypeClass final : public Type MATCH implicitConvTo(Type *to) override; MATCH constConv(Type *to) override; unsigned char deduceWild(Type *t, bool isRef) override; - Type *toHeadMutable() override; bool isZeroInit(const Loc &loc) override; bool isscope() override; bool isBoolean() override; @@ -892,6 +884,8 @@ namespace dmd Type *pointerTo(Type *type); Type *referenceTo(Type *type); Type *merge2(Type *type); + Type *sarrayOf(Type *type, dinteger_t dim); + Type *arrayOf(Type *type); Type *constOf(Type *type); Type *immutableOf(Type *type); Type *mutableOf(Type *type); @@ -902,7 +896,11 @@ namespace dmd Type *wildConstOf(Type *type); Type *sharedWildOf(Type *type); Type *sharedWildConstOf(Type *type); + Type *unqualify(Type *type, unsigned m); + Type *toHeadMutable(Type *type); + Type *aliasthisOf(Type *type); Type *castMod(Type *type, MOD mod); Type *addMod(Type *type, MOD mod); Type *addStorageClass(Type *type, StorageClass stc); + Type *substWildTo(Type *type, unsigned mod); } diff --git a/gcc/d/dmd/optimize.d b/gcc/d/dmd/optimize.d index dd6b117e0aca..2c89a58d5d23 100644 --- a/gcc/d/dmd/optimize.d +++ b/gcc/d/dmd/optimize.d @@ -1349,7 +1349,7 @@ Expression optimize(Expression e, int result, bool keepLvalue = false) if (b++ == global.recursionLimit) { error(e.loc, "infinite loop while optimizing expression"); - fatal(); + return ErrorExp.get(); } auto ex = ret; diff --git a/gcc/d/dmd/parse.d b/gcc/d/dmd/parse.d index 9c446eb1bf31..646c4b7d3dbc 100644 --- a/gcc/d/dmd/parse.d +++ b/gcc/d/dmd/parse.d @@ -7130,7 +7130,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer private void checkParens(TOK value, AST.Expression e) { - if (precedence[e.op] == PREC.rel) + if (precedence[e.op] == PREC.rel && !e.parens) error(e.loc, "`%s` must be surrounded by parentheses when next to operator `%s`", e.toChars(), Token.toChars(value)); } @@ -8550,6 +8550,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer // ( expression ) nextToken(); e = parseExpression(); + e.parens = true; check(loc, TOK.rightParenthesis); break; } @@ -8874,9 +8875,9 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer nextToken(); return AST.ErrorExp.get(); } - auto te = new AST.TypeExp(loc, t); - te.parens = true; - e = parsePostExp(te); + e = new AST.TypeExp(loc, t); + e.parens = true; + e = parsePostExp(e); } else if (token.value == TOK.leftParenthesis || token.value == TOK.plusPlus || token.value == TOK.minusMinus) @@ -9193,18 +9194,14 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer private AST.Expression parseAndExp() { Loc loc = token.loc; - bool parens = token.value == TOK.leftParenthesis; auto e = parseCmpExp(); while (token.value == TOK.and) { - if (!parens) - checkParens(TOK.and, e); - parens = nextToken() == TOK.leftParenthesis; + checkParens(TOK.and, e); + nextToken(); auto e2 = parseCmpExp(); - if (!parens) - checkParens(TOK.and, e2); + checkParens(TOK.and, e2); e = new AST.AndExp(loc, e, e2); - parens = true; // don't call checkParens() for And loc = token.loc; } return e; @@ -9212,42 +9209,32 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer private AST.Expression parseXorExp() { - Loc loc = token.loc; + const loc = token.loc; - bool parens = token.value == TOK.leftParenthesis; auto e = parseAndExp(); while (token.value == TOK.xor) { - if (!parens) - checkParens(TOK.xor, e); - parens = nextToken() == TOK.leftParenthesis; + checkParens(TOK.xor, e); + nextToken(); auto e2 = parseAndExp(); - if (!parens) - checkParens(TOK.xor, e2); + checkParens(TOK.xor, e2); e = new AST.XorExp(loc, e, e2); - parens = true; - loc = token.loc; } return e; } private AST.Expression parseOrExp() { - Loc loc = token.loc; + const loc = token.loc; - bool parens = token.value == TOK.leftParenthesis; auto e = parseXorExp(); while (token.value == TOK.or) { - if (!parens) - checkParens(TOK.or, e); - parens = nextToken() == TOK.leftParenthesis; + checkParens(TOK.or, e); + nextToken(); auto e2 = parseXorExp(); - if (!parens) - checkParens(TOK.or, e2); + checkParens(TOK.or, e2); e = new AST.OrExp(loc, e, e2); - parens = true; - loc = token.loc; } return e; } @@ -9298,7 +9285,6 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer AST.Expression parseAssignExp() { - bool parens = token.value == TOK.leftParenthesis; AST.Expression e; e = parseCondExp(); if (e is null) @@ -9307,7 +9293,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer // require parens for e.g. `t ? a = 1 : b = 2` void checkRequiredParens() { - if (e.op == EXP.question && !parens) + if (e.op == EXP.question && !e.parens) eSink.error(e.loc, "`%s` must be surrounded by parentheses when next to operator `%s`", e.toChars(), Token.toChars(token.value)); } diff --git a/gcc/d/dmd/root/array.h b/gcc/d/dmd/root/array.h index 1033b22237a3..3e2880431e94 100644 --- a/gcc/d/dmd/root/array.h +++ b/gcc/d/dmd/root/array.h @@ -9,7 +9,6 @@ #pragma once #include "dsystem.h" -#include "object.h" #include "rmem.h" template @@ -44,7 +43,7 @@ struct Array d_size_t len = 2; for (d_size_t u = 0; u < length; u++) { - buf[u] = ((RootObject *)data.ptr[u])->toChars(); + buf[u] = ((TYPE)data.ptr[u])->toChars(); len += strlen(buf[u]) + 1; } char *str = (char *)mem.xmalloc(len); diff --git a/gcc/d/dmd/root/bitarray.h b/gcc/d/dmd/root/bitarray.h index 2cd7152f7253..2a8270335879 100644 --- a/gcc/d/dmd/root/bitarray.h +++ b/gcc/d/dmd/root/bitarray.h @@ -9,7 +9,6 @@ #pragma once #include "dsystem.h" -#include "object.h" #include "rmem.h" struct BitArray diff --git a/gcc/d/dmd/root/object.h b/gcc/d/dmd/rootobject.h similarity index 91% rename from gcc/d/dmd/root/object.h rename to gcc/d/dmd/rootobject.h index f56cb1760175..718a54f0275d 100644 --- a/gcc/d/dmd/root/object.h +++ b/gcc/d/dmd/rootobject.h @@ -4,13 +4,13 @@ * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. * https://www.boost.org/LICENSE_1_0.txt - * https://github.com/dlang/dmd/blob/master/src/dmd/root/object.h + * https://github.com/dlang/dmd/blob/master/src/dmd/rootobject.h */ #pragma once -#include "dsystem.h" -#include "dcompat.h" +#include "root/dsystem.h" +#include "root/dcompat.h" typedef size_t hash_t; diff --git a/gcc/d/dmd/safe.d b/gcc/d/dmd/safe.d index 8b57f7fe2498..1e5fb47a3dc7 100644 --- a/gcc/d/dmd/safe.d +++ b/gcc/d/dmd/safe.d @@ -26,7 +26,7 @@ import dmd.identifier; import dmd.mtype; import dmd.target; import dmd.tokens; -import dmd.typesem : hasPointers; +import dmd.typesem : hasPointers, arrayOf; import dmd.func : setUnsafe, setUnsafePreview; /************************************************************* diff --git a/gcc/d/dmd/statementsem.d b/gcc/d/dmd/statementsem.d index 5013c569933b..1bf36e3082d8 100644 --- a/gcc/d/dmd/statementsem.d +++ b/gcc/d/dmd/statementsem.d @@ -1196,7 +1196,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc) } case Taarray: if (fs.op == TOK.foreach_reverse_) - warning(fs.loc, "cannot use `foreach_reverse` with an associative array"); + error(fs.loc, "cannot use `foreach_reverse` with an associative array"); if (checkForArgTypes(fs)) return retError(); diff --git a/gcc/d/dmd/staticcond.d b/gcc/d/dmd/staticcond.d index 72afe0296415..3ab6885586ad 100644 --- a/gcc/d/dmd/staticcond.d +++ b/gcc/d/dmd/staticcond.d @@ -11,120 +11,13 @@ module dmd.staticcond; -import dmd.arraytypes; -import dmd.dinterpret; -import dmd.dmodule; -import dmd.dscope; -import dmd.dsymbol; -import dmd.errors; import dmd.expression; -import dmd.expressionsem; -import dmd.globals; -import dmd.identifier; -import dmd.mtype; -import dmd.optimize; import dmd.root.array; import dmd.common.outbuffer; import dmd.tokens; -/******************************************** - * Semantically analyze and then evaluate a static condition at compile time. - * This is special because short circuit operators &&, || and ?: at the top - * level are not semantically analyzed if the result of the expression is not - * necessary. - * Params: - * sc = instantiating scope - * original = original expression, for error messages - * e = resulting expression - * errors = set to `true` if errors occurred - * negatives = array to store negative clauses - * Returns: - * true if evaluates to true - */ -bool evalStaticCondition(Scope* sc, Expression original, Expression e, out bool errors, Expressions* negatives = null) -{ - if (negatives) - negatives.setDim(0); - - bool impl(Expression e) - { - if (e.isNotExp()) - { - NotExp ne = cast(NotExp)e; - return !impl(ne.e1); - } - - if (e.op == EXP.andAnd || e.op == EXP.orOr) - { - LogicalExp aae = cast(LogicalExp)e; - bool result = impl(aae.e1); - if (errors) - return false; - if (e.op == EXP.andAnd) - { - if (!result) - return false; - } - else - { - if (result) - return true; - } - result = impl(aae.e2); - return !errors && result; - } - - if (e.op == EXP.question) - { - CondExp ce = cast(CondExp)e; - bool result = impl(ce.econd); - if (errors) - return false; - Expression leg = result ? ce.e1 : ce.e2; - result = impl(leg); - return !errors && result; - } - - Expression before = e; - const uint nerrors = global.errors; - - sc = sc.startCTFE(); - sc.flags |= SCOPE.condition; - - e = e.expressionSemantic(sc); - e = resolveProperties(sc, e); - e = e.toBoolean(sc); - - sc = sc.endCTFE(); - e = e.optimize(WANTvalue); - - if (nerrors != global.errors || - e.isErrorExp() || - e.type.toBasetype() == Type.terror) - { - errors = true; - return false; - } - - e = e.ctfeInterpret(); - - const opt = e.toBool(); - if (opt.isEmpty()) - { - if (!e.type.isTypeError()) - error(e.loc, "expression `%s` is not constant", e.toChars()); - errors = true; - return false; - } - - if (negatives && !opt.get()) - negatives.push(before); - return opt.get(); - } - return impl(e); -} /******************************************** * Format a static condition as a tree-like structure, marking failed and diff --git a/gcc/d/dmd/template.h b/gcc/d/dmd/template.h index 6f12ac3eb1f2..0f96a1b3b098 100644 --- a/gcc/d/dmd/template.h +++ b/gcc/d/dmd/template.h @@ -36,7 +36,7 @@ class Tuple final : public RootObject // kludge for template.isType() DYNCAST dyncast() const override { return DYNCAST_TUPLE; } - const char *toChars() const override { return objects.toChars(); } + const char *toChars() const override; }; struct TemplatePrevious diff --git a/gcc/d/dmd/typesem.d b/gcc/d/dmd/typesem.d index 61272ea344c8..ad87ea0baebe 100644 --- a/gcc/d/dmd/typesem.d +++ b/gcc/d/dmd/typesem.d @@ -1687,7 +1687,7 @@ Type typeSemantic(Type type, const ref Loc loc, Scope* sc) if (!ClassDeclaration.object) { .error(Loc.initial, "missing or corrupt object.d"); - fatal(); + return error(); } __gshared FuncDeclaration feq = null; @@ -6229,6 +6229,29 @@ Type referenceTo(Type type) return type.rto; } +// Make corresponding static array type without semantic +Type sarrayOf(Type type, dinteger_t dim) +{ + assert(type.deco); + Type t = new TypeSArray(type, new IntegerExp(Loc.initial, dim, Type.tsize_t)); + // according to TypeSArray.semantic() + t = t.addMod(type.mod); + t = t.merge(); + return t; +} + +Type arrayOf(Type type) +{ + if (type.ty == Terror) + return type; + if (!type.arrayof) + { + Type t = new TypeDArray(type); + type.arrayof = t.merge(); + } + return type.arrayof; +} + /******************************** * Convert to 'const'. */ @@ -6478,6 +6501,104 @@ Type sharedWildConstOf(Type type) return t; } +Type unqualify(Type type, uint m) +{ + Type t = type.mutableOf().unSharedOf(); + + Type tn = type.ty == Tenum ? null : type.nextOf(); + if (tn && tn.ty != Tfunction) + { + Type utn = tn.unqualify(m); + if (utn != tn) + { + if (type.ty == Tpointer) + t = utn.pointerTo(); + else if (type.ty == Tarray) + t = utn.arrayOf(); + else if (type.ty == Tsarray) + t = new TypeSArray(utn, (cast(TypeSArray)type).dim); + else if (type.ty == Taarray) + { + t = new TypeAArray(utn, (cast(TypeAArray)type).index); + } + else + assert(0); + + t = t.merge(); + } + } + t = t.addMod(type.mod & ~m); + return t; +} + +/************************** + * Return type with the top level of it being mutable. + * + * Params: + * t = type for which the top level mutable version is being returned + * + * Returns: + * type version with mutable top level + */ +Type toHeadMutable(const Type t) +{ + Type unqualType = cast(Type) t; + if (t.isTypeStruct() || t.isTypeClass()) + return unqualType; + + if (!t.mod) + return unqualType; + return unqualType.mutableOf(); +} + +Type aliasthisOf(Type type) +{ + auto ad = isAggregate(type); + if (!ad || !ad.aliasthis) + return null; + + auto s = ad.aliasthis.sym; + if (s.isAliasDeclaration()) + s = s.toAlias(); + + if (s.isTupleDeclaration()) + return null; + + if (auto vd = s.isVarDeclaration()) + { + auto t = vd.type; + if (vd.needThis()) + t = t.addMod(type.mod); + return t; + } + Dsymbol callable = s.isFuncDeclaration(); + callable = callable ? callable : s.isTemplateDeclaration(); + if (callable) + { + auto fd = resolveFuncCall(Loc.initial, null, callable, null, type, ArgumentList(), FuncResolveFlag.quiet); + if (!fd || fd.errors || !functionSemantic(fd)) + return Type.terror; + + auto t = fd.type.nextOf(); + if (!t) // https://issues.dlang.org/show_bug.cgi?id=14185 + return Type.terror; + t = t.substWildTo(type.mod == 0 ? MODFlags.mutable : type.mod); + return t; + } + if (auto d = s.isDeclaration()) + { + assert(d.type); + return d.type; + } + if (auto ed = s.isEnumDeclaration()) + { + return ed.type; + } + + //printf("%s\n", s.kind()); + return null; +} + /************************************ * Apply MODxxxx bits to existing type. */ @@ -6528,6 +6649,137 @@ Type castMod(Type type, MOD mod) return t; } +Type substWildTo(Type type, uint mod) +{ + auto tf = type.isTypeFunction(); + if (!tf) + { + //printf("+Type.substWildTo this = %s, mod = x%x\n", toChars(), mod); + Type t; + + if (Type tn = type.nextOf()) + { + // substitution has no effect on function pointer type. + if (type.ty == Tpointer && tn.ty == Tfunction) + { + t = type; + goto L1; + } + + t = tn.substWildTo(mod); + if (t == tn) + t = type; + else + { + if (type.ty == Tpointer) + t = t.pointerTo(); + else if (type.ty == Tarray) + t = t.arrayOf(); + else if (type.ty == Tsarray) + t = new TypeSArray(t, (cast(TypeSArray)type).dim.syntaxCopy()); + else if (type.ty == Taarray) + { + t = new TypeAArray(t, (cast(TypeAArray)type).index.syntaxCopy()); + } + else if (type.ty == Tdelegate) + { + t = new TypeDelegate(t.isTypeFunction()); + } + else + assert(0); + + t = t.merge(); + } + } + else + t = type; + + L1: + if (type.isWild()) + { + if (mod == MODFlags.immutable_) + { + t = t.immutableOf(); + } + else if (mod == MODFlags.wildconst) + { + t = t.wildConstOf(); + } + else if (mod == MODFlags.wild) + { + if (type.isWildConst()) + t = t.wildConstOf(); + else + t = t.wildOf(); + } + else if (mod == MODFlags.const_) + { + t = t.constOf(); + } + else + { + if (type.isWildConst()) + t = t.constOf(); + else + t = t.mutableOf(); + } + } + if (type.isConst()) + t = t.addMod(MODFlags.const_); + if (type.isShared()) + t = t.addMod(MODFlags.shared_); + + //printf("-Type.substWildTo t = %s\n", t.toChars()); + return t; + } + + if (!tf.iswild && !(tf.mod & MODFlags.wild)) + return tf; + + // Substitude inout qualifier of function type to mutable or immutable + // would break type system. Instead substitude inout to the most weak + // qualifer - const. + uint m = MODFlags.const_; + + assert(tf.next); + Type tret = tf.next.substWildTo(m); + Parameters* params = tf.parameterList.parameters; + if (tf.mod & MODFlags.wild) + params = tf.parameterList.parameters.copy(); + for (size_t i = 0; i < params.length; i++) + { + Parameter p = (*params)[i]; + Type t = p.type.substWildTo(m); + if (t == p.type) + continue; + if (params == tf.parameterList.parameters) + params = tf.parameterList.parameters.copy(); + (*params)[i] = new Parameter(p.loc, p.storageClass, t, null, null, null); + } + if (tf.next == tret && params == tf.parameterList.parameters) + return tf; + + // Similar to TypeFunction.syntaxCopy; + auto t = new TypeFunction(ParameterList(params, tf.parameterList.varargs), tret, tf.linkage); + t.mod = ((tf.mod & MODFlags.wild) ? (tf.mod & ~MODFlags.wild) | MODFlags.const_ : tf.mod); + t.isnothrow = tf.isnothrow; + t.isnogc = tf.isnogc; + t.purity = tf.purity; + t.isproperty = tf.isproperty; + t.isref = tf.isref; + t.isreturn = tf.isreturn; + t.isreturnscope = tf.isreturnscope; + t.isScopeQual = tf.isScopeQual; + t.isreturninferred = tf.isreturninferred; + t.isscopeinferred = tf.isscopeinferred; + t.isInOutParam = false; + t.isInOutQual = false; + t.trust = tf.trust; + t.fargs = tf.fargs; + t.isctor = tf.isctor; + return t.merge(); +} + /************************************ * Add MODxxxx bits to existing type. * We're adding, not replacing, so adding const to @@ -6633,6 +6885,69 @@ Type addMod(Type type, MOD mod) return t; } +/** + * Check whether this type has endless `alias this` recursion. + * + * Params: + * t = type to check whether it has a recursive alias this + * Returns: + * `true` if `t` has an `alias this` that can be implicitly + * converted back to `t` itself. + */ +private bool checkAliasThisRec(Type t) +{ + Type tb = t.toBasetype(); + AliasThisRec* pflag; + if (tb.ty == Tstruct) + pflag = &(cast(TypeStruct)tb).att; + else if (tb.ty == Tclass) + pflag = &(cast(TypeClass)tb).att; + else + return false; + + AliasThisRec flag = cast(AliasThisRec)(*pflag & AliasThisRec.typeMask); + if (flag == AliasThisRec.fwdref) + { + Type att = aliasthisOf(t); + flag = att && att.implicitConvTo(t) ? AliasThisRec.yes : AliasThisRec.no; + } + *pflag = cast(AliasThisRec)(flag | (*pflag & ~AliasThisRec.typeMask)); + return flag == AliasThisRec.yes; +} + +/************************************** + * Check and set 'att' if 't' is a recursive 'alias this' type + * + * The goal is to prevent endless loops when there is a cycle in the alias this chain. + * Since there is no multiple `alias this`, the chain either ends in a leaf, + * or it loops back on itself as some point. + * + * Example: S0 -> (S1 -> S2 -> S3 -> S1) + * + * `S0` is not a recursive alias this, so this returns `false`, and a rewrite to `S1` can be tried. + * `S1` is a recursive alias this type, but since `att` is initialized to `null`, + * this still returns `false`, but `att1` is set to `S1`. + * A rewrite to `S2` and `S3` can be tried, but when we want to try a rewrite to `S1` again, + * we notice `att == t`, so we're back at the start of the loop, and this returns `true`. + * + * Params: + * att = type reference used to detect recursion. Should be initialized to `null`. + * t = type of 'alias this' rewrite to attempt + * + * Returns: + * `false` if the rewrite is safe, `true` if it would loop back around + */ +bool isRecursiveAliasThis(ref Type att, Type t) +{ + //printf("+isRecursiveAliasThis(att = %s, t = %s)\n", att ? att.toChars() : "null", t.toChars()); + auto tb = t.toBasetype(); + if (att && tb.equivalent(att)) + return true; + else if (!att && tb.checkAliasThisRec()) + att = tb; + return false; +} + /******************************* Private *****************************************/ private: diff --git a/gcc/d/expr.cc b/gcc/d/expr.cc index 7fbabbe185f0..d055e0b4025b 100644 --- a/gcc/d/expr.cc +++ b/gcc/d/expr.cc @@ -464,7 +464,7 @@ class ExprVisitor : public Visitor else { /* Use _adEq2() to compare each element. */ - Type *t1array = t1elem->arrayOf (); + Type *t1array = dmd::arrayOf (t1elem); tree result = build_libcall (LIBCALL_ADEQ2, e->type, 3, d_array_convert (e->e1), d_array_convert (e->e2), @@ -2172,7 +2172,8 @@ class ExprVisitor : public Visitor { /* Generate a slice for non-zero initialized aggregates, otherwise create an empty array. */ - gcc_assert (e->type == dmd::constOf (Type::tvoid->arrayOf ())); + gcc_assert (e->type->isConst () + && e->type->nextOf ()->ty == TY::Tvoid); tree type = build_ctype (e->type); tree length = size_int (sd->dsym->structsize); @@ -2571,7 +2572,7 @@ class ExprVisitor : public Visitor /* Implicitly convert void[n] to ubyte[n]. */ if (tb->ty == TY::Tsarray && tb->nextOf ()->toBasetype ()->ty == TY::Tvoid) - tb = Type::tuns8->sarrayOf (tb->isTypeSArray ()->dim->toUInteger ()); + tb = dmd::sarrayOf (Type::tuns8, tb->isTypeSArray ()->dim->toUInteger ()); gcc_assert (tb->ty == TY::Tarray || tb->ty == TY::Tsarray || tb->ty == TY::Tpointer); @@ -2685,7 +2686,7 @@ class ExprVisitor : public Visitor /* Allocate space on the memory managed heap. */ tree mem = build_libcall (LIBCALL_ARRAYLITERALTX, dmd::pointerTo (etype), 2, - build_typeinfo (e, etype->arrayOf ()), + build_typeinfo (e, dmd::arrayOf (etype)), size_int (e->elements->length)); mem = d_save_expr (mem); @@ -2732,20 +2733,20 @@ class ExprVisitor : public Visitor /* Build an expression that assigns all expressions in KEYS to a constructor. */ - tree akeys = build_array_from_exprs (ta->index->sarrayOf (e->keys->length), - e->keys, this->constp_); + Type *tkarray = dmd::sarrayOf (ta->index, e->keys->length); + tree akeys = build_array_from_exprs (tkarray, e->keys, this->constp_); tree init = stabilize_expr (&akeys); /* Do the same with all expressions in VALUES. */ - tree avals = build_array_from_exprs (ta->next->sarrayOf (e->values->length), - e->values, this->constp_); + Type *tvarray = dmd::sarrayOf (ta->next, e->values->length); + tree avals = build_array_from_exprs (tvarray, e->values, this->constp_); init = compound_expr (init, stabilize_expr (&avals)); /* Generate: _d_assocarrayliteralTX (ti, keys, vals); */ - tree keys = d_array_value (build_ctype (ta->index->arrayOf ()), + tree keys = d_array_value (build_ctype (dmd::arrayOf (ta->index)), size_int (e->keys->length), build_address (akeys)); - tree vals = d_array_value (build_ctype (ta->next->arrayOf ()), + tree vals = d_array_value (build_ctype (dmd::arrayOf (ta->next)), size_int (e->values->length), build_address (avals)); diff --git a/gcc/d/intrinsics.cc b/gcc/d/intrinsics.cc index 8bbcdc164ee2..c895c1a1a529 100644 --- a/gcc/d/intrinsics.cc +++ b/gcc/d/intrinsics.cc @@ -274,7 +274,7 @@ build_shuffle_mask_type (tree type) gcc_assert (t != NULL); unsigned HOST_WIDE_INT nunits = TYPE_VECTOR_SUBPARTS (type).to_constant (); - return build_ctype (TypeVector::create (t->sarrayOf (nunits))); + return build_ctype (TypeVector::create (dmd::sarrayOf (t, nunits))); } /* Checks if call to intrinsic FUNCTION in CALLEXP matches the internal @@ -414,7 +414,7 @@ maybe_warn_intrinsic_mismatch (tree function, tree callexp) break; Type *inner = build_frontend_type (TREE_TYPE (vec0)); - Type *vector = TypeVector::create (inner->sarrayOf (nunits)); + Type *vector = TypeVector::create (dmd::sarrayOf (inner, nunits)); return warn_mismatched_argument (callexp, 1, build_ctype (vector), true); } @@ -479,7 +479,7 @@ maybe_warn_intrinsic_mismatch (tree function, tree callexp) break; Type *inner = build_frontend_type (TREE_TYPE (arg)); - Type *vector = TypeVector::create (inner->sarrayOf (nunits)); + Type *vector = TypeVector::create (dmd::sarrayOf (inner, nunits)); return warn_mismatched_argument (callexp, 0, build_ctype (vector), true); } diff --git a/gcc/d/runtime.cc b/gcc/d/runtime.cc index e5988c721caf..8a64c5282d1e 100644 --- a/gcc/d/runtime.cc +++ b/gcc/d/runtime.cc @@ -158,31 +158,31 @@ get_libcall_type (d_libcall_type type) break; case LCT_ARRAY_VOID: - libcall_types[type] = Type::tvoid->arrayOf (); + libcall_types[type] = dmd::arrayOf (Type::tvoid); break; case LCT_ARRAY_SIZE_T: - libcall_types[type] = Type::tsize_t->arrayOf (); + libcall_types[type] = dmd::arrayOf (Type::tsize_t); break; case LCT_ARRAY_BYTE: - libcall_types[type] = Type::tint8->arrayOf (); + libcall_types[type] = dmd::arrayOf (Type::tint8); break; case LCT_ARRAY_STRING: - libcall_types[type] = Type::tstring->arrayOf (); + libcall_types[type] = dmd::arrayOf (Type::tstring); break; case LCT_ARRAY_WSTRING: - libcall_types[type] = Type::twstring->arrayOf (); + libcall_types[type] = dmd::arrayOf (Type::twstring); break; case LCT_ARRAY_DSTRING: - libcall_types[type] = Type::tdstring->arrayOf (); + libcall_types[type] = dmd::arrayOf (Type::tdstring); break; case LCT_ARRAYARRAY_BYTE: - libcall_types[type] = Type::tint8->arrayOf ()->arrayOf (); + libcall_types[type] = dmd::arrayOf (Type::tint8); break; case LCT_POINTER_ASSOCARRAY: @@ -190,15 +190,15 @@ get_libcall_type (d_libcall_type type) break; case LCT_POINTER_VOIDPTR: - libcall_types[type] = Type::tvoidptr->arrayOf (); + libcall_types[type] = dmd::arrayOf (Type::tvoidptr); break; case LCT_ARRAYPTR_VOID: - libcall_types[type] = dmd::pointerTo (Type::tvoid->arrayOf ()); + libcall_types[type] = dmd::pointerTo (dmd::arrayOf (Type::tvoid)); break; case LCT_ARRAYPTR_BYTE: - libcall_types[type] = dmd::pointerTo (Type::tint8->arrayOf ()); + libcall_types[type] = dmd::pointerTo (dmd::arrayOf (Type::tint8)); break; case LCT_IMMUTABLE_CHARPTR: diff --git a/gcc/d/typeinfo.cc b/gcc/d/typeinfo.cc index 794737b3b0b3..cadcbe8164e9 100644 --- a/gcc/d/typeinfo.cc +++ b/gcc/d/typeinfo.cc @@ -415,7 +415,7 @@ class TypeInfoVisitor : public Visitor tree decl = this->internal_reference (value); TREE_READONLY (decl) = 1; - value = d_array_value (build_ctype (Type::tchar->arrayOf ()), + value = d_array_value (build_ctype (dmd::arrayOf (Type::tchar)), size_int (len), build_address (decl)); this->layout_field (value); } @@ -1137,7 +1137,7 @@ class TypeInfoVisitor : public Visitor this->layout_base (Type::typeinfotypelist); /* TypeInfo[] elements; */ - Type *satype = Type::tvoidptr->sarrayOf (ti->arguments->length); + Type *satype = dmd::sarrayOf (Type::tvoidptr, ti->arguments->length); vec *elms = NULL; for (size_t i = 0; i < ti->arguments->length; i++) { diff --git a/gcc/doc/cppopts.texi b/gcc/doc/cppopts.texi index fa8f3d88c890..5b5b0848ae86 100644 --- a/gcc/doc/cppopts.texi +++ b/gcc/doc/cppopts.texi @@ -524,8 +524,7 @@ interpreted as a synonym for @option{-fdump-rtl-mach}. @opindex dD @item -dD -Like @option{-dM} except in two respects: it does @emph{not} include the -predefined macros, and it outputs @emph{both} the @samp{#define} +Like @option{-dM} except that it outputs @emph{both} the @samp{#define} directives and the result of preprocessing. Both kinds of output go to the standard output file. diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 2135dfde9c81..df0982fdfda5 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -6314,6 +6314,16 @@ Permissible values for this parameter are @code{user}, @code{supervisor}, and @code{machine}. If there is no parameter, then it defaults to @code{machine}. +@cindex @code{riscv_vector_cc} function attribute, RISC-V +@item riscv_vector_cc +Use this attribute to force the function to use the vector calling +convention variant. + +@smallexample +void foo() __attribute__((riscv_vector_cc)); +[[riscv::vector_cc]] void foo(); // For C++11 and C23 +@end smallexample + @end table The following target-specific function attributes are available for the @@ -12626,10 +12636,7 @@ In C, writing: @end smallexample suppresses warnings about using @samp{[[]]} attributes in C versions -that predate C23@. Since the scope token @samp{::} is not a single -lexing token in earlier versions of C, this construct also allows two colons -to be used in place of @code{::}. GCC does not check whether the two -colons are immediately adjacent. +that predate C23@. @end itemize @code{__extension__} has no effect aside from this. @@ -21381,8 +21388,8 @@ available on the PowerPC family of processors starting with ISA 2.07 or later. Unless specific options are explicitly disabled on the command line, specifying option @option{-mcpu=power8} has the effect of enabling all the same options as for @option{-mcpu=power7} in -addition to the @option{-mpower8-fusion}, @option{-mpower8-vector}, -@option{-mcrypto}, @option{-mhtm}, @option{-mquad-memory}, and +addition to the @option{-mpower8-fusion}, @option{-mcrypto}, +@option{-mhtm}, @option{-mquad-memory}, and @option{-mquad-memory-atomic} options. This section intentionally empty. @@ -29320,6 +29327,55 @@ Some_Class B __attribute__ ((init_priority (543))); Note that the particular values of @var{priority} do not matter; only their relative ordering. +@cindex @code{no_dangling} type attribute +@cindex @code{no_dangling} function attribute +@item no_dangling + +This attribute can be applied on a class type, function, or member +function. Dangling references to classes marked with this attribute +will have the @option{-Wdangling-reference} diagnostic suppressed; so +will references returned from the @code{gnu::no_dangling}-marked +functions. For example: + +@smallexample +class [[gnu::no_dangling]] S @{ @dots{} @}; +@end smallexample + +Or: + +@smallexample +class A @{ + int *p; + [[gnu::no_dangling]] int &foo() @{ return *p; @} +@}; + +[[gnu::no_dangling]] const int & +foo (const int &i) +@{ + @dots{} +@} +@end smallexample + +This attribute takes an optional argument, which must be an expression that +evaluates to true or false: + +@smallexample +template +struct [[gnu::no_dangling(std::is_reference_v)]] S @{ + @dots{} +@}; +@end smallexample + +Or: + +@smallexample +template +[[gnu::no_dangling(std::is_lvalue_reference_v)]] +decltype(auto) foo(T&& t) @{ + @dots{} +@}; +@end smallexample + @cindex @code{warn_unused} type attribute @item warn_unused diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index d75b28484bb2..85c938d4a148 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -256,7 +256,7 @@ in the following sections. -Wdeprecated-copy -Wdeprecated-copy-dtor -Wno-deprecated-enum-enum-conversion -Wno-deprecated-enum-float-conversion -Weffc++ -Wno-elaborated-enum-base --Wno-exceptions -Wextra-semi -Wno-inaccessible-base +-Wno-exceptions -Wextra-semi -Wno-global-module -Wno-inaccessible-base -Wno-inherited-variadic-ctor -Wno-init-list-lifetime -Winvalid-constexpr -Winvalid-imported-macros -Wno-invalid-offsetof -Wno-literal-suffix @@ -884,7 +884,7 @@ Objective-C and Objective-C++ Dialects}. @emph{AVR Options} @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args --mbranch-cost=@var{cost} +-mbranch-cost=@var{cost} -mfuse-add=@var{level} -mcall-prologues -mgas-isr-prologues -mint8 -mflmap -mdouble=@var{bits} -mlong-double=@var{bits} -mn_flash=@var{size} -mno-interrupts @@ -971,7 +971,7 @@ Objective-C and Objective-C++ Dialects}. @gccoptlist{-mbig-endian -mlittle-endian -mframe-limit=@var{bytes} -mxbpf -mco-re -mno-co-re -mjmpext -mjmp32 -malu32 -mv3-atomics -mbswap -msdiv -msmov -mcpu=@var{version} --masm=@var{dialect}} +-masm=@var{dialect} -minline-memops-threshold=@var{bytes}} @emph{FR30 Options} @gccoptlist{-msmall-model -mno-lsim} @@ -1317,7 +1317,7 @@ See RS/6000 and PowerPC Options. -mveclibabi=@var{type} -mfriz -mno-friz -mpointers-to-nested-functions -mno-pointers-to-nested-functions -msave-toc-indirect -mno-save-toc-indirect --mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector +-mpower8-fusion -mno-mpower8-fusion -mcrypto -mno-crypto -mhtm -mno-htm -mquad-memory -mno-quad-memory -mquad-memory-atomic -mno-quad-memory-atomic @@ -1450,6 +1450,7 @@ See RS/6000 and PowerPC Options. -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} -mpartial-vector-fp-math -mmove-max=@var{bits} -mstore-max=@var{bits} +-mnoreturn-no-callee-saved-registers -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @@ -3908,6 +3909,9 @@ const T& foo (const T&) @{ @dots{} @} #pragma GCC diagnostic pop @end smallexample +The @code{#pragma} can also surround the class; in that case, the warning +will be disabled for all the member functions. + @option{-Wdangling-reference} also warns about code like @smallexample @@ -3932,6 +3936,9 @@ struct Span @{ as @code{std::span}-like; that is, the class is a non-union class that has a pointer data member and a trivial destructor. +The warning can be disabled by using the @code{gnu::no_dangling} attribute +(@pxref{C++ Attributes}). + This warning is enabled by @option{-Wall}. @opindex Wdelete-non-virtual-dtor @@ -4768,6 +4775,12 @@ undefined behavior at runtime. This warning is enabled by default. @item -Wextra-semi @r{(C++, Objective-C++ only)} Warn about redundant semicolons after in-class function definitions. +@opindex Wno-global-module +@opindex Wglobal-module +@item -Wno-global-module @r{(C++ and Objective-C++ only)} +Disable the diagnostic for when the global module fragment of a module +unit does not consist only of preprocessor directives. + @opindex Winaccessible-base @opindex Wno-inaccessible-base @item -Wno-inaccessible-base @r{(C++, Objective-C++ only)} @@ -7262,7 +7275,7 @@ when non-existent profile data is justified. @item -Wmismatched-dealloc Warn for calls to deallocation functions with pointer arguments returned -from from allocations functions for which the former isn't a suitable +from allocation functions for which the former isn't a suitable deallocator. A pair of functions can be associated as matching allocators and deallocators by use of attribute @code{malloc}. Unless disabled by the @option{-fno-builtin} option the standard functions @code{calloc}, @@ -23785,6 +23798,15 @@ integers. The default branch cost is 0. Functions prologues/epilogues are expanded as calls to appropriate subroutines. Code size is smaller. +@opindex mfuse-add +@item -mfuse-add +@itemx -mno-fuse-add +@itemx -mfuse-add=@var{level} +Optimize indirect memory accesses on reduced Tiny devices. +The default uses @code{@var{level}=1} for optimizations @option{-Og} +and @option{-O1}, and @code{@var{level}=2} for higher optimizations. +Valid values for @var{level} are @code{0}, @code{1} and @code{2}. + @opindex mdouble @opindex mlong-double @item -mdouble=@var{bits} @@ -25679,6 +25701,15 @@ Outputs pseudo-c assembly dialect. @end table +@opindex -minline-memops-threshold +@item -minline-memops-threshold=@var{bytes} +Specifies a size threshold in bytes at or below which memmove, memcpy +and memset shall always be expanded inline. Operations dealing with +sizes larger than this threshold would have to be be implemented using +a library call instead of being expanded inline, but since BPF doesn't +allow libcalls, exceeding this threshold results in a compile-time +error. The default is @samp{1024} bytes. + @end table @node FR30 Options @@ -27995,11 +28026,7 @@ Aliases of @option{-minterlink-compressed} and @option{-mno-interlink-compressed}. These options predate the microMIPS ASE and are retained for backwards compatibility. -@opindex mabi=32 -@opindex mabi=o64 -@opindex mabi=n32 -@opindex mabi=64 -@opindex mabi=eabi +@opindex mabi @item -mabi=32 @itemx -mabi=o64 @itemx -mabi=n32 @@ -28486,9 +28513,8 @@ Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler relocation operators. This option has been superseded by @option{-mexplicit-relocs} but is retained for backwards compatibility. -@opindex mexplicit-relocs=none -@opindex mexplicit-relocs=base -@opindex mexplicit-relocs=pcrel +@opindex mexplicit-relocs +@opindex mno-explicit-relocs @item -mexplicit-relocs=none @itemx -mexplicit-relocs=base @itemx -mexplicit-relocs=pcrel @@ -28767,6 +28793,7 @@ Disable the insertion of cache barriers. This is the default setting. @end table @opindex mflush-func +@opindex mno-flush-func @item -mflush-func=@var{func} @itemx -mno-flush-func Specifies the function to call to flush the I and D caches, or to not @@ -28778,7 +28805,7 @@ depends on the target GCC was configured for, but commonly is either @code{_flush_func} or @code{__cpu_flush}. @opindex mbranch-cost -@item mbranch-cost=@var{num} +@item -mbranch-cost=@var{num} Set the cost of branches to roughly @var{num} ``simple'' instructions. This cost is only a heuristic and is not guaranteed to produce consistent results across releases. A zero cost redundantly selects @@ -30754,6 +30781,8 @@ Permissible values for this option are: @samp{sifive-e20}, @samp{sifive-e21}, @samp{sifive-u54}, @samp{sifive-u74}, @samp{sifive-x280}, @samp{sifive-xp450}, @samp{sifive-x670}. +Note that @option{-mcpu} does not override @option{-march} or @option{-mtune}. + @opindex mtune @item -mtune=@var{processor-string} Optimize the output for the given processor, specified by microarchitecture or @@ -31160,7 +31189,7 @@ following options: -mpopcntb -mpopcntd -mpowerpc64 -mpowerpc-gpopt -mpowerpc-gfxopt -mmulhw -mdlmzb -mmfpgpr -mvsx --mcrypto -mhtm -mpower8-fusion -mpower8-vector +-mcrypto -mhtm -mpower8-fusion -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware -mprefixed -mpcrel -mmma -mrop-protect} @@ -31283,15 +31312,6 @@ Generate code that keeps (does not keeps) some integer operations adjacent so that the instructions can be fused together on power8 and later processors. -@opindex mpower8-vector -@opindex mno-power8-vector -@item -mpower8-vector -@itemx -mno-power8-vector -Generate code that uses (does not use) the vector and scalar -instructions that were added in version 2.07 of the PowerPC ISA. Also -enable the use of built-in functions that allow more direct access to -the vector instructions. - @opindex mquad-memory @opindex mno-quad-memory @item -mquad-memory @@ -31323,13 +31343,12 @@ supported on Linux. The default for @option{-mfloat128} is enabled on PowerPC Linux systems using the VSX instruction set, and disabled on other systems. -If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or -@option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating -point support will also enable the generation of ISA 3.0 IEEE 128-bit -floating point instructions. Otherwise, if you do not specify to -generate ISA 3.0 instructions or you are targeting a 32-bit big endian -system, IEEE 128-bit floating point will be done with software -emulation. +If you use the ISA 3.0 instruction set (@option{-mcpu=power9}) on a +64-bit system, the IEEE 128-bit floating point support will also enable +the generation of ISA 3.0 IEEE 128-bit floating point instructions. +Otherwise, if you do not specify to generate ISA 3.0 instructions or you +are targeting a 32-bit big endian system, IEEE 128-bit floating point +will be done with software emulation. @opindex mfloat128-hardware @opindex mno-float128-hardware @@ -35388,6 +35407,15 @@ Prefer 256-bit vector width for instructions. Prefer 512-bit vector width for instructions. @end table +@opindex mnoreturn-no-callee-saved-registers +@item -mnoreturn-no-callee-saved-registers +This option optimizes functions with @code{noreturn} attribute or +@code{_Noreturn} specifier by not saving in the function prologue callee-saved +registers which are used in the function (except for the @code{BP} +register). This option can interfere with debugging of the caller of the +@code{noreturn} function or any function further up in the call stack, so it +is not enabled by default. + @opindex mcx16 @item -mcx16 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index 33b37e79cd4a..5730bda80dc8 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -3425,8 +3425,8 @@ Any condition register field, @code{cr0}@dots{}@code{cr7}. The carry bit, @code{XER[CA]}. @item we -Like @code{wa}, if @option{-mpower9-vector} and @option{-m64} are used; -otherwise, @code{NO_REGS}. +Like @code{wa}, if this is a POWER9 or later and @option{-mvsx} +and @option{-m64} are used; otherwise, @code{NO_REGS}. @item wn No register (@code{NO_REGS}). diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 7b747bfa6cb0..efab862b94f0 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -2443,9 +2443,6 @@ PowerPC target supports hardware double-precision floating-point. @item powerpc_htm_ok PowerPC target supports @code{-mhtm} -@item powerpc_p8vector_ok -PowerPC target supports @code{-mpower8-vector} - @item powerpc_popcntb_ok PowerPC target supports the @code{popcntb} instruction, indicating that this target supports @code{-mcpu=power5}. diff --git a/gcc/dojump.cc b/gcc/dojump.cc index ac744e54cf89..88600cb42d3d 100644 --- a/gcc/dojump.cc +++ b/gcc/dojump.cc @@ -1318,10 +1318,10 @@ do_compare_and_jump (tree treeop0, tree treeop1, enum rtx_code signed_code, { gcc_assert (code == EQ || code == NE); op0 = expand_binop (mode, and_optab, op0, - GEN_INT ((1 << nunits) - 1), NULL_RTX, + GEN_INT ((HOST_WIDE_INT_1U << nunits) - 1), NULL_RTX, true, OPTAB_WIDEN); op1 = expand_binop (mode, and_optab, op1, - GEN_INT ((1 << nunits) - 1), NULL_RTX, + GEN_INT ((HOST_WIDE_INT_1U << nunits) - 1), NULL_RTX, true, OPTAB_WIDEN); } diff --git a/gcc/double-int.cc b/gcc/double-int.cc index 08b0f7625f3b..e5c442f8e5bc 100644 --- a/gcc/double-int.cc +++ b/gcc/double-int.cc @@ -671,14 +671,14 @@ double_int::mask (unsigned prec) if (prec > HOST_BITS_PER_WIDE_INT) { prec -= HOST_BITS_PER_WIDE_INT; - m = ((unsigned HOST_WIDE_INT) 2 << (prec - 1)) - 1; + m = (HOST_WIDE_INT_UC (2) << (prec - 1)) - 1; mask.high = (HOST_WIDE_INT) m; mask.low = ALL_ONES; } else { mask.high = 0; - mask.low = prec ? ((unsigned HOST_WIDE_INT) 2 << (prec - 1)) - 1 : 0; + mask.low = prec ? (HOST_WIDE_INT_UC (2) << (prec - 1)) - 1 : 0; } return mask; diff --git a/gcc/dwarf2ctf.cc b/gcc/dwarf2ctf.cc index 93e5619933fa..77d6bf896893 100644 --- a/gcc/dwarf2ctf.cc +++ b/gcc/dwarf2ctf.cc @@ -349,105 +349,97 @@ gen_ctf_pointer_type (ctf_container_ref ctfc, dw_die_ref ptr_type) return ptr_type_id; } -/* Generate CTF for an array type. */ +/* Recursively generate CTF for array dimensions starting at DIE C (of type + DW_TAG_subrange_type) until DIE LAST (of type DW_TAG_subrange_type) is + reached. ARRAY_ELEMS_TYPE_ID is base type for the array. */ static ctf_id_t -gen_ctf_array_type (ctf_container_ref ctfc, dw_die_ref array_type) +gen_ctf_subrange_type (ctf_container_ref ctfc, ctf_id_t array_elems_type_id, + dw_die_ref c, dw_die_ref last) { - dw_die_ref c; - ctf_id_t array_elems_type_id = CTF_NULL_TYPEID; + ctf_arinfo_t arinfo; + ctf_id_t array_node_type_id = CTF_NULL_TYPEID; - int vector_type_p = get_AT_flag (array_type, DW_AT_GNU_vector); - if (vector_type_p) - return array_elems_type_id; + dw_attr_node *upper_bound_at; + dw_die_ref array_index_type; + uint32_t array_num_elements; - dw_die_ref array_elems_type = ctf_get_AT_type (array_type); + if (dw_get_die_tag (c) == DW_TAG_subrange_type) + { + /* When DW_AT_upper_bound is used to specify the size of an + array in DWARF, it is usually an unsigned constant + specifying the upper bound index of the array. However, + for unsized arrays, such as foo[] or bar[0], + DW_AT_upper_bound is a signed integer constant + instead. */ + + upper_bound_at = get_AT (c, DW_AT_upper_bound); + if (upper_bound_at + && AT_class (upper_bound_at) == dw_val_class_unsigned_const) + /* This is the upper bound index. */ + array_num_elements = get_AT_unsigned (c, DW_AT_upper_bound) + 1; + else if (get_AT (c, DW_AT_count)) + array_num_elements = get_AT_unsigned (c, DW_AT_count); + else + { + /* This is a VLA of some kind. */ + array_num_elements = 0; + } + } + else + gcc_unreachable (); - /* First, register the type of the array elements if needed. */ - array_elems_type_id = gen_ctf_type (ctfc, array_elems_type); + /* Ok, mount and register the array type. Note how the array + type we register here is the type of the elements in + subsequent "dimensions", if there are any. */ + arinfo.ctr_nelems = array_num_elements; - /* DWARF array types pretend C supports multi-dimensional arrays. - So for the type int[N][M], the array type DIE contains two - subrange_type children, the first with upper bound N-1 and the - second with upper bound M-1. + array_index_type = ctf_get_AT_type (c); + arinfo.ctr_index = gen_ctf_type (ctfc, array_index_type); - CTF, on the other hand, just encodes each array type in its own - array type CTF struct. Therefore we have to iterate on the - children and create all the needed types. */ + if (c == last) + arinfo.ctr_contents = array_elems_type_id; + else + arinfo.ctr_contents = gen_ctf_subrange_type (ctfc, array_elems_type_id, + dw_get_die_sib (c), last); - c = dw_get_die_child (array_type); - gcc_assert (c); - do - { - ctf_arinfo_t arinfo; - dw_die_ref array_index_type; - uint32_t array_num_elements; + if (!ctf_type_exists (ctfc, c, &array_node_type_id)) + array_node_type_id = ctf_add_array (ctfc, CTF_ADD_ROOT, &arinfo, c); - c = dw_get_die_sib (c); + return array_node_type_id; +} - if (dw_get_die_tag (c) == DW_TAG_subrange_type) - { - dw_attr_node *upper_bound_at; - - array_index_type = ctf_get_AT_type (c); - - /* When DW_AT_upper_bound is used to specify the size of an - array in DWARF, it is usually an unsigned constant - specifying the upper bound index of the array. However, - for unsized arrays, such as foo[] or bar[0], - DW_AT_upper_bound is a signed integer constant - instead. */ - - upper_bound_at = get_AT (c, DW_AT_upper_bound); - if (upper_bound_at - && AT_class (upper_bound_at) == dw_val_class_unsigned_const) - /* This is the upper bound index. */ - array_num_elements = get_AT_unsigned (c, DW_AT_upper_bound) + 1; - else if (get_AT (c, DW_AT_count)) - array_num_elements = get_AT_unsigned (c, DW_AT_count); - else - { - /* This is a VLA of some kind. */ - array_num_elements = 0; - } - } - else if (dw_get_die_tag (c) == DW_TAG_enumeration_type) - { - array_index_type = 0; - array_num_elements = 0; - /* XXX writeme. */ - gcc_assert (1); - } - else - gcc_unreachable (); +/* Generate CTF for an ARRAY_TYPE. */ - /* Ok, mount and register the array type. Note how the array - type we register here is the type of the elements in - subsequent "dimensions", if there are any. */ +static ctf_id_t +gen_ctf_array_type (ctf_container_ref ctfc, + dw_die_ref array_type) +{ + dw_die_ref first, last, array_elems_type; + ctf_id_t array_elems_type_id = CTF_NULL_TYPEID; + ctf_id_t array_type_id = CTF_NULL_TYPEID; - arinfo.ctr_nelems = array_num_elements; - if (array_index_type) - arinfo.ctr_index = gen_ctf_type (ctfc, array_index_type); - else - arinfo.ctr_index = gen_ctf_type (ctfc, ctf_array_index_die); + int vector_type_p = get_AT_flag (array_type, DW_AT_GNU_vector); + if (vector_type_p) + return array_elems_type_id; - arinfo.ctr_contents = array_elems_type_id; - if (!ctf_type_exists (ctfc, c, &array_elems_type_id)) - array_elems_type_id = ctf_add_array (ctfc, CTF_ADD_ROOT, &arinfo, - c); - } - while (c != dw_get_die_child (array_type)); + /* Find the first and last array dimension DIEs. */ + last = dw_get_die_child (array_type); + first = dw_get_die_sib (last); -#if 0 /* Type de-duplication. - Consult the ctfc_types hash again before adding the CTF array type because - there can be cases where an array_type type may have been added by the - gen_ctf_type call above. */ - if (!ctf_type_exists (ctfc, array_type, &type_id)) - type_id = ctf_add_array (ctfc, CTF_ADD_ROOT, &arinfo, array_type); -#endif - - return array_elems_type_id; + Consult the ctfc_types before adding CTF type for the first dimension. */ + if (!ctf_type_exists (ctfc, first, &array_type_id)) + { + array_elems_type = ctf_get_AT_type (array_type); + /* First, register the type of the array elements if needed. */ + array_elems_type_id = gen_ctf_type (ctfc, array_elems_type); + + array_type_id = gen_ctf_subrange_type (ctfc, array_elems_type_id, first, + last); + } + + return array_type_id; } /* Generate CTF for a typedef. */ @@ -944,7 +936,10 @@ ctf_debug_finalize (const char *filename, bool btf) if (btf) { btf_output (filename); - btf_finalize (); + /* btf_finalize when compiling BPF applciations gets deallocated by the + BPF target in bpf_file_end. */ + if (btf_debuginfo_p () && !btf_with_core_debuginfo_p ()) + btf_finalize (); } else @@ -1027,11 +1022,8 @@ ctf_debug_finish (const char * filename) /* Emit BTF debug info here when CO-RE relocations need to be generated. BTF with CO-RE relocations needs to be generated when CO-RE is in effect for the BPF target. */ - if (btf_with_core_debuginfo_p ()) - { - gcc_assert (btf_debuginfo_p ()); - ctf_debug_finalize (filename, btf_debuginfo_p ()); - } + if (btf_debuginfo_p () && btf_with_core_debuginfo_p ()) + ctf_debug_finalize (filename, btf_debuginfo_p ()); } #include "gt-dwarf2ctf.h" diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index 5d64100b95c5..87e4240b8715 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -8215,6 +8215,15 @@ should_move_die_to_comdat (dw_die_ref die) || is_nested_in_subprogram (die) || contains_subprogram_definition (die)) return false; + if (die->die_tag != DW_TAG_enumeration_type) + { + /* Don't move non-constant size aggregates. */ + dw_attr_node *sz = get_AT (die, DW_AT_byte_size); + if (sz == NULL + || (AT_class (sz) != dw_val_class_unsigned_const + && AT_class (sz) != dw_val_class_unsigned_const_implicit)) + return false; + } return true; case DW_TAG_array_type: case DW_TAG_interface_type: @@ -25153,6 +25162,17 @@ gen_field_die (tree decl, struct vlr_context *ctx, dw_die_ref context_die) add_accessibility_attribute (decl_die, decl); + /* Add DW_AT_export_symbols to anonymous unions or structs. */ + if ((dwarf_version >= 5 || !dwarf_strict) && DECL_NAME (decl) == NULL_TREE) + if (tree type = member_declared_type (decl)) + if (lang_hooks.types.type_dwarf_attribute (TYPE_MAIN_VARIANT (type), + DW_AT_export_symbols) != -1) + { + dw_die_ref type_die = lookup_type_die (TYPE_MAIN_VARIANT (type)); + if (type_die && get_AT (type_die, DW_AT_export_symbols) == NULL) + add_AT_flag (type_die, DW_AT_export_symbols, 1); + } + /* Equate decl number to die, so that we can look up this decl later on. */ equate_decl_number_to_die (decl, decl_die); } diff --git a/gcc/expmed.cc b/gcc/expmed.cc index 5916d6ed1bcc..4ec035e4843b 100644 --- a/gcc/expmed.cc +++ b/gcc/expmed.cc @@ -3285,11 +3285,15 @@ choose_mult_variant (machine_mode mode, HOST_WIDE_INT val, limit.latency = mult_cost - op_cost; } - synth_mult (&alg2, val - 1, &limit, mode); - alg2.cost.cost += op_cost; - alg2.cost.latency += op_cost; - if (CHEAPER_MULT_COST (&alg2.cost, &alg->cost)) - *alg = alg2, *variant = add_variant; + if (val != HOST_WIDE_INT_MIN + || GET_MODE_UNIT_PRECISION (mode) == HOST_BITS_PER_WIDE_INT) + { + synth_mult (&alg2, val - HOST_WIDE_INT_1U, &limit, mode); + alg2.cost.cost += op_cost; + alg2.cost.latency += op_cost; + if (CHEAPER_MULT_COST (&alg2.cost, &alg->cost)) + *alg = alg2, *variant = add_variant; + } return MULT_COST_LESS (&alg->cost, mult_cost); } diff --git a/gcc/expr.cc b/gcc/expr.cc index e238811110e4..f7d74525c15b 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -7879,8 +7879,8 @@ store_constructor (tree exp, rtx target, int cleared, poly_int64 size, auto nunits = TYPE_VECTOR_SUBPARTS (type).to_constant (); if (maybe_ne (GET_MODE_PRECISION (mode), nunits)) tmp = expand_binop (mode, and_optab, tmp, - GEN_INT ((1 << nunits) - 1), target, - true, OPTAB_WIDEN); + GEN_INT ((HOST_WIDE_INT_1U << nunits) - 1), + target, true, OPTAB_WIDEN); if (tmp != target) emit_move_insn (target, tmp); break; @@ -10259,12 +10259,12 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode, &algorithm, &variant, cost) : cost < mul_cost (speed, mode)) { - target = bit0_p ? expand_and (mode, negate_rtx (mode, op0), - op1, target) - : expand_and (mode, op0, - negate_rtx (mode, op1), - target); - return REDUCE_BIT_FIELD (target); + temp = bit0_p ? expand_and (mode, negate_rtx (mode, op0), + op1, target) + : expand_and (mode, op0, + negate_rtx (mode, op1), + target); + return REDUCE_BIT_FIELD (temp); } } } @@ -13707,11 +13707,11 @@ do_store_flag (sepops ops, rtx target, machine_mode mode) { gcc_assert (code == EQ || code == NE); op0 = expand_binop (mode, and_optab, op0, - GEN_INT ((1 << nunits) - 1), NULL_RTX, - true, OPTAB_WIDEN); + GEN_INT ((HOST_WIDE_INT_1U << nunits) - 1), + NULL_RTX, true, OPTAB_WIDEN); op1 = expand_binop (mode, and_optab, op1, - GEN_INT ((1 << nunits) - 1), NULL_RTX, - true, OPTAB_WIDEN); + GEN_INT ((HOST_WIDE_INT_1U << nunits) - 1), + NULL_RTX, true, OPTAB_WIDEN); } if (target == 0) diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc index 80e211e18c0e..43105d20be35 100644 --- a/gcc/fold-const.cc +++ b/gcc/fold-const.cc @@ -11779,6 +11779,15 @@ fold_binary_loc (location_t loc, enum tree_code code, tree type, + (lit0 != 0) + (lit1 != 0) + (minus_lit0 != 0) + (minus_lit1 != 0)) > 2) { + int var0_origin = (var0 != 0) + 2 * (var1 != 0); + int minus_var0_origin + = (minus_var0 != 0) + 2 * (minus_var1 != 0); + int con0_origin = (con0 != 0) + 2 * (con1 != 0); + int minus_con0_origin + = (minus_con0 != 0) + 2 * (minus_con1 != 0); + int lit0_origin = (lit0 != 0) + 2 * (lit1 != 0); + int minus_lit0_origin + = (minus_lit0 != 0) + 2 * (minus_lit1 != 0); var0 = associate_trees (loc, var0, var1, code, atype); minus_var0 = associate_trees (loc, minus_var0, minus_var1, code, atype); @@ -11791,15 +11800,19 @@ fold_binary_loc (location_t loc, enum tree_code code, tree type, if (minus_var0 && var0) { + var0_origin |= minus_var0_origin; var0 = associate_trees (loc, var0, minus_var0, MINUS_EXPR, atype); minus_var0 = 0; + minus_var0_origin = 0; } if (minus_con0 && con0) { + con0_origin |= minus_con0_origin; con0 = associate_trees (loc, con0, minus_con0, MINUS_EXPR, atype); minus_con0 = 0; + minus_con0_origin = 0; } /* Preserve the MINUS_EXPR if the negative part of the literal is @@ -11815,15 +11828,19 @@ fold_binary_loc (location_t loc, enum tree_code code, tree type, /* But avoid ending up with only negated parts. */ && (var0 || con0)) { + minus_lit0_origin |= lit0_origin; minus_lit0 = associate_trees (loc, minus_lit0, lit0, MINUS_EXPR, atype); lit0 = 0; + lit0_origin = 0; } else { + lit0_origin |= minus_lit0_origin; lit0 = associate_trees (loc, lit0, minus_lit0, MINUS_EXPR, atype); minus_lit0 = 0; + minus_lit0_origin = 0; } } @@ -11833,37 +11850,51 @@ fold_binary_loc (location_t loc, enum tree_code code, tree type, return NULL_TREE; /* Eliminate lit0 and minus_lit0 to con0 and minus_con0. */ + con0_origin |= lit0_origin; con0 = associate_trees (loc, con0, lit0, code, atype); - lit0 = 0; + minus_con0_origin |= minus_lit0_origin; minus_con0 = associate_trees (loc, minus_con0, minus_lit0, code, atype); - minus_lit0 = 0; /* Eliminate minus_con0. */ if (minus_con0) { if (con0) - con0 = associate_trees (loc, con0, minus_con0, - MINUS_EXPR, atype); + { + con0_origin |= minus_con0_origin; + con0 = associate_trees (loc, con0, minus_con0, + MINUS_EXPR, atype); + } else if (var0) - var0 = associate_trees (loc, var0, minus_con0, - MINUS_EXPR, atype); + { + var0_origin |= minus_con0_origin; + var0 = associate_trees (loc, var0, minus_con0, + MINUS_EXPR, atype); + } else gcc_unreachable (); - minus_con0 = 0; } /* Eliminate minus_var0. */ if (minus_var0) { if (con0) - con0 = associate_trees (loc, con0, minus_var0, - MINUS_EXPR, atype); + { + con0_origin |= minus_var0_origin; + con0 = associate_trees (loc, con0, minus_var0, + MINUS_EXPR, atype); + } else gcc_unreachable (); - minus_var0 = 0; } + /* Reassociate only if there has been any actual association + between subtrees from op0 and subtrees from op1 in at + least one of the operands, otherwise we risk infinite + recursion. See PR114084. */ + if (var0_origin != 3 && con0_origin != 3) + return NULL_TREE; + return fold_convert_loc (loc, type, associate_trees (loc, var0, con0, code, atype)); diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index f86cbe3e4c42..fb11c05186a8 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,80 @@ +2024-03-06 Harald Anlauf + + PR fortran/103707 + PR fortran/106987 + * arith.cc (is_hard_arith_error): New helper function to determine + whether an arithmetic error is "hard" or not. + (check_result): Use it. + (gfc_arith_divide): Set "Division by zero" only for regular + numerators of real and complex divisions. + (reduce_unary): Use is_hard_arith_error to determine whether a hard + or (recoverable) soft error was encountered. Terminate immediately + on hard error, otherwise remember code of first soft error. + (reduce_binary_ac): Likewise. + (reduce_binary_ca): Likewise. + (reduce_binary_aa): Likewise. + +2024-03-01 Harald Anlauf + + PR fortran/104819 + * check.cc (gfc_check_null): Handle nested NULL()s. + (is_c_interoperable): Check for MOLD argument of NULL() as part of + the interoperability check. + * interface.cc (gfc_compare_actual_formal): Extend checks for NULL() + actual arguments for presence of MOLD argument when required by + Interp J3/22-146. + +2024-02-29 Alexander Westbrooks + + PR fortran/82943 + PR fortran/86148 + PR fortran/86268 + * decl.cc (gfc_get_pdt_instance): Set the PDT instance field + 'f2k_derived', if not set already, to point to the given + PDT template 'f2k_derived' namespace in order to give the + PDT instance referential access to the typebound procedures + of the template. + * gfortran.h (gfc_pdt_is_instance_of): Add prototype. + * resolve.cc (resolve_typebound_procedure): If the derived type + does not have the attribute 'pdt_template' set, compare the + dummy argument to the 'resolve_bindings_derived' type like usual. + If the derived type is a 'pdt_template', then check if the + dummy argument is an instance of the PDT template. If the derived + type is a PDT template, and the dummy argument is an instance of + that template, but the dummy argument 'param_list' is not + SPEC_ASSUMED, check if there are any LEN parameters in the + dummy argument. If there are no LEN parameters, then this implies + that there are only KIND parameters in the dummy argument. + If there are LEN parameters, this would be an error, for all + LEN parameters for the dummy argument MUST be assumed for + typebound procedures of PDTs. + (resolve_pdt): Add a check for ALLOCATABLE and POINTER attributes for + SPEC_DEFERRED parameters of PDT class symbols. ALLOCATABLE and + POINTER attributes for a PDT class symbol are stored in the + 'class_pointer' and 'allocatable' attributes of the '_data' + component respectively. + * symbol.cc (gfc_pdt_is_instance_of): New function. + +2024-02-26 Harald Anlauf + + PR fortran/114012 + * trans-expr.cc (gfc_conv_procedure_call): Evaluate non-trivial + arguments just once before assigning to an unlimited polymorphic + dummy variable. + +2024-02-23 Steve Kargl + Harald Anlauf + + PR fortran/114024 + * trans-stmt.cc (gfc_trans_allocate): When a source expression has + substring references, part-refs, or %re/%im inquiries, wrap the + entity in parentheses to force evaluation of the expression. + +2024-02-23 Tobias Burnus + + * openmp.cc (gfc_match_omp_depobj): Use OPT_Wopenmp + as warning category in gfc_warning. + 2024-02-20 Peter Hill PR fortran/105658 diff --git a/gcc/fortran/arith.cc b/gcc/fortran/arith.cc index d17d1aaa1d91..b373c25e5e12 100644 --- a/gcc/fortran/arith.cc +++ b/gcc/fortran/arith.cc @@ -130,6 +130,30 @@ gfc_arith_error (arith code) } +/* Check if a certain arithmetic error code is severe enough to prevent + further simplification, as opposed to errors thrown by the range check + (e.g. overflow) or arithmetic exceptions that are tolerated with + -fno-range-check. */ + +static bool +is_hard_arith_error (arith code) +{ + switch (code) + { + case ARITH_OK: + case ARITH_OVERFLOW: + case ARITH_UNDERFLOW: + case ARITH_NAN: + case ARITH_DIV0: + case ARITH_ASYMMETRIC: + return false; + + default: + return true; + } +} + + /* Get things ready to do math. */ void @@ -579,10 +603,10 @@ check_result (arith rc, gfc_expr *x, gfc_expr *r, gfc_expr **rp) val = ARITH_OK; } - if (val == ARITH_OK || val == ARITH_OVERFLOW) - *rp = r; - else + if (is_hard_arith_error (val)) gfc_free_expr (r); + else + *rp = r; return val; } @@ -792,23 +816,26 @@ gfc_arith_divide (gfc_expr *op1, gfc_expr *op2, gfc_expr **resultp) break; case BT_REAL: - if (mpfr_sgn (op2->value.real) == 0 && flag_range_check == 1) - { - rc = ARITH_DIV0; - break; - } + /* Set "Division by zero" only for regular numerator. */ + if (flag_range_check == 1 + && mpfr_zero_p (op2->value.real) + && mpfr_regular_p (op1->value.real)) + rc = ARITH_DIV0; mpfr_div (result->value.real, op1->value.real, op2->value.real, GFC_RND_MODE); break; case BT_COMPLEX: - if (mpc_cmp_si_si (op2->value.complex, 0, 0) == 0 - && flag_range_check == 1) - { - rc = ARITH_DIV0; - break; - } + /* Set "Division by zero" only for regular numerator. */ + if (flag_range_check == 1 + && mpfr_zero_p (mpc_realref (op2->value.complex)) + && mpfr_zero_p (mpc_imagref (op2->value.complex)) + && ((mpfr_regular_p (mpc_realref (op1->value.complex)) + && mpfr_number_p (mpc_imagref (op1->value.complex))) + || (mpfr_regular_p (mpc_imagref (op1->value.complex)) + && mpfr_number_p (mpc_realref (op1->value.complex))))) + rc = ARITH_DIV0; gfc_set_model (mpc_realref (op1->value.complex)); if (mpc_cmp_si_si (op2->value.complex, 0, 0) == 0) @@ -1323,7 +1350,6 @@ reduce_unary (arith (*eval) (gfc_expr *, gfc_expr **), gfc_expr *op, gfc_constructor *c; gfc_expr *r; arith rc; - bool ov = false; if (op->expr_type == EXPR_CONSTANT) return eval (op, result); @@ -1335,19 +1361,22 @@ reduce_unary (arith (*eval) (gfc_expr *, gfc_expr **), gfc_expr *op, head = gfc_constructor_copy (op->value.constructor); for (c = gfc_constructor_first (head); c; c = gfc_constructor_next (c)) { - rc = reduce_unary (eval, c->expr, &r); + arith rc_tmp = reduce_unary (eval, c->expr, &r); - /* Remember any overflow encountered during reduction and continue, - but terminate on serious errors. */ - if (rc == ARITH_OVERFLOW) - ov = true; - else if (rc != ARITH_OK) - break; + /* Remember first recoverable ("soft") error encountered during + reduction and continue, but terminate on serious errors. */ + if (is_hard_arith_error (rc_tmp)) + { + rc = rc_tmp; + break; + } + else if (rc_tmp != ARITH_OK && rc == ARITH_OK) + rc = rc_tmp; gfc_replace_expr (c->expr, r); } - if (rc != ARITH_OK && rc != ARITH_OVERFLOW) + if (is_hard_arith_error (rc)) gfc_constructor_free (head); else { @@ -1368,7 +1397,7 @@ reduce_unary (arith (*eval) (gfc_expr *, gfc_expr **), gfc_expr *op, *result = r; } - return ov ? ARITH_OVERFLOW : rc; + return rc; } @@ -1384,22 +1413,31 @@ reduce_binary_ac (arith (*eval) (gfc_expr *, gfc_expr *, gfc_expr **), head = gfc_constructor_copy (op1->value.constructor); for (c = gfc_constructor_first (head); c; c = gfc_constructor_next (c)) { + arith rc_tmp; + gfc_simplify_expr (c->expr, 0); if (c->expr->expr_type == EXPR_CONSTANT) - rc = eval (c->expr, op2, &r); + rc_tmp = eval (c->expr, op2, &r); else if (c->expr->expr_type != EXPR_ARRAY) - rc = ARITH_NOT_REDUCED; + rc_tmp = ARITH_NOT_REDUCED; else - rc = reduce_binary_ac (eval, c->expr, op2, &r); + rc_tmp = reduce_binary_ac (eval, c->expr, op2, &r); - if (rc != ARITH_OK) - break; + /* Remember first recoverable ("soft") error encountered during + reduction and continue, but terminate on serious errors. */ + if (is_hard_arith_error (rc_tmp)) + { + rc = rc_tmp; + break; + } + else if (rc_tmp != ARITH_OK && rc == ARITH_OK) + rc = rc_tmp; gfc_replace_expr (c->expr, r); } - if (rc != ARITH_OK) + if (is_hard_arith_error (rc)) gfc_constructor_free (head); else { @@ -1438,22 +1476,31 @@ reduce_binary_ca (arith (*eval) (gfc_expr *, gfc_expr *, gfc_expr **), head = gfc_constructor_copy (op2->value.constructor); for (c = gfc_constructor_first (head); c; c = gfc_constructor_next (c)) { + arith rc_tmp; + gfc_simplify_expr (c->expr, 0); if (c->expr->expr_type == EXPR_CONSTANT) - rc = eval (op1, c->expr, &r); + rc_tmp = eval (op1, c->expr, &r); else if (c->expr->expr_type != EXPR_ARRAY) - rc = ARITH_NOT_REDUCED; + rc_tmp = ARITH_NOT_REDUCED; else - rc = reduce_binary_ca (eval, op1, c->expr, &r); + rc_tmp = reduce_binary_ca (eval, op1, c->expr, &r); - if (rc != ARITH_OK) - break; + /* Remember first recoverable ("soft") error encountered during + reduction and continue, but terminate on serious errors. */ + if (is_hard_arith_error (rc_tmp)) + { + rc = rc_tmp; + break; + } + else if (rc_tmp != ARITH_OK && rc == ARITH_OK) + rc = rc_tmp; gfc_replace_expr (c->expr, r); } - if (rc != ARITH_OK) + if (is_hard_arith_error (rc)) gfc_constructor_free (head); else { @@ -1503,10 +1550,17 @@ reduce_binary_aa (arith (*eval) (gfc_expr *, gfc_expr *, gfc_expr **), c && d; c = gfc_constructor_next (c), d = gfc_constructor_next (d)) { - rc = reduce_binary (eval, c->expr, d->expr, &r); + arith rc_tmp = reduce_binary (eval, c->expr, d->expr, &r); - if (rc != ARITH_OK) - break; + /* Remember first recoverable ("soft") error encountered during + reduction and continue, but terminate on serious errors. */ + if (is_hard_arith_error (rc_tmp)) + { + rc = rc_tmp; + break; + } + else if (rc_tmp != ARITH_OK && rc == ARITH_OK) + rc = rc_tmp; gfc_replace_expr (c->expr, r); } @@ -1514,7 +1568,7 @@ reduce_binary_aa (arith (*eval) (gfc_expr *, gfc_expr *, gfc_expr **), if (rc == ARITH_OK && (c || d)) rc = ARITH_INCOMMENSURATE; - if (rc != ARITH_OK) + if (is_hard_arith_error (rc)) gfc_constructor_free (head); else { diff --git a/gcc/fortran/check.cc b/gcc/fortran/check.cc index d661cf37f01e..db74dcf3f40b 100644 --- a/gcc/fortran/check.cc +++ b/gcc/fortran/check.cc @@ -4384,6 +4384,9 @@ gfc_check_null (gfc_expr *mold) if (mold == NULL) return true; + if (mold->expr_type == EXPR_NULL) + return true; + if (!variable_check (mold, 0, true)) return false; @@ -5216,7 +5219,7 @@ is_c_interoperable (gfc_expr *expr, const char **msg, bool c_loc, bool c_f_ptr) { *msg = NULL; - if (expr->expr_type == EXPR_NULL) + if (expr->expr_type == EXPR_NULL && expr->ts.type == BT_UNKNOWN) { *msg = "NULL() is not interoperable"; return false; diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc index 503ecb8d9b54..a7576f4bc402 100644 --- a/gcc/fortran/decl.cc +++ b/gcc/fortran/decl.cc @@ -4083,6 +4083,21 @@ gfc_get_pdt_instance (gfc_actual_arglist *param_list, gfc_symbol **sym, continue; } + /* Addressing PR82943, this will fix the issue where a function or + subroutine is declared as not a member of the PDT instance. + The reason for this is because the PDT instance did not have access + to its template's f2k_derived namespace in order to find the + typebound procedures. + + The number of references to the PDT template's f2k_derived will + ensure that f2k_derived is properly freed later on. */ + + if (!instance->f2k_derived && pdt->f2k_derived) + { + instance->f2k_derived = pdt->f2k_derived; + instance->f2k_derived->refs++; + } + /* Set the component kind using the parameterized expression. */ if ((c1->ts.kind == 0 || c1->ts.type == BT_CHARACTER) && c1->kind_expr != NULL) diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index fd843a3241db..ebba2336e129 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -3586,6 +3586,7 @@ void gfc_traverse_gsymbol (gfc_gsymbol *, void (*)(gfc_gsymbol *, void *), void gfc_typebound_proc* gfc_get_typebound_proc (gfc_typebound_proc*); gfc_symbol* gfc_get_derived_super_type (gfc_symbol*); bool gfc_type_is_extension_of (gfc_symbol *, gfc_symbol *); +bool gfc_pdt_is_instance_of (gfc_symbol *, gfc_symbol *); bool gfc_type_compatible (gfc_typespec *, gfc_typespec *); void gfc_copy_formal_args_intr (gfc_symbol *, gfc_intrinsic_sym *, diff --git a/gcc/fortran/interface.cc b/gcc/fortran/interface.cc index 231f2f252afe..64b90550be2a 100644 --- a/gcc/fortran/interface.cc +++ b/gcc/fortran/interface.cc @@ -3296,6 +3296,36 @@ gfc_compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, && a->expr->ts.type != BT_ASSUMED) gfc_find_vtab (&a->expr->ts); + /* Interp J3/22-146: + "If the context of the reference to NULL is an + corresponding to an dummy argument, MOLD shall be + present." */ + if (a->expr->expr_type == EXPR_NULL + && a->expr->ts.type == BT_UNKNOWN + && f->sym->as + && f->sym->as->type == AS_ASSUMED_RANK) + { + gfc_error ("Intrinsic % without % argument at %L " + "passed to assumed-rank dummy %qs", + &a->expr->where, f->sym->name); + ok = false; + goto match; + } + + if (a->expr->expr_type == EXPR_NULL + && a->expr->ts.type == BT_UNKNOWN + && f->sym->ts.type == BT_CHARACTER + && !f->sym->ts.deferred + && f->sym->ts.u.cl + && f->sym->ts.u.cl->length == NULL) + { + gfc_error ("Intrinsic % without % argument at %L " + "passed to assumed-length dummy %qs", + &a->expr->where, f->sym->name); + ok = false; + goto match; + } + if (a->expr->expr_type == EXPR_NULL && ((f->sym->ts.type != BT_CLASS && !f->sym->attr.pointer && (f->sym->attr.allocatable || !f->sym->attr.optional diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc index 77f6e1732f92..38de60238c0e 100644 --- a/gcc/fortran/openmp.cc +++ b/gcc/fortran/openmp.cc @@ -4768,8 +4768,8 @@ gfc_match_omp_depobj (void) if (gfc_match (" ( %v ) ", &destroyobj) == MATCH_YES) { if (destroyobj->symtree != depobj->symtree) - gfc_warning (0, "The same depend object should be used as DEPOBJ " - "argument at %L and as DESTROY argument at %L", + gfc_warning (OPT_Wopenmp, "The same depend object should be used as" + " DEPOBJ argument at %L and as DESTROY argument at %L", &depobj->where, &destroyobj->where); gfc_free_expr (destroyobj); } diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index 44f89f6afb4f..02acc4aef31b 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -14760,15 +14760,69 @@ resolve_typebound_procedure (gfc_symtree* stree) goto error; } - if (CLASS_DATA (me_arg)->ts.u.derived - != resolve_bindings_derived) + /* The derived type is not a PDT template. Resolve as usual. */ + if (!resolve_bindings_derived->attr.pdt_template + && (CLASS_DATA (me_arg)->ts.u.derived != resolve_bindings_derived)) { - gfc_error ("Argument %qs of %qs with PASS(%s) at %L must be of" - " the derived-type %qs", me_arg->name, proc->name, + gfc_error ("Argument %qs of %qs with PASS(%s) at %L must be of " + "the derived-type %qs", me_arg->name, proc->name, me_arg->name, &where, resolve_bindings_derived->name); goto error; } + if (resolve_bindings_derived->attr.pdt_template + && !gfc_pdt_is_instance_of (resolve_bindings_derived, + CLASS_DATA (me_arg)->ts.u.derived)) + { + gfc_error ("Argument %qs of %qs with PASS(%s) at %L must be of " + "the parametric derived-type %qs", me_arg->name, + proc->name, me_arg->name, &where, + resolve_bindings_derived->name); + goto error; + } + + if (resolve_bindings_derived->attr.pdt_template + && gfc_pdt_is_instance_of (resolve_bindings_derived, + CLASS_DATA (me_arg)->ts.u.derived) + && (me_arg->param_list != NULL) + && (gfc_spec_list_type (me_arg->param_list, + CLASS_DATA(me_arg)->ts.u.derived) + != SPEC_ASSUMED)) + { + + /* Add a check to verify if there are any LEN parameters in the + first place. If there are LEN parameters, throw this error. + If there are only KIND parameters, then don't trigger + this error. */ + gfc_component *c; + bool seen_len_param = false; + gfc_actual_arglist *me_arg_param = me_arg->param_list; + + for (; me_arg_param; me_arg_param = me_arg_param->next) + { + c = gfc_find_component (CLASS_DATA(me_arg)->ts.u.derived, + me_arg_param->name, true, true, NULL); + + gcc_assert (c != NULL); + + if (c->attr.pdt_kind) + continue; + + /* Getting here implies that there is a pdt_len parameter + in the list. */ + seen_len_param = true; + break; + } + + if (seen_len_param) + { + gfc_error ("All LEN type parameters of the passed dummy " + "argument %qs of %qs at %L must be ASSUMED.", + me_arg->name, proc->name, &where); + goto error; + } + } + gcc_assert (me_arg->ts.type == BT_CLASS); if (CLASS_DATA (me_arg)->as && CLASS_DATA (me_arg)->as->rank != 0) { @@ -15886,11 +15940,13 @@ resolve_pdt (gfc_symbol* sym) else if (param->spec_type == SPEC_ASSUMED) assumed_len_exprs = true; - if (param->spec_type == SPEC_DEFERRED - && !attr->allocatable && !attr->pointer) - gfc_error ("The object %qs at %L has a deferred LEN " - "parameter %qs and is neither allocatable " - "nor a pointer", sym->name, &sym->declared_at, + if (param->spec_type == SPEC_DEFERRED && !attr->allocatable + && ((sym->ts.type == BT_DERIVED && !attr->pointer) + || (sym->ts.type == BT_CLASS && !attr->class_pointer))) + gfc_error ("Entity %qs at %L has a deferred LEN " + "parameter %qs and requires either the POINTER " + "or ALLOCATABLE attribute", + sym->name, &sym->declared_at, param->name); } diff --git a/gcc/fortran/symbol.cc b/gcc/fortran/symbol.cc index fddf68f83989..5d9852c79e00 100644 --- a/gcc/fortran/symbol.cc +++ b/gcc/fortran/symbol.cc @@ -5172,6 +5172,33 @@ gfc_type_is_extension_of (gfc_symbol *t1, gfc_symbol *t2) return gfc_compare_derived_types (t1, t2); } +/* Check if parameterized derived type t2 is an instance of pdt template t1 + + gfc_symbol *t1 -> pdt template to verify t2 against. + gfc_symbol *t2 -> pdt instance to be verified. + + In decl.cc, gfc_get_pdt_instance, a pdt instance is given a 3 character + prefix "Pdt", followed by an underscore list of the kind parameters, + up to a maximum of 8 kind parameters. To verify if a PDT Type corresponds + to the template, this functions extracts t2's derive_type name, + and compares it to the derive_type name of t1 for compatibility. + + For example: + + t2->name = Pdtf_2_2; extract out the 'f' and compare with t1->name. */ + +bool +gfc_pdt_is_instance_of (gfc_symbol *t1, gfc_symbol *t2) +{ + if ( !t1->attr.pdt_template || !t2->attr.pdt_type ) + return false; + + /* Limit comparison to length of t1->name to ignore new kind params. */ + if ( !(strncmp (&(t2->name[3]), t1->name, strlen (t1->name)) == 0) ) + return false; + + return true; +} /* Check if two typespecs are type compatible (F03:5.1.1.2): If ts1 is nonpolymorphic, ts2 must be the same type. diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc index 118dfd7c9b23..d63c304661a4 100644 --- a/gcc/fortran/trans-expr.cc +++ b/gcc/fortran/trans-expr.cc @@ -6691,6 +6691,10 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, { tree efield; + /* Evaluate arguments just once. */ + if (e->expr_type != EXPR_VARIABLE) + parmse.expr = save_expr (parmse.expr); + /* Set the _data field. */ tmp = gfc_class_data_get (var); efield = fold_convert (TREE_TYPE (tmp), diff --git a/gcc/fortran/trans-stmt.cc b/gcc/fortran/trans-stmt.cc index 5247d3d39d71..e09828e218b1 100644 --- a/gcc/fortran/trans-stmt.cc +++ b/gcc/fortran/trans-stmt.cc @@ -6355,8 +6355,14 @@ gfc_trans_allocate (gfc_code * code, gfc_omp_namelist *omp_allocate) vtab_needed = (al->expr->ts.type == BT_CLASS); gfc_init_se (&se, NULL); - /* When expr3 is a variable, i.e., a very simple expression, - then convert it once here. */ + /* When expr3 is a variable, i.e., a very simple expression, then + convert it once here. If one has a source expression that has + substring references, part-refs, or %re/%im inquiries, wrap the + entity in parentheses to force evaluation of the expression. */ + if (code->expr3->expr_type == EXPR_VARIABLE + && is_subref_array (code->expr3)) + code->expr3 = gfc_get_parentheses (code->expr3); + if (code->expr3->expr_type == EXPR_VARIABLE || code->expr3->expr_type == EXPR_ARRAY || code->expr3->expr_type == EXPR_CONSTANT) diff --git a/gcc/function.cc b/gcc/function.cc index 5ffd438475e9..3cef6c17bce0 100644 --- a/gcc/function.cc +++ b/gcc/function.cc @@ -3650,7 +3650,8 @@ assign_parms (tree fndecl) assign_parms_initialize_all (&all); fnargs = assign_parms_augmented_arg_list (&all); - if (TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (fndecl))) + if (TYPE_NO_NAMED_ARGS_STDARG_P (TREE_TYPE (fndecl)) + && fnargs.is_empty ()) { struct assign_parm_data_one data = {}; assign_parms_setup_varargs (&all, &data, false); @@ -6391,7 +6392,7 @@ fndecl_name (tree fndecl) /* Returns the name of function FN. */ const char * -function_name (struct function *fn) +function_name (const function *fn) { tree fndecl = (fn == NULL) ? NULL : fn->decl; return fndecl_name (fndecl); diff --git a/gcc/function.h b/gcc/function.h index 2d775b877fc2..19e15bd63b0a 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -730,7 +730,7 @@ extern poly_int64 get_stack_dynamic_offset (); /* Returns the name of the current function. */ extern const char *fndecl_name (tree); -extern const char *function_name (struct function *); +extern const char *function_name (const function *); extern const char *current_function_name (void); extern void used_types_insert (tree); diff --git a/gcc/fwprop.cc b/gcc/fwprop.cc index 7872609b336a..de543923b92f 100644 --- a/gcc/fwprop.cc +++ b/gcc/fwprop.cc @@ -451,6 +451,7 @@ try_fwprop_subst_pattern (obstack_watermark &attempt, insn_change &use_change, if (!prop.likely_profitable_p () && (prop.changed_mem_p () + || contains_mem_rtx_p (src) || use_insn->is_asm () || !single_set (use_rtl))) { @@ -854,6 +855,8 @@ forward_propagate_into (use_info *use, bool reg_prop_only = false) rtx dest = SET_DEST (def_set); rtx src = SET_SRC (def_set); + if (volatile_refs_p (src)) + return false; /* Allow propagations into a loop only for reg-to-reg copies, since replacing one register by another shouldn't increase the cost. diff --git a/gcc/genattrtab.cc b/gcc/genattrtab.cc index 12082c1e3570..03c7d6c74a3b 100644 --- a/gcc/genattrtab.cc +++ b/gcc/genattrtab.cc @@ -2392,7 +2392,7 @@ static rtx attr_alt_complement (rtx s) { return attr_rtx (EQ_ATTR_ALT, XWINT (s, 0), - ((HOST_WIDE_INT) 1) - XWINT (s, 1)); + HOST_WIDE_INT_1 - XWINT (s, 1)); } /* Return EQ_ATTR_ALT expression representing set containing elements set @@ -2401,7 +2401,7 @@ attr_alt_complement (rtx s) static rtx mk_attr_alt (alternative_mask e) { - return attr_rtx (EQ_ATTR_ALT, (HOST_WIDE_INT) e, (HOST_WIDE_INT) 0); + return attr_rtx (EQ_ATTR_ALT, (HOST_WIDE_INT) e, HOST_WIDE_INT_0); } /* Given an expression, see if it can be simplified for a particular insn diff --git a/gcc/genautomata.cc b/gcc/genautomata.cc index c66298d9064f..ec1e5331a4b0 100644 --- a/gcc/genautomata.cc +++ b/gcc/genautomata.cc @@ -3416,13 +3416,13 @@ finish_alt_states (void) /* Set bit number bitno in the bit string. The macro is not side effect proof. */ -#define bitmap_set_bit(bitstring, bitno) \ +#define bitmap_set_bit(bitstring, bitno) \ ((bitstring)[(bitno) / (sizeof (*(bitstring)) * CHAR_BIT)] |= \ - (HOST_WIDE_INT)1 << (bitno) % (sizeof (*(bitstring)) * CHAR_BIT)) + HOST_WIDE_INT_1 << (bitno) % (sizeof (*(bitstring)) * CHAR_BIT)) #define CLEAR_BIT(bitstring, bitno) \ ((bitstring)[(bitno) / (sizeof (*(bitstring)) * CHAR_BIT)] &= \ - ~((HOST_WIDE_INT)1 << (bitno) % (sizeof (*(bitstring)) * CHAR_BIT))) + ~(HOST_WIDE_INT_1 << (bitno) % (sizeof (*(bitstring)) * CHAR_BIT))) /* Test if bit number bitno in the bitstring is set. The macro is not side effect proof. */ diff --git a/gcc/gengtype.cc b/gcc/gengtype.cc index 87f8090544c1..c0ecbe8558b1 100644 --- a/gcc/gengtype.cc +++ b/gcc/gengtype.cc @@ -1715,9 +1715,9 @@ open_base_files (void) "tree-dfa.h", "tree-ssa.h", "reload.h", "cpplib.h", "tree-chrec.h", "except.h", "output.h", "cfgloop.h", "target.h", "lto-streamer.h", "target-globals.h", "ipa-ref.h", "cgraph.h", "symbol-summary.h", - "ipa-prop.h", "ipa-fnsummary.h", "dwarf2out.h", "omp-general.h", - "omp-offload.h", "ipa-modref-tree.h", "ipa-modref.h", "symtab-thunks.h", - "symtab-clones.h", "diagnostic-spec.h", "ctfc.h", + "sreal.h", "ipa-cp.h", "ipa-prop.h", "ipa-fnsummary.h", "dwarf2out.h", + "omp-general.h", "omp-offload.h", "ipa-modref-tree.h", "ipa-modref.h", + "symtab-thunks.h", "symtab-clones.h", "diagnostic-spec.h", "ctfc.h", NULL }; const char *const *ifp; diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc index 5e92d0b4af2e..c982c95b70f4 100644 --- a/gcc/genmatch.cc +++ b/gcc/genmatch.cc @@ -4071,7 +4071,7 @@ decision_tree::gen (vec &files, bool gimple) for (unsigned i = 0; i < as_a (s->s->s->match)->ops.length (); ++i) fp_decl (f, " tree ARG_UNUSED (_p%d),", i); - fp_decl (f, " tree *captures"); + fp_decl (f, " tree *ARG_UNUSED (captures)"); } for (unsigned i = 0; i < s->s->s->for_subst_vec.length (); ++i) { @@ -4749,10 +4749,8 @@ parser::parse_c_expr (cpp_ttype start) = (const char *)CPP_HASHNODE (token->val.node.node)->ident.str; if (strcmp (str, "return") == 0) fatal_at (token, "return statement not allowed in C expression"); - id_base *idb = get_operator (str); - user_id *p; - if (idb && (p = dyn_cast (idb)) && p->is_oper_list) - record_operlist (token->src_loc, p); + /* Mark user operators corresponding to 'str' as used. */ + get_operator (str); } /* Record the token. */ diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc index 5191102df688..d2a0f6ddf196 100644 --- a/gcc/gimple-fold.cc +++ b/gcc/gimple-fold.cc @@ -995,9 +995,12 @@ gimple_fold_builtin_memory_op (gimple_stmt_iterator *gsi, if (warning != OPT_Wrestrict) return false; - scalar_int_mode mode; - if (int_mode_for_size (ilen * 8, 0).exists (&mode) - && GET_MODE_SIZE (mode) * BITS_PER_UNIT == ilen * 8 + scalar_int_mode imode; + machine_mode mode; + if (int_mode_for_size (ilen * BITS_PER_UNIT, 0).exists (&imode) + && bitwise_mode_for_size (ilen + * BITS_PER_UNIT).exists (&mode) + && known_eq (GET_MODE_BITSIZE (mode), ilen * BITS_PER_UNIT) /* If the destination pointer is not aligned we must be able to emit an unaligned store. */ && (dest_align >= GET_MODE_ALIGNMENT (mode) @@ -1005,7 +1008,7 @@ gimple_fold_builtin_memory_op (gimple_stmt_iterator *gsi, || (optab_handler (movmisalign_optab, mode) != CODE_FOR_nothing))) { - tree type = build_nonstandard_integer_type (ilen * 8, 1); + tree type = bitwise_type_for_mode (mode); tree srctype = type; tree desttype = type; if (src_align < GET_MODE_ALIGNMENT (mode)) diff --git a/gcc/gimple-lower-bitint.cc b/gcc/gimple-lower-bitint.cc index 13b9b205df79..65e4ab3f105e 100644 --- a/gcc/gimple-lower-bitint.cc +++ b/gcc/gimple-lower-bitint.cc @@ -54,6 +54,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-cfgcleanup.h" #include "tree-switch-conversion.h" #include "ubsan.h" +#include "stor-layout.h" #include "gimple-lower-bitint.h" /* Split BITINT_TYPE precisions in 4 categories. Small _BitInt, where @@ -212,6 +213,7 @@ mergeable_op (gimple *stmt) case BIT_NOT_EXPR: case SSA_NAME: case INTEGER_CST: + case BIT_FIELD_REF: return true; case LSHIFT_EXPR: { @@ -435,6 +437,7 @@ struct bitint_large_huge tree handle_plus_minus (tree_code, tree, tree, tree); tree handle_lshift (tree, tree, tree); tree handle_cast (tree, tree, tree); + tree handle_bit_field_ref (tree, tree); tree handle_load (gimple *, tree); tree handle_stmt (gimple *, tree); tree handle_operand_addr (tree, gimple *, int *, int *); @@ -620,7 +623,7 @@ bitint_large_huge::limb_access (tree type, tree var, tree idx, bool write_p) else if (TREE_CODE (var) == MEM_REF && tree_fits_uhwi_p (idx)) { ret - = build2 (MEM_REF, ltype, TREE_OPERAND (var, 0), + = build2 (MEM_REF, ltype, unshare_expr (TREE_OPERAND (var, 0)), size_binop (PLUS_EXPR, TREE_OPERAND (var, 1), build_int_cst (TREE_TYPE (TREE_OPERAND (var, 1)), tree_to_uhwi (idx) @@ -1685,6 +1688,86 @@ bitint_large_huge::handle_cast (tree lhs_type, tree rhs1, tree idx) return NULL_TREE; } +/* Helper function for handle_stmt method, handle a BIT_FIELD_REF. */ + +tree +bitint_large_huge::handle_bit_field_ref (tree op, tree idx) +{ + if (tree_fits_uhwi_p (idx)) + { + if (m_first) + m_data.safe_push (NULL); + ++m_data_cnt; + unsigned HOST_WIDE_INT sz = tree_to_uhwi (TYPE_SIZE (m_limb_type)); + tree bfr = build3 (BIT_FIELD_REF, m_limb_type, + TREE_OPERAND (op, 0), + TYPE_SIZE (m_limb_type), + size_binop (PLUS_EXPR, TREE_OPERAND (op, 2), + bitsize_int (tree_to_uhwi (idx) * sz))); + tree r = make_ssa_name (m_limb_type); + gimple *g = gimple_build_assign (r, bfr); + insert_before (g); + tree type = limb_access_type (TREE_TYPE (op), idx); + if (!useless_type_conversion_p (type, m_limb_type)) + r = add_cast (type, r); + return r; + } + tree var; + if (m_first) + { + unsigned HOST_WIDE_INT sz = tree_to_uhwi (TYPE_SIZE (TREE_TYPE (op))); + machine_mode mode; + tree type, bfr; + if (bitwise_mode_for_size (sz).exists (&mode) + && known_eq (GET_MODE_BITSIZE (mode), sz)) + type = bitwise_type_for_mode (mode); + else + { + mode = VOIDmode; + type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (op, 0))); + } + if (TYPE_ALIGN (type) < TYPE_ALIGN (TREE_TYPE (op))) + type = build_aligned_type (type, TYPE_ALIGN (TREE_TYPE (op))); + var = create_tmp_var (type); + TREE_ADDRESSABLE (var) = 1; + gimple *g; + if (mode != VOIDmode) + { + bfr = build3 (BIT_FIELD_REF, type, TREE_OPERAND (op, 0), + TYPE_SIZE (type), TREE_OPERAND (op, 2)); + g = gimple_build_assign (make_ssa_name (type), + BIT_FIELD_REF, bfr); + gimple_set_location (g, m_loc); + gsi_insert_after (&m_init_gsi, g, GSI_NEW_STMT); + bfr = gimple_assign_lhs (g); + } + else + bfr = TREE_OPERAND (op, 0); + g = gimple_build_assign (var, bfr); + gimple_set_location (g, m_loc); + gsi_insert_after (&m_init_gsi, g, GSI_NEW_STMT); + if (mode == VOIDmode) + { + unsigned HOST_WIDE_INT nelts + = CEIL (tree_to_uhwi (TYPE_SIZE (TREE_TYPE (op))), limb_prec); + tree atype = build_array_type_nelts (m_limb_type, nelts); + var = build2 (MEM_REF, atype, build_fold_addr_expr (var), + build_int_cst (build_pointer_type (type), + tree_to_uhwi (TREE_OPERAND (op, 2)) + / BITS_PER_UNIT)); + } + m_data.safe_push (var); + } + else + var = unshare_expr (m_data[m_data_cnt]); + ++m_data_cnt; + var = limb_access (TREE_TYPE (op), var, idx, false); + tree r = make_ssa_name (m_limb_type); + gimple *g = gimple_build_assign (r, var); + insert_before (g); + return r; +} + /* Add a new EH edge from SRC to EH_EDGE->dest, where EH_EDGE is an older EH edge, and except for virtual PHIs duplicate the PHI argument from the EH_EDGE to the new EH edge. */ @@ -2019,6 +2102,8 @@ bitint_large_huge::handle_stmt (gimple *stmt, tree idx) return handle_cast (TREE_TYPE (gimple_assign_lhs (stmt)), TREE_OPERAND (gimple_assign_rhs1 (stmt), 0), idx); + case BIT_FIELD_REF: + return handle_bit_field_ref (gimple_assign_rhs1 (stmt), idx); default: break; } @@ -4255,12 +4340,12 @@ bitint_large_huge::lower_addsub_overflow (tree obj, gimple *stmt) NULL_TREE, NULL_TREE); gimple *g2 = NULL; if (!single_comparison) - g2 = gimple_build_cond (LT_EXPR, idx, + g2 = gimple_build_cond (EQ_EXPR, idx, size_int (prec_limbs - 1), NULL_TREE, NULL_TREE); edge edge_true_true, edge_true_false, edge_false; if_then_if_then_else (g, g2, profile_probability::likely (), - profile_probability::likely (), + profile_probability::unlikely (), edge_true_true, edge_true_false, edge_false); tree l = limb_access (type, var ? var : obj, idx, true); @@ -4269,8 +4354,11 @@ bitint_large_huge::lower_addsub_overflow (tree obj, gimple *stmt) if (!single_comparison) { m_gsi = gsi_after_labels (edge_true_true->src); - l = limb_access (type, var ? var : obj, - size_int (prec_limbs - 1), true); + tree plm1idx = size_int (prec_limbs - 1); + tree plm1type = limb_access_type (type, plm1idx); + l = limb_access (type, var ? var : obj, plm1idx, true); + if (!useless_type_conversion_p (plm1type, TREE_TYPE (rhs))) + rhs = add_cast (plm1type, rhs); if (!useless_type_conversion_p (TREE_TYPE (l), TREE_TYPE (rhs))) rhs = add_cast (TREE_TYPE (l), rhs); @@ -4497,7 +4585,7 @@ bitint_large_huge::lower_mul_overflow (tree obj, gimple *stmt) size_one_node); insert_before (g); g = gimple_build_cond (NE_EXPR, idx_next, - size_int (endlimb + (cnt == 1)), + size_int (endlimb + (cnt == 2)), NULL_TREE, NULL_TREE); insert_before (g); edge true_edge, false_edge; @@ -5302,27 +5390,21 @@ bitint_large_huge::lower_stmt (gimple *stmt) else if (TREE_CODE (TREE_TYPE (rhs1)) == BITINT_TYPE && bitint_precision_kind (TREE_TYPE (rhs1)) >= bitint_prec_large && (INTEGRAL_TYPE_P (TREE_TYPE (lhs)) - || POINTER_TYPE_P (TREE_TYPE (lhs)))) + || POINTER_TYPE_P (TREE_TYPE (lhs)) + || gimple_assign_rhs_code (stmt) == VIEW_CONVERT_EXPR)) { final_cast_p = true; - if (TREE_CODE (TREE_TYPE (lhs)) == INTEGER_TYPE - && TYPE_PRECISION (TREE_TYPE (lhs)) > MAX_FIXED_MODE_SIZE + if (((TREE_CODE (TREE_TYPE (lhs)) == INTEGER_TYPE + && TYPE_PRECISION (TREE_TYPE (lhs)) > MAX_FIXED_MODE_SIZE) + || (!INTEGRAL_TYPE_P (TREE_TYPE (lhs)) + && !POINTER_TYPE_P (TREE_TYPE (lhs)))) && gimple_assign_rhs_code (stmt) == VIEW_CONVERT_EXPR) { /* Handle VIEW_CONVERT_EXPRs to not generally supported huge INTEGER_TYPEs like uint256_t or uint512_t. These are usually emitted from memcpy folding and backends - support moves with them but that is usually it. */ - if (TREE_CODE (rhs1) == INTEGER_CST) - { - rhs1 = fold_unary (VIEW_CONVERT_EXPR, TREE_TYPE (lhs), - rhs1); - gcc_assert (rhs1 && TREE_CODE (rhs1) == INTEGER_CST); - gimple_assign_set_rhs1 (stmt, rhs1); - gimple_assign_set_rhs_code (stmt, INTEGER_CST); - update_stmt (stmt); - return; - } + support moves with them but that is usually it. + Similarly handle VCEs to vector/complex types etc. */ gcc_assert (TREE_CODE (rhs1) == SSA_NAME); if (SSA_NAME_IS_DEFAULT_DEF (rhs1) && (!SSA_NAME_VAR (rhs1) || VAR_P (SSA_NAME_VAR (rhs1)))) @@ -5332,6 +5414,22 @@ bitint_large_huge::lower_stmt (gimple *stmt) gimple_assign_set_rhs1 (stmt, rhs1); gimple_assign_set_rhs_code (stmt, SSA_NAME); } + else if (m_names == NULL + || !bitmap_bit_p (m_names, SSA_NAME_VERSION (rhs1))) + { + gimple *g = SSA_NAME_DEF_STMT (rhs1); + gcc_assert (gimple_assign_load_p (g)); + tree mem = gimple_assign_rhs1 (g); + tree ltype = TREE_TYPE (lhs); + addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (mem)); + if (as != TYPE_ADDR_SPACE (ltype)) + ltype + = build_qualified_type (ltype, + TYPE_QUALS (ltype) + | ENCODE_QUAL_ADDR_SPACE (as)); + rhs1 = build1 (VIEW_CONVERT_EXPR, ltype, unshare_expr (mem)); + gimple_assign_set_rhs1 (stmt, rhs1); + } else { int part = var_to_partition (m_map, rhs1); @@ -5373,6 +5471,18 @@ bitint_large_huge::lower_stmt (gimple *stmt) } } } + else if (TREE_CODE (TREE_TYPE (lhs)) == BITINT_TYPE + && bitint_precision_kind (TREE_TYPE (lhs)) >= bitint_prec_large + && !INTEGRAL_TYPE_P (TREE_TYPE (rhs1)) + && !POINTER_TYPE_P (TREE_TYPE (rhs1)) + && gimple_assign_rhs_code (stmt) == VIEW_CONVERT_EXPR) + { + int part = var_to_partition (m_map, lhs); + gcc_assert (m_vars[part] != NULL_TREE); + lhs = build1 (VIEW_CONVERT_EXPR, TREE_TYPE (rhs1), m_vars[part]); + insert_before (gimple_build_assign (lhs, rhs1)); + return; + } } if (gimple_store_p (stmt)) { @@ -5408,6 +5518,28 @@ bitint_large_huge::lower_stmt (gimple *stmt) case IMAGPART_EXPR: lower_cplxpart_stmt (lhs, g); goto handled; + case VIEW_CONVERT_EXPR: + { + tree rhs1 = gimple_assign_rhs1 (g); + rhs1 = TREE_OPERAND (rhs1, 0); + if (!INTEGRAL_TYPE_P (TREE_TYPE (rhs1)) + && !POINTER_TYPE_P (TREE_TYPE (rhs1))) + { + tree ltype = TREE_TYPE (rhs1); + addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (lhs)); + ltype + = build_qualified_type (ltype, + TYPE_QUALS (TREE_TYPE (lhs)) + | ENCODE_QUAL_ADDR_SPACE (as)); + lhs = build1 (VIEW_CONVERT_EXPR, ltype, lhs); + gimple_assign_set_lhs (stmt, lhs); + gimple_assign_set_rhs1 (stmt, rhs1); + gimple_assign_set_rhs_code (stmt, TREE_CODE (rhs1)); + update_stmt (stmt); + return; + } + } + break; default: break; } @@ -6232,6 +6364,14 @@ gimple_lower_bitint (void) if (gimple_assign_cast_p (SSA_NAME_DEF_STMT (s))) { tree rhs1 = gimple_assign_rhs1 (SSA_NAME_DEF_STMT (s)); + if (TREE_CODE (rhs1) == VIEW_CONVERT_EXPR) + { + rhs1 = TREE_OPERAND (rhs1, 0); + if (!INTEGRAL_TYPE_P (TREE_TYPE (rhs1)) + && !POINTER_TYPE_P (TREE_TYPE (rhs1)) + && gimple_store_p (use_stmt)) + continue; + } if (INTEGRAL_TYPE_P (TREE_TYPE (rhs1)) && ((is_gimple_assign (use_stmt) && (gimple_assign_rhs_code (use_stmt) @@ -6276,11 +6416,15 @@ gimple_lower_bitint (void) goto force_name; break; case VIEW_CONVERT_EXPR: - /* Don't merge with VIEW_CONVERT_EXPRs to - huge INTEGER_TYPEs used sometimes in memcpy - expansion. */ { tree lhs = gimple_assign_lhs (use_stmt); + /* Don't merge with VIEW_CONVERT_EXPRs to + non-integral types. */ + if (!INTEGRAL_TYPE_P (TREE_TYPE (lhs))) + goto force_name; + /* Don't merge with VIEW_CONVERT_EXPRs to + huge INTEGER_TYPEs used sometimes in memcpy + expansion. */ if (TREE_CODE (TREE_TYPE (lhs)) == INTEGER_TYPE && (TYPE_PRECISION (TREE_TYPE (lhs)) > MAX_FIXED_MODE_SIZE)) diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc index 0cc531999631..9c4ad1ee7b91 100644 --- a/gcc/gimple-range-fold.cc +++ b/gcc/gimple-range-fold.cc @@ -48,6 +48,8 @@ along with GCC; see the file COPYING3. If not see #include "alloc-pool.h" #include "symbol-summary.h" #include "ipa-utils.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" // Construct a fur_source, and set the m_query field. diff --git a/gcc/gimple-ssa-warn-access.cc b/gcc/gimple-ssa-warn-access.cc index cd083ab22377..dedaae27b31c 100644 --- a/gcc/gimple-ssa-warn-access.cc +++ b/gcc/gimple-ssa-warn-access.cc @@ -1701,6 +1701,7 @@ new_delete_mismatch_p (const demangle_component &newc, case DEMANGLE_COMPONENT_FUNCTION_PARAM: case DEMANGLE_COMPONENT_TEMPLATE_PARAM: + case DEMANGLE_COMPONENT_UNNAMED_TYPE: return newc.u.s_number.number != delc.u.s_number.number; case DEMANGLE_COMPONENT_CHARACTER: diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc index 7f79b3cc7e61..6ebca964cb21 100644 --- a/gcc/gimplify.cc +++ b/gcc/gimplify.cc @@ -8144,13 +8144,6 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code) n = splay_tree_lookup (ctx->variables, (splay_tree_key)decl); if ((ctx->region_type & ORT_TARGET) != 0) { - if (ctx->region_type & ORT_ACC) - /* For OpenACC, as remarked above, defer expansion. */ - shared = false; - else - shared = true; - - ret = lang_hooks.decls.omp_disregard_value_expr (decl, shared); if (n == NULL) { unsigned nflags = flags; @@ -8275,9 +8268,22 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code) } found_outer: omp_add_variable (ctx, decl, nflags); + if (ctx->region_type & ORT_ACC) + /* For OpenACC, as remarked above, defer expansion. */ + shared = false; + else + shared = (nflags & (GOVD_PRIVATE | GOVD_FIRSTPRIVATE)) == 0; + ret = lang_hooks.decls.omp_disregard_value_expr (decl, shared); } else { + if (ctx->region_type & ORT_ACC) + /* For OpenACC, as remarked above, defer expansion. */ + shared = false; + else + shared = ((n->value | flags) + & (GOVD_PRIVATE | GOVD_FIRSTPRIVATE)) == 0; + ret = lang_hooks.decls.omp_disregard_value_expr (decl, shared); /* If nothing changed, there's nothing left to do. */ if ((n->value & flags) == flags) return ret; diff --git a/gcc/graphite-sese-to-poly.cc b/gcc/graphite-sese-to-poly.cc index 547d66105d3d..4f614a3ba827 100644 --- a/gcc/graphite-sese-to-poly.cc +++ b/gcc/graphite-sese-to-poly.cc @@ -391,8 +391,9 @@ add_conditions_to_domain (poly_bb_p pbb) { case GIMPLE_COND: { - /* Don't constrain on anything else than INTEGER_TYPE. */ - if (TREE_CODE (TREE_TYPE (gimple_cond_lhs (stmt))) != INTEGER_TYPE) + /* Don't constrain on anything else than INTEGRAL_TYPE_P. */ + tree cmp_type = TREE_TYPE (gimple_cond_lhs (stmt)); + if (!INTEGRAL_TYPE_P (cmp_type)) break; gcond *cond_stmt = as_a (stmt); diff --git a/gcc/internal-fn.cc b/gcc/internal-fn.cc index a07f25f3aee3..fcf47c7fa128 100644 --- a/gcc/internal-fn.cc +++ b/gcc/internal-fn.cc @@ -52,6 +52,7 @@ along with GCC; see the file COPYING3. If not see #include "explow.h" #include "rtl-iter.h" #include "gimple-range.h" +#include "fold-const-call.h" /* For lang_hooks.types.type_for_mode. */ #include "langhooks.h" @@ -5107,9 +5108,63 @@ expand_BITINTTOFLOAT (internal_fn, gcall *stmt) emit_move_insn (target, val); } +static bool +expand_bitquery (internal_fn fn, gcall *stmt) +{ + tree lhs = gimple_call_lhs (stmt); + if (lhs == NULL_TREE) + return false; + tree arg = gimple_call_arg (stmt, 0); + if (TREE_CODE (arg) == INTEGER_CST) + { + tree ret = fold_const_call (as_combined_fn (fn), TREE_TYPE (arg), arg); + gcc_checking_assert (ret && TREE_CODE (ret) == INTEGER_CST); + expand_assignment (lhs, ret, false); + return false; + } + return true; +} + +void +expand_CLRSB (internal_fn fn, gcall *stmt) +{ + if (expand_bitquery (fn, stmt)) + expand_unary_optab_fn (fn, stmt, clrsb_optab); +} + +void +expand_CLZ (internal_fn fn, gcall *stmt) +{ + if (expand_bitquery (fn, stmt)) + expand_unary_optab_fn (fn, stmt, clz_optab); +} + +void +expand_CTZ (internal_fn fn, gcall *stmt) +{ + if (expand_bitquery (fn, stmt)) + expand_unary_optab_fn (fn, stmt, ctz_optab); +} + +void +expand_FFS (internal_fn fn, gcall *stmt) +{ + if (expand_bitquery (fn, stmt)) + expand_unary_optab_fn (fn, stmt, ffs_optab); +} + +void +expand_PARITY (internal_fn fn, gcall *stmt) +{ + if (expand_bitquery (fn, stmt)) + expand_unary_optab_fn (fn, stmt, parity_optab); +} + void expand_POPCOUNT (internal_fn fn, gcall *stmt) { + if (!expand_bitquery (fn, stmt)) + return; if (gimple_call_num_args (stmt) == 1) { expand_unary_optab_fn (fn, stmt, popcount_optab); diff --git a/gcc/internal-fn.def b/gcc/internal-fn.def index c14d30365c14..848bb9dbff3f 100644 --- a/gcc/internal-fn.def +++ b/gcc/internal-fn.def @@ -440,11 +440,11 @@ DEF_INTERNAL_OPTAB_FN (COMPLEX_FMS, ECF_CONST, cmls, ternary) DEF_INTERNAL_OPTAB_FN (COMPLEX_FMS_CONJ, ECF_CONST, cmls_conj, ternary) /* Unary integer ops. */ -DEF_INTERNAL_INT_FN (CLRSB, ECF_CONST | ECF_NOTHROW, clrsb, unary) -DEF_INTERNAL_INT_FN (CLZ, ECF_CONST | ECF_NOTHROW, clz, unary) -DEF_INTERNAL_INT_FN (CTZ, ECF_CONST | ECF_NOTHROW, ctz, unary) -DEF_INTERNAL_INT_FN (FFS, ECF_CONST | ECF_NOTHROW, ffs, unary) -DEF_INTERNAL_INT_FN (PARITY, ECF_CONST | ECF_NOTHROW, parity, unary) +DEF_INTERNAL_INT_EXT_FN (CLRSB, ECF_CONST | ECF_NOTHROW, clrsb, unary) +DEF_INTERNAL_INT_EXT_FN (CLZ, ECF_CONST | ECF_NOTHROW, clz, unary) +DEF_INTERNAL_INT_EXT_FN (CTZ, ECF_CONST | ECF_NOTHROW, ctz, unary) +DEF_INTERNAL_INT_EXT_FN (FFS, ECF_CONST | ECF_NOTHROW, ffs, unary) +DEF_INTERNAL_INT_EXT_FN (PARITY, ECF_CONST | ECF_NOTHROW, parity, unary) DEF_INTERNAL_INT_EXT_FN (POPCOUNT, ECF_CONST | ECF_NOTHROW, popcount, unary) DEF_INTERNAL_FN (GOMP_TARGET_REV, ECF_NOVOPS | ECF_LEAF | ECF_NOTHROW, NULL) diff --git a/gcc/internal-fn.h b/gcc/internal-fn.h index bccee1c3e09d..2785a5a95a27 100644 --- a/gcc/internal-fn.h +++ b/gcc/internal-fn.h @@ -262,6 +262,11 @@ extern void expand_MULBITINT (internal_fn, gcall *); extern void expand_DIVMODBITINT (internal_fn, gcall *); extern void expand_FLOATTOBITINT (internal_fn, gcall *); extern void expand_BITINTTOFLOAT (internal_fn, gcall *); +extern void expand_CLRSB (internal_fn, gcall *); +extern void expand_CLZ (internal_fn, gcall *); +extern void expand_CTZ (internal_fn, gcall *); +extern void expand_FFS (internal_fn, gcall *); +extern void expand_PARITY (internal_fn, gcall *); extern void expand_POPCOUNT (internal_fn, gcall *); extern bool vectorized_internal_fn_supported_p (internal_fn, tree); diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc index e85477df32d0..2a1da631e9ca 100644 --- a/gcc/ipa-cp.cc +++ b/gcc/ipa-cp.cc @@ -109,6 +109,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple-expr.h" #include "gimple.h" #include "predict.h" +#include "sreal.h" #include "alloc-pool.h" #include "tree-pass.h" #include "cgraph.h" @@ -118,6 +119,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple-fold.h" #include "symbol-summary.h" #include "tree-vrp.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "tree-pretty-print.h" #include "tree-inline.h" @@ -130,274 +132,6 @@ along with GCC; see the file COPYING3. If not see #include "symtab-clones.h" #include "gimple-range.h" -template class ipcp_value; - -/* Describes a particular source for an IPA-CP value. */ - -template -struct ipcp_value_source -{ -public: - /* Aggregate offset of the source, negative if the source is scalar value of - the argument itself. */ - HOST_WIDE_INT offset; - /* The incoming edge that brought the value. */ - cgraph_edge *cs; - /* If the jump function that resulted into his value was a pass-through or an - ancestor, this is the ipcp_value of the caller from which the described - value has been derived. Otherwise it is NULL. */ - ipcp_value *val; - /* Next pointer in a linked list of sources of a value. */ - ipcp_value_source *next; - /* If the jump function that resulted into his value was a pass-through or an - ancestor, this is the index of the parameter of the caller the jump - function references. */ - int index; -}; - -/* Common ancestor for all ipcp_value instantiations. */ - -class ipcp_value_base -{ -public: - /* Time benefit and that specializing the function for this value would bring - about in this function alone. */ - sreal local_time_benefit; - /* Time benefit that specializing the function for this value can bring about - in it's callees. */ - sreal prop_time_benefit; - /* Size cost that specializing the function for this value would bring about - in this function alone. */ - int local_size_cost; - /* Size cost that specializing the function for this value can bring about in - it's callees. */ - int prop_size_cost; - - ipcp_value_base () - : local_time_benefit (0), prop_time_benefit (0), - local_size_cost (0), prop_size_cost (0) {} -}; - -/* Describes one particular value stored in struct ipcp_lattice. */ - -template -class ipcp_value : public ipcp_value_base -{ -public: - /* The actual value for the given parameter. */ - valtype value; - /* The list of sources from which this value originates. */ - ipcp_value_source *sources = nullptr; - /* Next pointers in a linked list of all values in a lattice. */ - ipcp_value *next = nullptr; - /* Next pointers in a linked list of values in a strongly connected component - of values. */ - ipcp_value *scc_next = nullptr; - /* Next pointers in a linked list of SCCs of values sorted topologically - according their sources. */ - ipcp_value *topo_next = nullptr; - /* A specialized node created for this value, NULL if none has been (so far) - created. */ - cgraph_node *spec_node = nullptr; - /* Depth first search number and low link for topological sorting of - values. */ - int dfs = 0; - int low_link = 0; - /* SCC number to identify values which recursively feed into each other. - Values in the same SCC have the same SCC number. */ - int scc_no = 0; - /* Non zero if the value is generated from another value in the same lattice - for a self-recursive call, the actual number is how many times the - operation has been performed. In the unlikely event of the value being - present in two chains fo self-recursive value generation chains, it is the - maximum. */ - unsigned self_recursion_generated_level = 0; - /* True if this value is currently on the topo-sort stack. */ - bool on_stack = false; - - void add_source (cgraph_edge *cs, ipcp_value *src_val, int src_idx, - HOST_WIDE_INT offset); - - /* Return true if both THIS value and O feed into each other. */ - - bool same_scc (const ipcp_value *o) - { - return o->scc_no == scc_no; - } - -/* Return true, if a this value has been generated for a self-recursive call as - a result of an arithmetic pass-through jump-function acting on a value in - the same lattice function. */ - - bool self_recursion_generated_p () - { - return self_recursion_generated_level > 0; - } -}; - -/* Lattice describing potential values of a formal parameter of a function, or - a part of an aggregate. TOP is represented by a lattice with zero values - and with contains_variable and bottom flags cleared. BOTTOM is represented - by a lattice with the bottom flag set. In that case, values and - contains_variable flag should be disregarded. */ - -template -struct ipcp_lattice -{ -public: - /* The list of known values and types in this lattice. Note that values are - not deallocated if a lattice is set to bottom because there may be value - sources referencing them. */ - ipcp_value *values; - /* Number of known values and types in this lattice. */ - int values_count; - /* The lattice contains a variable component (in addition to values). */ - bool contains_variable; - /* The value of the lattice is bottom (i.e. variable and unusable for any - propagation). */ - bool bottom; - - inline bool is_single_const (); - inline bool set_to_bottom (); - inline bool set_contains_variable (); - bool add_value (valtype newval, cgraph_edge *cs, - ipcp_value *src_val = NULL, - int src_idx = 0, HOST_WIDE_INT offset = -1, - ipcp_value **val_p = NULL, - unsigned same_lat_gen_level = 0); - void print (FILE * f, bool dump_sources, bool dump_benefits); -}; - -/* Lattice of tree values with an offset to describe a part of an - aggregate. */ - -struct ipcp_agg_lattice : public ipcp_lattice -{ -public: - /* Offset that is being described by this lattice. */ - HOST_WIDE_INT offset; - /* Size so that we don't have to re-compute it every time we traverse the - list. Must correspond to TYPE_SIZE of all lat values. */ - HOST_WIDE_INT size; - /* Next element of the linked list. */ - struct ipcp_agg_lattice *next; -}; - -/* Lattice of known bits, only capable of holding one value. - Bitwise constant propagation propagates which bits of a - value are constant. - For eg: - int f(int x) - { - return some_op (x); - } - - int f1(int y) - { - if (cond) - return f (y & 0xff); - else - return f (y & 0xf); - } - - In the above case, the param 'x' will always have all - the bits (except the bits in lsb) set to 0. - Hence the mask of 'x' would be 0xff. The mask - reflects that the bits in lsb are unknown. - The actual propagated value is given by m_value & ~m_mask. */ - -class ipcp_bits_lattice -{ -public: - bool bottom_p () const { return m_lattice_val == IPA_BITS_VARYING; } - bool top_p () const { return m_lattice_val == IPA_BITS_UNDEFINED; } - bool constant_p () const { return m_lattice_val == IPA_BITS_CONSTANT; } - bool set_to_bottom (); - bool set_to_constant (widest_int, widest_int); - bool known_nonzero_p () const; - - widest_int get_value () const { return m_value; } - widest_int get_mask () const { return m_mask; } - - bool meet_with (ipcp_bits_lattice& other, unsigned, signop, - enum tree_code, tree, bool); - - bool meet_with (widest_int, widest_int, unsigned); - - void print (FILE *); - -private: - enum { IPA_BITS_UNDEFINED, IPA_BITS_CONSTANT, IPA_BITS_VARYING } m_lattice_val; - - /* Similar to ccp_lattice_t, mask represents which bits of value are constant. - If a bit in mask is set to 0, then the corresponding bit in - value is known to be constant. */ - widest_int m_value, m_mask; - - bool meet_with_1 (widest_int, widest_int, unsigned, bool); - void get_value_and_mask (tree, widest_int *, widest_int *); -}; - -/* Lattice of value ranges. */ - -class ipcp_vr_lattice -{ -public: - Value_Range m_vr; - - inline bool bottom_p () const; - inline bool top_p () const; - inline bool set_to_bottom (); - bool meet_with (const vrange &p_vr); - bool meet_with (const ipcp_vr_lattice &other); - void init (tree type); - void print (FILE * f); - -private: - bool meet_with_1 (const vrange &other_vr); -}; - -inline void -ipcp_vr_lattice::init (tree type) -{ - if (type) - m_vr.set_type (type); - - // Otherwise m_vr will default to unsupported_range. -} - -/* Structure containing lattices for a parameter itself and for pieces of - aggregates that are passed in the parameter or by a reference in a parameter - plus some other useful flags. */ - -class ipcp_param_lattices -{ -public: - /* Lattice describing the value of the parameter itself. */ - ipcp_lattice itself; - /* Lattice describing the polymorphic contexts of a parameter. */ - ipcp_lattice ctxlat; - /* Lattices describing aggregate parts. */ - ipcp_agg_lattice *aggs; - /* Lattice describing known bits. */ - ipcp_bits_lattice bits_lattice; - /* Lattice describing value range. */ - ipcp_vr_lattice m_value_range; - /* Number of aggregate lattices */ - int aggs_count; - /* True if aggregate data were passed by reference (as opposed to by - value). */ - bool aggs_by_ref; - /* All aggregate lattices contain a variable component (in addition to - values). */ - bool aggs_contain_variable; - /* The value of all aggregate lattices is bottom (i.e. variable and unusable - for any propagation). */ - bool aggs_bottom; - - /* There is a virtual call based on this parameter. */ - bool virt_call; -}; /* Allocation pools for values and their sources in ipa-cp. */ @@ -431,7 +165,6 @@ ipa_get_parm_lattices (class ipa_node_params *info, int i) { gcc_assert (i >= 0 && i < ipa_get_param_count (info)); gcc_checking_assert (!info->ipcp_orig_node); - gcc_checking_assert (info->lattices); return &(info->lattices[i]); } @@ -1821,7 +1554,7 @@ ipa_value_from_jfunc (class ipa_node_params *info, struct ipa_jump_func *jfunc, { ipcp_lattice *lat; - if (!info->lattices + if (info->lattices.is_empty () || idx >= ipa_get_param_count (info)) return NULL_TREE; lat = ipa_get_scalar_lat (info, idx); @@ -1884,7 +1617,7 @@ ipa_context_from_jfunc (ipa_node_params *info, cgraph_edge *cs, int csidx, } else { - if (!info->lattices + if (info->lattices.is_empty () || srcidx >= ipa_get_param_count (info)) return ctx; ipcp_lattice *lat; @@ -2056,7 +1789,7 @@ ipa_agg_value_from_jfunc (ipa_node_params *info, cgraph_node *node, item->value.load_agg.by_ref); } } - else if (info->lattices) + else if (!info->lattices.is_empty ()) { class ipcp_param_lattices *src_plats = ipa_get_parm_lattices (info, src_idx); @@ -2937,7 +2670,6 @@ merge_agg_lats_step (class ipcp_param_lattices *dest_plats, return false; dest_plats->aggs_count++; new_al = ipcp_agg_lattice_pool.allocate (); - memset (new_al, 0, sizeof (*new_al)); new_al->offset = offset; new_al->size = val_size; @@ -4295,8 +4027,7 @@ ipcp_propagate_stage (class ipa_topo_info *topo) determine_versionability (node, info); unsigned nlattices = ipa_get_param_count (info); - void *chunk = XCNEWVEC (class ipcp_param_lattices, nlattices); - info->lattices = new (chunk) ipcp_param_lattices[nlattices]; + info->lattices.safe_grow_cleared (nlattices, true); initialize_node_lattices (node); } ipa_size_summary *s = ipa_size_summaries->get (node); @@ -6568,7 +6299,7 @@ ipcp_store_vr_results (void) if (info->ipcp_orig_node) info = ipa_node_params_sum->get (info->ipcp_orig_node); - if (!info->lattices) + if (info->lattices.is_empty ()) /* Newly expanded artificial thunks do not have lattices. */ continue; diff --git a/gcc/ipa-cp.h b/gcc/ipa-cp.h new file mode 100644 index 000000000000..0b3cfe4b526a --- /dev/null +++ b/gcc/ipa-cp.h @@ -0,0 +1,292 @@ +/* Interprocedural constant propagation + Copyright (C) 2024 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef IPA_CP_H +#define IPA_CP_H + +template class ipcp_value; + +/* Describes a particular source for an IPA-CP value. */ + +template +struct ipcp_value_source +{ +public: + /* Aggregate offset of the source, negative if the source is scalar value of + the argument itself. */ + HOST_WIDE_INT offset; + /* The incoming edge that brought the value. */ + cgraph_edge *cs; + /* If the jump function that resulted into his value was a pass-through or an + ancestor, this is the ipcp_value of the caller from which the described + value has been derived. Otherwise it is NULL. */ + ipcp_value *val; + /* Next pointer in a linked list of sources of a value. */ + ipcp_value_source *next; + /* If the jump function that resulted into his value was a pass-through or an + ancestor, this is the index of the parameter of the caller the jump + function references. */ + int index; +}; + +/* Common ancestor for all ipcp_value instantiations. */ + +class ipcp_value_base +{ +public: + /* Time benefit and that specializing the function for this value would bring + about in this function alone. */ + sreal local_time_benefit = 0; + /* Time benefit that specializing the function for this value can bring about + in it's callees. */ + sreal prop_time_benefit = 0; + /* Size cost that specializing the function for this value would bring about + in this function alone. */ + int local_size_cost = 0; + /* Size cost that specializing the function for this value can bring about in + it's callees. */ + int prop_size_cost = 0; +}; + +/* Describes one particular value stored in struct ipcp_lattice. */ + +template +class ipcp_value : public ipcp_value_base +{ +public: + /* The actual value for the given parameter. */ + valtype value; + /* The list of sources from which this value originates. */ + ipcp_value_source *sources = nullptr; + /* Next pointers in a linked list of all values in a lattice. */ + ipcp_value *next = nullptr; + /* Next pointers in a linked list of values in a strongly connected component + of values. */ + ipcp_value *scc_next = nullptr; + /* Next pointers in a linked list of SCCs of values sorted topologically + according their sources. */ + ipcp_value *topo_next = nullptr; + /* A specialized node created for this value, NULL if none has been (so far) + created. */ + cgraph_node *spec_node = nullptr; + /* Depth first search number and low link for topological sorting of + values. */ + int dfs = 0; + int low_link = 0; + /* SCC number to identify values which recursively feed into each other. + Values in the same SCC have the same SCC number. */ + int scc_no = 0; + /* Non zero if the value is generated from another value in the same lattice + for a self-recursive call, the actual number is how many times the + operation has been performed. In the unlikely event of the value being + present in two chains fo self-recursive value generation chains, it is the + maximum. */ + unsigned self_recursion_generated_level = 0; + /* True if this value is currently on the topo-sort stack. */ + bool on_stack = false; + + void add_source (cgraph_edge *cs, ipcp_value *src_val, int src_idx, + HOST_WIDE_INT offset); + + /* Return true if both THIS value and O feed into each other. */ + + bool same_scc (const ipcp_value *o) + { + return o->scc_no == scc_no; + } + +/* Return true, if a this value has been generated for a self-recursive call as + a result of an arithmetic pass-through jump-function acting on a value in + the same lattice function. */ + + bool self_recursion_generated_p () + { + return self_recursion_generated_level > 0; + } +}; + +/* Lattice describing potential values of a formal parameter of a function, or + a part of an aggregate. TOP is represented by a lattice with zero values + and with contains_variable and bottom flags cleared. BOTTOM is represented + by a lattice with the bottom flag set. In that case, values and + contains_variable flag should be disregarded. */ + +template +struct ipcp_lattice +{ +public: + /* The list of known values and types in this lattice. Note that values are + not deallocated if a lattice is set to bottom because there may be value + sources referencing them. */ + ipcp_value *values = nullptr; + /* Number of known values and types in this lattice. */ + int values_count = 0; + /* The lattice contains a variable component (in addition to values). */ + bool contains_variable = false; + /* The value of the lattice is bottom (i.e. variable and unusable for any + propagation). */ + bool bottom = false; + + inline bool is_single_const (); + inline bool set_to_bottom (); + inline bool set_contains_variable (); + bool add_value (valtype newval, cgraph_edge *cs, + ipcp_value *src_val = NULL, + int src_idx = 0, HOST_WIDE_INT offset = -1, + ipcp_value **val_p = NULL, + unsigned same_lat_gen_level = 0); + void print (FILE * f, bool dump_sources, bool dump_benefits); +}; + +/* Lattice of tree values with an offset to describe a part of an + aggregate. */ + +struct ipcp_agg_lattice : public ipcp_lattice +{ +public: + /* Offset that is being described by this lattice. */ + HOST_WIDE_INT offset = 0; + /* Size so that we don't have to re-compute it every time we traverse the + list. Must correspond to TYPE_SIZE of all lat values. */ + HOST_WIDE_INT size = 0; + /* Next element of the linked list. */ + struct ipcp_agg_lattice *next = nullptr; +}; + +/* Lattice of known bits, only capable of holding one value. + Bitwise constant propagation propagates which bits of a + value are constant. + For eg: + int f(int x) + { + return some_op (x); + } + + int f1(int y) + { + if (cond) + return f (y & 0xff); + else + return f (y & 0xf); + } + + In the above case, the param 'x' will always have all + the bits (except the bits in lsb) set to 0. + Hence the mask of 'x' would be 0xff. The mask + reflects that the bits in lsb are unknown. + The actual propagated value is given by m_value & ~m_mask. */ + +class ipcp_bits_lattice +{ +public: + bool bottom_p () const { return m_lattice_val == IPA_BITS_VARYING; } + bool top_p () const { return m_lattice_val == IPA_BITS_UNDEFINED; } + bool constant_p () const { return m_lattice_val == IPA_BITS_CONSTANT; } + bool set_to_bottom (); + bool set_to_constant (widest_int, widest_int); + bool known_nonzero_p () const; + + widest_int get_value () const { return m_value; } + widest_int get_mask () const { return m_mask; } + + bool meet_with (ipcp_bits_lattice& other, unsigned, signop, + enum tree_code, tree, bool); + + bool meet_with (widest_int, widest_int, unsigned); + + void print (FILE *); + +private: + enum { IPA_BITS_UNDEFINED, IPA_BITS_CONSTANT, IPA_BITS_VARYING } + m_lattice_val = IPA_BITS_UNDEFINED; + + /* Similar to ccp_lattice_t, mask represents which bits of value are constant. + If a bit in mask is set to 0, then the corresponding bit in + value is known to be constant. */ + widest_int m_value, m_mask; + + bool meet_with_1 (widest_int, widest_int, unsigned, bool); + void get_value_and_mask (tree, widest_int *, widest_int *); +}; + +/* Lattice of value ranges. */ + +class ipcp_vr_lattice +{ +public: + Value_Range m_vr; + + inline bool bottom_p () const; + inline bool top_p () const; + inline bool set_to_bottom (); + bool meet_with (const vrange &p_vr); + bool meet_with (const ipcp_vr_lattice &other); + void init (tree type); + void print (FILE * f); + +private: + bool meet_with_1 (const vrange &other_vr); +}; + +inline void +ipcp_vr_lattice::init (tree type) +{ + if (type) + m_vr.set_type (type); + + // Otherwise m_vr will default to unsupported_range. +} + +/* Structure containing lattices for a parameter itself and for pieces of + aggregates that are passed in the parameter or by a reference in a parameter + plus some other useful flags. + + Even after construction, m_value_range parts still need to be initialized + with the type they represent with the init method. */ + +class ipcp_param_lattices +{ +public: + /* Lattice describing the value of the parameter itself. */ + ipcp_lattice itself; + /* Lattice describing the polymorphic contexts of a parameter. */ + ipcp_lattice ctxlat; + /* Lattices describing aggregate parts. */ + ipcp_agg_lattice *aggs = nullptr; + /* Lattice describing known bits. */ + ipcp_bits_lattice bits_lattice; + /* Lattice describing value range. */ + ipcp_vr_lattice m_value_range; + /* Number of aggregate lattices */ + int aggs_count = 0; + /* True if aggregate data were passed by reference (as opposed to by + value). */ + bool aggs_by_ref = false; + /* All aggregate lattices contain a variable component (in addition to + values). */ + bool aggs_contain_variable = false; + /* The value of all aggregate lattices is bottom (i.e. variable and unusable + for any propagation). */ + bool aggs_bottom = false; + + /* There is a virtual call based on this parameter. */ + bool virt_call = false; +}; + +#endif /* IPA_CP_H */ diff --git a/gcc/ipa-devirt.cc b/gcc/ipa-devirt.cc index caf8548fbc9e..a7ce434bffb4 100644 --- a/gcc/ipa-devirt.cc +++ b/gcc/ipa-devirt.cc @@ -124,6 +124,8 @@ along with GCC; see the file COPYING3. If not see #include "gimple-fold.h" #include "symbol-summary.h" #include "tree-vrp.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "demangle.h" diff --git a/gcc/ipa-fnsummary.cc b/gcc/ipa-fnsummary.cc index 74c9b4e1d1e5..dff40cd8aa51 100644 --- a/gcc/ipa-fnsummary.cc +++ b/gcc/ipa-fnsummary.cc @@ -75,6 +75,8 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa-loop-niter.h" #include "tree-ssa-loop.h" #include "symbol-summary.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "cfgloop.h" diff --git a/gcc/ipa-icf.cc b/gcc/ipa-icf.cc index f56891325f3d..5d5a42f9c6c9 100644 --- a/gcc/ipa-icf.cc +++ b/gcc/ipa-icf.cc @@ -73,6 +73,8 @@ along with GCC; see the file COPYING3. If not see #include "gimple-iterator.h" #include "tree-cfg.h" #include "symbol-summary.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "except.h" diff --git a/gcc/ipa-inline-analysis.cc b/gcc/ipa-inline-analysis.cc index 24ac4cbafc02..a190cb6501b8 100644 --- a/gcc/ipa-inline-analysis.cc +++ b/gcc/ipa-inline-analysis.cc @@ -40,6 +40,8 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa-loop-niter.h" #include "tree-ssa-loop.h" #include "symbol-summary.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "ipa-inline.h" diff --git a/gcc/ipa-inline-transform.cc b/gcc/ipa-inline-transform.cc index a05631a085dd..73ae4e68ef3b 100644 --- a/gcc/ipa-inline-transform.cc +++ b/gcc/ipa-inline-transform.cc @@ -40,6 +40,8 @@ along with GCC; see the file COPYING3. If not see #include "tree-cfg.h" #include "symbol-summary.h" #include "tree-vrp.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "ipa-inline.h" diff --git a/gcc/ipa-inline.cc b/gcc/ipa-inline.cc index be2ca58c7dd1..cc509b0c4a4e 100644 --- a/gcc/ipa-inline.cc +++ b/gcc/ipa-inline.cc @@ -108,11 +108,12 @@ along with GCC; see the file COPYING3. If not see #include "profile.h" #include "symbol-summary.h" #include "tree-vrp.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "ipa-inline.h" #include "ipa-utils.h" -#include "sreal.h" #include "auto-profile.h" #include "builtins.h" #include "fibonacci_heap.h" diff --git a/gcc/ipa-modref.cc b/gcc/ipa-modref.cc index cec730dfa4b2..a5adce8ea396 100644 --- a/gcc/ipa-modref.cc +++ b/gcc/ipa-modref.cc @@ -75,6 +75,8 @@ along with GCC; see the file COPYING3. If not see #include "ipa-modref-tree.h" #include "ipa-modref.h" #include "value-range.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "attr-fnspec.h" diff --git a/gcc/ipa-param-manipulation.cc b/gcc/ipa-param-manipulation.cc index 02f71a42237e..3e0df6a6f77a 100644 --- a/gcc/ipa-param-manipulation.cc +++ b/gcc/ipa-param-manipulation.cc @@ -47,6 +47,8 @@ along with GCC; see the file COPYING3. If not see #include "tree-phinodes.h" #include "cfgexpand.h" #include "attribs.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" /* Actual prefixes of different newly synthetized parameters. Keep in sync diff --git a/gcc/ipa-predicate.cc b/gcc/ipa-predicate.cc index d3b3227b0feb..164aba4a1266 100644 --- a/gcc/ipa-predicate.cc +++ b/gcc/ipa-predicate.cc @@ -27,6 +27,8 @@ along with GCC; see the file COPYING3. If not see #include "tree-vrp.h" #include "alloc-pool.h" #include "symbol-summary.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "real.h" diff --git a/gcc/ipa-profile.cc b/gcc/ipa-profile.cc index 5e89f677c3e6..27f411ce81a0 100644 --- a/gcc/ipa-profile.cc +++ b/gcc/ipa-profile.cc @@ -55,6 +55,8 @@ along with GCC; see the file COPYING3. If not see #include "tree-inline.h" #include "symbol-summary.h" #include "tree-vrp.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc index bec0ebd210cf..e22c4f78405d 100644 --- a/gcc/ipa-prop.cc +++ b/gcc/ipa-prop.cc @@ -41,6 +41,8 @@ along with GCC; see the file COPYING3. If not see #include "gimplify-me.h" #include "gimple-walk.h" #include "symbol-summary.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "tree-cfg.h" #include "tree-dfa.h" @@ -4561,7 +4563,7 @@ ipa_node_params_t::duplicate(cgraph_node *, cgraph_node *, ipa_node_params *new_info) { new_info->descriptors = vec_safe_copy (old_info->descriptors); - new_info->lattices = NULL; + gcc_assert (new_info->lattices.is_empty ()); new_info->ipcp_orig_node = old_info->ipcp_orig_node; new_info->known_csts = old_info->known_csts.copy (); new_info->known_contexts = old_info->known_contexts.copy (); diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h index 9c78dc9f4860..ee3c0006add9 100644 --- a/gcc/ipa-prop.h +++ b/gcc/ipa-prop.h @@ -627,7 +627,7 @@ class GTY((for_user)) ipa_node_params vec *descriptors; /* Pointer to an array of structures describing individual formal parameters. */ - class ipcp_param_lattices * GTY((skip)) lattices; + vec GTY((skip)) lattices; /* Only for versioned nodes this field would not be NULL, it points to the node that IPA cp cloned from. */ struct cgraph_node * GTY((skip)) ipcp_orig_node; @@ -662,7 +662,7 @@ class GTY((for_user)) ipa_node_params inline ipa_node_params::ipa_node_params () -: descriptors (NULL), lattices (NULL), ipcp_orig_node (NULL), +: descriptors (NULL), lattices (vNULL), ipcp_orig_node (NULL), known_csts (vNULL), known_contexts (vNULL), analysis_done (0), node_enqueued (0), do_clone_for_all_contexts (0), is_all_contexts_clone (0), node_dead (0), node_within_scc (0), node_is_self_scc (0), @@ -673,8 +673,8 @@ ipa_node_params::ipa_node_params () inline ipa_node_params::~ipa_node_params () { - free (lattices); vec_free (descriptors); + lattices.release (); known_csts.release (); known_contexts.release (); } diff --git a/gcc/ipa-pure-const.cc b/gcc/ipa-pure-const.cc index 7e9ece21b229..d285462b6cf1 100644 --- a/gcc/ipa-pure-const.cc +++ b/gcc/ipa-pure-const.cc @@ -59,6 +59,8 @@ along with GCC; see the file COPYING3. If not see #include "ssa.h" #include "alloc-pool.h" #include "symbol-summary.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "symtab-thunks.h" diff --git a/gcc/ipa-split.cc b/gcc/ipa-split.cc index 8e6aa018a7d4..39ad822608b2 100644 --- a/gcc/ipa-split.cc +++ b/gcc/ipa-split.cc @@ -95,6 +95,8 @@ along with GCC; see the file COPYING3. If not see #include "gimplify-me.h" #include "gimple-walk.h" #include "symbol-summary.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "tree-cfg.h" #include "tree-into-ssa.h" diff --git a/gcc/ipa-sra.cc b/gcc/ipa-sra.cc index 14c2a344e6d8..6d6da4089251 100644 --- a/gcc/ipa-sra.cc +++ b/gcc/ipa-sra.cc @@ -84,6 +84,8 @@ along with GCC; see the file COPYING3. If not see #include "internal-fn.h" #include "symtab-clones.h" #include "attribs.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" static void ipa_sra_summarize_function (cgraph_node *); diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc index 0ee063c9eddc..dff94222351a 100644 --- a/gcc/ipa-strub.cc +++ b/gcc/ipa-strub.cc @@ -43,6 +43,8 @@ along with GCC; see the file COPYING3. If not see #include "cgraph.h" #include "alloc-pool.h" #include "symbol-summary.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "gimple-fold.h" @@ -938,7 +940,7 @@ can_strub_internally_p (cgraph_node *node, bool report = false) } if (list_length (TYPE_ARG_TYPES (TREE_TYPE (node->decl))) - >= (((HOST_WIDE_INT) 1 << IPA_PARAM_MAX_INDEX_BITS) + >= ((HOST_WIDE_INT_1 << IPA_PARAM_MAX_INDEX_BITS) - STRUB_INTERNAL_MAX_EXTRA_ARGS)) { result = false; diff --git a/gcc/ipa-utils.cc b/gcc/ipa-utils.cc index 1567874882fd..3be0ddb8e966 100644 --- a/gcc/ipa-utils.cc +++ b/gcc/ipa-utils.cc @@ -33,6 +33,8 @@ along with GCC; see the file COPYING3. If not see #include "ipa-utils.h" #include "symbol-summary.h" #include "tree-vrp.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "tree-eh.h" diff --git a/gcc/ipa.cc b/gcc/ipa.cc index 82d8c59d660b..c453fca5d9b6 100644 --- a/gcc/ipa.cc +++ b/gcc/ipa.cc @@ -33,6 +33,8 @@ along with GCC; see the file COPYING3. If not see #include "ipa-utils.h" #include "symbol-summary.h" #include "tree-vrp.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "dbgcnt.h" diff --git a/gcc/loop-iv.cc b/gcc/loop-iv.cc index eb7e923a38b0..f56cc5e1db67 100644 --- a/gcc/loop-iv.cc +++ b/gcc/loop-iv.cc @@ -1577,7 +1577,7 @@ implies_p (rtx a, rtx b) && CONST_INT_P (XEXP (opb0, 1)) /* Avoid overflows. */ && ((unsigned HOST_WIDE_INT) INTVAL (XEXP (opb0, 1)) - != ((unsigned HOST_WIDE_INT)1 + != (HOST_WIDE_INT_1U << (HOST_BITS_PER_WIDE_INT - 1)) - 1) && INTVAL (XEXP (opb0, 1)) + 1 == -INTVAL (op1)) return rtx_equal_p (op0, XEXP (opb0, 0)); diff --git a/gcc/lower-subreg.cc b/gcc/lower-subreg.cc index 05fb27cf7ce7..2f7f0a83e237 100644 --- a/gcc/lower-subreg.cc +++ b/gcc/lower-subreg.cc @@ -927,6 +927,21 @@ resolve_simple_move (rtx set, rtx_insn *insn) SRC's operator. */ dest = resolve_operand_for_swap_move_operator (dest); src = src_op; + if (resolve_reg_p (src)) + { + gcc_assert (GET_CODE (src) == CONCATN); + if (reg_overlap_mentioned_p (XVECEXP (dest, 0, 0), + XVECEXP (src, 0, 1))) + { + /* If there is overlap betwee the first half of the + destination and what will be stored to the second one, + use a temporary pseudo. See PR114211. */ + rtx tem = gen_reg_rtx (GET_MODE (XVECEXP (src, 0, 1))); + emit_move_insn (tem, XVECEXP (src, 0, 1)); + src = copy_rtx (src); + XVECEXP (src, 0, 1) = tem; + } + } } else if (resolve_reg_p (src_op)) { diff --git a/gcc/lra-assigns.cc b/gcc/lra-assigns.cc index d1b2b35ffc95..7dfa6f70941e 100644 --- a/gcc/lra-assigns.cc +++ b/gcc/lra-assigns.cc @@ -1430,13 +1430,19 @@ assign_by_spills (void) hard_regno = spill_for (regno, &all_spilled_pseudos, iter == 1); if (hard_regno < 0) { - if (reload_p) { - /* Put unassigned reload pseudo first in the - array. */ - regno2 = sorted_pseudos[nfails]; - sorted_pseudos[nfails++] = regno; - sorted_pseudos[i] = regno2; - } + if (reload_p) + { + /* Put unassigned reload pseudo first in the array. */ + regno2 = sorted_pseudos[nfails]; + sorted_pseudos[nfails++] = regno; + sorted_pseudos[i] = regno2; + } + else + { + /* Consider all alternatives on the next constraint + subpass. */ + bitmap_set_bit (&all_spilled_pseudos, regno); + } } else { diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index e20654412b70..dd9310eac7c3 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,10 @@ +2024-02-21 Martin Jambor + + PR ipa/113476 + * lto-common.cc: Include sreal.h and ipa-cp.h. + * lto-partition.cc: Include ipa-cp.h, move inclusion of sreal higher. + * lto.cc: Include sreal.h and ipa-cp.h. + 2024-02-10 Jakub Jelinek * lto-common.cc (print_lto_report_1): Use HOST_SIZE_T_PRINT_DEC diff --git a/gcc/lto/lto-common.cc b/gcc/lto/lto-common.cc index e54ddf2ca410..2ce94cc32828 100644 --- a/gcc/lto/lto-common.cc +++ b/gcc/lto/lto-common.cc @@ -37,6 +37,8 @@ along with GCC; see the file COPYING3. If not see #include "stor-layout.h" #include "symbol-summary.h" #include "tree-vrp.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "common.h" #include "debug.h" diff --git a/gcc/lto/lto-partition.cc b/gcc/lto/lto-partition.cc index 7165747d57ef..19f91e5d6607 100644 --- a/gcc/lto/lto-partition.cc +++ b/gcc/lto/lto-partition.cc @@ -31,10 +31,11 @@ along with GCC; see the file COPYING3. If not see #include "lto-streamer.h" #include "symbol-summary.h" #include "tree-vrp.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "ipa-fnsummary.h" #include "lto-partition.h" -#include "sreal.h" vec ltrans_partitions; diff --git a/gcc/lto/lto.cc b/gcc/lto/lto.cc index f7c0623f6b2a..91aa2fbddb4e 100644 --- a/gcc/lto/lto.cc +++ b/gcc/lto/lto.cc @@ -38,6 +38,8 @@ along with GCC; see the file COPYING3. If not see #include "stor-layout.h" #include "symbol-summary.h" #include "tree-vrp.h" +#include "sreal.h" +#include "ipa-cp.h" #include "ipa-prop.h" #include "debug.h" #include "lto.h" diff --git a/gcc/m2/ChangeLog b/gcc/m2/ChangeLog index 6c075b2b917a..ed51728aa31e 100644 --- a/gcc/m2/ChangeLog +++ b/gcc/m2/ChangeLog @@ -1,3 +1,233 @@ +2024-03-08 Gaius Mulley + + * gm2-compiler/M2Quads.mod (Init): Use InitIndexTuned with + default size 65K. + * gm2-compiler/SymbolConversion.mod (Init): Ditto. + * gm2-compiler/SymbolTable.mod (BEGIN): Ditto. + * mc-boot/GM2Dependent.cc: Rebuild. + * mc-boot/GM2Dependent.h: Rebuild. + * mc-boot/GM2RTS.cc: Rebuild. + * pge-boot/GIndexing.cc: Rebuild. + * pge-boot/GIndexing.h: Rebuild. + * pge-boot/GM2Dependent.cc: Rebuild. + * pge-boot/GM2Dependent.h: Rebuild. + * pge-boot/GM2RTS.cc: Rebuild. + +2024-03-07 Gaius Mulley + + PR modula2/109969 + * gm2-compiler/M2LexBuf.def (TokenToLineNo): Rename parameter. + (TokenToColumnNo): Rename parameter. + (TokenToLocation): Rename parameter. + (FindFileNameFromToken): Rename parameter. + (DumpTokens): Rewrite comment. + * gm2-compiler/M2LexBuf.mod: Rewrite. + * gm2-compiler/P0SyntaxCheck.bnf (CheckInsertCandidate): + DumpTokens before and after inserting recovery token. + * gm2-gcc/m2builtins.cc (do_target_support_exists): Add + bf_c99_compl case. + * gm2-libs/Indexing.def (InitIndexTuned): New procedure + function. + (IsEmpty): New procedure function. + * gm2-libs/Indexing.mod (InitIndexTuned): New procedure + function. + (IsEmpty): New procedure function. + (Index): New field GrowFactor. + (PutIndice): Use GrowFactor to extend dynamic array. + +2024-03-04 Gaius Mulley + + PR modula2/114227 + * gm2-libs-iso/M2RTS.mod (ProcedureChain): Remove. + (ProcedureList): Remove. + (ExecuteReverse): Remove. + (ExecuteTerminationProcedures): Rewrite. + (ExecuteInitialProcedures): Rewrite. + (AppendProc): Remove. + (InstallTerminationProcedure): Rewrite. + (InstallInitialProcedure): Rewrite. + (InitProcList): Remove. + * gm2-libs/M2Dependent.def (InstallTerminationProcedure): + New procedure. + (ExecuteTerminationProcedures): New procedure. + (InstallInitialProcedure): New procedure. + (ExecuteInitialProcedures): New procedure. + * gm2-libs/M2Dependent.mod (ProcedureChain): New type. + (ProcedureList): New type. + (ExecuteReverse): New procedure. + (ExecuteTerminationProcedures): New procedure. + (ExecuteInitialProcedures): New procedure. + (AppendProc): New procedure. + (InstallTerminationProcedure): New procedure. + (InstallInitialProcedure): New procedure. + (InitProcList): New procedure. + * gm2-libs/M2RTS.mod (ProcedureChain): Remove. + (ProcedureList): Remove. + (ExecuteReverse): Remove. + (ExecuteTerminationProcedures): Rewrite. + (ExecuteInitialProcedures): Rewrite. + (AppendProc): Remove. + (InstallTerminationProcedure): Rewrite. + (InstallInitialProcedure): Rewrite. + (InitProcList): Remove. + +2024-02-25 Gaius Mulley + + 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. + +2024-02-22 Gaius Mulley + + PR modula2/114055 + * gm2-compiler/M2Check.mod (Import): IsConstLitInternal and + IsConstLit. + (isInternal): New procedure function. + (doCheck): Test for isInternal in either operand and early + return true. + * gm2-compiler/M2Quads.mod (PushOne): Rewrite with extra + parameter internal. + (BuildPseudoBy): Add TRUE parameter to PushOne call. + (BuildIncProcedure): Add FALSE parameter to PushOne call. + (BuildDecProcedure): Add FALSE parameter to PushOne call. + * gm2-compiler/M2Range.mod (ForLoopBeginTypeCompatible): + Uncomment code and tidy up error string. + * gm2-compiler/SymbolTable.def (PutConstLitInternal): + New procedure. + (IsConstLitInternal): New procedure function. + * gm2-compiler/SymbolTable.mod (PutConstLitInternal): + New procedure. + (IsConstLitInternal): New procedure function. + (SymConstLit): New field IsInternal. + (CreateConstLit): Initialize IsInternal to FALSE. + +2024-02-21 Gaius Mulley + + PR modula2/114026 + * gm2-compiler/M2GenGCC.mod (Import): Remove DisplayQuadruples. + Remove DisplayQuadList. + (MixTypesBinary): Replace check with overflowCheck. + New variable typeChecking. + Use GenQuadOTypetok to retrieve typeChecking. + Use typeChecking to suppress error message. + * gm2-compiler/M2LexBuf.def (MakeVirtual2Tok): New procedure + function. + * gm2-compiler/M2LexBuf.mod (MakeVirtualTok): Improve comment. + (MakeVirtual2Tok): New procedure function. + * gm2-compiler/M2Quads.def (GetQuadOTypetok): New procedure. + * gm2-compiler/M2Quads.mod (QuadFrame): New field CheckType. + (PutQuadO): Rewrite using PutQuadOType. + (PutQuadOType): New procedure. + (GetQuadOTypetok): New procedure. + (BuildPseudoBy): Rewrite. + (BuildForToByDo): Remove type checking. + Add parameters e2, e2tok, BySym, bytok to + InitForLoopBeginRange. + Push the RangeId. + (BuildEndFor): Pop the RangeId. + Use GenQuadOTypetok to generate AddOp without type checking. + Call PutRangeForIncrement with the RangeId and IncQuad. + (GenQuadOtok): Rewrite using GenQuadOTypetok. + (GenQuadOTypetok): New procedure. + * gm2-compiler/M2Range.def (InitForLoopBeginRangeCheck): + Rename d as des, e as expr. + Add expr1, expr1tok, expr2, expr2tok, byconst, byconsttok + parameters. + (PutRangeForIncrement): New procedure. + * gm2-compiler/M2Range.mod (Import): MakeVirtual2Tok. + (Range): Add expr2, byconst, destok, exprtok, expr2tok, + incrementquad. + (InitRange): Initialize expr2 to NulSym. + Initialize byconst to NulSym. + Initialize tokenNo, destok, exprtok, expr2tok, byconst to + UnknownTokenNo. + Initialize incrementquad to 0. + (PutRangeForIncrement): New procedure. + (PutRangeDesExpr2): New procedure. + (InitForLoopBeginRangeCheck): Rewrite. + (ForLoopBeginTypeCompatible): New procedure function. + (CodeForLoopBegin): Call ForLoopBeginTypeCompatible and + only code the for loop assignment if all the type checks + succeed. + 2024-02-19 Gaius Mulley PR modula2/113889 diff --git a/gcc/m2/Make-lang.in b/gcc/m2/Make-lang.in index 45bfa933dca0..33b9ce8d8e88 100644 --- a/gcc/m2/Make-lang.in +++ b/gcc/m2/Make-lang.in @@ -1786,6 +1786,7 @@ BUILD-PGE-O = \ m2/pge-boot/GSymbolKey.o \ m2/pge-boot/GSysStorage.o \ m2/pge-boot/Glibc.o \ + m2/pge-boot/Gwrapc.o \ m2/pge-boot/Gerrno.o \ m2/pge-boot/GUnixArgs.o \ m2/pge-boot/Gtermios.o \ diff --git a/gcc/m2/gm2-compiler/M2Check.mod b/gcc/m2/gm2-compiler/M2Check.mod index a296766ba35c..5b45ad39c118 100644 --- a/gcc/m2/gm2-compiler/M2Check.mod +++ b/gcc/m2/gm2-compiler/M2Check.mod @@ -39,7 +39,15 @@ FROM M2Error IMPORT Error, InternalError, NewError, ErrorString, ChainError ; FROM M2MetaError IMPORT MetaErrorStringT2, MetaErrorStringT3, MetaErrorStringT4, MetaString2, MetaString3, MetaString4 ; FROM StrLib IMPORT StrEqual ; FROM M2Debug IMPORT Assert ; -FROM SymbolTable IMPORT NulSym, IsRecord, IsSet, GetDType, GetSType, IsType, SkipType, IsProcedure, NoOfParam, IsVarParam, GetNth, GetNthParam, IsProcType, IsVar, IsEnumeration, IsArray, GetDeclaredMod, IsSubrange, GetArraySubscript, IsConst, IsReallyPointer, IsPointer, IsParameter, ModeOfAddr, GetMode, GetType, IsUnbounded, IsComposite, IsConstructor, IsParameter, IsConstString ; + +FROM SymbolTable IMPORT NulSym, IsRecord, IsSet, GetDType, GetSType, IsType, + SkipType, IsProcedure, NoOfParam, IsVarParam, GetNth, + GetNthParam, IsProcType, IsVar, IsEnumeration, IsArray, + GetDeclaredMod, IsSubrange, GetArraySubscript, IsConst, + IsReallyPointer, IsPointer, IsParameter, ModeOfAddr, + GetMode, GetType, IsUnbounded, IsComposite, IsConstructor, + IsParameter, IsConstString, IsConstLitInternal, IsConstLit ; + FROM M2GCCDeclare IMPORT GetTypeMin, GetTypeMax ; FROM M2System IMPORT Address ; FROM M2ALU IMPORT Equ, PushIntegerTree ; @@ -1370,6 +1378,17 @@ BEGIN END get ; +(* + isInternal - return TRUE if sym is a constant lit which was declared + as internal. +*) + +PROCEDURE isInternal (sym: CARDINAL) : BOOLEAN ; +BEGIN + RETURN IsConstLit (sym) AND IsConstLitInternal (sym) +END isInternal ; + + (* doCheck - keep obtaining an unresolved pair and check for the type compatibility. This is the main check routine used by @@ -1393,6 +1412,13 @@ BEGIN printf ("doCheck (%d, %d)\n", left, right) ; dumptInfo (tinfo) END ; + IF isInternal (left) OR isInternal (right) + THEN + (* Do not check constants which have been generated internally. + Currently these are generated by the default BY constant value + in a FOR loop. *) + RETURN TRUE + END ; (* IF in (tinfo^.visited, left, right) THEN diff --git a/gcc/m2/gm2-compiler/M2GenGCC.mod b/gcc/m2/gm2-compiler/M2GenGCC.mod index c7581f859374..aeba48d356e6 100644 --- a/gcc/m2/gm2-compiler/M2GenGCC.mod +++ b/gcc/m2/gm2-compiler/M2GenGCC.mod @@ -93,7 +93,7 @@ FROM M2Error IMPORT InternalError, WriteFormat0, WriteFormat1, WriteFormat2, War FROM M2MetaError IMPORT MetaErrorT0, MetaErrorT1, MetaErrorT2, MetaErrorT3, MetaError1, MetaError2, MetaErrorStringT1 ; -FROM M2Options IMPORT DisplayQuadruples, UnboundedByReference, PedanticCast, +FROM M2Options IMPORT UnboundedByReference, PedanticCast, VerboseUnbounded, Iso, Pim, DebugBuiltins, WholeProgram, StrictTypeChecking, AutoInit, cflag, ScaffoldMain, ScaffoldDynamic, ScaffoldStatic, @@ -256,9 +256,9 @@ FROM m2except IMPORT BuildThrow, BuildTryBegin, BuildTryEnd, FROM M2Quads IMPORT QuadOperator, GetQuad, IsReferenced, GetNextQuad, SubQuad, PutQuad, MustCheckOverflow, GetQuadOtok, + GetQuadOTypetok, QuadToTokenNo, DisplayQuad, GetQuadtok, - GetM2OperatorDesc, GetQuadOp, - DisplayQuadList ; + GetM2OperatorDesc, GetQuadOp ; FROM M2Check IMPORT ParameterTypeCompatible, AssignmentTypeCompatible, ExpressionTypeCompatible ; FROM M2SSA IMPORT EnableSSA ; @@ -644,11 +644,6 @@ BEGIN Changed := TRUE END UNTIL NoChange ; - IF Debugging AND DisplayQuadruples AND FALSE - THEN - printf0('after resolving expressions with gcc\n') ; - DisplayQuadList - END ; RETURN Changed END ResolveConstantExpressions ; @@ -3660,13 +3655,13 @@ END CodeBinaryCheck ; (* - MixTypesBinary - depending upon check do not check pointer arithmetic. + MixTypesBinary - depending upon overflowCheck do not check pointer arithmetic. *) PROCEDURE MixTypesBinary (left, right: CARDINAL; - tokpos: CARDINAL; check: BOOLEAN) : CARDINAL ; + tokpos: CARDINAL; overflowCheck: BOOLEAN) : CARDINAL ; BEGIN - IF (NOT check) AND + IF (NOT overflowCheck) AND (IsPointer (GetTypeMode (left)) OR IsPointer (GetTypeMode (right))) THEN RETURN Address @@ -3743,6 +3738,7 @@ VAR lefttype, righttype, des, left, right: CARDINAL ; + typeChecking, overflowChecking: BOOLEAN ; despos, leftpos, rightpos, @@ -3750,10 +3746,10 @@ VAR subexprpos : CARDINAL ; op : QuadOperator ; BEGIN - GetQuadOtok (quad, operatorpos, op, - des, left, right, overflowChecking, - despos, leftpos, rightpos) ; - IF ((op # LogicalRotateOp) AND (op # LogicalShiftOp)) + GetQuadOTypetok (quad, operatorpos, op, + des, left, right, overflowChecking, typeChecking, + despos, leftpos, rightpos) ; + IF typeChecking AND (op # LogicalRotateOp) AND (op # LogicalShiftOp) THEN subexprpos := MakeVirtualTok (operatorpos, leftpos, rightpos) ; lefttype := GetType (left) ; diff --git a/gcc/m2/gm2-compiler/M2LexBuf.def b/gcc/m2/gm2-compiler/M2LexBuf.def index dd49f4539f35..07f5934a6311 100644 --- a/gcc/m2/gm2-compiler/M2LexBuf.def +++ b/gcc/m2/gm2-compiler/M2LexBuf.def @@ -1,4 +1,4 @@ -(* M2LexBuf.def provides a buffer for m2.lex. +(* M2LexBuf.def provides a buffer for m2.flex. Copyright (C) 2001-2024 Free Software Foundation, Inc. Contributed by Gaius Mulley . @@ -35,17 +35,6 @@ FROM DynamicStrings IMPORT String ; FROM m2linemap IMPORT location_t ; FROM NameKey IMPORT Name ; -EXPORT QUALIFIED OpenSource, CloseSource, ReInitialize, GetToken, InsertToken, - InsertTokenAndRewind, GetPreviousTokenLineNo, GetLineNo, - GetColumnNo, GetTokenNo, TokenToLineNo, TokenToColumnNo, - TokenToLocation, GetTokenName, - FindFileNameFromToken, GetFileName, - ResetForNewPass, - currenttoken, currentstring, currentinteger, - AddTok, AddTokCharStar, AddTokInteger, MakeVirtualTok, - SetFile, PushFile, PopFile, - PrintTokenNo, DisplayToken, DumpTokens, - BuiltinTokenNo, UnknownTokenNo ; CONST UnknownTokenNo = 0 ; @@ -142,13 +131,13 @@ PROCEDURE GetTokenName (tokenno: CARDINAL) : Name ; (* TokenToLineNo - returns the line number of the current file for the - TokenNo. The depth refers to the include depth. + tokenno. The depth refers to the include depth. A depth of 0 is the current file, depth of 1 is the file which included the current file. Zero is returned if the depth exceeds the file nesting level. *) -PROCEDURE TokenToLineNo (TokenNo: CARDINAL; depth: CARDINAL) : CARDINAL ; +PROCEDURE TokenToLineNo (tokenno: CARDINAL; depth: CARDINAL) : CARDINAL ; (* @@ -161,31 +150,31 @@ PROCEDURE GetColumnNo () : CARDINAL ; (* TokenToColumnNo - returns the column number of the current file for the - TokenNo. The depth refers to the include depth. + tokenno. The depth refers to the include depth. A depth of 0 is the current file, depth of 1 is the file which included the current file. Zero is returned if the depth exceeds the file nesting level. *) -PROCEDURE TokenToColumnNo (TokenNo: CARDINAL; depth: CARDINAL) : CARDINAL ; +PROCEDURE TokenToColumnNo (tokenno: CARDINAL; depth: CARDINAL) : CARDINAL ; (* - TokenToLocation - returns the location_t corresponding to, TokenNo. + TokenToLocation - returns the location_t corresponding to tokenno. *) -PROCEDURE TokenToLocation (TokenNo: CARDINAL) : location_t ; +PROCEDURE TokenToLocation (tokenno: CARDINAL) : location_t ; (* FindFileNameFromToken - returns the complete FileName for the appropriate - source file yields the token number, TokenNo. + source file yields the token number tokenno. The, Depth, indicates the include level: 0..n Level 0 is the current. NIL is returned if n+1 is requested. *) -PROCEDURE FindFileNameFromToken (TokenNo: CARDINAL; depth: CARDINAL) : String ; +PROCEDURE FindFileNameFromToken (tokenno: CARDINAL; depth: CARDINAL) : String ; (* @@ -197,12 +186,20 @@ PROCEDURE GetFileName () : String ; (* MakeVirtualTok - creates and return a new tokenno which is created from - tokenno range1 and range2. + tokenno caret, left and right. *) PROCEDURE MakeVirtualTok (caret, left, right: CARDINAL) : CARDINAL ; +(* + MakeVirtual2Tok - creates and return a new tokenno which is created from + two tokens left and right. +*) + +PROCEDURE MakeVirtual2Tok (left, right: CARDINAL) : CARDINAL ; + + (* *********************************************************************** * * These functions allow m2.lex to deliver tokens into the buffer @@ -268,7 +265,7 @@ PROCEDURE DisplayToken (tok: toktype) ; (* - DumpTokens - developer debugging aid. + DumpTokens - displays all tokens. *) PROCEDURE DumpTokens ; diff --git a/gcc/m2/gm2-compiler/M2LexBuf.mod b/gcc/m2/gm2-compiler/M2LexBuf.mod index 84a0e2501825..8d9b5a5a6e3b 100644 --- a/gcc/m2/gm2-compiler/M2LexBuf.mod +++ b/gcc/m2/gm2-compiler/M2LexBuf.mod @@ -36,9 +36,16 @@ FROM NameKey IMPORT makekey ; FROM m2linemap IMPORT location_t, GetLocationBinary ; FROM M2Emit IMPORT UnknownLocation, BuiltinsLocation ; FROM M2Error IMPORT WarnStringAt ; +FROM M2MetaError IMPORT MetaErrorT0 ; + +FROM Indexing IMPORT Index, InitIndex, GetIndice, PutIndice, + KillIndex, ForeachIndiceInIndexDo, + LowIndice, HighIndice, IsEmpty, InBounds, + InitIndexTuned ; + CONST - MaxBucketSize = 100 ; + Tracing = FALSE ; Debugging = FALSE ; DebugRecover = FALSE ; InitialSourceToken = 2 ; (* 0 is unknown, 1 is builtin. *) @@ -52,7 +59,7 @@ TYPE col : CARDINAL ; END ; - TokenDesc = RECORD + TokenDesc = POINTER TO RECORD token : toktype ; str : Name ; (* ident name or string literal. *) int : INTEGER ; @@ -60,61 +67,85 @@ TYPE col : CARDINAL ; file : SourceList ; loc : location_t ; - insert: TokenBucket ; (* contains any inserted tokens. *) + insert: Index ; (* Contains any inserted tokens. *) END ; - TokenBucket = POINTER TO RECORD - buf : ARRAY [0..MaxBucketSize] OF TokenDesc ; - len : CARDINAL ; - next: TokenBucket ; - END ; - - ListDesc = RECORD - head, - tail : TokenBucket ; - LastBucketOffset: CARDINAL ; - END ; - VAR CurrentSource : SourceList ; UseBufferedTokens, CurrentUsed : BOOLEAN ; - ListOfTokens : ListDesc ; + ListOfTokens : Index ; CurrentTokNo : CARDINAL ; InsertionIndex : CARDINAL ; SeenEof : BOOLEAN ; (* Have we seen eof since the last call to OpenSource. *) +(* + InitTokenDesc - returns a TokenDesc filled in with the parameters and + the insert field set to NIL. +*) + +PROCEDURE InitTokenDesc (token: toktype; str: Name; int: INTEGER; + line, col: CARDINAL; + file: SourceList; loc: location_t) : TokenDesc ; +VAR + tokdesc: TokenDesc ; +BEGIN + NEW (tokdesc) ; + tokdesc^.token := token ; + tokdesc^.str := str ; + tokdesc^.int := int ; + tokdesc^.line := line ; + tokdesc^.col := col ; + tokdesc^.file := file ; + tokdesc^.loc := loc ; + tokdesc^.insert := NIL ; + RETURN tokdesc +END InitTokenDesc ; + + +(* + DeleteTokenDesc - delete tokdesc and any sub indices. +*) + +PROCEDURE DeleteTokenDesc (tokdesc: TokenDesc) ; +BEGIN + IF tokdesc^.insert # NIL + THEN + ForeachIndiceInIndexDo (tokdesc^.insert, DeleteTokenDesc) + END ; + DISPOSE (tokdesc) +END DeleteTokenDesc ; + + +(* + Append - appends tokdesc to the end of the list defined by index. +*) + +PROCEDURE Append (index: Index; tokdesc: TokenDesc) ; +BEGIN + IF IsEmpty (index) + THEN + PutIndice (index, LowIndice (index), tokdesc) + ELSE + PutIndice (index, HighIndice (index) +1, tokdesc) + END +END Append ; + + (* InitTokenList - creates an empty token list, which starts the first source token - at position 2. This allows position 0 to be for unknown location - and position 1 for builtin token. + at position 2. This allows position 0 to be used for the unknown + location and position 1 for the builtin token. *) PROCEDURE InitTokenList ; BEGIN - NEW (ListOfTokens.head) ; - ListOfTokens.tail := ListOfTokens.head ; - WITH ListOfTokens.tail^.buf[0] DO - token := eoftok ; - str := NulName ; - int := 0 ; - line := 0 ; - col := 0 ; - file := NIL ; - loc := UnknownLocation () - END ; - WITH ListOfTokens.tail^.buf[1] DO - token := eoftok ; - str := NulName ; - int := 0 ; - line := 0 ; - col := 0 ; - file := NIL ; - loc := BuiltinsLocation () - END ; - ListOfTokens.tail^.len := InitialSourceToken + (* 65K elements in the array and when it becomes full it will grow to 1M, 16M etc elements. *) + ListOfTokens := InitIndexTuned (0, 1024*1024 DIV 16, 16) ; + Append (ListOfTokens, InitTokenDesc (eoftok, NulName, 0, 0, 0, NIL, UnknownLocation ())) ; + Append (ListOfTokens, InitTokenDesc (eoftok, NulName, 0, 0, 0, NIL, BuiltinsLocation ())) END InitTokenList ; @@ -129,8 +160,6 @@ BEGIN currenttoken := eoftok ; CurrentTokNo := InitialSourceToken ; CurrentSource := NIL ; - ListOfTokens.head := NIL ; - ListOfTokens.tail := NIL ; UseBufferedTokens := FALSE ; InitTokenList END Init ; @@ -302,20 +331,10 @@ END KillList ; *) PROCEDURE ReInitialize ; -VAR - s, t: TokenBucket ; BEGIN - IF ListOfTokens.head#NIL - THEN - t := ListOfTokens.head ; - REPEAT - s := t ; - t := t^.next ; - DISPOSE(s) ; - UNTIL t=NIL ; - CurrentUsed := FALSE ; - KillList - END ; + ForeachIndiceInIndexDo (ListOfTokens, DeleteTokenDesc) ; + CurrentUsed := FALSE ; + KillList ; Init END ReInitialize ; @@ -340,6 +359,7 @@ END SetFile ; PROCEDURE OpenSource (s: String) : BOOLEAN ; BEGIN + tprintf1 ("OpenSource (%s)\n", s) ; SeenEof := FALSE ; IF UseBufferedTokens THEN @@ -349,8 +369,11 @@ BEGIN IF m2flex.OpenSource (string (s)) THEN SetFile (string (s)) ; - SyncOpenWithBuffer ; GetToken ; + IF IsLastTokenEof () + THEN + MetaErrorT0 (GetTokenNo (), "source file is empty") + END ; RETURN TRUE ELSE RETURN FALSE @@ -365,6 +388,7 @@ END OpenSource ; PROCEDURE CloseSource ; BEGIN + tprintf0 ("CloseSource\n") ; IF UseBufferedTokens THEN WHILE currenttoken#eoftok DO @@ -483,138 +507,133 @@ BEGIN END DisplayToken ; +VAR + indent: CARDINAL ; + + (* - UpdateFromBucket - updates the global variables: currenttoken, - currentstring, currentcolumn and currentinteger - from TokenBucket, b, and, offset. + DumpToken - *) -PROCEDURE UpdateFromBucket (b: TokenBucket; offset: CARDINAL) ; +PROCEDURE DumpToken (tokdesc: TokenDesc) ; +VAR + n: CARDINAL ; BEGIN - IF InsertionIndex > 0 - THEN - (* we have an inserted token to use. *) - Assert (b^.buf[offset].insert # NIL) ; - WITH b^.buf[offset].insert^.buf[InsertionIndex] DO - currenttoken := token ; - currentstring := KeyToCharStar(str) ; - currentcolumn := col ; - currentinteger := int ; - IF Debugging - THEN - printf3('line %d (# %d %d) ', line, offset, CurrentTokNo) - END + n := indent ; + WHILE n > 0 DO + printf0 (" ") ; + DEC (n) + END ; + WITH tokdesc^ DO + DisplayToken (token) ; + IF str # NulName + THEN + printf1 (" %a", str) END ; - INC (InsertionIndex) ; - IF InsertionIndex = b^.buf[offset].insert^.len + IF insert # NIL THEN - InsertionIndex := 0 ; (* finished consuming the inserted tokens. *) - INC (CurrentTokNo) + printf0 ("inserted error recovery tokens\n") ; + INC (indent, 2) ; + ForeachIndiceInIndexDo (insert, DumpToken) ; + DEC (indent, 2) END - ELSIF (b^.buf[offset].insert # NIL) AND (InsertionIndex = 0) + END +END DumpToken ; + + +(* + DumpTokens - displays all tokens. +*) + +PROCEDURE DumpTokens ; +VAR + high, + ind : CARDINAL ; +BEGIN + IF IsEmpty (ListOfTokens) THEN - (* this source token has extra tokens appended after it by the error recovery. *) - Assert (b^.buf[offset].insert^.len > 0) ; (* we must have at least one token. *) - InsertionIndex := 1 ; (* so set the index ready for the next UpdateFromBucket. *) - (* and read the original token. *) - WITH b^.buf[offset] DO - currenttoken := token ; - currentstring := KeyToCharStar(str) ; - currentcolumn := col ; - currentinteger := int ; - IF Debugging - THEN - printf3('line %d (# %d %d) ', line, offset, CurrentTokNo) - END - END + printf0 ("The token buffer is empty\n") ELSE - (* no inserted tokens after this token so read it and move on. *) - WITH b^.buf[offset] DO - currenttoken := token ; - currentstring := KeyToCharStar(str) ; - currentcolumn := col ; - currentinteger := int ; - IF Debugging - THEN - printf3('line %d (# %d %d) ', line, offset, CurrentTokNo) - END - END ; - INC (CurrentTokNo) + ind := LowIndice (ListOfTokens) ; + high := HighIndice (ListOfTokens) ; + WHILE ind <= high DO + printf1 ("%5d ", ind) ; + DumpToken (GetIndice (ListOfTokens, ind)) ; + INC (ind) + END END -END UpdateFromBucket ; +END DumpTokens ; (* - DisplayTokenEntry - + CopyOutCurrent - copies the token in buffer[index][insertion] into + then current token global variables. *) -PROCEDURE DisplayTokenEntry (topBucket: TokenBucket; index, total: CARDINAL) ; +PROCEDURE CopyOutCurrent (buffer: Index; index, insertion: CARDINAL) ; VAR - i: CARDINAL ; + tokdesc: TokenDesc ; BEGIN - printf1 ("%d: ", total) ; - DisplayToken (topBucket^.buf[index].token) ; - printf1 (" %a ", topBucket^.buf[index].str) ; - IF total = GetTokenNo () + tokdesc := GetIndice (buffer, index) ; + IF insertion # 0 THEN - printf0 (" <- current token") + tokdesc := GetIndice (tokdesc^.insert, insertion) END ; - printf0 ("\n") ; - (* now check for inserted tokens. *) - IF topBucket^.buf[index].insert # NIL - THEN - i := 1 ; - WHILE i < topBucket^.buf[index].insert^.len DO - printf1 (" %d: ", i) ; - DisplayToken (topBucket^.buf[index].insert^.buf[i].token) ; - printf1 (" %a\n", topBucket^.buf[index].insert^.buf[i].str) ; - INC (i) - END + WITH tokdesc^ DO + currenttoken := token ; + currentstring := KeyToCharStar (str) ; + currentcolumn := col ; + currentinteger := int END -END DisplayTokenEntry ; +END CopyOutCurrent ; (* - DumpTokens - developer debugging aid. + UpdateToken - update the global current token variables from buffer[index] + using inserted tokens if directed by InsertionIndex. *) -PROCEDURE DumpTokens ; +PROCEDURE UpdateToken (buffer: Index; index: CARDINAL) ; VAR - tb : TokenBucket ; - i, - tokenNo, - total, - length : CARDINAL ; + tokdesc: TokenDesc ; BEGIN - tokenNo := GetTokenNo () ; - tb := ListOfTokens.head ; - total := 0 ; - WHILE tb # NIL DO - length := tb^.len ; - i := 0 ; - WHILE i < length DO - DisplayTokenEntry (tb, i, total) ; - INC (i) ; - INC (total) - END ; - tb := tb^.next - END ; - printf2 ("%d: tokenNo, %d: total\n", tokenNo, total) ; - IF (total # 0) AND (tokenNo = total) + tokdesc := GetIndice (buffer, index) ; + IF InsertionIndex > 0 THEN - printf1 ("%d: end of buffer ", total) ; - printf0 (" <- current token") ; - printf0 ("\n") ; - END ; -END DumpTokens ; + (* We have an inserted token to use. *) + Assert (tokdesc^.insert # NIL) ; + CopyOutCurrent (buffer, index, InsertionIndex) ; + (* Move InsertionIndex to the next position. *) + INC (InsertionIndex) ; + IF InsertionIndex > HighIndice (tokdesc^.insert) + THEN + (* We are done consuming the inserted tokens, so move + onto the next original source token. *) + InsertionIndex := 0 ; + INC (CurrentTokNo) + END + ELSIF (tokdesc^.insert # NIL) AND (InsertionIndex = 0) + THEN + (* This source token has extra tokens appended after it by the error recovery. + Set the index ready for the next UpdateToken which will read the extra + tokens. *) + InsertionIndex := 1 ; + (* However this call must read the original token. *) + CopyOutCurrent (buffer, index, 0) + ELSE + CopyOutCurrent (buffer, index, 0) ; + (* Move onto the next original source token. *) + INC (CurrentTokNo) + END +END UpdateToken ; (* - GetNonEofToken - providing that we have not already seen an eof for this source - file call m2flex.GetToken and GetToken if requested. + GetTokenFiltered - providing that we have not already seen an eof for this source + file call m2flex.GetToken and GetToken if requested. *) -PROCEDURE GetNonEofToken (callGetToken: BOOLEAN) ; +PROCEDURE GetTokenFiltered (callGetToken: BOOLEAN) ; BEGIN IF SeenEof THEN @@ -627,7 +646,7 @@ BEGIN GetToken END END -END GetNonEofToken ; +END GetTokenFiltered ; (* @@ -635,134 +654,95 @@ END GetNonEofToken ; *) PROCEDURE GetToken ; -VAR - t: CARDINAL ; - b: TokenBucket ; BEGIN IF UseBufferedTokens THEN - t := CurrentTokNo ; - b := FindTokenBucket(t) ; - UpdateFromBucket (b, t) + UpdateToken (ListOfTokens, CurrentTokNo) ELSE - IF ListOfTokens.tail=NIL + IF NOT InBounds (ListOfTokens, CurrentTokNo) THEN - GetNonEofToken (FALSE) ; - IF ListOfTokens.tail=NIL - THEN - HALT - END + GetTokenFiltered (FALSE) END ; - IF CurrentTokNo>=ListOfTokens.LastBucketOffset - THEN - (* CurrentTokNo is in the last bucket or needs to be read. *) - IF CurrentTokNo-ListOfTokens.LastBucketOffset 0 THEN InsertToken (token) ; - offset := CurrentTokNo -2 ; - topBucket := FindTokenBucket (offset) ; - InsertionIndex := topBucket^.buf[offset].insert^.len -1 ; + position := CurrentTokNo -2 ; + tokdesc := GetIndice (ListOfTokens, position) ; + IF tokdesc^.insert = NIL + THEN + tokdesc^.insert := InitIndex (1) + END ; + AppendInsertToken (tokdesc^.insert, DupTok (tokdesc, token)) ; + InsertionIndex := HighIndice (tokdesc^.insert) ; DEC (CurrentTokNo, 2) ; GetToken END @@ -775,14 +755,6 @@ END InsertTokenAndRewind ; PROCEDURE GetPreviousTokenLineNo () : CARDINAL ; BEGIN - (* - IF GetTokenNo()>0 - THEN - RETURN( TokenToLineNo(GetTokenNo()-1, 0) ) - ELSE - RETURN( 0 ) - END - *) RETURN GetLineNo () END GetPreviousTokenLineNo ; @@ -840,158 +812,122 @@ END GetTokenNo ; PROCEDURE GetTokenName (tokenno: CARDINAL) : Name ; VAR - b: TokenBucket ; - n: Name ; + tokdesc: TokenDesc ; + name : Name ; BEGIN - b := FindTokenBucket (tokenno) ; - IF b=NIL + IF InBounds (ListOfTokens, tokenno) THEN - RETURN NulName - ELSE - WITH b^.buf[tokenno] DO - n := tokToTok (token) ; - IF n=NulName - THEN - RETURN str - ELSE - RETURN n - END + tokdesc := GetIndice (ListOfTokens, tokenno) ; + name := tokToTok (tokdesc^.token) ; + IF name = NulName + THEN + RETURN tokdesc^.str + ELSE + RETURN name END - END -END GetTokenName ; - - -(* - FindTokenBucket - returns the TokenBucket corresponding to the TokenNo. -*) - -PROCEDURE FindTokenBucket (VAR TokenNo: CARDINAL) : TokenBucket ; -VAR - b: TokenBucket ; -BEGIN - b := ListOfTokens.head ; - WHILE b#NIL DO - WITH b^ DO - IF TokenNo0 DO - l := l^.left ; - IF l=b^.buf[TokenNo].file^.left + level := tokdesc^.file^.left ; + WHILE depth > 0 DO + level := level^.left ; + IF level = tokdesc^.file^.left THEN RETURN 0 END ; DEC (depth) END ; - RETURN l^.line + RETURN level^.line END END - END + END ; + RETURN 0 END TokenToLineNo ; (* TokenToColumnNo - returns the column number of the current file for the - TokenNo. The depth refers to the include depth. + tokenno. The depth refers to the include depth. A depth of 0 is the current file, depth of 1 is the file which included the current file. Zero is returned if the depth exceeds the file nesting level. *) -PROCEDURE TokenToColumnNo (TokenNo: CARDINAL; depth: CARDINAL) : CARDINAL ; +PROCEDURE TokenToColumnNo (tokenno: CARDINAL; depth: CARDINAL) : CARDINAL ; VAR - b: TokenBucket ; - l: SourceList ; + tokdesc: TokenDesc ; + level : SourceList ; BEGIN - IF (TokenNo = UnknownTokenNo) OR (TokenNo = BuiltinTokenNo) + IF (tokenno # UnknownTokenNo) AND (tokenno # BuiltinTokenNo) THEN - RETURN 0 - ELSE - b := FindTokenBucket (TokenNo) ; - IF b=NIL + IF InBounds (ListOfTokens, tokenno) THEN - RETURN 0 - ELSE + tokdesc := GetIndice (ListOfTokens, tokenno) ; IF depth = 0 THEN - RETURN b^.buf[TokenNo].col + RETURN tokdesc^.col ELSE - l := b^.buf[TokenNo].file^.left ; - WHILE depth>0 DO - l := l^.left ; - IF l=b^.buf[TokenNo].file^.left + level := tokdesc^.file^.left ; + WHILE depth > 0 DO + level := level^.left ; + IF level = tokdesc^.file^.left THEN RETURN 0 END ; DEC (depth) END ; - RETURN l^.col + RETURN level^.col END END - END + END ; + RETURN 0 END TokenToColumnNo ; (* - TokenToLocation - returns the location_t corresponding to, TokenNo. + TokenToLocation - returns the location_t corresponding to tokenno. *) -PROCEDURE TokenToLocation (TokenNo: CARDINAL) : location_t ; +PROCEDURE TokenToLocation (tokenno: CARDINAL) : location_t ; VAR - b: TokenBucket ; + tokdesc: TokenDesc ; BEGIN - IF TokenNo = UnknownTokenNo + IF tokenno = UnknownTokenNo THEN RETURN UnknownLocation () - ELSIF TokenNo = BuiltinTokenNo + ELSIF tokenno = BuiltinTokenNo THEN RETURN BuiltinsLocation () - ELSE - b := FindTokenBucket (TokenNo) ; - IF b=NIL - THEN - RETURN UnknownLocation () - ELSE - RETURN b^.buf[TokenNo].loc - END - END + ELSIF InBounds (ListOfTokens, tokenno) + THEN + tokdesc := GetIndice (ListOfTokens, tokenno) ; + RETURN tokdesc^.loc + END ; + RETURN UnknownLocation () END TokenToLocation ; @@ -1003,35 +939,29 @@ END TokenToLocation ; is requested. *) -PROCEDURE FindFileNameFromToken (TokenNo: CARDINAL; depth: CARDINAL) : String ; +PROCEDURE FindFileNameFromToken (tokenno: CARDINAL; depth: CARDINAL) : String ; VAR - b: TokenBucket ; - l: SourceList ; + tokdesc: TokenDesc ; + level : SourceList ; BEGIN - b := FindTokenBucket (TokenNo) ; - IF b=NIL + IF (tokenno # UnknownTokenNo) AND (tokenno # BuiltinTokenNo) THEN - RETURN NIL - ELSE - IF TokenNo = UnknownTokenNo + IF InBounds (ListOfTokens, tokenno) THEN - RETURN NIL - ELSIF TokenNo = BuiltinTokenNo - THEN - RETURN NIL - ELSE - l := b^.buf[TokenNo].file^.left ; - WHILE depth>0 DO - l := l^.left ; - IF l=b^.buf[TokenNo].file^.left + tokdesc := GetIndice (ListOfTokens, tokenno) ; + level := tokdesc^.file^.left ; + WHILE depth > 0 DO + level := level^.left ; + IF level = tokdesc^.file^.left THEN RETURN NIL END ; DEC (depth) END ; - RETURN l^.name + RETURN level^.name END - END + END ; + RETURN NIL END FindFileNameFromToken ; @@ -1049,46 +979,12 @@ END GetFileName ; AddTokToList - adds a token to a dynamic list. *) -PROCEDURE AddTokToList (t: toktype; n: Name; - i: INTEGER; l: CARDINAL; c: CARDINAL; - f: SourceList; location: location_t) ; +PROCEDURE AddTokToList (token: toktype; str: Name; + int: INTEGER; line: CARDINAL; col: CARDINAL; + file: SourceList; location: location_t) ; BEGIN - IF ListOfTokens.head=NIL - THEN - NEW (ListOfTokens.head) ; - IF ListOfTokens.head=NIL - THEN - (* list error *) - END ; - ListOfTokens.tail := ListOfTokens.head ; - ListOfTokens.tail^.len := 0 - ELSIF ListOfTokens.tail^.len=MaxBucketSize - THEN - Assert(ListOfTokens.tail^.next=NIL) ; - NEW (ListOfTokens.tail^.next) ; - IF ListOfTokens.tail^.next=NIL - THEN - (* list error *) - ELSE - ListOfTokens.tail := ListOfTokens.tail^.next ; - ListOfTokens.tail^.len := 0 - END ; - INC (ListOfTokens.LastBucketOffset, MaxBucketSize) - END ; - WITH ListOfTokens.tail^ DO - next := NIL ; - WITH buf[len] DO - token := t ; - str := n ; - int := i ; - line := l ; - col := c ; - file := f ; - loc := location ; - insert := NIL ; - END ; - INC (len) - END + Append (ListOfTokens, InitTokenDesc (token, str, int, line, + col, file, location)) END AddTokToList ; @@ -1098,29 +994,15 @@ END AddTokToList ; PROCEDURE IsLastTokenEof () : BOOLEAN ; VAR - b: TokenBucket ; + tokdesc: TokenDesc ; BEGIN - IF ListOfTokens.tail#NIL + IF IsEmpty (ListOfTokens) THEN - IF ListOfTokens.tail^.len=0 - THEN - b := ListOfTokens.head ; - IF b=ListOfTokens.tail - THEN - RETURN FALSE - END ; - WHILE b^.next#ListOfTokens.tail DO - b := b^.next - END ; - ELSE - b := ListOfTokens.tail - END ; - WITH b^ DO - Assert (len>0) ; (* len should always be >0 *) - RETURN buf[len-1].token=eoftok - END - END ; - RETURN FALSE + RETURN FALSE + ELSE + tokdesc := GetIndice (ListOfTokens, HighIndice (ListOfTokens)) ; + RETURN tokdesc^.token = eoftok + END END IsLastTokenEof ; @@ -1154,36 +1036,75 @@ END isSrcToken ; MakeVirtualTok - providing caret, left, right are associated with a source file and exist on the same src line then create and return a new tokenno which is created from - tokenno range1 and range2. Otherwise return caret. + tokenno left and right. Otherwise return caret. *) PROCEDURE MakeVirtualTok (caret, left, right: CARDINAL) : CARDINAL ; VAR - bufLeft, bufRight: TokenBucket ; - lc, ll, lr : location_t ; + descLeft, descRight: TokenDesc ; + lc, ll, lr : location_t ; BEGIN IF isSrcToken (caret) AND isSrcToken (left) AND isSrcToken (right) THEN lc := TokenToLocation (caret) ; ll := TokenToLocation (left) ; lr := TokenToLocation (right) ; - bufLeft := FindTokenBucket (left) ; (* left maybe changed now. *) - bufRight := FindTokenBucket (right) ; (* right maybe changed now. *) - - IF (bufLeft^.buf[left].line = bufRight^.buf[right].line) AND - (bufLeft^.buf[left].file = bufRight^.buf[right].file) + IF InBounds (ListOfTokens, left) AND InBounds (ListOfTokens, right) THEN - (* on the same line, create a new token and location. *) - AddTokToList (virtualrangetok, NulName, 0, - bufLeft^.buf[left].line, bufLeft^.buf[left].col, bufLeft^.buf[left].file, - GetLocationBinary (lc, ll, lr)) ; - RETURN ListOfTokens.LastBucketOffset + ListOfTokens.tail^.len - 1 + descLeft := GetIndice (ListOfTokens, left) ; + descRight := GetIndice (ListOfTokens, right) ; + IF (descLeft^.line = descRight^.line) AND + (descLeft^.file = descRight^.file) + THEN + (* On the same line, create a new token and location. *) + AddTokToList (virtualrangetok, NulName, 0, + descLeft^.line, descLeft^.col, descLeft^.file, + GetLocationBinary (lc, ll, lr)) ; + RETURN HighIndice (ListOfTokens) + END END END ; RETURN caret END MakeVirtualTok ; +(* + MakeVirtual2Tok - creates and return a new tokenno which is created from + two tokens left and right. +*) + +PROCEDURE MakeVirtual2Tok (left, right: CARDINAL) : CARDINAL ; +BEGIN + RETURN MakeVirtualTok (left, left, right) +END MakeVirtual2Tok ; + + +(* + tprintf0 - +*) + +PROCEDURE tprintf0 (format: ARRAY OF CHAR) ; +BEGIN + IF Tracing + THEN + printf0 (format) + END +END tprintf0 ; + + +(* + tprintf1 - +*) + +PROCEDURE tprintf1 (format: ARRAY OF CHAR; str: String) ; +BEGIN + IF Tracing + THEN + printf1 (format, str) + END +END tprintf1 ; + + (* *********************************************************************** * * These functions allow m2.flex to deliver tokens into the buffer @@ -1198,12 +1119,24 @@ PROCEDURE AddTok (t: toktype) ; VAR s: String ; BEGIN - IF t = eoftok + IF Tracing THEN - SeenEof := TRUE + printf0 (" m2.flex -> AddTok ") ; + DisplayToken (t) ; + printf0 ("\n") ; END ; - IF NOT ((t=eoftok) AND IsLastTokenEof()) + IF (t=eoftok) AND SeenEof THEN + IF Debugging + THEN + printf0 ("extra eoftok ignored as buffer already contains eoftok\n") + END + ELSE + IF Debugging + THEN + printf0 ("adding token: ") ; DisplayToken (t) ; + printf0 ("\n") + END ; AddTokToList(t, NulName, 0, m2flex.GetLineNo(), m2flex.GetColumnNo(), CurrentSource, m2flex.GetLocation()) ; @@ -1213,6 +1146,10 @@ BEGIN (* display each token as a warning. *) s := InitStringCharStar (KeyToCharStar (GetTokenName (GetTokenNo ()))) ; WarnStringAt (s, GetTokenNo ()) + END ; + IF t = eoftok + THEN + SeenEof := TRUE END END END AddTok ; @@ -1224,7 +1161,22 @@ END AddTok ; *) PROCEDURE AddTokCharStar (t: toktype; s: ADDRESS) ; +VAR + str: String ; BEGIN + Assert (t # eoftok) ; + IF Tracing + THEN + printf0 (" m2.flex -> AddTokCharStar ") ; + DisplayToken (t) ; + str := InitStringCharStar (s) ; + printf1 (" %s\n", str) ; + str := KillString (str) + END ; + IF Debugging + THEN + printf0 ("AddTokCharStar: ") ; DisplayToken (t) ; printf0 ("\n") + END ; AddTokToList(t, makekey(s), 0, m2flex.GetLineNo(), m2flex.GetColumnNo(), CurrentSource, m2flex.GetLocation()) ; CurrentUsed := TRUE @@ -1241,6 +1193,13 @@ VAR c, l: CARDINAL ; BEGIN + Assert (t # eoftok) ; + IF Tracing + THEN + printf0 (" m2.flex -> AddTokInteger ") ; + DisplayToken (t) ; + printf1 (" %d\n", i) ; + END ; l := m2flex.GetLineNo() ; c := m2flex.GetColumnNo() ; s := Sprintf1(Mark(InitString('%d')), i) ; diff --git a/gcc/m2/gm2-compiler/M2Quads.def b/gcc/m2/gm2-compiler/M2Quads.def index e9fd1224d860..3e92e3181dc1 100644 --- a/gcc/m2/gm2-compiler/M2Quads.def +++ b/gcc/m2/gm2-compiler/M2Quads.def @@ -132,6 +132,7 @@ EXPORT QUALIFIED StartBuildDefFile, StartBuildModFile, EndBuildFile, SubQuad, EraseQuad, GetRealQuad, GetQuadtok, GetQuadOtok, PutQuadOtok, GetQuadOp, GetM2OperatorDesc, + GetQuadOTypetok, CountQuads, GetLastFileQuad, GetLastQuadNo, @@ -548,6 +549,17 @@ PROCEDURE GetQuadOtok (QuadNo: CARDINAL; VAR Op1Pos, Op2Pos, Op3Pos: CARDINAL) ; +(* + GetQuadOTypetok - returns the fields associated with quadruple QuadNo. +*) + +PROCEDURE GetQuadOTypetok (QuadNo: CARDINAL; + VAR tok: CARDINAL; + VAR Op: QuadOperator; + VAR Oper1, Oper2, Oper3: CARDINAL; + VAR overflowChecking, typeChecking: BOOLEAN ; + VAR Op1Pos, Op2Pos, Op3Pos: CARDINAL) ; + (* PutQuadOtok - alters a quadruple QuadNo with Op, Oper1, Oper2, Oper3, and sets a boolean to determinine whether overflow should be checked. diff --git a/gcc/m2/gm2-compiler/M2Quads.mod b/gcc/m2/gm2-compiler/M2Quads.mod index e40e07d55c58..2be229d0bf82 100644 --- a/gcc/m2/gm2-compiler/M2Quads.mod +++ b/gcc/m2/gm2-compiler/M2Quads.mod @@ -85,6 +85,7 @@ FROM SymbolTable IMPORT ModeOfAddr, GetMode, PutMode, GetSymName, IsUnknown, PutPriority, GetPriority, PutProcedureBegin, PutProcedureEnd, PutVarConst, IsVarConst, + PutConstLitInternal, PutVarHeap, IsVarParam, IsProcedure, IsPointer, IsParameter, IsUnboundedParam, IsEnumeration, IsDefinitionForC, @@ -229,7 +230,8 @@ FROM M2StackWord IMPORT StackOfWord, InitStackWord, KillStackWord, PushWord, PopWord, PeepWord, RemoveTop, IsEmptyWord, NoOfItemsInStackWord ; -FROM Indexing IMPORT Index, InitIndex, GetIndice, PutIndice, InBounds, HighIndice, IncludeIndiceIntoIndex ; +FROM Indexing IMPORT Index, InitIndex, GetIndice, PutIndice, InBounds, HighIndice, + IncludeIndiceIntoIndex, InitIndexTuned ; FROM M2Range IMPORT InitAssignmentRangeCheck, InitReturnRangeCheck, @@ -255,6 +257,7 @@ FROM M2Range IMPORT InitAssignmentRangeCheck, InitWholeZeroDivisionCheck, InitWholeZeroRemainderCheck, InitParameterRangeCheck, + PutRangeForIncrement, WriteRangeCheck ; FROM M2CaseList IMPORT PushCase, PopCase, AddRange, BeginCaseList, EndCaseList, ElseCase ; @@ -298,6 +301,7 @@ TYPE LineNo : CARDINAL ; (* Line No of source text. *) TokenNo : CARDINAL ; (* Token No of source text. *) NoOfTimesReferenced: CARDINAL ; (* No of times quad is referenced. *) + CheckType, CheckOverflow : BOOLEAN ; (* should backend check overflow *) op1pos, op2pos, @@ -1343,6 +1347,19 @@ PROCEDURE PutQuadO (QuadNo: CARDINAL; Op: QuadOperator; Oper1, Oper2, Oper3: CARDINAL; overflow: BOOLEAN) ; +BEGIN + PutQuadOType (QuadNo, Op, Oper1, Oper2, Oper3, overflow, TRUE) +END PutQuadO ; + + +(* + PutQuadOType - +*) + +PROCEDURE PutQuadOType (QuadNo: CARDINAL; + Op: QuadOperator; + Oper1, Oper2, Oper3: CARDINAL; + overflow, checktype: BOOLEAN) ; VAR f: QuadFrame ; BEGIN @@ -1360,10 +1377,11 @@ BEGIN Operand1 := Oper1 ; Operand2 := Oper2 ; Operand3 := Oper3 ; - CheckOverflow := overflow + CheckOverflow := overflow ; + CheckType := checktype END END -END PutQuadO ; +END PutQuadOType ; (* @@ -1378,6 +1396,36 @@ BEGIN END PutQuad ; +(* + GetQuadOtok - returns the fields associated with quadruple QuadNo. +*) + +PROCEDURE GetQuadOTypetok (QuadNo: CARDINAL; + VAR tok: CARDINAL; + VAR Op: QuadOperator; + VAR Oper1, Oper2, Oper3: CARDINAL; + VAR overflowChecking, typeChecking: BOOLEAN ; + VAR Op1Pos, Op2Pos, Op3Pos: CARDINAL) ; +VAR + f: QuadFrame ; +BEGIN + f := GetQF (QuadNo) ; + LastQuadNo := QuadNo ; + WITH f^ DO + Op := Operator ; + Oper1 := Operand1 ; + Oper2 := Operand2 ; + Oper3 := Operand3 ; + Op1Pos := op1pos ; + Op2Pos := op2pos ; + Op3Pos := op3pos ; + tok := TokenNo ; + overflowChecking := CheckOverflow ; + typeChecking := CheckType + END +END GetQuadOTypetok ; + + (* UndoReadWriteInfo - *) @@ -4301,11 +4349,16 @@ END BuildElsif2 ; |------------| *) -PROCEDURE PushOne (tok: CARDINAL; type: CARDINAL; message: ARRAY OF CHAR) ; +PROCEDURE PushOne (tok: CARDINAL; type: CARDINAL; + message: ARRAY OF CHAR; internal: BOOLEAN) ; +VAR + const: CARDINAL ; BEGIN IF type = NulSym THEN - PushTF (MakeConstLit (tok, MakeKey('1'), NulSym), NulSym) + const := MakeConstLit (tok, MakeKey('1'), NulSym) ; + PutConstLitInternal (const, TRUE) ; + PushTFtok (const, NulSym, tok) ELSIF IsEnumeration (type) THEN IF NoOfElements (type) = 0 @@ -4315,14 +4368,16 @@ BEGIN type) ; PushZero (tok, type) ELSE - PushTF (Convert, NulSym) ; + PushTFtok (Convert, NulSym, tok) ; PushT (type) ; - PushT (MakeConstLit (tok, MakeKey ('1'), ZType)) ; + PushTFtok (MakeConstLit (tok, MakeKey ('1'), ZType), ZType, tok) ; PushT (2) ; (* Two parameters *) BuildConvertFunction END ELSE - PushTF (MakeConstLit (tok, MakeKey ('1'), type), type) + const := MakeConstLit (tok, MakeKey ('1'), type) ; + PutConstLitInternal (const, TRUE) ; + PushTFtok (const, type, tok) END END PushOne ; @@ -4379,15 +4434,23 @@ END PushZero ; PROCEDURE BuildPseudoBy ; VAR - e, t, dotok: CARDINAL ; + expr, type, dotok: CARDINAL ; BEGIN - PopTFtok (e, t, dotok) ; (* as there is no BY token this position is the DO at the end of the last expression. *) - PushTFtok (e, t, dotok) ; - IF t=NulSym + (* As there is no BY token this position is the DO at the end of the last expression. *) + PopTFtok (expr, type, dotok) ; + PushTFtok (expr, type, dotok) ; + IF type = NulSym + THEN + (* type := ZType *) + ELSIF IsEnumeration (SkipType (type)) OR (SkipType (type) = Char) THEN - t := GetSType (e) + (* Use type. *) + ELSIF IsOrdinalType (SkipType (type)) + THEN + type := ZType END ; - PushOne (dotok, t, 'the implied FOR loop increment will cause an overflow {%1ad}') + PushOne (dotok, type, + 'the implied {%kFOR} loop increment will cause an overflow {%1ad}', TRUE) END BuildPseudoBy ; @@ -4418,8 +4481,9 @@ END BuildForLoopToRangeCheck ; Entry Exit ===== ==== - - Ptr -> <- Ptr + <- Ptr + +----------------+ + Ptr -> | RangeId | +----------------+ |----------------| | BySym | ByType | | ForQuad | |----------------| |----------------| @@ -4490,6 +4554,7 @@ VAR BySym, ByType, ForLoop, + RangeId, t, f : CARDINAL ; etype, t1 : CARDINAL ; @@ -4503,24 +4568,8 @@ BEGIN PopTtok (e1, e1tok) ; PopTtok (Id, idtok) ; IdSym := RequestSym (idtok, Id) ; - IF NOT IsExpressionCompatible (GetSType (e1), GetSType (e2)) - THEN - MetaError2 ('incompatible types found in {%EkFOR} loop header, initial expression {%1tsad} and final expression {%2tsad}', - e1, e2) ; - CheckExpressionCompatible (idtok, GetSType (e1), GetSType (e2)) - END ; - IF NOT IsExpressionCompatible( GetSType (e1), ByType) - THEN - MetaError2 ('incompatible types found in {%EkFOR} loop header, initial expression {%1tsad} and {%kBY} {%2tsad}', - e2, BySym) ; - CheckExpressionCompatible (e1tok, GetSType (e1), ByType) - ELSIF NOT IsExpressionCompatible (GetSType (e2), ByType) - THEN - MetaError2 ('incompatible types found in {%EkFOR} loop header, final expression {%1tsad} and {%kBY} {%2tsad}', - e2, BySym) ; - CheckExpressionCompatible (e1tok, GetSType (e2), ByType) - END ; - BuildRange (InitForLoopBeginRangeCheck (IdSym, e1)) ; + RangeId := InitForLoopBeginRangeCheck (IdSym, idtok, e1, e1tok, e2, e2tok, BySym, bytok) ; + BuildRange (RangeId) ; PushTtok (IdSym, idtok) ; PushTtok (e1, e1tok) ; BuildAssignmentWithoutBounds (idtok, TRUE, TRUE) ; @@ -4593,7 +4642,8 @@ BEGIN PushTFtok (IdSym, GetSym (IdSym), idtok) ; PushTFtok (BySym, ByType, bytok) ; PushTFtok (FinalValue, GetSType (FinalValue), e2tok) ; - PushT (ForLoop) + PushT (ForLoop) ; + PushT (RangeId) END BuildForToByDo ; @@ -4608,6 +4658,8 @@ END BuildForToByDo ; Ptr -> +----------------+ + | RangeId | + |----------------| | ForQuad | |----------------| | LastValue | @@ -4622,6 +4674,7 @@ PROCEDURE BuildEndFor (endpostok: CARDINAL) ; VAR t, f, tsym, + RangeId, IncQuad, ForQuad: CARDINAL ; LastSym, @@ -4631,6 +4684,7 @@ VAR IdSym, idtok : CARDINAL ; BEGIN + PopT (RangeId) ; PopT (ForQuad) ; PopT (LastSym) ; PopTFtok (BySym, ByType, bytok) ; @@ -4661,10 +4715,11 @@ BEGIN is counting down. The above test will generate a more precise error message, so we suppress overflow detection here. *) - GenQuadOtok (bytok, AddOp, tsym, tsym, BySym, FALSE, - bytok, bytok, bytok) ; + GenQuadOTypetok (bytok, AddOp, tsym, tsym, BySym, FALSE, FALSE, + idtok, idtok, bytok) ; CheckPointerThroughNil (idtok, IdSym) ; - GenQuadOtok (idtok, XIndrOp, IdSym, GetSType (IdSym), tsym, FALSE, + GenQuadOtok (idtok, XIndrOp, IdSym, GetSType (IdSym), + tsym, FALSE, idtok, idtok, idtok) ELSE BuildRange (InitForLoopEndRangeCheck (IdSym, BySym)) ; @@ -4673,13 +4728,20 @@ BEGIN this addition can legitimately overflow if a cardinal type is counting down. The above test will generate a more precise error message, so we suppress overflow detection - here. *) - GenQuadOtok (idtok, AddOp, IdSym, IdSym, BySym, FALSE, - bytok, bytok, bytok) + here. + + This quadruple suppresses the generic binary op type + check (performed in M2GenGCC.mod) as there + will be a more informative/exhaustive check performed by the + InitForLoopBeginRangeCheck setup in BuildForToByDo and + performed by M2Range.mod. *) + GenQuadOTypetok (idtok, AddOp, IdSym, IdSym, BySym, FALSE, FALSE, + idtok, idtok, bytok) END ; GenQuadO (endpostok, GotoOp, NulSym, NulSym, ForQuad, FALSE) ; BackPatch (PopFor (), NextQuad) ; - AddForInfo (ForQuad, NextQuad-1, IncQuad, IdSym, idtok) + AddForInfo (ForQuad, NextQuad-1, IncQuad, IdSym, idtok) ; + PutRangeForIncrement (RangeId, IncQuad) END BuildEndFor ; @@ -7244,7 +7306,8 @@ BEGIN THEN OperandSym := DereferenceLValue (OperandTok (1), OperandT (1)) ELSE - PushOne (proctok, dtype, 'the {%EkINC} will cause an overflow {%1ad}') ; + PushOne (proctok, dtype, + 'the {%EkINC} will cause an overflow {%1ad}', FALSE) ; PopT (OperandSym) END ; @@ -7316,7 +7379,8 @@ BEGIN THEN OperandSym := DereferenceLValue (OperandTok (1), OperandT (1)) ELSE - PushOne (proctok, dtype, 'the {%EkDEC} will cause an overflow {%1ad}') ; + PushOne (proctok, dtype, + 'the {%EkDEC} will cause an overflow {%1ad}', FALSE) ; PopT (OperandSym) END ; @@ -13188,6 +13252,22 @@ PROCEDURE GenQuadOtok (TokPos: CARDINAL; Operation: QuadOperator; Op1, Op2, Op3: CARDINAL; overflow: BOOLEAN; Op1Pos, Op2Pos, Op3Pos: CARDINAL) ; +BEGIN + GenQuadOTypetok (TokPos, Operation, Op1, Op2, Op3, overflow, TRUE, + Op1Pos, Op2Pos, Op3Pos) +END GenQuadOtok ; + + +(* + GenQuadOTypetok - assigns the fields of the quadruple with + the parameters. +*) + +PROCEDURE GenQuadOTypetok (TokPos: CARDINAL; + Operation: QuadOperator; + Op1, Op2, Op3: CARDINAL; + overflow, typecheck: BOOLEAN; + Op1Pos, Op2Pos, Op3Pos: CARDINAL) ; VAR f: QuadFrame ; BEGIN @@ -13199,7 +13279,7 @@ BEGIN f := GetQF (NextQuad-1) ; f^.Next := NextQuad END ; - PutQuadO (NextQuad, Operation, Op1, Op2, Op3, overflow) ; + PutQuadOType (NextQuad, Operation, Op1, Op2, Op3, overflow, typecheck) ; f := GetQF (NextQuad) ; WITH f^ DO Next := 0 ; @@ -13221,7 +13301,7 @@ BEGIN (* DisplayQuad(NextQuad) ; *) NewQuad (NextQuad) END -END GenQuadOtok ; +END GenQuadOTypetok ; (* @@ -15372,7 +15452,7 @@ BEGIN LogicalXorTok := MakeKey('_LXOR') ; LogicalDifferenceTok := MakeKey('_LDIFF') ; ArithPlusTok := MakeKey ('_ARITH_+') ; - QuadArray := InitIndex (1) ; + QuadArray := InitIndexTuned (1, 1024*1024 DIV 16, 16) ; FreeList := 1 ; NewQuad(NextQuad) ; Assert(NextQuad=1) ; diff --git a/gcc/m2/gm2-compiler/M2Range.def b/gcc/m2/gm2-compiler/M2Range.def index 14c30a71387d..2ffd74f2c378 100644 --- a/gcc/m2/gm2-compiler/M2Range.def +++ b/gcc/m2/gm2-compiler/M2Range.def @@ -117,11 +117,23 @@ PROCEDURE InitDecRangeCheck (d, e: CARDINAL) : CARDINAL ; (* InitForLoopBeginRangeCheck - returns a range check node which remembers the information necessary - so that a range check for FOR d := e TO .. DO - can be generated later on. + so that a range check for + FOR des := expr1 TO expr2 DO + can be generated later on. expr2 is + only used to type check with des. *) -PROCEDURE InitForLoopBeginRangeCheck (d, e: CARDINAL) : CARDINAL ; +PROCEDURE InitForLoopBeginRangeCheck (des, destok, + expr1, expr1tok, + expr2, expr2tok, + byconst, byconsttok: CARDINAL) : CARDINAL ; + + +(* + PutRangeForIncrement - places incrementquad into the range record. +*) + +PROCEDURE PutRangeForIncrement (range: CARDINAL; incrementquad: CARDINAL) ; (* diff --git a/gcc/m2/gm2-compiler/M2Range.mod b/gcc/m2/gm2-compiler/M2Range.mod index 97abd3eda1a8..654ac046c6fb 100644 --- a/gcc/m2/gm2-compiler/M2Range.mod +++ b/gcc/m2/gm2-compiler/M2Range.mod @@ -69,7 +69,9 @@ FROM M2MetaError IMPORT MetaError1, MetaError2, MetaError3, MetaErrorStringT1, MetaErrorStringT2, MetaErrorStringT3, MetaString3 ; -FROM M2LexBuf IMPORT UnknownTokenNo, GetTokenNo, FindFileNameFromToken, TokenToLineNo, TokenToColumnNo, TokenToLocation ; +FROM M2LexBuf IMPORT UnknownTokenNo, GetTokenNo, FindFileNameFromToken, + TokenToLineNo, TokenToColumnNo, TokenToLocation, MakeVirtual2Tok ; + FROM StrIO IMPORT WriteString, WriteLn ; FROM M2GCCDeclare IMPORT TryDeclareConstant, DeclareConstructor ; FROM M2Quads IMPORT QuadOperator, PutQuad, SubQuad, WriteOperand ; @@ -122,7 +124,8 @@ TYPE Range = POINTER TO RECORD type : TypeOfRange ; des, - expr, + expr, expr2, + byconst, desLowestType, exprLowestType: CARDINAL ; procedure : CARDINAL ; @@ -131,7 +134,12 @@ TYPE only used in pointernil *) dimension : CARDINAL ; caseList : CARDINAL ; + destok, + exprtok, + expr2tok, + byconsttok, tokenNo : CARDINAL ; + incrementquad : CARDINAL ; (* Increment quad used in FOR the loop. *) errorReported : BOOLEAN ; (* error message reported yet? *) strict : BOOLEAN ; (* is it a comparison expression? *) isin : BOOLEAN ; (* expression created by IN operator? *) @@ -293,12 +301,19 @@ BEGIN type := none ; des := NulSym ; expr := NulSym ; + expr2 := NulSym ; + byconst := NulSym ; desLowestType := NulSym ; exprLowestType := NulSym ; isLeftValue := FALSE ; (* ignored in all cases other *) dimension := 0 ; caseList := 0 ; - tokenNo := 0 ; (* than pointernil *) + tokenNo := UnknownTokenNo ; (* than pointernil *) + destok := UnknownTokenNo ; + exprtok := UnknownTokenNo ; + expr2tok := UnknownTokenNo ; + byconsttok := UnknownTokenNo ; + incrementquad := 0 ; errorReported := FALSE END ; PutIndice(RangeIndex, r, p) @@ -334,6 +349,19 @@ BEGIN END setReported ; +(* + PutRangeForIncrement - places incrementquad into the range record. +*) + +PROCEDURE PutRangeForIncrement (range: CARDINAL; incrementquad: CARDINAL) ; +VAR + p: Range ; +BEGIN + p := GetIndice (RangeIndex, range) ; + p^.incrementquad := incrementquad +END PutRangeForIncrement ; + + (* PutRange - initializes contents of, p, to d, e and their lowest types. @@ -357,6 +385,38 @@ BEGIN END PutRange ; +(* + PutRangeDesExpr2 - initializes contents of, p, to + des, expr1 and their lowest types. + It also fills in the token numbers for + des, expr, expr2 and returns, p. +*) + +PROCEDURE PutRangeDesExpr2 (p: Range; t: TypeOfRange; + des, destok, + expr1, expr1tok, + expr2, expr2tok, + byconst, byconsttok: CARDINAL) : Range ; +BEGIN + p^.des := des ; + p^.destok := destok ; + p^.expr := expr1 ; + p^.exprtok := expr1tok ; + p^.expr2 := expr2 ; + p^.expr2tok := expr2tok ; + p^.byconst := byconst ; + p^.byconsttok := byconsttok ; + WITH p^ DO + type := t ; + desLowestType := GetLowestType (des) ; + exprLowestType := GetLowestType (expr1) ; + strict := FALSE ; + isin := FALSE + END ; + RETURN p +END PutRangeDesExpr2 ; + + (* chooseTokenPos - returns, tokenpos, if it is not the unknown location, otherwise it returns GetTokenNo. @@ -808,16 +868,25 @@ END InitTypesExpressionCheck ; (* InitForLoopBeginRangeCheck - returns a range check node which remembers the information necessary - so that a range check for FOR d := e TO .. DO - can be generated later on. + so that a range check for + FOR des := expr1 TO expr2 DO + can be generated later on. expr2 is + only used to type check with des. *) -PROCEDURE InitForLoopBeginRangeCheck (d, e: CARDINAL) : CARDINAL ; +PROCEDURE InitForLoopBeginRangeCheck (des, destok, + expr1, expr1tok, + expr2, expr2tok, + byconst, byconsttok: CARDINAL) : CARDINAL ; VAR r: CARDINAL ; BEGIN r := InitRange () ; - Assert (PutRange (GetTokenNo (), GetIndice (RangeIndex, r), forloopbegin, d, e) # NIL) ; + Assert (PutRangeDesExpr2 (GetIndice (RangeIndex, r), forloopbegin, + des, destok, + expr1, expr1tok, + expr2, expr2tok, + byconst, byconsttok) # NIL) ; RETURN r END InitForLoopBeginRangeCheck ; @@ -1785,6 +1854,56 @@ BEGIN END CodeTypeCheck ; +(* + ForLoopBeginTypeCompatible - check for designator assignment compatibility with + expr1 and designator expression compatibility with expr2. + FOR des := expr1 TO expr2 BY byconst DO + END + It generates composite tokens if the tokens are on + the same source line. +*) + +PROCEDURE ForLoopBeginTypeCompatible (p: Range) : BOOLEAN ; +VAR + combinedtok: CARDINAL ; + success : BOOLEAN ; +BEGIN + success := TRUE ; + WITH p^ DO + combinedtok := MakeVirtual2Tok (destok, exprtok) ; + IF NOT AssignmentTypeCompatible (combinedtok, "", des, expr) + THEN + MetaErrorT2 (combinedtok, + 'type incompatibility between {%1Et} and {%2t} detected during the assignment of the designator {%1a} to the first expression {%2a} in the {%kFOR} loop', + des, expr) ; + success := FALSE + END ; + combinedtok := MakeVirtual2Tok (destok, expr2tok) ; + IF NOT ExpressionTypeCompatible (combinedtok, "", des, expr2, TRUE, FALSE) + THEN + MetaErrorT2 (combinedtok, + 'type expression incompatibility between {%1Et} and {%2t} detected when comparing the designator {%1a} against the second expression {%2a} in the {%kFOR} loop', + des, expr2) ; + success := FALSE + END ; + combinedtok := MakeVirtual2Tok (destok, byconsttok) ; + IF NOT ExpressionTypeCompatible (combinedtok, "", des, byconst, TRUE, FALSE) + THEN + MetaErrorT2 (combinedtok, + 'type expression incompatibility between {%1Et} and {%2t} detected between the designator {%1a} and the {%kBY} constant expression {%2a} in the {%kFOR} loop', + des, byconst) ; + success := FALSE + END ; + IF (NOT success) AND (incrementquad # 0) + THEN + (* Avoid a subsequent generic type check error. *) + SubQuad (incrementquad) + END + END ; + RETURN success +END ForLoopBeginTypeCompatible ; + + (* FoldForLoopBegin - *) @@ -1802,14 +1921,17 @@ BEGIN IF GccKnowsAbout(expr) AND IsConst(expr) AND GetMinMax(tokenno, desLowestType, min, max) THEN - IF OutOfRange(tokenno, min, expr, max, desLowestType) + IF NOT ForLoopBeginTypeCompatible (p) THEN - MetaErrorT2(tokenNo, + SubQuad (q) + ELSIF OutOfRange (tokenno, min, expr, max, desLowestType) + THEN + MetaErrorT2 (tokenNo, 'attempting to assign a value {%2Wa} to a FOR loop designator {%1a} which will exceed the range of type {%1tad}', - des, expr) ; - PutQuad(q, ErrorOp, NulSym, NulSym, r) + des, expr) ; + PutQuad (q, ErrorOp, NulSym, NulSym, r) ELSE - SubQuad(q) + SubQuad (q) END END END @@ -2872,7 +2994,10 @@ END CodeDynamicArraySubscript ; PROCEDURE CodeForLoopBegin (tokenno: CARDINAL; r: CARDINAL; function, message: String) ; BEGIN - DoCodeAssignment(tokenno, r, function, message) + IF ForLoopBeginTypeCompatible (GetIndice (RangeIndex, r)) + THEN + DoCodeAssignment(tokenno, r, function, message) + END END CodeForLoopBegin ; diff --git a/gcc/m2/gm2-compiler/P0SyntaxCheck.bnf b/gcc/m2/gm2-compiler/P0SyntaxCheck.bnf index 918b127bac66..c1c86c1827dc 100644 --- a/gcc/m2/gm2-compiler/P0SyntaxCheck.bnf +++ b/gcc/m2/gm2-compiler/P0SyntaxCheck.bnf @@ -253,12 +253,14 @@ BEGIN IF DebugRecover THEN printf0 ('buffer before\n') ; - DumpTokens ; - printf0 ('inserting token: buffer after\n') ; - DumpTokens ; - printf0 ('inserting token\n') + DumpTokens END ; InsertTokenAndRewind (t) ; + IF DebugRecover + THEN + printf0 ('inserting token: buffer after insertion\n') ; + DumpTokens + END ; RETURN TRUE END END ; diff --git a/gcc/m2/gm2-compiler/SymbolConversion.mod b/gcc/m2/gm2-compiler/SymbolConversion.mod index c3c484db00af..b8f0f70b4355 100644 --- a/gcc/m2/gm2-compiler/SymbolConversion.mod +++ b/gcc/m2/gm2-compiler/SymbolConversion.mod @@ -24,7 +24,7 @@ IMPLEMENTATION MODULE SymbolConversion ; FROM NameKey IMPORT Name ; FROM Indexing IMPORT Index, InitIndex, PutIndice, GetIndice, InBounds, - DebugIndex ; + DebugIndex, InitIndexTuned ; FROM SymbolTable IMPORT IsConst, PopValue, IsValueSolved, GetSymName, GetType, SkipType ; @@ -237,8 +237,8 @@ END Poison ; PROCEDURE Init ; BEGIN - mod2gcc := InitIndex(1) ; - ALLOCATE(PoisonedSymbol, 1) + mod2gcc := InitIndexTuned (1, 1024*1024 DIV 16, 16) ; + ALLOCATE (PoisonedSymbol, 1) END Init ; diff --git a/gcc/m2/gm2-compiler/SymbolTable.def b/gcc/m2/gm2-compiler/SymbolTable.def index 508b818767ee..ec48631e43fe 100644 --- a/gcc/m2/gm2-compiler/SymbolTable.def +++ b/gcc/m2/gm2-compiler/SymbolTable.def @@ -3315,4 +3315,23 @@ PROCEDURE PutProcedureParameterHeapVars (sym: CARDINAL) ; PROCEDURE IsProcedureBuiltinAvailable (procedure: CARDINAL) : BOOLEAN ; +(* + PutConstLitInternal - marks the sym as being an internal constant. + Currently this is used when generating a default + BY constant expression during a FOR loop. + A constant marked as internal will always pass + an expression type check. +*) + +PROCEDURE PutConstLitInternal (sym: CARDINAL; value: BOOLEAN) ; + + +(* + IsConstLitInternal - returns the value of the IsInternal field within + a constant expression. +*) + +PROCEDURE IsConstLitInternal (sym: CARDINAL) : BOOLEAN ; + + END SymbolTable. diff --git a/gcc/m2/gm2-compiler/SymbolTable.mod b/gcc/m2/gm2-compiler/SymbolTable.mod index 6fe36da0bbca..b49cc889dcae 100644 --- a/gcc/m2/gm2-compiler/SymbolTable.mod +++ b/gcc/m2/gm2-compiler/SymbolTable.mod @@ -28,7 +28,10 @@ FROM M2Debug IMPORT Assert ; FROM libc IMPORT printf ; IMPORT Indexing ; -FROM Indexing IMPORT InitIndex, InBounds, LowIndice, HighIndice, PutIndice, GetIndice ; + +FROM Indexing IMPORT InitIndex, InBounds, LowIndice, HighIndice, + PutIndice, GetIndice, InitIndexTuned ; + FROM Sets IMPORT Set, InitSet, IncludeElementIntoSet, IsElementInSet ; FROM m2linemap IMPORT location_t ; @@ -487,7 +490,8 @@ TYPE Value : PtrToValue ; (* Value of the constant. *) Type : CARDINAL ; (* TYPE of constant, char etc *) IsSet : BOOLEAN ; (* is the constant a set? *) - IsConstructor: BOOLEAN ; (* is the constant a set? *) + IsConstructor: BOOLEAN ; (* is it a constructor? *) + IsInternal : BOOLEAN ; (* Generated internally? *) FromType : CARDINAL ; (* type is determined FromType *) RangeError : BOOLEAN ; (* Have we reported an error? *) UnresFromType: BOOLEAN ; (* is Type unresolved? *) @@ -1643,7 +1647,7 @@ BEGIN InitTree (ConstLitPoolTree) ; InitTree (DefModuleTree) ; InitTree (ModuleTree) ; - Symbols := InitIndex (1) ; + Symbols := InitIndexTuned (1, 1024*1024 DIV 16, 16) ; ConstLitArray := InitIndex (1) ; FreeSymbol := 1 ; ScopePtr := 1 ; @@ -4865,6 +4869,8 @@ BEGIN PopInto (ConstLit.Value) ; ConstLit.Type := constType ; ConstLit.IsSet := FALSE ; + ConstLit.IsInternal := FALSE ; (* Is it a default BY constant + expression? *) ConstLit.IsConstructor := FALSE ; ConstLit.FromType := NulSym ; (* type is determined FromType *) ConstLit.RangeError := overflow ; @@ -6790,6 +6796,53 @@ BEGIN END PutConst ; +(* + PutConstLitInternal - marks the sym as being an internal constant. + Currently this is used when generating a default + BY constant expression during a FOR loop. + A constant marked as internal will always pass + an expression type check. +*) + +PROCEDURE PutConstLitInternal (sym: CARDINAL; value: BOOLEAN) ; +VAR + pSym: PtrToSymbol ; +BEGIN + pSym := GetPsym (sym) ; + WITH pSym^ DO + CASE SymbolType OF + + ConstLitSym: ConstLit.IsInternal := value + + ELSE + InternalError ('expecting ConstLitSym') + END + END +END PutConstLitInternal ; + + +(* + IsConstLitInternal - returns the value of the IsInternal field within + a constant expression. +*) + +PROCEDURE IsConstLitInternal (sym: CARDINAL) : BOOLEAN ; +VAR + pSym: PtrToSymbol ; +BEGIN + pSym := GetPsym (sym) ; + WITH pSym^ DO + CASE SymbolType OF + + ConstLitSym: RETURN ConstLit.IsInternal + + ELSE + InternalError ('expecting ConstLitSym') + END + END +END IsConstLitInternal ; + + (* PutVarArrayRef - assigns ArrayRef field with value. *) diff --git a/gcc/m2/gm2-gcc/m2builtins.cc b/gcc/m2/gm2-gcc/m2builtins.cc index 98d8abf8b0d1..e4fc6a50c1cc 100644 --- a/gcc/m2/gm2-gcc/m2builtins.cc +++ b/gcc/m2/gm2-gcc/m2builtins.cc @@ -871,6 +871,8 @@ do_target_support_exists (struct builtin_function_entry *fe) return targetm.libc_has_function (function_c99_misc, type); case bf_extension_lib_floatn: return true; + case bf_c99_compl: + return targetm.libc_has_function (function_c99_math_complex, type); default: gcc_unreachable (); } diff --git a/gcc/m2/gm2-libs-ch/wrapc.c b/gcc/m2/gm2-libs-ch/wrapc.c index ed80cbdd4c4c..24b65a99babb 100644 --- a/gcc/m2/gm2-libs-ch/wrapc.c +++ b/gcc/m2/gm2-libs-ch/wrapc.c @@ -252,6 +252,38 @@ wrapc_isnanl (long double x) return isnan (x); } +/* SeekSet return the system libc SEEK_SET value. */ + +int +wrapc_SeekSet (void) +{ + return SEEK_SET; +} + +/* SeekEnd return the system libc SEEK_END value. */ + +int +wrapc_SeekEnd (void) +{ + return SEEK_END; +} + +/* ReadOnly return the system value of O_RDONLY. */ + +int +wrapc_ReadOnly (void) +{ + return O_RDONLY; +} + +/* WriteOnly return the system value of O_WRONLY. */ + +int +wrapc_WriteOnly (void) +{ + return O_WRONLY; +} + /* init - init/finish functions for the module */ void diff --git a/gcc/m2/gm2-libs-iso/M2RTS.mod b/gcc/m2/gm2-libs-iso/M2RTS.mod index 14a9e8170ec8..291b8e99b3cb 100644 --- a/gcc/m2/gm2-libs-iso/M2RTS.mod +++ b/gcc/m2/gm2-libs-iso/M2RTS.mod @@ -45,20 +45,7 @@ CONST TYPE PtrToChar = POINTER TO CHAR ; - ProcedureChain = POINTER TO RECORD - p : PROC ; - prev, - next: ProcedureChain ; - END ; - - ProcedureList = RECORD - head, tail: ProcedureChain - END ; - - VAR - InitialProc, - TerminateProc : ProcedureList ; ExitValue : INTEGER ; isTerminating, isHalting, @@ -121,21 +108,6 @@ BEGIN END RequestDependant ; -(* - ExecuteReverse - execute the procedure associated with procptr - and then proceed to try and execute all previous - procedures in the chain. -*) - -PROCEDURE ExecuteReverse (procptr: ProcedureChain) ; -BEGIN - WHILE procptr # NIL DO - procptr^.p ; (* Invoke the procedure. *) - procptr := procptr^.prev - END -END ExecuteReverse ; - - (* ExecuteTerminationProcedures - calls each installed termination procedure in reverse order. @@ -143,7 +115,7 @@ END ExecuteReverse ; PROCEDURE ExecuteTerminationProcedures ; BEGIN - ExecuteReverse (TerminateProc.tail) + M2Dependent.ExecuteTerminationProcedures END ExecuteTerminationProcedures ; @@ -154,34 +126,10 @@ END ExecuteTerminationProcedures ; PROCEDURE ExecuteInitialProcedures ; BEGIN - ExecuteReverse (InitialProc.tail) + M2Dependent.ExecuteInitialProcedures END ExecuteInitialProcedures ; -(* - AppendProc - append proc to the end of the procedure list - defined by proclist. -*) - -PROCEDURE AppendProc (VAR proclist: ProcedureList; proc: PROC) : BOOLEAN ; -VAR - pdes: ProcedureChain ; -BEGIN - NEW (pdes) ; - WITH pdes^ DO - p := proc ; - prev := proclist.tail ; - next := NIL - END ; - IF proclist.head = NIL - THEN - proclist.head := pdes - END ; - proclist.tail := pdes ; - RETURN TRUE -END AppendProc ; - - (* InstallTerminationProcedure - installs a procedure, p, which will be called when the procedure @@ -192,7 +140,7 @@ END AppendProc ; PROCEDURE InstallTerminationProcedure (p: PROC) : BOOLEAN ; BEGIN - RETURN AppendProc (TerminateProc, p) + RETURN M2Dependent.InstallTerminationProcedure (p) END InstallTerminationProcedure ; @@ -204,7 +152,7 @@ END InstallTerminationProcedure ; PROCEDURE InstallInitialProcedure (p: PROC) : BOOLEAN ; BEGIN - RETURN AppendProc (InitialProc, p) + RETURN M2Dependent.InstallInitialProcedure (p) END InstallInitialProcedure ; @@ -625,25 +573,12 @@ BEGIN END NoException ; -(* - InitProcList - initialize the head and tail pointers to NIL. -*) - -PROCEDURE InitProcList (VAR p: ProcedureList) ; -BEGIN - p.head := NIL ; - p.tail := NIL -END InitProcList ; - - (* Init - *) PROCEDURE Init ; BEGIN - InitProcList (InitialProc) ; - InitProcList (TerminateProc) ; ExitValue := 0 ; isHalting := FALSE ; CallExit := FALSE ; (* default by calling abort *) diff --git a/gcc/m2/gm2-libs/FIO.mod b/gcc/m2/gm2-libs/FIO.mod index 6755d3d649d9..8347e8289a34 100644 --- a/gcc/m2/gm2-libs/FIO.mod +++ b/gcc/m2/gm2-libs/FIO.mod @@ -41,18 +41,16 @@ FROM ASCII IMPORT nl, nul, tab ; FROM StrLib IMPORT StrLen, StrConCat, StrCopy ; FROM Storage IMPORT ALLOCATE, DEALLOCATE ; FROM NumberIO IMPORT CardToStr ; -FROM libc IMPORT exit, open, creat, read, write, close, lseek, strncpy, memcpy ; FROM Indexing IMPORT Index, InitIndex, InBounds, HighIndice, PutIndice, GetIndice ; FROM M2RTS IMPORT InstallTerminationProcedure ; +FROM libc IMPORT exit, open, creat, read, write, close, lseek, strncpy, memcpy ; +FROM wrapc IMPORT SeekSet, SeekEnd, ReadOnly, WriteOnly ; + CONST - SEEK_SET = 0 ; (* relative from beginning of the file *) - SEEK_END = 2 ; (* relative to the end of the file *) - UNIXREADONLY = 0 ; - UNIXWRITEONLY = 1 ; - CreatePermissions = 666B; MaxBufferLength = 1024*16 ; MaxErrorString = 1024* 8 ; + CreatePermissions = 666B; TYPE FileUsage = (unused, openedforread, openedforwrite, openedforrandom) ; @@ -428,10 +426,10 @@ BEGIN THEN unixfd := creat(name.address, CreatePermissions) ELSE - unixfd := open(name.address, UNIXWRITEONLY, 0) + unixfd := open(name.address, INTEGER (WriteOnly ()), 0) END ELSE - unixfd := open(name.address, UNIXREADONLY, 0) + unixfd := open(name.address, INTEGER (ReadOnly ()), 0) END ; IF unixfd<0 THEN @@ -1448,7 +1446,7 @@ BEGIN filled := 0 END END ; - offset := lseek (unixfd, VAL (CSSIZE_T, pos), SEEK_SET) ; + offset := lseek (unixfd, VAL (CSSIZE_T, pos), SeekSet ()) ; IF (offset>=0) AND (pos=offset) THEN abspos := pos @@ -1497,7 +1495,7 @@ BEGIN filled := 0 END END ; - offset := lseek (unixfd, VAL (CSSIZE_T, pos), SEEK_END) ; + offset := lseek (unixfd, VAL (CSSIZE_T, pos), SeekEnd ()) ; IF offset>=0 THEN abspos := offset ; diff --git a/gcc/m2/gm2-libs/Indexing.def b/gcc/m2/gm2-libs/Indexing.def index 8aad985e84df..f7c4676df33a 100644 --- a/gcc/m2/gm2-libs/Indexing.def +++ b/gcc/m2/gm2-libs/Indexing.def @@ -27,16 +27,23 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see DEFINITION MODULE Indexing ; FROM SYSTEM IMPORT ADDRESS ; -EXPORT QUALIFIED Index, InitIndex, KillIndex, GetIndice, PutIndice, - HighIndice, LowIndice, InBounds, IsIndiceInIndex, - RemoveIndiceFromIndex, IncludeIndiceIntoIndex, - ForeachIndiceInIndexDo, DeleteIndice, DebugIndex ; + TYPE Index ; IndexProcedure = PROCEDURE (ADDRESS) ; +(* + InitIndexTuned - creates a dynamic array with low indice. + minsize is the initial number of elements the + array is allocated and growfactor determines how + it will be resized once it becomes full. +*) + +PROCEDURE InitIndexTuned (low, minsize, growfactor: CARDINAL) : Index ; + + (* InitIndex - creates and returns an Index. *) @@ -130,4 +137,11 @@ PROCEDURE IncludeIndiceIntoIndex (i: Index; a: ADDRESS) ; PROCEDURE ForeachIndiceInIndexDo (i: Index; p: IndexProcedure) ; +(* + IsEmpty - return TRUE if the array has no entries it. +*) + +PROCEDURE IsEmpty (i: Index) : BOOLEAN ; + + END Indexing. diff --git a/gcc/m2/gm2-libs/Indexing.mod b/gcc/m2/gm2-libs/Indexing.mod index f2b4b36ed702..08af13484d08 100644 --- a/gcc/m2/gm2-libs/Indexing.mod +++ b/gcc/m2/gm2-libs/Indexing.mod @@ -31,7 +31,8 @@ FROM Storage IMPORT ALLOCATE, REALLOCATE, DEALLOCATE ; FROM SYSTEM IMPORT TSIZE, WORD, BYTE ; CONST - MinSize = 128 ; + MinSize = 128 ; + DefaultGrowFactor = 2 ; TYPE PtrToAddress = POINTER TO ADDRESS ; @@ -45,28 +46,43 @@ TYPE High : CARDINAL ; Debug : BOOLEAN ; Map : BITSET ; + GrowFactor: CARDINAL ; END ; (* - InitIndex - creates and returns an Index. + InitIndexTuned - creates a dynamic array with low indice. + The minsize is the initial number of elements the + array is allocated and growfactor determines how + it will be resized once it becomes full. *) -PROCEDURE InitIndex (low: CARDINAL) : Index ; +PROCEDURE InitIndexTuned (low, minsize, growfactor: CARDINAL) : Index ; VAR i: Index ; BEGIN - NEW(i) ; + NEW (i) ; WITH i^ DO Low := low ; High := 0 ; - ArraySize := MinSize ; - ALLOCATE(ArrayStart, MinSize) ; - ArrayStart := memset(ArrayStart, 0, ArraySize) ; + ArraySize := minsize * TSIZE (ADDRESS) ; + ALLOCATE (ArrayStart, ArraySize) ; + ArrayStart := memset (ArrayStart, 0, ArraySize) ; Debug := FALSE ; Used := 0 ; - Map := BITSET{} + Map := BITSET {} ; + GrowFactor := growfactor END ; - RETURN( i ) + RETURN i +END InitIndexTuned ; + + +(* + InitIndex - creates and returns an Index. +*) + +PROCEDURE InitIndex (low: CARDINAL) : Index ; +BEGIN + RETURN InitIndexTuned (low, MinSize, DefaultGrowFactor) END InitIndex ; @@ -162,7 +178,7 @@ BEGIN ELSE oldSize := ArraySize ; WHILE (n-Low)*TSIZE(ADDRESS)>=ArraySize DO - ArraySize := ArraySize * 2 + ArraySize := ArraySize * GrowFactor END ; IF oldSize#ArraySize THEN @@ -342,4 +358,14 @@ BEGIN END ForeachIndiceInIndexDo ; +(* + IsEmpty - return TRUE if the array has no entries it. +*) + +PROCEDURE IsEmpty (i: Index) : BOOLEAN ; +BEGIN + RETURN i^.Used = 0 +END IsEmpty ; + + END Indexing. diff --git a/gcc/m2/gm2-libs/M2Dependent.def b/gcc/m2/gm2-libs/M2Dependent.def index 9e31d57285b9..b37c00489484 100644 --- a/gcc/m2/gm2-libs/M2Dependent.def +++ b/gcc/m2/gm2-libs/M2Dependent.def @@ -62,4 +62,40 @@ PROCEDURE RequestDependant (modulename, libname, dependantmodule, dependantlibname: ADDRESS) ; +(* + InstallTerminationProcedure - installs a procedure, p, which will + be called when the procedure + ExecuteTerminationProcedures + is invoked. It returns TRUE is the + procedure is installed. +*) + +PROCEDURE InstallTerminationProcedure (p: PROC) : BOOLEAN ; + + +(* + ExecuteInitialProcedures - executes the initial procedures installed + by InstallInitialProcedure. +*) + +PROCEDURE ExecuteInitialProcedures ; + + +(* + InstallInitialProcedure - installs a procedure to be executed just + before the BEGIN code section of the main + program module. +*) + +PROCEDURE InstallInitialProcedure (p: PROC) : BOOLEAN ; + + +(* + ExecuteTerminationProcedures - calls each installed termination procedure + in reverse order. +*) + +PROCEDURE ExecuteTerminationProcedures ; + + END M2Dependent. diff --git a/gcc/m2/gm2-libs/M2Dependent.mod b/gcc/m2/gm2-libs/M2Dependent.mod index e7b502e29d77..d6dfa636e263 100644 --- a/gcc/m2/gm2-libs/M2Dependent.mod +++ b/gcc/m2/gm2-libs/M2Dependent.mod @@ -33,8 +33,6 @@ FROM SYSTEM IMPORT ADR ; FROM Storage IMPORT ALLOCATE ; FROM StrLib IMPORT StrCopy, StrLen, StrEqual ; -IMPORT M2RTS ; - TYPE PtrToChar = POINTER TO CHAR ; @@ -61,6 +59,16 @@ TYPE next : ModuleChain ; END ; + ProcedureList = RECORD + head, tail: ProcedureChain + END ; + + ProcedureChain = POINTER TO RECORD + p : PROC ; + prev, + next: ProcedureChain ; + END ; + VAR Modules : ARRAY DependencyState OF ModuleChain ; DynamicInitialization, @@ -72,6 +80,8 @@ VAR PreTrace, PostTrace, ForceTrace : BOOLEAN ; + InitialProc, + TerminateProc : ProcedureList ; (* @@ -816,8 +826,8 @@ BEGIN IF mptr^.dependency.appl THEN traceprintf3 (ModuleTrace, "application module: %s [%s]\n", mptr^.name, mptr^.libname); - traceprintf (ModuleTrace, " calling M2RTS_ExecuteInitialProcedures\n"); - M2RTS.ExecuteInitialProcedures ; + traceprintf (ModuleTrace, " calling ExecuteInitialProcedures\n"); + ExecuteInitialProcedures ; traceprintf (ModuleTrace, " calling application module\n"); END ; mptr^.init (argc, argv, envp) ; @@ -844,7 +854,7 @@ BEGIN traceprintf (ModuleTrace, " no ordered modules found during finishing\n") ELSE traceprintf (ModuleTrace, "ExecuteTerminationProcedures\n") ; - M2RTS.ExecuteTerminationProcedures ; + ExecuteTerminationProcedures ; traceprintf (ModuleTrace, "terminating modules in sequence\n") ; mptr := Modules[ordered]^.prev ; REPEAT @@ -1005,6 +1015,8 @@ PROCEDURE Init ; VAR state: DependencyState ; BEGIN + InitProcList (InitialProc) ; + InitProcList (TerminateProc) ; SetupDebugFlags ; FOR state := MIN (DependencyState) TO MAX (DependencyState) DO Modules[state] := NIL @@ -1030,6 +1042,104 @@ BEGIN END CheckInitialized ; +(* + ExecuteReverse - execute the procedure associated with procptr + and then proceed to try and execute all previous + procedures in the chain. +*) + +PROCEDURE ExecuteReverse (procptr: ProcedureChain) ; +BEGIN + WHILE procptr # NIL DO + procptr^.p ; (* Invoke the procedure. *) + procptr := procptr^.prev + END +END ExecuteReverse ; + + +(* + ExecuteTerminationProcedures - calls each installed termination procedure + in reverse order. +*) + +PROCEDURE ExecuteTerminationProcedures ; +BEGIN + ExecuteReverse (TerminateProc.tail) +END ExecuteTerminationProcedures ; + + +(* + ExecuteInitialProcedures - executes the initial procedures installed by + InstallInitialProcedure. +*) + +PROCEDURE ExecuteInitialProcedures ; +BEGIN + ExecuteReverse (InitialProc.tail) +END ExecuteInitialProcedures ; + + +(* + AppendProc - append proc to the end of the procedure list + defined by proclist. +*) + +PROCEDURE AppendProc (VAR proclist: ProcedureList; proc: PROC) : BOOLEAN ; +VAR + pdes: ProcedureChain ; +BEGIN + NEW (pdes) ; + WITH pdes^ DO + p := proc ; + prev := proclist.tail ; + next := NIL + END ; + IF proclist.head = NIL + THEN + proclist.head := pdes + END ; + proclist.tail := pdes ; + RETURN TRUE +END AppendProc ; + + +(* + InstallTerminationProcedure - installs a procedure, p, which will + be called when the procedure + ExecuteTerminationProcedures + is invoked. It returns TRUE if the + procedure is installed. +*) + +PROCEDURE InstallTerminationProcedure (p: PROC) : BOOLEAN ; +BEGIN + RETURN AppendProc (TerminateProc, p) +END InstallTerminationProcedure ; + + +(* + InstallInitialProcedure - installs a procedure to be executed just + before the BEGIN code section of the + main program module. +*) + +PROCEDURE InstallInitialProcedure (p: PROC) : BOOLEAN ; +BEGIN + RETURN AppendProc (InitialProc, p) +END InstallInitialProcedure ; + + +(* + InitProcList - initialize the head and tail pointers to NIL. +*) + +PROCEDURE InitProcList (VAR p: ProcedureList) ; +BEGIN + p.head := NIL ; + p.tail := NIL +END InitProcList ; + + BEGIN CheckInitialized END M2Dependent. diff --git a/gcc/m2/gm2-libs/M2RTS.mod b/gcc/m2/gm2-libs/M2RTS.mod index 765e6e53cd4c..41add830766e 100644 --- a/gcc/m2/gm2-libs/M2RTS.mod +++ b/gcc/m2/gm2-libs/M2RTS.mod @@ -45,20 +45,7 @@ CONST TYPE PtrToChar = POINTER TO CHAR ; - ProcedureList = RECORD - head, tail: ProcedureChain - END ; - - ProcedureChain = POINTER TO RECORD - p : PROC ; - prev, - next: ProcedureChain ; - END ; - - VAR - InitialProc, - TerminateProc: ProcedureList ; ExitValue : INTEGER ; isHalting, CallExit : BOOLEAN ; @@ -120,21 +107,6 @@ BEGIN END RequestDependant ; -(* - ExecuteReverse - execute the procedure associated with procptr - and then proceed to try and execute all previous - procedures in the chain. -*) - -PROCEDURE ExecuteReverse (procptr: ProcedureChain) ; -BEGIN - WHILE procptr # NIL DO - procptr^.p ; (* Invoke the procedure. *) - procptr := procptr^.prev - END -END ExecuteReverse ; - - (* ExecuteTerminationProcedures - calls each installed termination procedure in reverse order. @@ -142,7 +114,7 @@ END ExecuteReverse ; PROCEDURE ExecuteTerminationProcedures ; BEGIN - ExecuteReverse (TerminateProc.tail) + M2Dependent.ExecuteTerminationProcedures END ExecuteTerminationProcedures ; @@ -153,34 +125,10 @@ END ExecuteTerminationProcedures ; PROCEDURE ExecuteInitialProcedures ; BEGIN - ExecuteReverse (InitialProc.tail) + M2Dependent.ExecuteInitialProcedures END ExecuteInitialProcedures ; -(* - AppendProc - append proc to the end of the procedure list - defined by proclist. -*) - -PROCEDURE AppendProc (VAR proclist: ProcedureList; proc: PROC) : BOOLEAN ; -VAR - pdes: ProcedureChain ; -BEGIN - NEW (pdes) ; - WITH pdes^ DO - p := proc ; - prev := proclist.tail ; - next := NIL - END ; - IF proclist.head = NIL - THEN - proclist.head := pdes - END ; - proclist.tail := pdes ; - RETURN TRUE -END AppendProc ; - - (* InstallTerminationProcedure - installs a procedure, p, which will be called when the procedure @@ -191,7 +139,7 @@ END AppendProc ; PROCEDURE InstallTerminationProcedure (p: PROC) : BOOLEAN ; BEGIN - RETURN AppendProc (TerminateProc, p) + RETURN M2Dependent.InstallTerminationProcedure (p) END InstallTerminationProcedure ; @@ -203,7 +151,7 @@ END InstallTerminationProcedure ; PROCEDURE InstallInitialProcedure (p: PROC) : BOOLEAN ; BEGIN - RETURN AppendProc (InitialProc, p) + RETURN M2Dependent.InstallInitialProcedure (p) END InstallInitialProcedure ; @@ -558,25 +506,12 @@ BEGIN END Length ; -(* - InitProcList - initialize the head and tail pointers to NIL. -*) - -PROCEDURE InitProcList (VAR p: ProcedureList) ; -BEGIN - p.head := NIL ; - p.tail := NIL -END InitProcList ; - - (* Init - initialize the initial, terminate procedure lists and booleans. *) PROCEDURE Init ; BEGIN - InitProcList (InitialProc) ; - InitProcList (TerminateProc) ; ExitValue := 0 ; isHalting := FALSE ; CallExit := FALSE (* default by calling abort *) diff --git a/gcc/m2/gm2-libs/wrapc.def b/gcc/m2/gm2-libs/wrapc.def index 0daf7c3ebc11..244baa33b9d3 100644 --- a/gcc/m2/gm2-libs/wrapc.def +++ b/gcc/m2/gm2-libs/wrapc.def @@ -140,4 +140,32 @@ PROCEDURE isnanf (x: SHORTREAL) : INTEGER ; PROCEDURE isnanl (x: LONGREAL) : INTEGER ; +(* + SeekSet - return the system libc SEEK_SET value. +*) + +PROCEDURE SeekSet () : INTEGER ; + + +(* + SeekEnd - return the system libc SEEK_END value. +*) + +PROCEDURE SeekEnd () : INTEGER ; + + +(* + ReadOnly - return the system value of O_RDONLY. +*) + +PROCEDURE ReadOnly () : BITSET ; + + +(* + WriteOnly - return the system value of O_WRONLY. +*) + +PROCEDURE WriteOnly () : BITSET ; + + END wrapc. diff --git a/gcc/m2/mc-boot-ch/Glibc.c b/gcc/m2/mc-boot-ch/Glibc.c index 6154934799b0..23a490571ff9 100644 --- a/gcc/m2/mc-boot-ch/Glibc.c +++ b/gcc/m2/mc-boot-ch/Glibc.c @@ -28,25 +28,116 @@ along with GNU Modula-2; see the file COPYING3. If not see #define EXTERN #endif +#undef BUILD_MC_LIBC_TRACE + +#if defined(BUILD_MC_LIBC_TRACE) +static bool initialzed_trace = false; +static bool trace_on = false; + +static +void +check_init (void) +{ + if (! initialzed_trace) + { + initialzed_trace = true; + trace_on = ((getenv ("MC_LIBC_TRACE") != NULL)); + } +} +#endif + +static +void +tracedb (const char *format, ...) +{ +#if defined(BUILD_MC_LIBC_TRACE) + check_init (); + if (trace_on) + { + va_list arg; + va_start (arg, format); + { + vfprintf (stdout, format, arg); + fflush (stdout); + } + va_end (arg); + } +#endif +} + +static +void +tracedb_open (const char *p, int flags, mode_t mode) +{ +#if defined(BUILD_MC_LIBC_TRACE) + bool item_written = false; + tracedb ("libc_open (%s, flags = 0x%x = ", p, flags); + + int bits = (flags & O_ACCMODE); + tracedb ("bits = 0x%x", bits); + if (bits == O_RDONLY) + { + tracedb ("O_RDONLY"); + item_written = true; + } + if ((flags & O_WRONLY) != 0) + { + if (item_written) + tracedb (" | "); + tracedb ("O_WRONLY"); + item_written = true; + } + if ((flags & O_RDWR) != 0) + { + if (item_written) + tracedb (" | "); + tracedb ("O_RDWR"); + item_written = true; + } + tracedb (", 0x%x)\n", mode); +#endif +} + +static +void +tracedb_result (int result) +{ +#if defined(BUILD_MC_LIBC_TRACE) + tracedb (" result = %d", result); + if (result == -1) + tracedb (", errno = %s", strerror (errno)); + tracedb ("\n"); +#endif +} + EXTERN int libc_read (int fd, void *a, int nbytes) { - return read (fd, a, nbytes); + tracedb ("libc_read (%d, %p, %d)\n", fd, a, nbytes); + int result = read (fd, a, nbytes); + tracedb_result (result); + return result; } EXTERN int libc_write (int fd, void *a, int nbytes) { - return write (fd, a, nbytes); + tracedb ("libc_write (%d, %p, %d)\n", fd, a, nbytes); + int result = write (fd, a, nbytes); + tracedb_result (result); + return result; } EXTERN int libc_close (int fd) { - return close (fd); + tracedb ("libc_close (%d)\n", fd); + int result = close (fd); + tracedb_result (result); + return result; } EXTERN @@ -232,21 +323,30 @@ EXTERN int libc_creat (char *p, mode_t mode) { - return creat (p, mode); + tracedb ("libc_creat (%s, 0x%x)\n", p, mode); + int result = creat (p, mode); + tracedb_result (result); + return result; } EXTERN int libc_open (char *p, int flags, mode_t mode) { - return open (p, flags, mode); + tracedb_open (p, flags, mode); + int result = open (p, flags, mode); + tracedb_result (result); + return result; } EXTERN off_t libc_lseek (int fd, off_t offset, int whence) { - return lseek (fd, offset, whence); + tracedb ("libc_lseek (%s, %p, %d)\n", fd, offset, whence); + int result = lseek (fd, offset, whence); + tracedb_result (result); + return result; } EXTERN diff --git a/gcc/m2/mc-boot-ch/Gwrapc.c b/gcc/m2/mc-boot-ch/Gwrapc.c index f9397eb230ef..5e27e313d1a1 100644 --- a/gcc/m2/mc-boot-ch/Gwrapc.c +++ b/gcc/m2/mc-boot-ch/Gwrapc.c @@ -164,6 +164,38 @@ wrapc_signbitf (float r) #endif } +/* SeekSet return the system libc SEEK_SET value. */ + +int +wrapc_SeekSet (void) +{ + return SEEK_SET; +} + +/* SeekEnd return the system libc SEEK_END value. */ + +int +wrapc_SeekEnd (void) +{ + return SEEK_END; +} + +/* ReadOnly return the system value of O_RDONLY. */ + +int +wrapc_ReadOnly (void) +{ + return O_RDONLY; +} + +/* WriteOnly return the system value of O_WRONLY. */ + +int +wrapc_WriteOnly (void) +{ + return O_WRONLY; +} + /* init constructor for the module. */ void diff --git a/gcc/m2/mc-boot/GDynamicStrings.cc b/gcc/m2/mc-boot/GDynamicStrings.cc index e9d75ee4fc5c..7f61778af64a 100644 --- a/gcc/m2/mc-boot/GDynamicStrings.cc +++ b/gcc/m2/mc-boot/GDynamicStrings.cc @@ -1225,7 +1225,7 @@ static void ConcatContents (DynamicStrings_Contents *c, const char *a_, unsigned (*c).next->contents.next = NULL; ConcatContents (&(*c).next->contents, (const char *) a, _a_high, h, o); AddDebugInfo ((*c).next); - (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 722, (const char *) "ConcatContents", 14); + (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 722, (const char *) "ConcatContents", 14); } else { @@ -1323,7 +1323,7 @@ static void ConcatContentsAddress (DynamicStrings_Contents *c, void * a, unsigne AddDebugInfo ((*c).next); if (TraceOn) { - (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 917, (const char *) "ConcatContentsAddress", 21); + (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 917, (const char *) "ConcatContentsAddress", 21); } } else @@ -1548,7 +1548,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitString (const char *a_, unsi AddDebugInfo (s); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 758, (const char *) "InitString", 10); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 758, (const char *) "InitString", 10); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1651,7 +1651,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitStringCharStar (void * a) AddDebugInfo (s); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 957, (const char *) "InitStringCharStar", 18); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 957, (const char *) "InitStringCharStar", 18); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1676,7 +1676,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitStringChar (char ch) s = DynamicStrings_InitString ((const char *) &a.array[0], 1); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 977, (const char *) "InitStringChar", 14); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 977, (const char *) "InitStringChar", 14); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1863,7 +1863,7 @@ extern "C" DynamicStrings_String DynamicStrings_Dup (DynamicStrings_String s) s = DynamicStrings_Assign (DynamicStrings_InitString ((const char *) "", 0), s); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1198, (const char *) "Dup", 3); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1198, (const char *) "Dup", 3); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1885,7 +1885,7 @@ extern "C" DynamicStrings_String DynamicStrings_Add (DynamicStrings_String a, Dy a = DynamicStrings_ConCat (DynamicStrings_ConCat (DynamicStrings_InitString ((const char *) "", 0), a), b); if (TraceOn) { - a = AssignDebug (a, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1218, (const char *) "Add", 3); + a = AssignDebug (a, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1218, (const char *) "Add", 3); } return a; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1950,7 +1950,7 @@ extern "C" bool DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a) t = DynamicStrings_InitStringCharStar (a); if (TraceOn) { - t = AssignDebug (t, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1275, (const char *) "EqualCharStar", 13); + t = AssignDebug (t, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1275, (const char *) "EqualCharStar", 13); } t = AddToGarbage (t, s); if (DynamicStrings_Equal (t, s)) @@ -1988,7 +1988,7 @@ extern "C" bool DynamicStrings_EqualArray (DynamicStrings_String s, const char * t = DynamicStrings_InitString ((const char *) a, _a_high); if (TraceOn) { - t = AssignDebug (t, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1305, (const char *) "EqualArray", 10); + t = AssignDebug (t, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1305, (const char *) "EqualArray", 10); } t = AddToGarbage (t, s); if (DynamicStrings_Equal (t, s)) @@ -2026,7 +2026,7 @@ extern "C" DynamicStrings_String DynamicStrings_Mult (DynamicStrings_String s, u } if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1337, (const char *) "Mult", 4); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1337, (const char *) "Mult", 4); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2105,7 +2105,7 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s, AddDebugInfo (t->contents.next); if (TraceOn) { - t->contents.next = AssignDebug (t->contents.next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1405, (const char *) "Slice", 5); + t->contents.next = AssignDebug (t->contents.next, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1405, (const char *) "Slice", 5); } } t = t->contents.next; @@ -2123,7 +2123,7 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s, } if (TraceOn) { - d = AssignDebug (d, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1422, (const char *) "Slice", 5); + d = AssignDebug (d, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1422, (const char *) "Slice", 5); } return d; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2251,7 +2251,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveComment (DynamicStrings_St } if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1534, (const char *) "RemoveComment", 13); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1534, (const char *) "RemoveComment", 13); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2276,7 +2276,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveWhitePrefix (DynamicString s = DynamicStrings_Slice (s, (int ) (i), 0); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1646, (const char *) "RemoveWhitePrefix", 17); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1646, (const char *) "RemoveWhitePrefix", 17); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2301,7 +2301,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveWhitePostfix (DynamicStrin s = DynamicStrings_Slice (s, 0, i+1); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1668, (const char *) "RemoveWhitePostfix", 18); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1668, (const char *) "RemoveWhitePostfix", 18); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2668,7 +2668,7 @@ extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (bool hal if (frameHead == NULL) { stop (); - M2RTS_Halt ((const char *) "mismatched number of PopAllocation's compared to PushAllocation's", 65, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, (const char *) "PopAllocationExemption", 22, 174); + M2RTS_Halt ((const char *) "mismatched number of PopAllocation's compared to PushAllocation's", 65, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, (const char *) "PopAllocationExemption", 22, 174); } else { diff --git a/gcc/m2/mc-boot/GFIO.cc b/gcc/m2/mc-boot/GFIO.cc index 8de4c4f2de00..3f05b35e6e21 100644 --- a/gcc/m2/mc-boot/GFIO.cc +++ b/gcc/m2/mc-boot/GFIO.cc @@ -56,22 +56,19 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # include "GStrLib.h" # include "GStorage.h" # include "GNumberIO.h" -# include "Glibc.h" # include "GIndexing.h" # include "GM2RTS.h" +# include "Glibc.h" +# include "Gwrapc.h" typedef unsigned int FIO_File; FIO_File FIO_StdErr; FIO_File FIO_StdOut; FIO_File FIO_StdIn; -# define SEEK_SET 0 -# define SEEK_END 2 -# define UNIXREADONLY 0 -# define UNIXWRITEONLY 1 -# define CreatePermissions 0666 # define MaxBufferLength (1024*16) # define MaxErrorString (1024*8) +# define CreatePermissions 0666 typedef struct FIO_NameInfo_r FIO_NameInfo; typedef struct FIO_buf_r FIO_buf; @@ -556,7 +553,7 @@ static FIO_File GetNextFreeDescriptor (void) return f; /* create new slot */ } } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/FIO.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/FIO.def", 25, 1); __builtin_unreachable (); } @@ -673,12 +670,12 @@ static void ConnectToUnix (FIO_File f, bool towrite, bool newfile) } else { - fd->unixfd = libc_open (fd->name.address, UNIXWRITEONLY, 0); + fd->unixfd = libc_open (fd->name.address, (int ) (wrapc_WriteOnly ()), 0); } } else { - fd->unixfd = libc_open (fd->name.address, UNIXREADONLY, 0); + fd->unixfd = libc_open (fd->name.address, (int ) (wrapc_ReadOnly ()), 0); } if (fd->unixfd < 0) { @@ -2093,7 +2090,7 @@ extern "C" void FIO_SetPositionFromBeginning (FIO_File f, long int pos) fd->buffer->position = 0; fd->buffer->filled = 0; } - offset = libc_lseek (fd->unixfd, pos, SEEK_SET); + offset = static_cast (libc_lseek (fd->unixfd, (ssize_t ) (pos), wrapc_SeekSet ())); if ((offset >= 0) && (pos == offset)) { fd->abspos = pos; @@ -2142,7 +2139,7 @@ extern "C" void FIO_SetPositionFromEnd (FIO_File f, long int pos) fd->buffer->position = 0; fd->buffer->filled = 0; } - offset = libc_lseek (fd->unixfd, pos, SEEK_END); + offset = static_cast (libc_lseek (fd->unixfd, (ssize_t ) (pos), wrapc_SeekEnd ())); if (offset >= 0) { fd->abspos = offset; diff --git a/gcc/m2/mc-boot/GIndexing.cc b/gcc/m2/mc-boot/GIndexing.cc index ac184be3a44e..894b8cbea1fc 100644 --- a/gcc/m2/mc-boot/GIndexing.cc +++ b/gcc/m2/mc-boot/GIndexing.cc @@ -223,7 +223,7 @@ extern "C" bool Indexing_InBounds (Indexing_Index i, unsigned int n) { return (n >= i->Low) && (n <= i->High); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/Indexing.def", 20, 1); + ReturnException ("../../gcc/m2/mc/Indexing.def", 20, 1); __builtin_unreachable (); } @@ -243,7 +243,7 @@ extern "C" unsigned int Indexing_HighIndice (Indexing_Index i) { return i->High; } - ReturnException ("../../gcc-read-write/gcc/m2/mc/Indexing.def", 20, 1); + ReturnException ("../../gcc/m2/mc/Indexing.def", 20, 1); __builtin_unreachable (); } @@ -263,7 +263,7 @@ extern "C" unsigned int Indexing_LowIndice (Indexing_Index i) { return i->Low; } - ReturnException ("../../gcc-read-write/gcc/m2/mc/Indexing.def", 20, 1); + ReturnException ("../../gcc/m2/mc/Indexing.def", 20, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GM2Dependent.cc b/gcc/m2/mc-boot/GM2Dependent.cc index 198d2e8b5a7f..bf0daab4563d 100644 --- a/gcc/m2/mc-boot/GM2Dependent.cc +++ b/gcc/m2/mc-boot/GM2Dependent.cc @@ -55,7 +55,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # include "GSYSTEM.h" # include "GStorage.h" # include "GStrLib.h" -# include "GM2RTS.h" typedef struct M2Dependent_ArgCVEnvP_p M2Dependent_ArgCVEnvP; @@ -63,11 +62,17 @@ typedef struct M2Dependent_DependencyList_r M2Dependent_DependencyList; typedef char *M2Dependent_PtrToChar; +typedef struct M2Dependent_ProcedureList_r M2Dependent_ProcedureList; + typedef struct M2Dependent__T2_r M2Dependent__T2; typedef M2Dependent__T2 *M2Dependent_ModuleChain; -typedef struct M2Dependent__T3_a M2Dependent__T3; +typedef struct M2Dependent__T3_r M2Dependent__T3; + +typedef M2Dependent__T3 *M2Dependent_ProcedureChain; + +typedef struct M2Dependent__T4_a M2Dependent__T4; typedef enum {M2Dependent_unregistered, M2Dependent_unordered, M2Dependent_started, M2Dependent_ordered, M2Dependent_user} M2Dependent_DependencyState; @@ -82,7 +87,18 @@ struct M2Dependent_DependencyList_r { M2Dependent_DependencyState state; }; -struct M2Dependent__T3_a { M2Dependent_ModuleChain array[M2Dependent_user-M2Dependent_unregistered+1]; }; +struct M2Dependent_ProcedureList_r { + M2Dependent_ProcedureChain head; + M2Dependent_ProcedureChain tail; + }; + +struct M2Dependent__T3_r { + PROC p; + M2Dependent_ProcedureChain prev; + M2Dependent_ProcedureChain next; + }; + +struct M2Dependent__T4_a { M2Dependent_ModuleChain array[M2Dependent_user-M2Dependent_unregistered+1]; }; struct M2Dependent__T2_r { void *name; void *libname; @@ -93,7 +109,7 @@ struct M2Dependent__T2_r { M2Dependent_ModuleChain next; }; -static M2Dependent__T3 Modules; +static M2Dependent__T4 Modules; static bool DynamicInitialization; static bool Initialized; static bool WarningTrace; @@ -103,6 +119,8 @@ static bool DependencyTrace; static bool PreTrace; static bool PostTrace; static bool ForceTrace; +static M2Dependent_ProcedureList InitialProc; +static M2Dependent_ProcedureList TerminateProc; /* ConstructModules - resolve dependencies and then call each @@ -134,6 +152,44 @@ extern "C" void M2Dependent_RegisterModule (void * modulename, void * libname, M extern "C" void M2Dependent_RequestDependant (void * modulename, void * libname, void * dependantmodule, void * dependantlibname); +/* + InstallTerminationProcedure - installs a procedure, p, which will + be called when the procedure + ExecuteTerminationProcedures + is invoked. It returns TRUE if the + procedure is installed. +*/ + +extern "C" bool M2Dependent_InstallTerminationProcedure (PROC p); + +/* + ExecuteInitialProcedures - executes the initial procedures installed by + InstallInitialProcedure. +*/ + +extern "C" void M2Dependent_ExecuteInitialProcedures (void); + +/* + InstallInitialProcedure - installs a procedure to be executed just + before the BEGIN code section of the + main program module. +*/ + +extern "C" bool M2Dependent_InstallInitialProcedure (PROC p); + +/* + ExecuteTerminationProcedures - calls each installed termination procedure + in reverse order. +*/ + +extern "C" void M2Dependent_ExecuteTerminationProcedures (void); + +/* + InitDependencyList - initialize all fields of DependencyList. +*/ + +static void InitDependencyList (M2Dependent_DependencyList *depList, PROC proc, M2Dependent_DependencyState state); + /* CreateModule - creates a new module entry and returns the ModuleChain. @@ -353,6 +409,41 @@ static void Init (void); static void CheckInitialized (void); +/* + ExecuteReverse - execute the procedure associated with procptr + and then proceed to try and execute all previous + procedures in the chain. +*/ + +static void ExecuteReverse (M2Dependent_ProcedureChain procptr); + +/* + AppendProc - append proc to the end of the procedure list + defined by proclist. +*/ + +static bool AppendProc (M2Dependent_ProcedureList *proclist, PROC proc); + +/* + InitProcList - initialize the head and tail pointers to NIL. +*/ + +static void InitProcList (M2Dependent_ProcedureList *p); + + +/* + InitDependencyList - initialize all fields of DependencyList. +*/ + +static void InitDependencyList (M2Dependent_DependencyList *depList, PROC proc, M2Dependent_DependencyState state) +{ + (*depList).proc = proc; + (*depList).forced = false; + (*depList).forc = false; + (*depList).appl = false; + (*depList).state = state; +} + /* CreateModule - creates a new module entry and returns the @@ -368,8 +459,7 @@ static M2Dependent_ModuleChain CreateModule (void * name, void * libname, M2Depe mptr->libname = libname; mptr->init = init; mptr->fini = fini; - mptr->dependency.proc = dependencies; - mptr->dependency.state = M2Dependent_unregistered; + InitDependencyList (&mptr->dependency, dependencies, M2Dependent_unregistered); mptr->prev = NULL; mptr->next = NULL; if (HexTrace) @@ -946,10 +1036,10 @@ static void combine (M2Dependent_DependencyState src, M2Dependent_DependencyStat static void tracemodule (bool flag, void * modname, unsigned int modlen, void * libname, unsigned int liblen) { - typedef struct tracemodule__T4_a tracemodule__T4; + typedef struct tracemodule__T5_a tracemodule__T5; - struct tracemodule__T4_a { char array[100+1]; }; - tracemodule__T4 buffer; + struct tracemodule__T5_a { char array[100+1]; }; + tracemodule__T5 buffer; unsigned int len; if (flag) @@ -1090,10 +1180,10 @@ static void CheckApplication (void) static void warning3 (const char *format_, unsigned int _format_high, void * arg1, void * arg2) { - typedef struct warning3__T5_a warning3__T5; + typedef struct warning3__T6_a warning3__T6; - struct warning3__T5_a { char array[4096+1]; }; - warning3__T5 buffer; + struct warning3__T6_a { char array[4096+1]; }; + warning3__T6 buffer; int len; char format[_format_high+1]; @@ -1232,6 +1322,8 @@ static void Init (void) { M2Dependent_DependencyState state; + InitProcList (&InitialProc); + InitProcList (&TerminateProc); SetupDebugFlags (); for (state=M2Dependent_unregistered; state<=M2Dependent_user; state= static_cast(static_cast(state+1))) { @@ -1258,6 +1350,57 @@ static void CheckInitialized (void) } +/* + ExecuteReverse - execute the procedure associated with procptr + and then proceed to try and execute all previous + procedures in the chain. +*/ + +static void ExecuteReverse (M2Dependent_ProcedureChain procptr) +{ + while (procptr != NULL) + { + (*procptr->p.proc) (); /* Invoke the procedure. */ + procptr = procptr->prev; /* Invoke the procedure. */ + } +} + + +/* + AppendProc - append proc to the end of the procedure list + defined by proclist. +*/ + +static bool AppendProc (M2Dependent_ProcedureList *proclist, PROC proc) +{ + M2Dependent_ProcedureChain pdes; + + Storage_ALLOCATE ((void **) &pdes, sizeof (M2Dependent__T3)); + pdes->p = proc; + pdes->prev = (*proclist).tail; + pdes->next = NULL; + if ((*proclist).head == NULL) + { + (*proclist).head = pdes; + } + (*proclist).tail = pdes; + return true; + /* static analysis guarentees a RETURN statement will be used before here. */ + __builtin_unreachable (); +} + + +/* + InitProcList - initialize the head and tail pointers to NIL. +*/ + +static void InitProcList (M2Dependent_ProcedureList *p) +{ + (*p).head = NULL; + (*p).tail = NULL; +} + + /* ConstructModules - resolve dependencies and then call each module constructor in turn. @@ -1307,8 +1450,8 @@ extern "C" void M2Dependent_ConstructModules (void * applicationmodule, void * l if (mptr->dependency.appl) { traceprintf3 (ModuleTrace, (const char *) "application module: %s [%s]\\n", 29, mptr->name, mptr->libname); - traceprintf (ModuleTrace, (const char *) " calling M2RTS_ExecuteInitialProcedures\\n", 42); - M2RTS_ExecuteInitialProcedures (); + traceprintf (ModuleTrace, (const char *) " calling ExecuteInitialProcedures\\n", 36); + M2Dependent_ExecuteInitialProcedures (); traceprintf (ModuleTrace, (const char *) " calling application module\\n", 30); } (*mptr->init.proc) (argc, argv, envp); @@ -1335,7 +1478,7 @@ extern "C" void M2Dependent_DeconstructModules (void * applicationmodule, void * else { traceprintf (ModuleTrace, (const char *) "ExecuteTerminationProcedures\\n", 30); - M2RTS_ExecuteTerminationProcedures (); + M2Dependent_ExecuteTerminationProcedures (); traceprintf (ModuleTrace, (const char *) "terminating modules in sequence\\n", 33); mptr = Modules.array[M2Dependent_ordered-M2Dependent_unregistered]->prev; do { @@ -1391,6 +1534,58 @@ extern "C" void M2Dependent_RequestDependant (void * modulename, void * libname, PerformRequestDependant (modulename, libname, dependantmodule, dependantlibname); } + +/* + InstallTerminationProcedure - installs a procedure, p, which will + be called when the procedure + ExecuteTerminationProcedures + is invoked. It returns TRUE if the + procedure is installed. +*/ + +extern "C" bool M2Dependent_InstallTerminationProcedure (PROC p) +{ + return AppendProc (&TerminateProc, p); + /* static analysis guarentees a RETURN statement will be used before here. */ + __builtin_unreachable (); +} + + +/* + ExecuteInitialProcedures - executes the initial procedures installed by + InstallInitialProcedure. +*/ + +extern "C" void M2Dependent_ExecuteInitialProcedures (void) +{ + ExecuteReverse (InitialProc.tail); +} + + +/* + InstallInitialProcedure - installs a procedure to be executed just + before the BEGIN code section of the + main program module. +*/ + +extern "C" bool M2Dependent_InstallInitialProcedure (PROC p) +{ + return AppendProc (&InitialProc, p); + /* static analysis guarentees a RETURN statement will be used before here. */ + __builtin_unreachable (); +} + + +/* + ExecuteTerminationProcedures - calls each installed termination procedure + in reverse order. +*/ + +extern "C" void M2Dependent_ExecuteTerminationProcedures (void) +{ + ExecuteReverse (TerminateProc.tail); +} + extern "C" void _M2_M2Dependent_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[]) { CheckInitialized (); diff --git a/gcc/m2/mc-boot/GM2Dependent.h b/gcc/m2/mc-boot/GM2Dependent.h index 0a2a60a96532..0353236f8c1c 100644 --- a/gcc/m2/mc-boot/GM2Dependent.h +++ b/gcc/m2/mc-boot/GM2Dependent.h @@ -72,6 +72,38 @@ EXTERN void M2Dependent_RegisterModule (void * modulename, void * libname, M2Dep */ EXTERN void M2Dependent_RequestDependant (void * modulename, void * libname, void * dependantmodule, void * dependantlibname); + +/* + InstallTerminationProcedure - installs a procedure, p, which will + be called when the procedure + ExecuteTerminationProcedures + is invoked. It returns TRUE is the + procedure is installed. +*/ + +EXTERN bool M2Dependent_InstallTerminationProcedure (PROC p); + +/* + ExecuteInitialProcedures - executes the initial procedures installed + by InstallInitialProcedure. +*/ + +EXTERN void M2Dependent_ExecuteInitialProcedures (void); + +/* + InstallInitialProcedure - installs a procedure to be executed just + before the BEGIN code section of the main + program module. +*/ + +EXTERN bool M2Dependent_InstallInitialProcedure (PROC p); + +/* + ExecuteTerminationProcedures - calls each installed termination procedure + in reverse order. +*/ + +EXTERN void M2Dependent_ExecuteTerminationProcedures (void); # ifdef __cplusplus } # endif diff --git a/gcc/m2/mc-boot/GM2EXCEPTION.cc b/gcc/m2/mc-boot/GM2EXCEPTION.cc index 2f9d61a5f345..2e268317765f 100644 --- a/gcc/m2/mc-boot/GM2EXCEPTION.cc +++ b/gcc/m2/mc-boot/GM2EXCEPTION.cc @@ -58,13 +58,13 @@ extern "C" M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void) n = RTExceptions_GetNumber (e); if (n == (UINT_MAX)) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast (reinterpret_cast("M2Exception")), const_cast (reinterpret_cast("current coroutine is not in the exceptional execution state"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast (reinterpret_cast("M2Exception")), const_cast (reinterpret_cast("current coroutine is not in the exceptional execution state"))); } else { return (M2EXCEPTION_M2Exceptions) (n); } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/M2EXCEPTION.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/M2EXCEPTION.def", 25, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GM2RTS.cc b/gcc/m2/mc-boot/GM2RTS.cc index a1fd5f597883..d529a7880077 100644 --- a/gcc/m2/mc-boot/GM2RTS.cc +++ b/gcc/m2/mc-boot/GM2RTS.cc @@ -42,11 +42,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # define FALSE (1==0) # endif -# include "GStorage.h" -#if defined(__cplusplus) -# undef NULL -# define NULL 0 -#endif #define _M2RTS_H #define _M2RTS_C @@ -63,30 +58,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see typedef struct M2RTS_ArgCVEnvP_p M2RTS_ArgCVEnvP; # define stderrFd 2 -typedef struct M2RTS_ProcedureList_r M2RTS_ProcedureList; - typedef char *M2RTS_PtrToChar; -typedef struct M2RTS__T1_r M2RTS__T1; - -typedef M2RTS__T1 *M2RTS_ProcedureChain; - typedef void (*M2RTS_ArgCVEnvP_t) (int, void *, void *); struct M2RTS_ArgCVEnvP_p { M2RTS_ArgCVEnvP_t proc; }; -struct M2RTS_ProcedureList_r { - M2RTS_ProcedureChain head; - M2RTS_ProcedureChain tail; - }; - -struct M2RTS__T1_r { - PROC p; - M2RTS_ProcedureChain prev; - M2RTS_ProcedureChain next; - }; - -static M2RTS_ProcedureList InitialProc; -static M2RTS_ProcedureList TerminateProc; static int ExitValue; static bool isHalting; static bool CallExit; @@ -235,21 +211,6 @@ extern "C" void M2RTS_RealValueException (void * filename, unsigned int line, un extern "C" void M2RTS_ParameterException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); extern "C" void M2RTS_NoException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn)); -/* - ExecuteReverse - execute the procedure associated with procptr - and then proceed to try and execute all previous - procedures in the chain. -*/ - -static void ExecuteReverse (M2RTS_ProcedureChain procptr); - -/* - AppendProc - append proc to the end of the procedure list - defined by proclist. -*/ - -static bool AppendProc (M2RTS_ProcedureList *proclist, PROC proc); - /* ErrorString - writes a string to stderr. */ @@ -268,12 +229,6 @@ static void ErrorStringC (void * str); static void ErrorMessageC (void * message, void * filename, unsigned int line, void * function) __attribute__ ((noreturn)); -/* - InitProcList - initialize the head and tail pointers to NIL. -*/ - -static void InitProcList (M2RTS_ProcedureList *p); - /* Init - initialize the initial, terminate procedure lists and booleans. */ @@ -290,46 +245,6 @@ static void Init (void); static void CheckInitialized (void); -/* - ExecuteReverse - execute the procedure associated with procptr - and then proceed to try and execute all previous - procedures in the chain. -*/ - -static void ExecuteReverse (M2RTS_ProcedureChain procptr) -{ - while (procptr != NULL) - { - (*procptr->p.proc) (); /* Invoke the procedure. */ - procptr = procptr->prev; /* Invoke the procedure. */ - } -} - - -/* - AppendProc - append proc to the end of the procedure list - defined by proclist. -*/ - -static bool AppendProc (M2RTS_ProcedureList *proclist, PROC proc) -{ - M2RTS_ProcedureChain pdes; - - Storage_ALLOCATE ((void **) &pdes, sizeof (M2RTS__T1)); - pdes->p = proc; - pdes->prev = (*proclist).tail; - pdes->next = NULL; - if ((*proclist).head == NULL) - { - (*proclist).head = pdes; - } - (*proclist).tail = pdes; - return true; - /* static analysis guarentees a RETURN statement will be used before here. */ - __builtin_unreachable (); -} - - /* ErrorString - writes a string to stderr. */ @@ -364,10 +279,10 @@ static void ErrorStringC (void * str) static void ErrorMessageC (void * message, void * filename, unsigned int line, void * function) { - typedef struct ErrorMessageC__T2_a ErrorMessageC__T2; + typedef struct ErrorMessageC__T1_a ErrorMessageC__T1; - struct ErrorMessageC__T2_a { char array[10+1]; }; - ErrorMessageC__T2 buffer; + struct ErrorMessageC__T1_a { char array[10+1]; }; + ErrorMessageC__T1 buffer; ErrorStringC (filename); ErrorString ((const char *) ":", 1); @@ -388,25 +303,12 @@ static void ErrorMessageC (void * message, void * filename, unsigned int line, v } -/* - InitProcList - initialize the head and tail pointers to NIL. -*/ - -static void InitProcList (M2RTS_ProcedureList *p) -{ - (*p).head = NULL; - (*p).tail = NULL; -} - - /* Init - initialize the initial, terminate procedure lists and booleans. */ static void Init (void) { - InitProcList (&InitialProc); - InitProcList (&TerminateProc); ExitValue = 0; isHalting = false; CallExit = false; /* default by calling abort */ @@ -485,7 +387,7 @@ extern "C" void M2RTS_RequestDependant (void * modulename, void * libname, void extern "C" bool M2RTS_InstallTerminationProcedure (PROC p) { - return AppendProc (&TerminateProc, p); + return M2Dependent_InstallTerminationProcedure (p); /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -498,7 +400,7 @@ extern "C" bool M2RTS_InstallTerminationProcedure (PROC p) extern "C" void M2RTS_ExecuteInitialProcedures (void) { - ExecuteReverse (InitialProc.tail); + M2Dependent_ExecuteInitialProcedures (); } @@ -510,7 +412,7 @@ extern "C" void M2RTS_ExecuteInitialProcedures (void) extern "C" bool M2RTS_InstallInitialProcedure (PROC p) { - return AppendProc (&InitialProc, p); + return M2Dependent_InstallInitialProcedure (p); /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -523,7 +425,7 @@ extern "C" bool M2RTS_InstallInitialProcedure (PROC p) extern "C" void M2RTS_ExecuteTerminationProcedures (void) { - ExecuteReverse (TerminateProc.tail); + M2Dependent_ExecuteTerminationProcedures (); } @@ -629,10 +531,10 @@ extern "C" void M2RTS_ExitOnHalt (int e) extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high) { - typedef struct ErrorMessage__T3_a ErrorMessage__T3; + typedef struct ErrorMessage__T2_a ErrorMessage__T2; - struct ErrorMessage__T3_a { char array[10+1]; }; - ErrorMessage__T3 buffer; + struct ErrorMessage__T2_a { char array[10+1]; }; + ErrorMessage__T2 buffer; char message[_message_high+1]; char filename[_filename_high+1]; char function[_function_high+1]; diff --git a/gcc/m2/mc-boot/GPushBackInput.cc b/gcc/m2/mc-boot/GPushBackInput.cc index 715a7d4fbb48..4e0b41e491ed 100644 --- a/gcc/m2/mc-boot/GPushBackInput.cc +++ b/gcc/m2/mc-boot/GPushBackInput.cc @@ -275,7 +275,7 @@ extern "C" char PushBackInput_PutCh (char ch) } else { - Debug_Halt ((const char *) "max push back stack exceeded, increase MaxPushBackStack", 55, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54, (const char *) "PutCh", 5, 151); + Debug_Halt ((const char *) "max push back stack exceeded, increase MaxPushBackStack", 55, (const char *) "../../gcc/m2/gm2-libs/PushBackInput.mod", 39, (const char *) "PutCh", 5, 151); } return ch; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -301,7 +301,7 @@ extern "C" void PushBackInput_PutString (const char *a_, unsigned int _a_high) l -= 1; if ((PushBackInput_PutCh (a[l])) != a[l]) { - Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54, (const char *) "PutString", 9, 132); + Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc/m2/gm2-libs/PushBackInput.mod", 39, (const char *) "PutString", 9, 132); } } } @@ -322,7 +322,7 @@ extern "C" void PushBackInput_PutStr (DynamicStrings_String s) i -= 1; if ((PushBackInput_PutCh (DynamicStrings_char (s, static_cast (i)))) != (DynamicStrings_char (s, static_cast (i)))) { - Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54, (const char *) "PutStr", 6, 113); + Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc/m2/gm2-libs/PushBackInput.mod", 39, (const char *) "PutStr", 6, 113); } } } diff --git a/gcc/m2/mc-boot/GRTExceptions.cc b/gcc/m2/mc-boot/GRTExceptions.cc index 99e364c61d94..e7b35cfeed8a 100644 --- a/gcc/m2/mc-boot/GRTExceptions.cc +++ b/gcc/m2/mc-boot/GRTExceptions.cc @@ -722,7 +722,7 @@ static void AddHandler (RTExceptions_EHBlock e, RTExceptions_Handler h) static void indexf (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_indexException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 614, 9, const_cast (reinterpret_cast("indexf")), const_cast (reinterpret_cast("array index out of bounds"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_indexException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 614, 9, const_cast (reinterpret_cast("indexf")), const_cast (reinterpret_cast("array index out of bounds"))); } @@ -732,7 +732,7 @@ static void indexf (void * a) static void range (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_rangeException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 626, 9, const_cast (reinterpret_cast("range")), const_cast (reinterpret_cast("assignment out of range"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_rangeException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 626, 9, const_cast (reinterpret_cast("range")), const_cast (reinterpret_cast("assignment out of range"))); } @@ -742,7 +742,7 @@ static void range (void * a) static void casef (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_caseSelectException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 638, 9, const_cast (reinterpret_cast("casef")), const_cast (reinterpret_cast("case selector out of range"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_caseSelectException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 638, 9, const_cast (reinterpret_cast("casef")), const_cast (reinterpret_cast("case selector out of range"))); } @@ -752,7 +752,7 @@ static void casef (void * a) static void invalidloc (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_invalidLocation)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 650, 9, const_cast (reinterpret_cast("invalidloc")), const_cast (reinterpret_cast("invalid address referenced"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_invalidLocation)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 650, 9, const_cast (reinterpret_cast("invalidloc")), const_cast (reinterpret_cast("invalid address referenced"))); } @@ -762,7 +762,7 @@ static void invalidloc (void * a) static void function (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_functionException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 662, 9, const_cast (reinterpret_cast("function")), const_cast (reinterpret_cast("... function ... "))); /* --fixme-- what has happened ? */ + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_functionException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 662, 9, const_cast (reinterpret_cast("function")), const_cast (reinterpret_cast("... function ... "))); /* --fixme-- what has happened ? */ } @@ -772,7 +772,7 @@ static void function (void * a) static void wholevalue (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeValueException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 674, 9, const_cast (reinterpret_cast("wholevalue")), const_cast (reinterpret_cast("illegal whole value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeValueException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 674, 9, const_cast (reinterpret_cast("wholevalue")), const_cast (reinterpret_cast("illegal whole value exception"))); } @@ -782,7 +782,7 @@ static void wholevalue (void * a) static void wholediv (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeDivException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 686, 9, const_cast (reinterpret_cast("wholediv")), const_cast (reinterpret_cast("illegal whole value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeDivException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 686, 9, const_cast (reinterpret_cast("wholediv")), const_cast (reinterpret_cast("illegal whole value exception"))); } @@ -792,7 +792,7 @@ static void wholediv (void * a) static void realvalue (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realValueException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 698, 9, const_cast (reinterpret_cast("realvalue")), const_cast (reinterpret_cast("illegal real value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realValueException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 698, 9, const_cast (reinterpret_cast("realvalue")), const_cast (reinterpret_cast("illegal real value exception"))); } @@ -802,7 +802,7 @@ static void realvalue (void * a) static void realdiv (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realDivException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 710, 9, const_cast (reinterpret_cast("realdiv")), const_cast (reinterpret_cast("real number division by zero exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realDivException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 710, 9, const_cast (reinterpret_cast("realdiv")), const_cast (reinterpret_cast("real number division by zero exception"))); } @@ -812,7 +812,7 @@ static void realdiv (void * a) static void complexvalue (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexValueException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 722, 9, const_cast (reinterpret_cast("complexvalue")), const_cast (reinterpret_cast("illegal complex value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexValueException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 722, 9, const_cast (reinterpret_cast("complexvalue")), const_cast (reinterpret_cast("illegal complex value exception"))); } @@ -822,7 +822,7 @@ static void complexvalue (void * a) static void complexdiv (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexDivException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 734, 9, const_cast (reinterpret_cast("complexdiv")), const_cast (reinterpret_cast("complex number division by zero exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexDivException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 734, 9, const_cast (reinterpret_cast("complexdiv")), const_cast (reinterpret_cast("complex number division by zero exception"))); } @@ -832,7 +832,7 @@ static void complexdiv (void * a) static void protection (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_protException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 746, 9, const_cast (reinterpret_cast("protection")), const_cast (reinterpret_cast("protection exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_protException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 746, 9, const_cast (reinterpret_cast("protection")), const_cast (reinterpret_cast("protection exception"))); } @@ -842,7 +842,7 @@ static void protection (void * a) static void systemf (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_sysException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 758, 9, const_cast (reinterpret_cast("systemf")), const_cast (reinterpret_cast("system exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_sysException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 758, 9, const_cast (reinterpret_cast("systemf")), const_cast (reinterpret_cast("system exception"))); } @@ -852,7 +852,7 @@ static void systemf (void * a) static void coroutine (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_coException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 770, 9, const_cast (reinterpret_cast("coroutine")), const_cast (reinterpret_cast("coroutine exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_coException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 770, 9, const_cast (reinterpret_cast("coroutine")), const_cast (reinterpret_cast("coroutine exception"))); } @@ -862,7 +862,7 @@ static void coroutine (void * a) static void exception (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 782, 9, const_cast (reinterpret_cast("exception")), const_cast (reinterpret_cast("exception exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 782, 9, const_cast (reinterpret_cast("exception")), const_cast (reinterpret_cast("exception exception"))); } @@ -1180,13 +1180,13 @@ extern "C" RTExceptions_EHBlock RTExceptions_GetBaseExceptionBlock (void) { if (currentEHB == NULL) { - M2RTS_Halt ((const char *) "currentEHB has not been initialized yet", 39, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod", 53, (const char *) "GetBaseExceptionBlock", 21, 600); + M2RTS_Halt ((const char *) "currentEHB has not been initialized yet", 39, (const char *) "../../gcc/m2/gm2-libs/RTExceptions.mod", 38, (const char *) "GetBaseExceptionBlock", 21, 600); } else { return currentEHB; } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/RTExceptions.def", 25, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GRTint.cc b/gcc/m2/mc-boot/GRTint.cc index 8e83b1ff569d..236dbf4af651 100644 --- a/gcc/m2/mc-boot/GRTint.cc +++ b/gcc/m2/mc-boot/GRTint.cc @@ -585,7 +585,7 @@ static bool activatePending (bool untilInterrupt, RTint_DispatchVector call, uns default: - CaseException ("../../gcc-read-write/gcc/m2/gm2-libs/RTint.def", 25, 1); + CaseException ("../../gcc/m2/gm2-libs/RTint.def", 25, 1); __builtin_unreachable (); } vec = vec->pending; @@ -698,7 +698,7 @@ extern "C" unsigned int RTint_InitOutputVector (int fd, unsigned int pri) RTco_signal (lock); return vptr->no; } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/RTint.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/RTint.def", 25, 1); __builtin_unreachable (); } @@ -755,7 +755,7 @@ extern "C" void RTint_ReArmTimeVector (unsigned int vec, unsigned int micro, uns vptr = FindVectorNo (vec); if (vptr == NULL) { - M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, (const char *) "ReArmTimeVector", 15, 287); + M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc/m2/gm2-libs/RTint.mod", 31, (const char *) "ReArmTimeVector", 15, 287); } else { @@ -780,7 +780,7 @@ extern "C" void RTint_GetTimeVector (unsigned int vec, unsigned int *micro, unsi vptr = FindVectorNo (vec); if (vptr == NULL) { - M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, (const char *) "GetTimeVector", 13, 313); + M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc/m2/gm2-libs/RTint.mod", 31, (const char *) "GetTimeVector", 13, 313); } else { @@ -806,7 +806,7 @@ extern "C" void * RTint_AttachVector (unsigned int vec, void * ptr) vptr = FindVectorNo (vec); if (vptr == NULL) { - M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, (const char *) "AttachVector", 12, 340); + M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc/m2/gm2-libs/RTint.mod", 31, (const char *) "AttachVector", 12, 340); } else { @@ -820,7 +820,7 @@ extern "C" void * RTint_AttachVector (unsigned int vec, void * ptr) RTco_signal (lock); return prevArg; } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/RTint.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/RTint.def", 25, 1); __builtin_unreachable (); } @@ -845,7 +845,7 @@ extern "C" void RTint_IncludeVector (unsigned int vec) vptr = FindVectorNo (vec); if (vptr == NULL) { - M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, (const char *) "IncludeVector", 13, 374); + M2RTS_Halt ((const char *) "cannot find vector supplied", 27, (const char *) "../../gcc/m2/gm2-libs/RTint.mod", 31, (const char *) "IncludeVector", 13, 374); } else { @@ -891,7 +891,7 @@ extern "C" void RTint_ExcludeVector (unsigned int vec) vptr = FindPendingVector (vec); if (vptr == NULL) { - M2RTS_Halt ((const char *) "cannot find pending vector supplied", 35, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, (const char *) "ExcludeVector", 13, 416); + M2RTS_Halt ((const char *) "cannot find pending vector supplied", 35, (const char *) "../../gcc/m2/gm2-libs/RTint.mod", 31, (const char *) "ExcludeVector", 13, 416); } else { @@ -989,7 +989,7 @@ extern "C" void RTint_Listen (bool untilInterrupt, RTint_DispatchVector call, un default: - CaseException ("../../gcc-read-write/gcc/m2/gm2-libs/RTint.def", 25, 1); + CaseException ("../../gcc/m2/gm2-libs/RTint.def", 25, 1); __builtin_unreachable (); } vec = vec->pending; @@ -1002,7 +1002,7 @@ extern "C" void RTint_Listen (bool untilInterrupt, RTint_DispatchVector call, un } if ((untilInterrupt && (((inSet == NULL) && (outSet == NULL)) || (maxFd == -1))) && ! found) { - M2RTS_Halt ((const char *) "deadlock found, no more processes to run and no interrupts active", 65, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTint.mod", 46, (const char *) "Listen", 6, 733); + M2RTS_Halt ((const char *) "deadlock found, no more processes to run and no interrupts active", 65, (const char *) "../../gcc/m2/gm2-libs/RTint.mod", 31, (const char *) "Listen", 6, 733); } /* printf('} ') ; */ diff --git a/gcc/m2/mc-boot/GSArgs.cc b/gcc/m2/mc-boot/GSArgs.cc index d69c47d46280..3424fbcc9988 100644 --- a/gcc/m2/mc-boot/GSArgs.cc +++ b/gcc/m2/mc-boot/GSArgs.cc @@ -85,13 +85,15 @@ extern "C" unsigned int SArgs_Narg (void); extern "C" bool SArgs_GetArg (DynamicStrings_String *s, unsigned int n) { int i; + void * a; SArgs_PtrToPtrToChar ppc; i = (int ) (n); if (i < (UnixArgs_GetArgC ())) { - /* ppc := ADDRESS (VAL (PtrToPtrToChar, ArgV) + (i * CARDINAL (TSIZE(PtrToChar)))) ; */ - ppc = static_cast ((void *) (((SArgs_PtrToChar) (UnixArgs_GetArgV ()))+(n*sizeof (SArgs_PtrToChar)))); + a = (void *) (UnixArgs_GetArgV ()); + a = reinterpret_cast (reinterpret_cast (a)+n*sizeof (SArgs_PtrToChar)); + ppc = static_cast (a); (*s) = DynamicStrings_InitStringCharStar (reinterpret_cast ((*ppc))); return true; } diff --git a/gcc/m2/mc-boot/GStdIO.cc b/gcc/m2/mc-boot/GStdIO.cc index b3ab5c90ecaa..bf25ba25ee35 100644 --- a/gcc/m2/mc-boot/GStdIO.cc +++ b/gcc/m2/mc-boot/GStdIO.cc @@ -194,7 +194,7 @@ extern "C" StdIO_ProcWrite StdIO_GetCurrentOutput (void) M2RTS_HALT (-1); __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/StdIO.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/StdIO.def", 25, 1); __builtin_unreachable (); } @@ -253,7 +253,7 @@ extern "C" StdIO_ProcRead StdIO_GetCurrentInput (void) M2RTS_HALT (-1); __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/StdIO.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/StdIO.def", 25, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GStringConvert.cc b/gcc/m2/mc-boot/GStringConvert.cc index 4178d8910fe1..5d07bd133bab 100644 --- a/gcc/m2/mc-boot/GStringConvert.cc +++ b/gcc/m2/mc-boot/GStringConvert.cc @@ -1915,7 +1915,7 @@ extern "C" DynamicStrings_String StringConvert_ToSigFig (DynamicStrings_String s int point; unsigned int poTen; - Assert ((IsDigit (DynamicStrings_char (s, 0))) || ((DynamicStrings_char (s, 0)) == '.'), (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/StringConvert.mod", 54, 1220, (const char *) "ToSigFig", 8); + Assert ((IsDigit (DynamicStrings_char (s, 0))) || ((DynamicStrings_char (s, 0)) == '.'), (const char *) "../../gcc/m2/gm2-libs/StringConvert.mod", 39, 1220, (const char *) "ToSigFig", 8); point = DynamicStrings_Index (s, '.', 0); if (point < 0) { @@ -1967,7 +1967,7 @@ extern "C" DynamicStrings_String StringConvert_ToDecimalPlaces (DynamicStrings_S { int point; - Assert ((IsDigit (DynamicStrings_char (s, 0))) || ((DynamicStrings_char (s, 0)) == '.'), (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/StringConvert.mod", 54, 1069, (const char *) "ToDecimalPlaces", 15); + Assert ((IsDigit (DynamicStrings_char (s, 0))) || ((DynamicStrings_char (s, 0)) == '.'), (const char *) "../../gcc/m2/gm2-libs/StringConvert.mod", 39, 1069, (const char *) "ToDecimalPlaces", 15); point = DynamicStrings_Index (s, '.', 0); if (point < 0) { diff --git a/gcc/m2/mc-boot/GSysStorage.cc b/gcc/m2/mc-boot/GSysStorage.cc index b5c22752eff2..d1d958df7792 100644 --- a/gcc/m2/mc-boot/GSysStorage.cc +++ b/gcc/m2/mc-boot/GSysStorage.cc @@ -94,7 +94,7 @@ extern "C" void SysStorage_ALLOCATE (void * *a, unsigned int size) (*a) = libc_malloc (static_cast (size)); if ((*a) == NULL) { - Debug_Halt ((const char *) "out of memory error", 19, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51, (const char *) "ALLOCATE", 8, 51); + Debug_Halt ((const char *) "out of memory error", 19, (const char *) "../../gcc/m2/gm2-libs/SysStorage.mod", 36, (const char *) "ALLOCATE", 8, 51); } if (enableTrace && trace) { @@ -119,7 +119,7 @@ extern "C" void SysStorage_DEALLOCATE (void * *a, unsigned int size) } if ((libc_memset ((*a), 0, static_cast (size))) != (*a)) { - Debug_Halt ((const char *) "memset should have returned the first parameter", 47, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51, (const char *) "DEALLOCATE", 10, 78); + Debug_Halt ((const char *) "memset should have returned the first parameter", 47, (const char *) "../../gcc/m2/gm2-libs/SysStorage.mod", 36, (const char *) "DEALLOCATE", 10, 78); } } if (enableDeallocation) @@ -164,7 +164,7 @@ extern "C" void SysStorage_REALLOCATE (void * *a, unsigned int size) (*a) = libc_realloc ((*a), static_cast (size)); if ((*a) == NULL) { - Debug_Halt ((const char *) "out of memory error", 19, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51, (const char *) "REALLOCATE", 10, 122); + Debug_Halt ((const char *) "out of memory error", 19, (const char *) "../../gcc/m2/gm2-libs/SysStorage.mod", 36, (const char *) "REALLOCATE", 10, 122); } if (enableTrace && trace) { diff --git a/gcc/m2/mc-boot/Gdecl.cc b/gcc/m2/mc-boot/Gdecl.cc index f96d2f99a94c..654cb0f3120c 100644 --- a/gcc/m2/mc-boot/Gdecl.cc +++ b/gcc/m2/mc-boot/Gdecl.cc @@ -2781,7 +2781,7 @@ extern "C" int libc_dup (int d); extern "C" int libc_close (int d); extern "C" int libc_open (void * filename, int oflag, ...); extern "C" int libc_creat (void * filename, unsigned int mode); -extern "C" long int libc_lseek (int fd, long int offset, int whence); +extern "C" ssize_t libc_lseek (int fd, ssize_t offset, int whence); extern "C" void libc_perror (const char *string_, unsigned int _string_high); extern "C" int libc_readv (int fd, void * v, int n); extern "C" int libc_writev (int fd, void * v, int n); @@ -6705,7 +6705,7 @@ static decl_node newNode (decl_nodeT k) d->at.firstUsed = 0; return d; } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -7065,7 +7065,7 @@ static decl_node addToScope (decl_node n) } M2RTS_HALT (-1); __builtin_unreachable (); - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -7143,7 +7143,7 @@ static void setUnary (decl_node u, decl_nodeT k, decl_node a, decl_node t) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -7426,7 +7426,7 @@ static void putFieldVarient (decl_node f, decl_node v) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } switch (f->kind) @@ -7437,7 +7437,7 @@ static void putFieldVarient (decl_node f, decl_node v) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -7488,7 +7488,7 @@ static decl_node putFieldRecord (decl_node r, nameKey_Name tag, decl_node type, default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* fill in, n. */ @@ -7546,7 +7546,7 @@ static void putVarientTag (decl_node v, decl_node tag) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -7570,7 +7570,7 @@ static decl_node getParent (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -7598,7 +7598,7 @@ static decl_node getRecord (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -7778,7 +7778,7 @@ static bool getConstExpComplete (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -7883,7 +7883,7 @@ static decl_node makeVal (decl_node params) M2RTS_HALT (-1); __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -7904,7 +7904,7 @@ static decl_node makeCast (decl_node c, decl_node p) M2RTS_HALT (-1); __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -8414,7 +8414,7 @@ static decl_node makeUnary (decl_nodeT k, decl_node e, decl_node res) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -8508,7 +8508,7 @@ static DynamicStrings_String getStringContents (decl_node n) } M2RTS_HALT (-1); __builtin_unreachable (); - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -8644,7 +8644,7 @@ static decl_node doMakeBinary (decl_nodeT k, decl_node l, decl_node r, decl_node default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } return n; @@ -9244,12 +9244,12 @@ static decl_node doGetExprType (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } M2RTS_HALT (-1); __builtin_unreachable (); - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -9388,12 +9388,12 @@ static decl_node getSymScope (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } M2RTS_HALT (-1); __builtin_unreachable (); - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -9705,7 +9705,7 @@ static bool needsParen (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } return true; @@ -9814,7 +9814,7 @@ static void doPolyBinary (mcPretty_pretty p, decl_nodeT op, decl_node left, decl default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -9840,7 +9840,7 @@ static void doPolyBinary (mcPretty_pretty p, decl_nodeT op, decl_node left, decl default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -10118,7 +10118,7 @@ static decl_node doGetLastOp (decl_node a, decl_node b) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -10772,7 +10772,7 @@ static void doExprC (mcPretty_pretty p, decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -10977,7 +10977,7 @@ static void doExprM2 (mcPretty_pretty p, decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -11149,7 +11149,7 @@ static DynamicStrings_String replaceChar (DynamicStrings_String s, char ch, cons return s; } } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -11209,7 +11209,7 @@ static unsigned int countChar (DynamicStrings_String s, char ch) return c; } } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -12268,7 +12268,7 @@ static decl_node doMin (decl_node n) M2RTS_HALT (-1); /* finish the cacading elsif statement. */ __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -12349,7 +12349,7 @@ static decl_node doMax (decl_node n) M2RTS_HALT (-1); /* finish the cacading elsif statement. */ __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -12655,7 +12655,7 @@ static void doBaseC (mcPretty_pretty p, decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } mcPretty_setNeedSpace (p); @@ -12745,7 +12745,7 @@ static void doSystemC (mcPretty_pretty p, decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -16099,7 +16099,7 @@ static void doCreal (mcPretty_pretty p, decl_node t) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -16130,7 +16130,7 @@ static void doCimag (mcPretty_pretty p, decl_node t) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -16261,7 +16261,7 @@ static void doIntrinsicC (mcPretty_pretty p, decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } outText (p, (const char *) ";", 1); @@ -17437,7 +17437,7 @@ static void dbs (decl_dependentState s, decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } if (n != NULL) @@ -18330,10 +18330,10 @@ static decl_dependentState doDependants (alists_alist l, decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -18430,7 +18430,7 @@ static void visitIntrinsicFunction (alists_alist v, decl_node n, decl_nodeProced default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -19429,7 +19429,7 @@ static void visitDependants (alists_alist v, decl_node n, decl_nodeProcedure p) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -19776,12 +19776,12 @@ static DynamicStrings_String genKind (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } M2RTS_HALT (-1); __builtin_unreachable (); - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -20956,7 +20956,7 @@ static void doBaseM2 (mcPretty_pretty p, decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } mcPretty_setNeedSpace (p); @@ -20982,7 +20982,7 @@ static void doSystemM2 (mcPretty_pretty p, decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -22193,10 +22193,10 @@ static decl_node doDupExpr (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -22526,7 +22526,7 @@ extern "C" bool decl_isVisited (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -22556,7 +22556,7 @@ extern "C" void decl_unsetVisited (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -22584,7 +22584,7 @@ extern "C" void decl_setVisited (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -22612,7 +22612,7 @@ extern "C" void decl_setEnumsComplete (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -22640,7 +22640,7 @@ extern "C" bool decl_getEnumsComplete (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -22861,7 +22861,7 @@ extern "C" decl_node decl_lookupInScope (decl_node scope, nameKey_Name n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -23236,12 +23236,12 @@ extern "C" decl_node decl_getType (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } M2RTS_HALT (-1); __builtin_unreachable (); - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -23635,7 +23635,7 @@ extern "C" decl_node decl_getScope (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -24290,7 +24290,7 @@ extern "C" decl_node decl_makeVarient (decl_node r) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } return n; @@ -24743,6 +24743,10 @@ extern "C" nameKey_Name decl_getSymName (decl_node n) return nameKey_makeKey ((const char *) "MIN", 3); break; + case decl_pointerref: + return nameKey_NulName; + break; + case decl_funccall: return nameKey_NulName; break; @@ -24757,7 +24761,7 @@ extern "C" nameKey_Name decl_getSymName (decl_node n) __builtin_unreachable (); break; } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -24795,7 +24799,7 @@ extern "C" decl_node decl_import (decl_node m, decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } importEnumFields (m, n); @@ -24924,7 +24928,7 @@ extern "C" void decl_setSource (decl_node n, nameKey_Name s) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -24952,7 +24956,7 @@ extern "C" nameKey_Name decl_getSource (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } /* static analysis guarentees a RETURN statement will be used before here. */ @@ -25395,7 +25399,7 @@ extern "C" void decl_addParameter (decl_node proc, decl_node param) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -25488,7 +25492,7 @@ extern "C" decl_node decl_makeBinaryTok (mcReserved_toktype op, decl_node l, dec M2RTS_HALT (-1); /* most likely op needs a clause as above. */ __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -25520,7 +25524,7 @@ extern "C" decl_node decl_makeUnaryTok (mcReserved_toktype op, decl_node e) M2RTS_HALT (-1); /* most likely op needs a clause as above. */ __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + ReturnException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } @@ -25958,7 +25962,7 @@ extern "C" void decl_setConstExpComplete (decl_node n) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -26323,7 +26327,7 @@ extern "C" void decl_putBegin (decl_node b, decl_node s) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -26350,7 +26354,7 @@ extern "C" void decl_putFinally (decl_node b, decl_node s) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } } @@ -26978,7 +26982,7 @@ extern "C" void decl_out (void) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/decl.def", 20, 1); + CaseException ("../../gcc/m2/mc/decl.def", 20, 1); __builtin_unreachable (); } closeOutput (); diff --git a/gcc/m2/mc-boot/Gkeyc.cc b/gcc/m2/mc-boot/Gkeyc.cc index 24744ff0330d..0deb633d6b44 100644 --- a/gcc/m2/mc-boot/Gkeyc.cc +++ b/gcc/m2/mc-boot/Gkeyc.cc @@ -928,7 +928,7 @@ static bool mangleN (nameKey_Name n, DynamicStrings_String *m, bool scopes) return true; } } - ReturnException ("../../gcc-read-write/gcc/m2/mc/keyc.def", 20, 1); + ReturnException ("../../gcc/m2/mc/keyc.def", 20, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/Glibc.h b/gcc/m2/mc-boot/Glibc.h index 9b3e005f3665..382b737e4b8f 100644 --- a/gcc/m2/mc-boot/Glibc.h +++ b/gcc/m2/mc-boot/Glibc.h @@ -192,7 +192,7 @@ EXTERN int libc_creat (void * filename, unsigned int mode); off_t lseek(int fildes, off_t offset, int whence); */ -EXTERN long int libc_lseek (int fd, long int offset, int whence); +EXTERN ssize_t libc_lseek (int fd, ssize_t offset, int whence); /* perror - writes errno and string. (ARRAY OF CHAR is translated onto ADDRESS). diff --git a/gcc/m2/mc-boot/GmcComment.cc b/gcc/m2/mc-boot/GmcComment.cc index c1a14c81a65f..f17fb19a8e65 100644 --- a/gcc/m2/mc-boot/GmcComment.cc +++ b/gcc/m2/mc-boot/GmcComment.cc @@ -258,7 +258,7 @@ static void dumpComment (mcComment_commentDesc cd) default: - CaseException ("../../gcc-read-write/gcc/m2/mc/mcComment.def", 20, 1); + CaseException ("../../gcc/m2/mc/mcComment.def", 20, 1); __builtin_unreachable (); } if (cd->used) diff --git a/gcc/m2/mc-boot/GmcComp.cc b/gcc/m2/mc-boot/GmcComp.cc index 70b1a7102ddf..33c8201d8ad4 100644 --- a/gcc/m2/mc-boot/GmcComp.cc +++ b/gcc/m2/mc-boot/GmcComp.cc @@ -295,7 +295,7 @@ static decl_node examineCompilationUnit (void) } mcflex_mcError (DynamicStrings_string (DynamicStrings_InitString ((const char *) "failed to find module name", 26))); libc_exit (1); - ReturnException ("../../gcc-read-write/gcc/m2/mc/mcComp.def", 20, 1); + ReturnException ("../../gcc/m2/mc/mcComp.def", 20, 1); __builtin_unreachable (); } @@ -325,7 +325,7 @@ static decl_node peepInto (DynamicStrings_String s) mcPrintf_fprintf1 (FIO_StdErr, (const char *) "failed to open %s\\n", 19, (const unsigned char *) &s, (sizeof (s)-1)); libc_exit (1); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/mcComp.def", 20, 1); + ReturnException ("../../gcc/m2/mc/mcComp.def", 20, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GmcDebug.cc b/gcc/m2/mc-boot/GmcDebug.cc index 0d134b658e87..f89195931993 100644 --- a/gcc/m2/mc-boot/GmcDebug.cc +++ b/gcc/m2/mc-boot/GmcDebug.cc @@ -55,7 +55,7 @@ extern "C" void mcDebug_assert (bool q) { if (! q) { - mcError_internalError ((const char *) "assert failed", 13, (const char *) "../../gcc-read-write/gcc/m2/mc/mcDebug.mod", 42, 35); + mcError_internalError ((const char *) "assert failed", 13, (const char *) "../../gcc/m2/mc/mcDebug.mod", 27, 35); } } diff --git a/gcc/m2/mc-boot/GmcMetaError.cc b/gcc/m2/mc-boot/GmcMetaError.cc index 32f6efa50f4a..b4f483bdb187 100644 --- a/gcc/m2/mc-boot/GmcMetaError.cc +++ b/gcc/m2/mc-boot/GmcMetaError.cc @@ -409,7 +409,7 @@ static void internalFormat (DynamicStrings_String s, int i, const char *m_, unsi s = DynamicStrings_ConCatChar (s, '^'); s = SFIO_WriteS (FIO_StdOut, s); FIO_WriteLine (FIO_StdOut); - mcError_internalError ((const char *) m, _m_high, (const char *) "../../gcc-read-write/gcc/m2/mc/mcMetaError.mod", 46, 97); + mcError_internalError ((const char *) m, _m_high, (const char *) "../../gcc/m2/mc/mcMetaError.mod", 31, 97); } @@ -421,7 +421,7 @@ static DynamicStrings_String x (DynamicStrings_String a, DynamicStrings_String b { if (a != b) { - mcError_internalError ((const char *) "different string returned", 25, (const char *) "../../gcc-read-write/gcc/m2/mc/mcMetaError.mod", 46, 109); + mcError_internalError ((const char *) "different string returned", 25, (const char *) "../../gcc/m2/mc/mcMetaError.mod", 31, 109); } return a; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -735,7 +735,7 @@ static mcError_error doError (mcError_error e, mcMetaError_errorType t, unsigned case mcMetaError_chained: if (e == NULL) { - mcError_internalError ((const char *) "should not be chaining an error onto an empty error note", 56, (const char *) "../../gcc-read-write/gcc/m2/mc/mcMetaError.mod", 46, 355); + mcError_internalError ((const char *) "should not be chaining an error onto an empty error note", 56, (const char *) "../../gcc/m2/mc/mcMetaError.mod", 31, 355); } else { @@ -759,7 +759,7 @@ static mcError_error doError (mcError_error e, mcMetaError_errorType t, unsigned default: - mcError_internalError ((const char *) "unexpected enumeration value", 28, (const char *) "../../gcc-read-write/gcc/m2/mc/mcMetaError.mod", 46, 369); + mcError_internalError ((const char *) "unexpected enumeration value", 28, (const char *) "../../gcc/m2/mc/mcMetaError.mod", 31, 369); break; } return e; diff --git a/gcc/m2/mc-boot/GmcStack.cc b/gcc/m2/mc-boot/GmcStack.cc index b08e9185a171..c35fef32f112 100644 --- a/gcc/m2/mc-boot/GmcStack.cc +++ b/gcc/m2/mc-boot/GmcStack.cc @@ -166,7 +166,7 @@ extern "C" void * mcStack_pop (mcStack_stack s) Indexing_DeleteIndice (s->list, Indexing_HighIndice (s->list)); return a; } - ReturnException ("../../gcc-read-write/gcc/m2/mc/mcStack.def", 20, 1); + ReturnException ("../../gcc/m2/mc/mcStack.def", 20, 1); __builtin_unreachable (); } @@ -216,7 +216,7 @@ extern "C" void * mcStack_access (mcStack_stack s, unsigned int i) { return Indexing_GetIndice (s->list, i); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/mcStack.def", 20, 1); + ReturnException ("../../gcc/m2/mc/mcStack.def", 20, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GmcStream.cc b/gcc/m2/mc-boot/GmcStream.cc index 81597b65a336..baf301aff61d 100644 --- a/gcc/m2/mc-boot/GmcStream.cc +++ b/gcc/m2/mc-boot/GmcStream.cc @@ -181,10 +181,19 @@ static void copy (mcStream_ptrToFile p) s = DynamicStrings_InitStringCharStar (FIO_getFileName (f)); FIO_Close (f); f = SFIO_OpenToRead (s); - while (! (FIO_EOF (f))) + while ((! (FIO_EOF (f))) && (FIO_IsNoError (f))) { b = FIO_ReadNBytes (f, maxBuffer, &buffer); - b = FIO_WriteNBytes (destFile, b, &buffer); + if (FIO_IsNoError (f)) + { + b = FIO_WriteNBytes (destFile, b, &buffer); + } + else if (! (FIO_EOF (f))) + { + /* avoid dangling else. */ + libc_printf ((const char *) "mcStream.mod:copy: error seen when reading file fragment: %s\\n", 62, DynamicStrings_string (s)); + libc_exit (1); + } } FIO_Close (f); } diff --git a/gcc/m2/mc-boot/GnameKey.cc b/gcc/m2/mc-boot/GnameKey.cc index 322a6c495796..2b236667ea1b 100644 --- a/gcc/m2/mc-boot/GnameKey.cc +++ b/gcc/m2/mc-boot/GnameKey.cc @@ -324,7 +324,7 @@ extern "C" nameKey_Name nameKey_makeKey (const char *a_, unsigned int _a_high) (*p) = ASCII_nul; return doMakeKey (n, higha); } - ReturnException ("../../gcc-read-write/gcc/m2/mc/nameKey.def", 20, 1); + ReturnException ("../../gcc/m2/mc/nameKey.def", 20, 1); __builtin_unreachable (); } @@ -374,7 +374,7 @@ extern "C" nameKey_Name nameKey_makekey (void * a) return doMakeKey (n, higha); } } - ReturnException ("../../gcc-read-write/gcc/m2/mc/nameKey.def", 20, 1); + ReturnException ("../../gcc/m2/mc/nameKey.def", 20, 1); __builtin_unreachable (); } diff --git a/gcc/m2/mc-boot/GsymbolKey.cc b/gcc/m2/mc-boot/GsymbolKey.cc index 8b01133bae08..8a396ef1bac0 100644 --- a/gcc/m2/mc-boot/GsymbolKey.cc +++ b/gcc/m2/mc-boot/GsymbolKey.cc @@ -143,7 +143,7 @@ static void findNodeAndParentInTree (symbolKey_symbolTree t, nameKey_Name n, sym (*father) = t; if (t == NULL) { - Debug_Halt ((const char *) "parameter t should never be NIL", 31, (const char *) "../../gcc-read-write/gcc/m2/mc/symbolKey.mod", 44, (const char *) "findNodeAndParentInTree", 23, 203); + Debug_Halt ((const char *) "parameter t should never be NIL", 31, (const char *) "../../gcc/m2/mc/symbolKey.mod", 29, (const char *) "findNodeAndParentInTree", 23, 203); } (*child) = t->left; if ((*child) != NULL) @@ -286,7 +286,7 @@ extern "C" void symbolKey_putSymKey (symbolKey_symbolTree t, nameKey_Name name, } else { - Debug_Halt ((const char *) "symbol already stored", 21, (const char *) "../../gcc-read-write/gcc/m2/mc/symbolKey.mod", 44, (const char *) "putSymKey", 9, 119); + Debug_Halt ((const char *) "symbol already stored", 21, (const char *) "../../gcc/m2/mc/symbolKey.mod", 29, (const char *) "putSymKey", 9, 119); } } @@ -353,7 +353,7 @@ extern "C" void symbolKey_delSymKey (symbolKey_symbolTree t, nameKey_Name name) } else { - Debug_Halt ((const char *) "trying to delete a symbol that is not in the tree - the compiler never expects this to occur", 92, (const char *) "../../gcc-read-write/gcc/m2/mc/symbolKey.mod", 44, (const char *) "delSymKey", 9, 186); + Debug_Halt ((const char *) "trying to delete a symbol that is not in the tree - the compiler never expects this to occur", 92, (const char *) "../../gcc/m2/mc/symbolKey.mod", 29, (const char *) "delSymKey", 9, 186); } } diff --git a/gcc/m2/mc-boot/Gvarargs.cc b/gcc/m2/mc-boot/Gvarargs.cc index 22aef2b39602..23bd7cd1644b 100644 --- a/gcc/m2/mc-boot/Gvarargs.cc +++ b/gcc/m2/mc-boot/Gvarargs.cc @@ -213,7 +213,8 @@ extern "C" varargs_vararg varargs_copy (varargs_vararg v) for (j=0; j<=c->nArgs; j++) { offset = (unsigned int ) (((varargs_ptrToByte) (v->contents))-((varargs_ptrToByte) (v->arg.array[j].ptr))); - c->arg.array[j].ptr = reinterpret_cast ((varargs_ptrToByte) (((varargs_ptrToByte) (c->contents))+offset)); + c->arg.array[j].ptr = reinterpret_cast ((varargs_ptrToByte) (c->contents)); + c->arg.array[j].ptr = reinterpret_cast (reinterpret_cast (c->arg.array[j].ptr)+offset); c->arg.array[j].len = v->arg.array[j].len; } return c; diff --git a/gcc/m2/mc-boot/Gwrapc.h b/gcc/m2/mc-boot/Gwrapc.h index 0ab5a1dbb4f7..e4db1e2a99f3 100644 --- a/gcc/m2/mc-boot/Gwrapc.h +++ b/gcc/m2/mc-boot/Gwrapc.h @@ -118,6 +118,51 @@ EXTERN int wrapc_isfinitef (float x); */ EXTERN int wrapc_isfinitel (long double x); + +/* + isnan - provide non builtin alternative to the gcc builtin isnan. + Returns 1 if x is a NaN otherwise return 0. +*/ + +EXTERN int wrapc_isnan (double x); + +/* + isnanf - provide non builtin alternative to the gcc builtin isnanf. + Returns 1 if x is a NaN otherwise return 0. +*/ + +EXTERN int wrapc_isnanf (float x); + +/* + isnanl - provide non builtin alternative to the gcc builtin isnanl. + Returns 1 if x is a NaN otherwise return 0. +*/ + +EXTERN int wrapc_isnanl (long double x); + +/* + SeekSet - return the system libc SEEK_SET value. +*/ + +EXTERN int wrapc_SeekSet (void); + +/* + SeekEnd - return the system libc SEEK_END value. +*/ + +EXTERN int wrapc_SeekEnd (void); + +/* + ReadOnly - return the system value of O_RDONLY. +*/ + +EXTERN unsigned int wrapc_ReadOnly (void); + +/* + WriteOnly - return the system value of O_WRONLY. +*/ + +EXTERN unsigned int wrapc_WriteOnly (void); # ifdef __cplusplus } # endif diff --git a/gcc/m2/mc/decl.mod b/gcc/m2/mc/decl.mod index 084942fbee18..3d1b57fb4aef 100644 --- a/gcc/m2/mc/decl.mod +++ b/gcc/m2/mc/decl.mod @@ -4243,6 +4243,7 @@ BEGIN im : RETURN makeKey ('IM') | max : RETURN makeKey ('MAX') | min : RETURN makeKey ('MIN') | + pointerref : RETURN NulName | funccall : RETURN NulName | identlist : RETURN NulName diff --git a/gcc/m2/mc/mcStream.mod b/gcc/m2/mc/mcStream.mod index 066d3acb05e7..b29045e1eece 100644 --- a/gcc/m2/mc/mcStream.mod +++ b/gcc/m2/mc/mcStream.mod @@ -22,8 +22,8 @@ along with GNU Modula-2; see the file COPYING3. If not see IMPLEMENTATION MODULE mcStream ; -FROM FIO IMPORT File, OpenToWrite, OpenToRead, EOF, ReadNBytes, WriteNBytes, Close, getFileName ; -FROM libc IMPORT unlink, printf, getpid ; +FROM FIO IMPORT File, OpenToWrite, OpenToRead, EOF, ReadNBytes, WriteNBytes, Close, getFileName, IsNoError ; +FROM libc IMPORT unlink, printf, getpid, exit ; FROM Indexing IMPORT InitIndex, InBounds, HighIndice, LowIndice, PutIndice, GetIndice, Index, ForeachIndiceInIndexDo ; FROM DynamicStrings IMPORT String, InitString, InitStringCharStar, string ; FROM FormatStrings IMPORT Sprintf2 ; @@ -134,9 +134,17 @@ BEGIN s := InitStringCharStar(getFileName (f)) ; Close (f) ; f := SFIO.OpenToRead (s) ; - WHILE NOT EOF (f) DO + WHILE (NOT EOF (f)) AND IsNoError (f) DO b := ReadNBytes (f, HIGH (buffer), ADR (buffer)) ; - b := WriteNBytes (destFile, b, ADR (buffer)) + IF IsNoError (f) + THEN + b := WriteNBytes (destFile, b, ADR (buffer)) + ELSIF NOT EOF (f) + THEN + printf ("mcStream.mod:copy: error seen when reading file fragment: %s\n", + string (s)) ; + exit (1) + END END ; Close (f) END diff --git a/gcc/m2/mc/varargs.mod b/gcc/m2/mc/varargs.mod index 7e4bcf35fe28..1a99f70a6736 100644 --- a/gcc/m2/mc/varargs.mod +++ b/gcc/m2/mc/varargs.mod @@ -108,7 +108,8 @@ BEGIN contents := memcpy (contents, v^.contents, size) ; FOR j := 0 TO nArgs DO offset := VAL (CARDINAL, VAL (ptrToByte, v^.contents) - VAL (ptrToByte, v^.arg[j].ptr)) ; - arg[j].ptr := VAL (ptrToByte, VAL (ptrToByte, contents) + offset) ; + arg[j].ptr := VAL (ptrToByte, contents) ; + INC (arg[j].ptr, offset) ; arg[j].len := v^.arg[j].len ; END END ; diff --git a/gcc/m2/pge-boot/GDynamicStrings.cc b/gcc/m2/pge-boot/GDynamicStrings.cc index 542c51596c6e..997802b3f844 100644 --- a/gcc/m2/pge-boot/GDynamicStrings.cc +++ b/gcc/m2/pge-boot/GDynamicStrings.cc @@ -190,6 +190,12 @@ extern "C" DynamicStrings_String DynamicStrings_ConCatChar (DynamicStrings_Strin extern "C" DynamicStrings_String DynamicStrings_Assign (DynamicStrings_String a, DynamicStrings_String b); +/* + ReplaceChar - returns string s after it has changed all occurances of from to to. +*/ + +extern "C" DynamicStrings_String DynamicStrings_ReplaceChar (DynamicStrings_String s, char from, char to); + /* Dup - duplicate a String, s, returning the copy of s. */ @@ -1222,7 +1228,7 @@ static void ConcatContents (DynamicStrings_Contents *c, const char *a_, unsigned (*c).next->contents.next = NULL; ConcatContents (&(*c).next->contents, (const char *) a, _a_high, h, o); AddDebugInfo ((*c).next); - (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 722, (const char *) "ConcatContents", 14); + (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 722, (const char *) "ConcatContents", 14); } else { @@ -1320,7 +1326,7 @@ static void ConcatContentsAddress (DynamicStrings_Contents *c, void * a, unsigne AddDebugInfo ((*c).next); if (TraceOn) { - (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 917, (const char *) "ConcatContentsAddress", 21); + (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 917, (const char *) "ConcatContentsAddress", 21); } } else @@ -1545,7 +1551,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitString (const char *a_, unsi AddDebugInfo (s); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 758, (const char *) "InitString", 10); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 758, (const char *) "InitString", 10); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1648,7 +1654,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitStringCharStar (void * a) AddDebugInfo (s); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 957, (const char *) "InitStringCharStar", 18); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 957, (const char *) "InitStringCharStar", 18); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1673,7 +1679,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitStringChar (char ch) s = DynamicStrings_InitString ((const char *) &a.array[0], 1); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 977, (const char *) "InitStringChar", 14); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 977, (const char *) "InitStringChar", 14); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1818,6 +1824,35 @@ extern "C" DynamicStrings_String DynamicStrings_Assign (DynamicStrings_String a, } +/* + ReplaceChar - returns string s after it has changed all occurances of from to to. +*/ + +extern "C" DynamicStrings_String DynamicStrings_ReplaceChar (DynamicStrings_String s, char from, char to) +{ + DynamicStrings_String t; + unsigned int i; + + t = s; + while (t != NULL) + { + i = 0; + while (i < t->contents.len) + { + if (t->contents.buf.array[i] == from) + { + t->contents.buf.array[i] = to; + } + i += 1; + } + t = t->contents.next; + } + return s; + /* static analysis guarentees a RETURN statement will be used before here. */ + __builtin_unreachable (); +} + + /* Dup - duplicate a String, s, returning the copy of s. */ @@ -1831,7 +1866,7 @@ extern "C" DynamicStrings_String DynamicStrings_Dup (DynamicStrings_String s) s = DynamicStrings_Assign (DynamicStrings_InitString ((const char *) "", 0), s); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1173, (const char *) "Dup", 3); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1198, (const char *) "Dup", 3); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1853,7 +1888,7 @@ extern "C" DynamicStrings_String DynamicStrings_Add (DynamicStrings_String a, Dy a = DynamicStrings_ConCat (DynamicStrings_ConCat (DynamicStrings_InitString ((const char *) "", 0), a), b); if (TraceOn) { - a = AssignDebug (a, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1193, (const char *) "Add", 3); + a = AssignDebug (a, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1218, (const char *) "Add", 3); } return a; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -1918,7 +1953,7 @@ extern "C" bool DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a) t = DynamicStrings_InitStringCharStar (a); if (TraceOn) { - t = AssignDebug (t, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1250, (const char *) "EqualCharStar", 13); + t = AssignDebug (t, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1275, (const char *) "EqualCharStar", 13); } t = AddToGarbage (t, s); if (DynamicStrings_Equal (t, s)) @@ -1956,7 +1991,7 @@ extern "C" bool DynamicStrings_EqualArray (DynamicStrings_String s, const char * t = DynamicStrings_InitString ((const char *) a, _a_high); if (TraceOn) { - t = AssignDebug (t, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1280, (const char *) "EqualArray", 10); + t = AssignDebug (t, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1305, (const char *) "EqualArray", 10); } t = AddToGarbage (t, s); if (DynamicStrings_Equal (t, s)) @@ -1994,7 +2029,7 @@ extern "C" DynamicStrings_String DynamicStrings_Mult (DynamicStrings_String s, u } if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1312, (const char *) "Mult", 4); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1337, (const char *) "Mult", 4); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2073,7 +2108,7 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s, AddDebugInfo (t->contents.next); if (TraceOn) { - t->contents.next = AssignDebug (t->contents.next, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1380, (const char *) "Slice", 5); + t->contents.next = AssignDebug (t->contents.next, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1405, (const char *) "Slice", 5); } } t = t->contents.next; @@ -2091,7 +2126,7 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s, } if (TraceOn) { - d = AssignDebug (d, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1397, (const char *) "Slice", 5); + d = AssignDebug (d, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1422, (const char *) "Slice", 5); } return d; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2219,7 +2254,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveComment (DynamicStrings_St } if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1509, (const char *) "RemoveComment", 13); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1534, (const char *) "RemoveComment", 13); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2244,7 +2279,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveWhitePrefix (DynamicString s = DynamicStrings_Slice (s, (int ) (i), 0); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1621, (const char *) "RemoveWhitePrefix", 17); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1646, (const char *) "RemoveWhitePrefix", 17); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2269,7 +2304,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveWhitePostfix (DynamicStrin s = DynamicStrings_Slice (s, 0, i+1); if (TraceOn) { - s = AssignDebug (s, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, 1643, (const char *) "RemoveWhitePostfix", 18); + s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1668, (const char *) "RemoveWhitePostfix", 18); } return s; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -2636,7 +2671,7 @@ extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (bool hal if (frameHead == NULL) { stop (); - M2RTS_Halt ((const char *) "mismatched number of PopAllocation's compared to PushAllocation's", 65, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/DynamicStrings.mod", 55, (const char *) "PopAllocationExemption", 22, 174); + M2RTS_Halt ((const char *) "mismatched number of PopAllocation's compared to PushAllocation's", 65, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, (const char *) "PopAllocationExemption", 22, 174); } else { diff --git a/gcc/m2/pge-boot/GDynamicStrings.h b/gcc/m2/pge-boot/GDynamicStrings.h index 4484df2f27c4..76f4cea6c819 100644 --- a/gcc/m2/pge-boot/GDynamicStrings.h +++ b/gcc/m2/pge-boot/GDynamicStrings.h @@ -124,6 +124,13 @@ EXTERN DynamicStrings_String DynamicStrings_ConCatChar (DynamicStrings_String a, EXTERN DynamicStrings_String DynamicStrings_Assign (DynamicStrings_String a, DynamicStrings_String b); +/* + ReplaceChar - returns string s after it has changed all + occurances of from to to. +*/ + +EXTERN DynamicStrings_String DynamicStrings_ReplaceChar (DynamicStrings_String s, char from, char to); + /* Dup - duplicate a String, s, returning the copy of s. */ diff --git a/gcc/m2/pge-boot/GFIO.cc b/gcc/m2/pge-boot/GFIO.cc index e9fbc1250319..3e56792f20f6 100644 --- a/gcc/m2/pge-boot/GFIO.cc +++ b/gcc/m2/pge-boot/GFIO.cc @@ -47,6 +47,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # include "GStorage.h" # include "Gmcrts.h" #include +# include #if defined(__cplusplus) # undef NULL # define NULL 0 @@ -59,22 +60,19 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # include "GStrLib.h" # include "GStorage.h" # include "GNumberIO.h" -# include "Glibc.h" # include "GIndexing.h" # include "GM2RTS.h" +# include "Glibc.h" +# include "Gwrapc.h" typedef unsigned int FIO_File; FIO_File FIO_StdErr; FIO_File FIO_StdOut; FIO_File FIO_StdIn; -# define SEEK_SET 0 -# define SEEK_END 2 -# define UNIXREADONLY 0 -# define UNIXWRITEONLY 1 -# define CreatePermissions 0666 # define MaxBufferLength (1024*16) # define MaxErrorString (1024*8) +# define CreatePermissions 0666 typedef struct FIO_NameInfo_r FIO_NameInfo; typedef struct FIO_buf_r FIO_buf; @@ -198,7 +196,7 @@ extern "C" void FIO_FlushBuffer (FIO_File f); extern "C" unsigned int FIO_ReadNBytes (FIO_File f, unsigned int nBytes, void * dest); /* - ReadAny - reads HIGH(a) bytes into, a. All input + ReadAny - reads HIGH (a) + 1 bytes into, a. All input is fully buffered, unlike ReadNBytes and thus is more suited to small reads. */ @@ -216,7 +214,7 @@ extern "C" void FIO_ReadAny (FIO_File f, unsigned char *a, unsigned int _a_high) extern "C" unsigned int FIO_WriteNBytes (FIO_File f, unsigned int nBytes, void * src); /* - WriteAny - writes HIGH(a) bytes onto, file, f. All output + WriteAny - writes HIGH (a) + 1 bytes onto, file, f. All output is fully buffered, unlike WriteNBytes and thus is more suited to small writes. */ @@ -413,7 +411,7 @@ static int ReadFromBuffer (FIO_File f, void * a, unsigned int nBytes); Useful when performing small reads. */ -static int BufferedRead (FIO_File f, unsigned int nBytes, void * a); +static int BufferedRead (FIO_File f, unsigned int nBytes, void * dest); /* HandleEscape - translates @@ -476,7 +474,7 @@ static void SetEndOfLine (FIO_File f, char ch); Useful when performing small writes. */ -static int BufferedWrite (FIO_File f, unsigned int nBytes, void * a); +static int BufferedWrite (FIO_File f, unsigned int nBytes, void * src); /* PreInitialize - preinitialize the file descriptor. @@ -559,7 +557,7 @@ static FIO_File GetNextFreeDescriptor (void) return f; /* create new slot */ } } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/FIO.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/FIO.def", 25, 1); __builtin_unreachable (); } @@ -676,12 +674,12 @@ static void ConnectToUnix (FIO_File f, bool towrite, bool newfile) } else { - fd->unixfd = libc_open (fd->name.address, UNIXWRITEONLY, 0); + fd->unixfd = libc_open (fd->name.address, (int ) (wrapc_WriteOnly ()), 0); } } else { - fd->unixfd = libc_open (fd->name.address, UNIXREADONLY, 0); + fd->unixfd = libc_open (fd->name.address, (int ) (wrapc_ReadOnly ()), 0); } if (fd->unixfd < 0) { @@ -812,11 +810,11 @@ static int ReadFromBuffer (FIO_File f, void * a, unsigned int nBytes) Useful when performing small reads. */ -static int BufferedRead (FIO_File f, unsigned int nBytes, void * a) +static int BufferedRead (FIO_File f, unsigned int nBytes, void * dest) { typedef unsigned char *BufferedRead__T3; - void * t; + void * src; int total; int n; BufferedRead__T3 p; @@ -838,7 +836,7 @@ static int BufferedRead (FIO_File f, unsigned int nBytes, void * a) if (nBytes == 1) { /* too expensive to call memcpy for 1 character */ - p = static_cast (a); + p = static_cast (dest); (*p) = static_cast ((*fd->buffer->contents).array[fd->buffer->position]); fd->buffer->left -= 1; /* remove consumed byte */ fd->buffer->position += 1; /* move onwards n byte */ @@ -848,13 +846,13 @@ static int BufferedRead (FIO_File f, unsigned int nBytes, void * a) else { n = Min (fd->buffer->left, nBytes); - t = fd->buffer->address; - t = reinterpret_cast (reinterpret_cast (t)+fd->buffer->position); - p = static_cast (libc_memcpy (a, t, static_cast (n))); + src = fd->buffer->address; + src = reinterpret_cast (reinterpret_cast (src)+fd->buffer->position); + p = static_cast (libc_memcpy (dest, src, static_cast (n))); fd->buffer->left -= n; /* remove consumed bytes */ fd->buffer->position += n; /* move onwards n bytes */ /* move onwards ready for direct reads */ - a = reinterpret_cast (reinterpret_cast (a)+n); + dest = reinterpret_cast (reinterpret_cast (dest)+n); nBytes -= n; /* reduce the amount for future direct */ /* read */ total += n; @@ -1239,11 +1237,11 @@ static void SetEndOfLine (FIO_File f, char ch) Useful when performing small writes. */ -static int BufferedWrite (FIO_File f, unsigned int nBytes, void * a) +static int BufferedWrite (FIO_File f, unsigned int nBytes, void * src) { typedef unsigned char *BufferedWrite__T5; - void * t; + void * dest; int total; int n; BufferedWrite__T5 p; @@ -1265,7 +1263,7 @@ static int BufferedWrite (FIO_File f, unsigned int nBytes, void * a) if (nBytes == 1) { /* too expensive to call memcpy for 1 character */ - p = static_cast (a); + p = static_cast (src); (*fd->buffer->contents).array[fd->buffer->position] = static_cast ((*p)); fd->buffer->left -= 1; /* reduce space */ fd->buffer->position += 1; /* move onwards n byte */ @@ -1275,13 +1273,13 @@ static int BufferedWrite (FIO_File f, unsigned int nBytes, void * a) else { n = Min (fd->buffer->left, nBytes); - t = fd->buffer->address; - t = reinterpret_cast (reinterpret_cast (t)+fd->buffer->position); - p = static_cast (libc_memcpy (a, t, static_cast ((unsigned int ) (n)))); + dest = fd->buffer->address; + dest = reinterpret_cast (reinterpret_cast (dest)+fd->buffer->position); + p = static_cast (libc_memcpy (dest, src, static_cast ((unsigned int ) (n)))); fd->buffer->left -= n; /* remove consumed bytes */ fd->buffer->position += n; /* move onwards n bytes */ /* move ready for further writes */ - a = reinterpret_cast (reinterpret_cast (a)+n); + src = reinterpret_cast (reinterpret_cast (src)+n); nBytes -= n; /* reduce the amount for future writes */ total += n; /* reduce the amount for future writes */ } @@ -1689,7 +1687,7 @@ extern "C" unsigned int FIO_ReadNBytes (FIO_File f, unsigned int nBytes, void * /* - ReadAny - reads HIGH(a) bytes into, a. All input + ReadAny - reads HIGH (a) + 1 bytes into, a. All input is fully buffered, unlike ReadNBytes and thus is more suited to small reads. */ @@ -1697,7 +1695,7 @@ extern "C" unsigned int FIO_ReadNBytes (FIO_File f, unsigned int nBytes, void * extern "C" void FIO_ReadAny (FIO_File f, unsigned char *a, unsigned int _a_high) { CheckAccess (f, FIO_openedforread, false); - if ((BufferedRead (f, _a_high, a)) == ((int ) (_a_high))) + if ((BufferedRead (f, _a_high+1, a)) == ((int ) (_a_high+1))) { SetEndOfLine (f, static_cast (a[_a_high])); } @@ -1748,7 +1746,7 @@ extern "C" unsigned int FIO_WriteNBytes (FIO_File f, unsigned int nBytes, void * /* - WriteAny - writes HIGH(a) bytes onto, file, f. All output + WriteAny - writes HIGH (a) + 1 bytes onto, file, f. All output is fully buffered, unlike WriteNBytes and thus is more suited to small writes. */ @@ -1756,7 +1754,7 @@ extern "C" unsigned int FIO_WriteNBytes (FIO_File f, unsigned int nBytes, void * extern "C" void FIO_WriteAny (FIO_File f, unsigned char *a, unsigned int _a_high) { CheckAccess (f, FIO_openedforwrite, true); - if ((BufferedWrite (f, _a_high, a)) == ((int ) (_a_high))) + if ((BufferedWrite (f, _a_high+1, a)) == ((int ) (_a_high+1))) {} /* empty. */ } @@ -2096,7 +2094,7 @@ extern "C" void FIO_SetPositionFromBeginning (FIO_File f, long int pos) fd->buffer->position = 0; fd->buffer->filled = 0; } - offset = libc_lseek (fd->unixfd, pos, SEEK_SET); + offset = static_cast (libc_lseek (fd->unixfd, (ssize_t ) (pos), wrapc_SeekSet ())); if ((offset >= 0) && (pos == offset)) { fd->abspos = pos; @@ -2145,7 +2143,7 @@ extern "C" void FIO_SetPositionFromEnd (FIO_File f, long int pos) fd->buffer->position = 0; fd->buffer->filled = 0; } - offset = libc_lseek (fd->unixfd, pos, SEEK_END); + offset = static_cast (libc_lseek (fd->unixfd, (ssize_t ) (pos), wrapc_SeekEnd ())); if (offset >= 0) { fd->abspos = offset; diff --git a/gcc/m2/pge-boot/GFIO.h b/gcc/m2/pge-boot/GFIO.h index 8404d4b96e5a..d82396449ffe 100644 --- a/gcc/m2/pge-boot/GFIO.h +++ b/gcc/m2/pge-boot/GFIO.h @@ -135,7 +135,7 @@ EXTERN void FIO_FlushBuffer (FIO_File f); EXTERN unsigned int FIO_ReadNBytes (FIO_File f, unsigned int nBytes, void * dest); /* - ReadAny - reads HIGH(a) bytes into, a. All input + ReadAny - reads HIGH (a) + 1 bytes into, a. All input is fully buffered, unlike ReadNBytes and thus is more suited to small reads. */ @@ -153,7 +153,7 @@ EXTERN void FIO_ReadAny (FIO_File f, unsigned char *a, unsigned int _a_high); EXTERN unsigned int FIO_WriteNBytes (FIO_File f, unsigned int nBytes, void * src); /* - WriteAny - writes HIGH(a) bytes onto, file, f. All output + WriteAny - writes HIGH (a) + 1 bytes onto, file, f. All output is fully buffered, unlike WriteNBytes and thus is more suited to small writes. */ diff --git a/gcc/m2/pge-boot/GIO.cc b/gcc/m2/pge-boot/GIO.cc index 4e650c8e8846..7d391bb72ff6 100644 --- a/gcc/m2/pge-boot/GIO.cc +++ b/gcc/m2/pge-boot/GIO.cc @@ -286,12 +286,13 @@ static void dononraw (termios_TERMIOS term) static void Init (void) { - fdState.array[0].IsEof = false; - fdState.array[0].IsRaw = false; - fdState.array[1].IsEof = false; - fdState.array[1].IsRaw = false; - fdState.array[2].IsEof = false; - fdState.array[2].IsRaw = false; + unsigned int fdi; + + for (fdi=0; fdi<=MaxDefaultFd; fdi++) + { + fdState.array[fdi].IsEof = false; + fdState.array[fdi].IsRaw = false; + } } diff --git a/gcc/m2/pge-boot/GIndexing.cc b/gcc/m2/pge-boot/GIndexing.cc index 61973107192a..21e3a43a8c86 100644 --- a/gcc/m2/pge-boot/GIndexing.cc +++ b/gcc/m2/pge-boot/GIndexing.cc @@ -59,14 +59,15 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see typedef struct Indexing_IndexProcedure_p Indexing_IndexProcedure; # define MinSize 128 +# define DefaultGrowFactor 2 typedef struct Indexing__T2_r Indexing__T2; typedef void * *Indexing_PtrToAddress; -typedef Indexing__T2 *Indexing_Index; - typedef unsigned char *Indexing_PtrToByte; +typedef Indexing__T2 *Indexing_Index; + typedef void (*Indexing_IndexProcedure_t) (void *); struct Indexing_IndexProcedure_p { Indexing_IndexProcedure_t proc; }; @@ -78,9 +79,19 @@ struct Indexing__T2_r { unsigned int High; bool Debug; unsigned int Map; + unsigned int GrowFactor; }; +/* + InitIndexTuned - creates a dynamic array with low indice. + The minsize is the initial number of elements the + array is allocated and growfactor determines how + it will be resized once it becomes full. +*/ + +extern "C" Indexing_Index Indexing_InitIndexTuned (unsigned int low, unsigned int minsize, unsigned int growfactor); + /* InitIndex - creates and returns an Index. */ @@ -161,30 +172,52 @@ extern "C" void Indexing_IncludeIndiceIntoIndex (Indexing_Index i, void * a); extern "C" void Indexing_ForeachIndiceInIndexDo (Indexing_Index i, Indexing_IndexProcedure p); +/* + IsEmpty - return TRUE if the array has no entries it. +*/ + +extern "C" bool Indexing_IsEmpty (Indexing_Index i); + /* - InitIndex - creates and returns an Index. + InitIndexTuned - creates a dynamic array with low indice. + The minsize is the initial number of elements the + array is allocated and growfactor determines how + it will be resized once it becomes full. */ -extern "C" Indexing_Index Indexing_InitIndex (unsigned int low) +extern "C" Indexing_Index Indexing_InitIndexTuned (unsigned int low, unsigned int minsize, unsigned int growfactor) { Indexing_Index i; Storage_ALLOCATE ((void **) &i, sizeof (Indexing__T2)); i->Low = low; i->High = 0; - i->ArraySize = MinSize; - Storage_ALLOCATE (&i->ArrayStart, MinSize); + i->ArraySize = minsize*sizeof (void *); + Storage_ALLOCATE (&i->ArrayStart, i->ArraySize); i->ArrayStart = libc_memset (i->ArrayStart, 0, static_cast (i->ArraySize)); i->Debug = false; i->Used = 0; i->Map = (unsigned int) 0; + i->GrowFactor = growfactor; return i; /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } +/* + InitIndex - creates and returns an Index. +*/ + +extern "C" Indexing_Index Indexing_InitIndex (unsigned int low) +{ + return Indexing_InitIndexTuned (low, MinSize, DefaultGrowFactor); + /* static analysis guarentees a RETURN statement will be used before here. */ + __builtin_unreachable (); +} + + /* KillIndex - returns Index to free storage. */ @@ -228,7 +261,7 @@ extern "C" bool Indexing_InBounds (Indexing_Index i, unsigned int n) { return (n >= i->Low) && (n <= i->High); } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/Indexing.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/Indexing.def", 25, 1); __builtin_unreachable (); } @@ -248,7 +281,7 @@ extern "C" unsigned int Indexing_HighIndice (Indexing_Index i) { return i->High; } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/Indexing.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/Indexing.def", 25, 1); __builtin_unreachable (); } @@ -268,7 +301,7 @@ extern "C" unsigned int Indexing_LowIndice (Indexing_Index i) { return i->Low; } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/Indexing.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/Indexing.def", 25, 1); __builtin_unreachable (); } @@ -298,7 +331,7 @@ extern "C" void Indexing_PutIndice (Indexing_Index i, unsigned int n, void * a) oldSize = i->ArraySize; while (((n-i->Low)*sizeof (void *)) >= i->ArraySize) { - i->ArraySize = i->ArraySize*2; + i->ArraySize = i->ArraySize*i->GrowFactor; } if (oldSize != i->ArraySize) { @@ -484,6 +517,18 @@ extern "C" void Indexing_ForeachIndiceInIndexDo (Indexing_Index i, Indexing_Inde } } + +/* + IsEmpty - return TRUE if the array has no entries it. +*/ + +extern "C" bool Indexing_IsEmpty (Indexing_Index i) +{ + return i->Used == 0; + /* static analysis guarentees a RETURN statement will be used before here. */ + __builtin_unreachable (); +} + extern "C" void _M2_Indexing_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[]) { } diff --git a/gcc/m2/pge-boot/GIndexing.h b/gcc/m2/pge-boot/GIndexing.h index 63bef3702e80..d65e8bd91dda 100644 --- a/gcc/m2/pge-boot/GIndexing.h +++ b/gcc/m2/pge-boot/GIndexing.h @@ -60,6 +60,15 @@ typedef void (*Indexing_IndexProcedure_t) (void *); struct Indexing_IndexProcedure_p { Indexing_IndexProcedure_t proc; }; +/* + InitIndexTuned - creates a dynamic array with low indice. + minsize is the initial number of elements the + array is allocated and growfactor determines how + it will be resized once it becomes full. +*/ + +EXTERN Indexing_Index Indexing_InitIndexTuned (unsigned int low, unsigned int minsize, unsigned int growfactor); + /* InitIndex - creates and returns an Index. */ @@ -139,6 +148,12 @@ EXTERN void Indexing_IncludeIndiceIntoIndex (Indexing_Index i, void * a); */ EXTERN void Indexing_ForeachIndiceInIndexDo (Indexing_Index i, Indexing_IndexProcedure p); + +/* + IsEmpty - return TRUE if the array has no entries it. +*/ + +EXTERN bool Indexing_IsEmpty (Indexing_Index i); # ifdef __cplusplus } # endif diff --git a/gcc/m2/pge-boot/GM2Dependent.cc b/gcc/m2/pge-boot/GM2Dependent.cc index a623a048d189..89c80832889f 100644 --- a/gcc/m2/pge-boot/GM2Dependent.cc +++ b/gcc/m2/pge-boot/GM2Dependent.cc @@ -58,7 +58,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # include "GSYSTEM.h" # include "GStorage.h" # include "GStrLib.h" -# include "GM2RTS.h" typedef struct M2Dependent_ArgCVEnvP_p M2Dependent_ArgCVEnvP; @@ -66,11 +65,17 @@ typedef struct M2Dependent_DependencyList_r M2Dependent_DependencyList; typedef char *M2Dependent_PtrToChar; +typedef struct M2Dependent_ProcedureList_r M2Dependent_ProcedureList; + typedef struct M2Dependent__T2_r M2Dependent__T2; typedef M2Dependent__T2 *M2Dependent_ModuleChain; -typedef struct M2Dependent__T3_a M2Dependent__T3; +typedef struct M2Dependent__T3_r M2Dependent__T3; + +typedef M2Dependent__T3 *M2Dependent_ProcedureChain; + +typedef struct M2Dependent__T4_a M2Dependent__T4; typedef enum {M2Dependent_unregistered, M2Dependent_unordered, M2Dependent_started, M2Dependent_ordered, M2Dependent_user} M2Dependent_DependencyState; @@ -85,7 +90,18 @@ struct M2Dependent_DependencyList_r { M2Dependent_DependencyState state; }; -struct M2Dependent__T3_a { M2Dependent_ModuleChain array[M2Dependent_user-M2Dependent_unregistered+1]; }; +struct M2Dependent_ProcedureList_r { + M2Dependent_ProcedureChain head; + M2Dependent_ProcedureChain tail; + }; + +struct M2Dependent__T3_r { + PROC p; + M2Dependent_ProcedureChain prev; + M2Dependent_ProcedureChain next; + }; + +struct M2Dependent__T4_a { M2Dependent_ModuleChain array[M2Dependent_user-M2Dependent_unregistered+1]; }; struct M2Dependent__T2_r { void *name; void *libname; @@ -96,7 +112,7 @@ struct M2Dependent__T2_r { M2Dependent_ModuleChain next; }; -static M2Dependent__T3 Modules; +static M2Dependent__T4 Modules; static bool DynamicInitialization; static bool Initialized; static bool WarningTrace; @@ -106,6 +122,8 @@ static bool DependencyTrace; static bool PreTrace; static bool PostTrace; static bool ForceTrace; +static M2Dependent_ProcedureList InitialProc; +static M2Dependent_ProcedureList TerminateProc; /* ConstructModules - resolve dependencies and then call each @@ -137,6 +155,44 @@ extern "C" void M2Dependent_RegisterModule (void * modulename, void * libname, M extern "C" void M2Dependent_RequestDependant (void * modulename, void * libname, void * dependantmodule, void * dependantlibname); +/* + InstallTerminationProcedure - installs a procedure, p, which will + be called when the procedure + ExecuteTerminationProcedures + is invoked. It returns TRUE if the + procedure is installed. +*/ + +extern "C" bool M2Dependent_InstallTerminationProcedure (PROC p); + +/* + ExecuteInitialProcedures - executes the initial procedures installed by + InstallInitialProcedure. +*/ + +extern "C" void M2Dependent_ExecuteInitialProcedures (void); + +/* + InstallInitialProcedure - installs a procedure to be executed just + before the BEGIN code section of the + main program module. +*/ + +extern "C" bool M2Dependent_InstallInitialProcedure (PROC p); + +/* + ExecuteTerminationProcedures - calls each installed termination procedure + in reverse order. +*/ + +extern "C" void M2Dependent_ExecuteTerminationProcedures (void); + +/* + InitDependencyList - initialize all fields of DependencyList. +*/ + +static void InitDependencyList (M2Dependent_DependencyList *depList, PROC proc, M2Dependent_DependencyState state); + /* CreateModule - creates a new module entry and returns the ModuleChain. @@ -356,6 +412,41 @@ static void Init (void); static void CheckInitialized (void); +/* + ExecuteReverse - execute the procedure associated with procptr + and then proceed to try and execute all previous + procedures in the chain. +*/ + +static void ExecuteReverse (M2Dependent_ProcedureChain procptr); + +/* + AppendProc - append proc to the end of the procedure list + defined by proclist. +*/ + +static bool AppendProc (M2Dependent_ProcedureList *proclist, PROC proc); + +/* + InitProcList - initialize the head and tail pointers to NIL. +*/ + +static void InitProcList (M2Dependent_ProcedureList *p); + + +/* + InitDependencyList - initialize all fields of DependencyList. +*/ + +static void InitDependencyList (M2Dependent_DependencyList *depList, PROC proc, M2Dependent_DependencyState state) +{ + (*depList).proc = proc; + (*depList).forced = false; + (*depList).forc = false; + (*depList).appl = false; + (*depList).state = state; +} + /* CreateModule - creates a new module entry and returns the @@ -371,8 +462,7 @@ static M2Dependent_ModuleChain CreateModule (void * name, void * libname, M2Depe mptr->libname = libname; mptr->init = init; mptr->fini = fini; - mptr->dependency.proc = dependencies; - mptr->dependency.state = M2Dependent_unregistered; + InitDependencyList (&mptr->dependency, dependencies, M2Dependent_unregistered); mptr->prev = NULL; mptr->next = NULL; if (HexTrace) @@ -949,10 +1039,10 @@ static void combine (M2Dependent_DependencyState src, M2Dependent_DependencyStat static void tracemodule (bool flag, void * modname, unsigned int modlen, void * libname, unsigned int liblen) { - typedef struct tracemodule__T4_a tracemodule__T4; + typedef struct tracemodule__T5_a tracemodule__T5; - struct tracemodule__T4_a { char array[100+1]; }; - tracemodule__T4 buffer; + struct tracemodule__T5_a { char array[100+1]; }; + tracemodule__T5 buffer; unsigned int len; if (flag) @@ -1093,10 +1183,10 @@ static void CheckApplication (void) static void warning3 (const char *format_, unsigned int _format_high, void * arg1, void * arg2) { - typedef struct warning3__T5_a warning3__T5; + typedef struct warning3__T6_a warning3__T6; - struct warning3__T5_a { char array[4096+1]; }; - warning3__T5 buffer; + struct warning3__T6_a { char array[4096+1]; }; + warning3__T6 buffer; int len; char format[_format_high+1]; @@ -1235,6 +1325,8 @@ static void Init (void) { M2Dependent_DependencyState state; + InitProcList (&InitialProc); + InitProcList (&TerminateProc); SetupDebugFlags (); for (state=M2Dependent_unregistered; state<=M2Dependent_user; state= static_cast(static_cast(state+1))) { @@ -1261,6 +1353,57 @@ static void CheckInitialized (void) } +/* + ExecuteReverse - execute the procedure associated with procptr + and then proceed to try and execute all previous + procedures in the chain. +*/ + +static void ExecuteReverse (M2Dependent_ProcedureChain procptr) +{ + while (procptr != NULL) + { + (*procptr->p.proc) (); /* Invoke the procedure. */ + procptr = procptr->prev; /* Invoke the procedure. */ + } +} + + +/* + AppendProc - append proc to the end of the procedure list + defined by proclist. +*/ + +static bool AppendProc (M2Dependent_ProcedureList *proclist, PROC proc) +{ + M2Dependent_ProcedureChain pdes; + + Storage_ALLOCATE ((void **) &pdes, sizeof (M2Dependent__T3)); + pdes->p = proc; + pdes->prev = (*proclist).tail; + pdes->next = NULL; + if ((*proclist).head == NULL) + { + (*proclist).head = pdes; + } + (*proclist).tail = pdes; + return true; + /* static analysis guarentees a RETURN statement will be used before here. */ + __builtin_unreachable (); +} + + +/* + InitProcList - initialize the head and tail pointers to NIL. +*/ + +static void InitProcList (M2Dependent_ProcedureList *p) +{ + (*p).head = NULL; + (*p).tail = NULL; +} + + /* ConstructModules - resolve dependencies and then call each module constructor in turn. @@ -1310,8 +1453,8 @@ extern "C" void M2Dependent_ConstructModules (void * applicationmodule, void * l if (mptr->dependency.appl) { traceprintf3 (ModuleTrace, (const char *) "application module: %s [%s]\\n", 29, mptr->name, mptr->libname); - traceprintf (ModuleTrace, (const char *) " calling M2RTS_ExecuteInitialProcedures\\n", 42); - M2RTS_ExecuteInitialProcedures (); + traceprintf (ModuleTrace, (const char *) " calling ExecuteInitialProcedures\\n", 36); + M2Dependent_ExecuteInitialProcedures (); traceprintf (ModuleTrace, (const char *) " calling application module\\n", 30); } (*mptr->init.proc) (argc, argv, envp); @@ -1338,7 +1481,7 @@ extern "C" void M2Dependent_DeconstructModules (void * applicationmodule, void * else { traceprintf (ModuleTrace, (const char *) "ExecuteTerminationProcedures\\n", 30); - M2RTS_ExecuteTerminationProcedures (); + M2Dependent_ExecuteTerminationProcedures (); traceprintf (ModuleTrace, (const char *) "terminating modules in sequence\\n", 33); mptr = Modules.array[M2Dependent_ordered-M2Dependent_unregistered]->prev; do { @@ -1394,6 +1537,58 @@ extern "C" void M2Dependent_RequestDependant (void * modulename, void * libname, PerformRequestDependant (modulename, libname, dependantmodule, dependantlibname); } + +/* + InstallTerminationProcedure - installs a procedure, p, which will + be called when the procedure + ExecuteTerminationProcedures + is invoked. It returns TRUE if the + procedure is installed. +*/ + +extern "C" bool M2Dependent_InstallTerminationProcedure (PROC p) +{ + return AppendProc (&TerminateProc, p); + /* static analysis guarentees a RETURN statement will be used before here. */ + __builtin_unreachable (); +} + + +/* + ExecuteInitialProcedures - executes the initial procedures installed by + InstallInitialProcedure. +*/ + +extern "C" void M2Dependent_ExecuteInitialProcedures (void) +{ + ExecuteReverse (InitialProc.tail); +} + + +/* + InstallInitialProcedure - installs a procedure to be executed just + before the BEGIN code section of the + main program module. +*/ + +extern "C" bool M2Dependent_InstallInitialProcedure (PROC p) +{ + return AppendProc (&InitialProc, p); + /* static analysis guarentees a RETURN statement will be used before here. */ + __builtin_unreachable (); +} + + +/* + ExecuteTerminationProcedures - calls each installed termination procedure + in reverse order. +*/ + +extern "C" void M2Dependent_ExecuteTerminationProcedures (void) +{ + ExecuteReverse (TerminateProc.tail); +} + extern "C" void _M2_M2Dependent_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[]) { CheckInitialized (); diff --git a/gcc/m2/pge-boot/GM2Dependent.h b/gcc/m2/pge-boot/GM2Dependent.h index 0a2a60a96532..0353236f8c1c 100644 --- a/gcc/m2/pge-boot/GM2Dependent.h +++ b/gcc/m2/pge-boot/GM2Dependent.h @@ -72,6 +72,38 @@ EXTERN void M2Dependent_RegisterModule (void * modulename, void * libname, M2Dep */ EXTERN void M2Dependent_RequestDependant (void * modulename, void * libname, void * dependantmodule, void * dependantlibname); + +/* + InstallTerminationProcedure - installs a procedure, p, which will + be called when the procedure + ExecuteTerminationProcedures + is invoked. It returns TRUE is the + procedure is installed. +*/ + +EXTERN bool M2Dependent_InstallTerminationProcedure (PROC p); + +/* + ExecuteInitialProcedures - executes the initial procedures installed + by InstallInitialProcedure. +*/ + +EXTERN void M2Dependent_ExecuteInitialProcedures (void); + +/* + InstallInitialProcedure - installs a procedure to be executed just + before the BEGIN code section of the main + program module. +*/ + +EXTERN bool M2Dependent_InstallInitialProcedure (PROC p); + +/* + ExecuteTerminationProcedures - calls each installed termination procedure + in reverse order. +*/ + +EXTERN void M2Dependent_ExecuteTerminationProcedures (void); # ifdef __cplusplus } # endif diff --git a/gcc/m2/pge-boot/GM2EXCEPTION.cc b/gcc/m2/pge-boot/GM2EXCEPTION.cc index 43f1acbc6133..274f29a9553b 100644 --- a/gcc/m2/pge-boot/GM2EXCEPTION.cc +++ b/gcc/m2/pge-boot/GM2EXCEPTION.cc @@ -57,13 +57,13 @@ extern "C" M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void) n = RTExceptions_GetNumber (e); if (n == (UINT_MAX)) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast (reinterpret_cast("M2Exception")), const_cast (reinterpret_cast("current coroutine is not in the exceptional execution state"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast (reinterpret_cast("M2Exception")), const_cast (reinterpret_cast("current coroutine is not in the exceptional execution state"))); } else { return (M2EXCEPTION_M2Exceptions) (n); } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/M2EXCEPTION.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/M2EXCEPTION.def", 25, 1); __builtin_unreachable (); } diff --git a/gcc/m2/pge-boot/GM2RTS.cc b/gcc/m2/pge-boot/GM2RTS.cc index 827eeab124fc..5214c42ae9be 100644 --- a/gcc/m2/pge-boot/GM2RTS.cc +++ b/gcc/m2/pge-boot/GM2RTS.cc @@ -40,16 +40,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # define FALSE (1==0) # endif -#include #include #include #include -# include "GStorage.h" #include -#if defined(__cplusplus) -# undef NULL -# define NULL 0 -#endif #define _M2RTS_H #define _M2RTS_C @@ -66,30 +60,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see typedef struct M2RTS_ArgCVEnvP_p M2RTS_ArgCVEnvP; # define stderrFd 2 -typedef struct M2RTS_ProcedureList_r M2RTS_ProcedureList; - typedef char *M2RTS_PtrToChar; -typedef struct M2RTS__T1_r M2RTS__T1; - -typedef M2RTS__T1 *M2RTS_ProcedureChain; - typedef void (*M2RTS_ArgCVEnvP_t) (int, void *, void *); struct M2RTS_ArgCVEnvP_p { M2RTS_ArgCVEnvP_t proc; }; -struct M2RTS_ProcedureList_r { - M2RTS_ProcedureChain head; - M2RTS_ProcedureChain tail; - }; - -struct M2RTS__T1_r { - PROC p; - M2RTS_ProcedureChain prev; - M2RTS_ProcedureChain next; - }; - -static M2RTS_ProcedureList InitialProc; -static M2RTS_ProcedureList TerminateProc; static int ExitValue; static bool isHalting; static bool CallExit; @@ -238,21 +213,6 @@ extern "C" void M2RTS_RealValueException (void * filename, unsigned int line, un extern "C" void M2RTS_ParameterException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); extern "C" void M2RTS_NoException (void * filename, unsigned int line, unsigned int column, void * scope, void * message); -/* - ExecuteReverse - execute the procedure associated with procptr - and then proceed to try and execute all previous - procedures in the chain. -*/ - -static void ExecuteReverse (M2RTS_ProcedureChain procptr); - -/* - AppendProc - append proc to the end of the procedure list - defined by proclist. -*/ - -static bool AppendProc (M2RTS_ProcedureList *proclist, PROC proc); - /* ErrorString - writes a string to stderr. */ @@ -271,12 +231,6 @@ static void ErrorStringC (void * str); static void ErrorMessageC (void * message, void * filename, unsigned int line, void * function); -/* - InitProcList - initialize the head and tail pointers to NIL. -*/ - -static void InitProcList (M2RTS_ProcedureList *p); - /* Init - initialize the initial, terminate procedure lists and booleans. */ @@ -293,46 +247,6 @@ static void Init (void); static void CheckInitialized (void); -/* - ExecuteReverse - execute the procedure associated with procptr - and then proceed to try and execute all previous - procedures in the chain. -*/ - -static void ExecuteReverse (M2RTS_ProcedureChain procptr) -{ - while (procptr != NULL) - { - (*procptr->p.proc) (); /* Invoke the procedure. */ - procptr = procptr->prev; /* Invoke the procedure. */ - } -} - - -/* - AppendProc - append proc to the end of the procedure list - defined by proclist. -*/ - -static bool AppendProc (M2RTS_ProcedureList *proclist, PROC proc) -{ - M2RTS_ProcedureChain pdes; - - Storage_ALLOCATE ((void **) &pdes, sizeof (M2RTS__T1)); - pdes->p = proc; - pdes->prev = (*proclist).tail; - pdes->next = NULL; - if ((*proclist).head == NULL) - { - (*proclist).head = pdes; - } - (*proclist).tail = pdes; - return true; - /* static analysis guarentees a RETURN statement will be used before here. */ - __builtin_unreachable (); -} - - /* ErrorString - writes a string to stderr. */ @@ -367,10 +281,10 @@ static void ErrorStringC (void * str) static void ErrorMessageC (void * message, void * filename, unsigned int line, void * function) { - typedef struct ErrorMessageC__T2_a ErrorMessageC__T2; + typedef struct ErrorMessageC__T1_a ErrorMessageC__T1; - struct ErrorMessageC__T2_a { char array[10+1]; }; - ErrorMessageC__T2 buffer; + struct ErrorMessageC__T1_a { char array[10+1]; }; + ErrorMessageC__T1 buffer; ErrorStringC (filename); ErrorString ((const char *) ":", 1); @@ -391,25 +305,12 @@ static void ErrorMessageC (void * message, void * filename, unsigned int line, v } -/* - InitProcList - initialize the head and tail pointers to NIL. -*/ - -static void InitProcList (M2RTS_ProcedureList *p) -{ - (*p).head = NULL; - (*p).tail = NULL; -} - - /* Init - initialize the initial, terminate procedure lists and booleans. */ static void Init (void) { - InitProcList (&InitialProc); - InitProcList (&TerminateProc); ExitValue = 0; isHalting = false; CallExit = false; /* default by calling abort */ @@ -488,7 +389,7 @@ extern "C" void M2RTS_RequestDependant (void * modulename, void * libname, void extern "C" bool M2RTS_InstallTerminationProcedure (PROC p) { - return AppendProc (&TerminateProc, p); + return M2Dependent_InstallTerminationProcedure (p); /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -501,7 +402,7 @@ extern "C" bool M2RTS_InstallTerminationProcedure (PROC p) extern "C" void M2RTS_ExecuteInitialProcedures (void) { - ExecuteReverse (InitialProc.tail); + M2Dependent_ExecuteInitialProcedures (); } @@ -513,7 +414,7 @@ extern "C" void M2RTS_ExecuteInitialProcedures (void) extern "C" bool M2RTS_InstallInitialProcedure (PROC p) { - return AppendProc (&InitialProc, p); + return M2Dependent_InstallInitialProcedure (p); /* static analysis guarentees a RETURN statement will be used before here. */ __builtin_unreachable (); } @@ -526,7 +427,7 @@ extern "C" bool M2RTS_InstallInitialProcedure (PROC p) extern "C" void M2RTS_ExecuteTerminationProcedures (void) { - ExecuteReverse (TerminateProc.tail); + M2Dependent_ExecuteTerminationProcedures (); } @@ -632,10 +533,10 @@ extern "C" void M2RTS_ExitOnHalt (int e) extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high) { - typedef struct ErrorMessage__T3_a ErrorMessage__T3; + typedef struct ErrorMessage__T2_a ErrorMessage__T2; - struct ErrorMessage__T3_a { char array[10+1]; }; - ErrorMessage__T3 buffer; + struct ErrorMessage__T2_a { char array[10+1]; }; + ErrorMessage__T2 buffer; char message[_message_high+1]; char filename[_filename_high+1]; char function[_function_high+1]; diff --git a/gcc/m2/pge-boot/GNameKey.cc b/gcc/m2/pge-boot/GNameKey.cc index 9adf98497095..52b90a03cf67 100644 --- a/gcc/m2/pge-boot/GNameKey.cc +++ b/gcc/m2/pge-boot/GNameKey.cc @@ -331,7 +331,7 @@ extern "C" NameKey_Name NameKey_MakeKey (const char *a_, unsigned int _a_high) (*p) = ASCII_nul; return DoMakeKey (n, higha); } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-compiler/NameKey.def", 20, 1); + ReturnException ("../../gcc/m2/gm2-compiler/NameKey.def", 20, 1); __builtin_unreachable (); } @@ -381,7 +381,7 @@ extern "C" NameKey_Name NameKey_makekey (void * a) return DoMakeKey (n, higha); } } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-compiler/NameKey.def", 20, 1); + ReturnException ("../../gcc/m2/gm2-compiler/NameKey.def", 20, 1); __builtin_unreachable (); } @@ -421,12 +421,15 @@ extern "C" unsigned int NameKey_LengthKey (NameKey_Name Key) unsigned int i; NameKey_PtrToChar p; - p = static_cast (NameKey_KeyToCharStar (Key)); i = 0; - while ((*p) != ASCII_nul) + if (Key != NameKey_NulName) { - i += 1; - p += 1; + p = static_cast (NameKey_KeyToCharStar (Key)); + while ((*p) != ASCII_nul) + { + i += 1; + p += 1; + } } return i; /* static analysis guarentees a RETURN statement will be used before here. */ diff --git a/gcc/m2/pge-boot/GPushBackInput.cc b/gcc/m2/pge-boot/GPushBackInput.cc index e0da0cbe1591..6fb0fbea9d30 100644 --- a/gcc/m2/pge-boot/GPushBackInput.cc +++ b/gcc/m2/pge-boot/GPushBackInput.cc @@ -276,7 +276,7 @@ extern "C" char PushBackInput_PutCh (char ch) } else { - Debug_Halt ((const char *) "max push back stack exceeded, increase MaxPushBackStack", 55, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54, (const char *) "PutCh", 5, 151); + Debug_Halt ((const char *) "max push back stack exceeded, increase MaxPushBackStack", 55, (const char *) "../../gcc/m2/gm2-libs/PushBackInput.mod", 39, (const char *) "PutCh", 5, 151); } return ch; /* static analysis guarentees a RETURN statement will be used before here. */ @@ -302,7 +302,7 @@ extern "C" void PushBackInput_PutString (const char *a_, unsigned int _a_high) l -= 1; if ((PushBackInput_PutCh (a[l])) != a[l]) { - Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54, (const char *) "PutString", 9, 132); + Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc/m2/gm2-libs/PushBackInput.mod", 39, (const char *) "PutString", 9, 132); } } } @@ -323,7 +323,7 @@ extern "C" void PushBackInput_PutStr (DynamicStrings_String s) i -= 1; if ((PushBackInput_PutCh (DynamicStrings_char (s, static_cast (i)))) != (DynamicStrings_char (s, static_cast (i)))) { - Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/PushBackInput.mod", 54, (const char *) "PutStr", 6, 113); + Debug_Halt ((const char *) "assert failed", 13, (const char *) "../../gcc/m2/gm2-libs/PushBackInput.mod", 39, (const char *) "PutStr", 6, 113); } } } diff --git a/gcc/m2/pge-boot/GRTExceptions.cc b/gcc/m2/pge-boot/GRTExceptions.cc index d4d0b1c1d88a..2b6557eb7be9 100644 --- a/gcc/m2/pge-boot/GRTExceptions.cc +++ b/gcc/m2/pge-boot/GRTExceptions.cc @@ -725,7 +725,7 @@ static void AddHandler (RTExceptions_EHBlock e, RTExceptions_Handler h) static void indexf (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_indexException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 614, 9, const_cast (reinterpret_cast("indexf")), const_cast (reinterpret_cast("array index out of bounds"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_indexException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 614, 9, const_cast (reinterpret_cast("indexf")), const_cast (reinterpret_cast("array index out of bounds"))); } @@ -735,7 +735,7 @@ static void indexf (void * a) static void range (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_rangeException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 626, 9, const_cast (reinterpret_cast("range")), const_cast (reinterpret_cast("assignment out of range"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_rangeException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 626, 9, const_cast (reinterpret_cast("range")), const_cast (reinterpret_cast("assignment out of range"))); } @@ -745,7 +745,7 @@ static void range (void * a) static void casef (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_caseSelectException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 638, 9, const_cast (reinterpret_cast("casef")), const_cast (reinterpret_cast("case selector out of range"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_caseSelectException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 638, 9, const_cast (reinterpret_cast("casef")), const_cast (reinterpret_cast("case selector out of range"))); } @@ -755,7 +755,7 @@ static void casef (void * a) static void invalidloc (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_invalidLocation)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 650, 9, const_cast (reinterpret_cast("invalidloc")), const_cast (reinterpret_cast("invalid address referenced"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_invalidLocation)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 650, 9, const_cast (reinterpret_cast("invalidloc")), const_cast (reinterpret_cast("invalid address referenced"))); } @@ -765,7 +765,7 @@ static void invalidloc (void * a) static void function (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_functionException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 662, 9, const_cast (reinterpret_cast("function")), const_cast (reinterpret_cast("... function ... "))); /* --fixme-- what has happened ? */ + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_functionException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 662, 9, const_cast (reinterpret_cast("function")), const_cast (reinterpret_cast("... function ... "))); /* --fixme-- what has happened ? */ } @@ -775,7 +775,7 @@ static void function (void * a) static void wholevalue (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeValueException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 674, 9, const_cast (reinterpret_cast("wholevalue")), const_cast (reinterpret_cast("illegal whole value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeValueException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 674, 9, const_cast (reinterpret_cast("wholevalue")), const_cast (reinterpret_cast("illegal whole value exception"))); } @@ -785,7 +785,7 @@ static void wholevalue (void * a) static void wholediv (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeDivException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 686, 9, const_cast (reinterpret_cast("wholediv")), const_cast (reinterpret_cast("illegal whole value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeDivException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 686, 9, const_cast (reinterpret_cast("wholediv")), const_cast (reinterpret_cast("illegal whole value exception"))); } @@ -795,7 +795,7 @@ static void wholediv (void * a) static void realvalue (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realValueException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 698, 9, const_cast (reinterpret_cast("realvalue")), const_cast (reinterpret_cast("illegal real value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realValueException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 698, 9, const_cast (reinterpret_cast("realvalue")), const_cast (reinterpret_cast("illegal real value exception"))); } @@ -805,7 +805,7 @@ static void realvalue (void * a) static void realdiv (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realDivException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 710, 9, const_cast (reinterpret_cast("realdiv")), const_cast (reinterpret_cast("real number division by zero exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realDivException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 710, 9, const_cast (reinterpret_cast("realdiv")), const_cast (reinterpret_cast("real number division by zero exception"))); } @@ -815,7 +815,7 @@ static void realdiv (void * a) static void complexvalue (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexValueException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 722, 9, const_cast (reinterpret_cast("complexvalue")), const_cast (reinterpret_cast("illegal complex value exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexValueException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 722, 9, const_cast (reinterpret_cast("complexvalue")), const_cast (reinterpret_cast("illegal complex value exception"))); } @@ -825,7 +825,7 @@ static void complexvalue (void * a) static void complexdiv (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexDivException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 734, 9, const_cast (reinterpret_cast("complexdiv")), const_cast (reinterpret_cast("complex number division by zero exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexDivException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 734, 9, const_cast (reinterpret_cast("complexdiv")), const_cast (reinterpret_cast("complex number division by zero exception"))); } @@ -835,7 +835,7 @@ static void complexdiv (void * a) static void protection (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_protException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 746, 9, const_cast (reinterpret_cast("protection")), const_cast (reinterpret_cast("protection exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_protException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 746, 9, const_cast (reinterpret_cast("protection")), const_cast (reinterpret_cast("protection exception"))); } @@ -845,7 +845,7 @@ static void protection (void * a) static void systemf (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_sysException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 758, 9, const_cast (reinterpret_cast("systemf")), const_cast (reinterpret_cast("system exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_sysException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 758, 9, const_cast (reinterpret_cast("systemf")), const_cast (reinterpret_cast("system exception"))); } @@ -855,7 +855,7 @@ static void systemf (void * a) static void coroutine (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_coException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 770, 9, const_cast (reinterpret_cast("coroutine")), const_cast (reinterpret_cast("coroutine exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_coException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 770, 9, const_cast (reinterpret_cast("coroutine")), const_cast (reinterpret_cast("coroutine exception"))); } @@ -865,7 +865,7 @@ static void coroutine (void * a) static void exception (void * a) { - RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod")), 782, 9, const_cast (reinterpret_cast("exception")), const_cast (reinterpret_cast("exception exception"))); + RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast (reinterpret_cast("../../gcc/m2/gm2-libs/RTExceptions.mod")), 782, 9, const_cast (reinterpret_cast("exception")), const_cast (reinterpret_cast("exception exception"))); } @@ -1183,13 +1183,13 @@ extern "C" RTExceptions_EHBlock RTExceptions_GetBaseExceptionBlock (void) { if (currentEHB == NULL) { - M2RTS_Halt ((const char *) "currentEHB has not been initialized yet", 39, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.mod", 53, (const char *) "GetBaseExceptionBlock", 21, 600); + M2RTS_Halt ((const char *) "currentEHB has not been initialized yet", 39, (const char *) "../../gcc/m2/gm2-libs/RTExceptions.mod", 38, (const char *) "GetBaseExceptionBlock", 21, 600); } else { return currentEHB; } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/RTExceptions.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/RTExceptions.def", 25, 1); __builtin_unreachable (); } diff --git a/gcc/m2/pge-boot/GStdIO.cc b/gcc/m2/pge-boot/GStdIO.cc index 24faf201e52d..cf02566757dc 100644 --- a/gcc/m2/pge-boot/GStdIO.cc +++ b/gcc/m2/pge-boot/GStdIO.cc @@ -192,7 +192,7 @@ extern "C" StdIO_ProcWrite StdIO_GetCurrentOutput (void) M2RTS_HALT (-1); __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/StdIO.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/StdIO.def", 25, 1); __builtin_unreachable (); } @@ -251,7 +251,7 @@ extern "C" StdIO_ProcRead StdIO_GetCurrentInput (void) M2RTS_HALT (-1); __builtin_unreachable (); } - ReturnException ("../../gcc-read-write/gcc/m2/gm2-libs/StdIO.def", 25, 1); + ReturnException ("../../gcc/m2/gm2-libs/StdIO.def", 25, 1); __builtin_unreachable (); } diff --git a/gcc/m2/pge-boot/GSymbolKey.cc b/gcc/m2/pge-boot/GSymbolKey.cc index d1495e4b3c18..5f22ae2be645 100644 --- a/gcc/m2/pge-boot/GSymbolKey.cc +++ b/gcc/m2/pge-boot/GSymbolKey.cc @@ -184,7 +184,7 @@ static void FindNodeParentInTree (SymbolKey_SymbolTree t, NameKey_Name n, Symbol (*parent) = t; if (t == NULL) { - Debug_Halt ((const char *) "parameter t should never be NIL", 31, (const char *) "../../gcc-read-write/gcc/m2/gm2-compiler/SymbolKey.mod", 54, (const char *) "FindNodeParentInTree", 20, 241); + Debug_Halt ((const char *) "parameter t should never be NIL", 31, (const char *) "../../gcc/m2/gm2-compiler/SymbolKey.mod", 39, (const char *) "FindNodeParentInTree", 20, 241); } Assertion_Assert (t->Right == NULL); (*child) = t->Left; @@ -393,7 +393,7 @@ extern "C" void SymbolKey_PutSymKey (SymbolKey_SymbolTree t, NameKey_Name NameKe } else { - Debug_Halt ((const char *) "symbol already stored", 21, (const char *) "../../gcc-read-write/gcc/m2/gm2-compiler/SymbolKey.mod", 54, (const char *) "PutSymKey", 9, 156); + Debug_Halt ((const char *) "symbol already stored", 21, (const char *) "../../gcc/m2/gm2-compiler/SymbolKey.mod", 39, (const char *) "PutSymKey", 9, 156); } } @@ -460,7 +460,7 @@ extern "C" void SymbolKey_DelSymKey (SymbolKey_SymbolTree t, NameKey_Name NameKe } else { - Debug_Halt ((const char *) "trying to delete a symbol that is not in the tree - the compiler never expects this to occur", 92, (const char *) "../../gcc-read-write/gcc/m2/gm2-compiler/SymbolKey.mod", 54, (const char *) "DelSymKey", 9, 223); + Debug_Halt ((const char *) "trying to delete a symbol that is not in the tree - the compiler never expects this to occur", 92, (const char *) "../../gcc/m2/gm2-compiler/SymbolKey.mod", 39, (const char *) "DelSymKey", 9, 223); } } diff --git a/gcc/m2/pge-boot/GSysStorage.cc b/gcc/m2/pge-boot/GSysStorage.cc index 8b7bc115b068..9449a3e2b968 100644 --- a/gcc/m2/pge-boot/GSysStorage.cc +++ b/gcc/m2/pge-boot/GSysStorage.cc @@ -94,7 +94,7 @@ extern "C" void SysStorage_ALLOCATE (void * *a, unsigned int size) (*a) = libc_malloc (static_cast (size)); if ((*a) == NULL) { - Debug_Halt ((const char *) "out of memory error", 19, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51, (const char *) "ALLOCATE", 8, 51); + Debug_Halt ((const char *) "out of memory error", 19, (const char *) "../../gcc/m2/gm2-libs/SysStorage.mod", 36, (const char *) "ALLOCATE", 8, 51); } if (enableTrace && trace) { @@ -119,7 +119,7 @@ extern "C" void SysStorage_DEALLOCATE (void * *a, unsigned int size) } if ((libc_memset ((*a), 0, static_cast (size))) != (*a)) { - Debug_Halt ((const char *) "memset should have returned the first parameter", 47, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51, (const char *) "DEALLOCATE", 10, 78); + Debug_Halt ((const char *) "memset should have returned the first parameter", 47, (const char *) "../../gcc/m2/gm2-libs/SysStorage.mod", 36, (const char *) "DEALLOCATE", 10, 78); } } if (enableDeallocation) @@ -164,7 +164,7 @@ extern "C" void SysStorage_REALLOCATE (void * *a, unsigned int size) (*a) = libc_realloc ((*a), static_cast (size)); if ((*a) == NULL) { - Debug_Halt ((const char *) "out of memory error", 19, (const char *) "../../gcc-read-write/gcc/m2/gm2-libs/SysStorage.mod", 51, (const char *) "REALLOCATE", 10, 122); + Debug_Halt ((const char *) "out of memory error", 19, (const char *) "../../gcc/m2/gm2-libs/SysStorage.mod", 36, (const char *) "REALLOCATE", 10, 122); } if (enableTrace && trace) { diff --git a/gcc/m2/pge-boot/Glibc.h b/gcc/m2/pge-boot/Glibc.h index 9b3e005f3665..382b737e4b8f 100644 --- a/gcc/m2/pge-boot/Glibc.h +++ b/gcc/m2/pge-boot/Glibc.h @@ -192,7 +192,7 @@ EXTERN int libc_creat (void * filename, unsigned int mode); off_t lseek(int fildes, off_t offset, int whence); */ -EXTERN long int libc_lseek (int fd, long int offset, int whence); +EXTERN ssize_t libc_lseek (int fd, ssize_t offset, int whence); /* perror - writes errno and string. (ARRAY OF CHAR is translated onto ADDRESS). diff --git a/gcc/m2/pge-boot/Gwrapc.cc b/gcc/m2/pge-boot/Gwrapc.cc index 24a6f3583aba..41ceac8a0279 100644 --- a/gcc/m2/pge-boot/Gwrapc.cc +++ b/gcc/m2/pge-boot/Gwrapc.cc @@ -164,6 +164,38 @@ wrapc_signbitf (float r) #endif } +/* SeekSet return the system libc SEEK_SET value. */ + +int +wrapc_SeekSet (void) +{ + return SEEK_SET; +} + +/* SeekEnd return the system libc SEEK_END value. */ + +int +wrapc_SeekEnd (void) +{ + return SEEK_END; +} + +/* ReadOnly return the system value of O_RDONLY. */ + +int +wrapc_ReadOnly (void) +{ + return O_RDONLY; +} + +/* WriteOnly return the system value of O_WRONLY. */ + +int +wrapc_WriteOnly (void) +{ + return O_WRONLY; +} + /* init constructor for the module. */ void diff --git a/gcc/m2/pge-boot/Gwrapc.h b/gcc/m2/pge-boot/Gwrapc.h index 0ab5a1dbb4f7..e4db1e2a99f3 100644 --- a/gcc/m2/pge-boot/Gwrapc.h +++ b/gcc/m2/pge-boot/Gwrapc.h @@ -118,6 +118,51 @@ EXTERN int wrapc_isfinitef (float x); */ EXTERN int wrapc_isfinitel (long double x); + +/* + isnan - provide non builtin alternative to the gcc builtin isnan. + Returns 1 if x is a NaN otherwise return 0. +*/ + +EXTERN int wrapc_isnan (double x); + +/* + isnanf - provide non builtin alternative to the gcc builtin isnanf. + Returns 1 if x is a NaN otherwise return 0. +*/ + +EXTERN int wrapc_isnanf (float x); + +/* + isnanl - provide non builtin alternative to the gcc builtin isnanl. + Returns 1 if x is a NaN otherwise return 0. +*/ + +EXTERN int wrapc_isnanl (long double x); + +/* + SeekSet - return the system libc SEEK_SET value. +*/ + +EXTERN int wrapc_SeekSet (void); + +/* + SeekEnd - return the system libc SEEK_END value. +*/ + +EXTERN int wrapc_SeekEnd (void); + +/* + ReadOnly - return the system value of O_RDONLY. +*/ + +EXTERN unsigned int wrapc_ReadOnly (void); + +/* + WriteOnly - return the system value of O_WRONLY. +*/ + +EXTERN unsigned int wrapc_WriteOnly (void); # ifdef __cplusplus } # endif diff --git a/gcc/match.pd b/gcc/match.pd index c5b6540f939a..9ce313323a30 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -453,8 +453,9 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) /* (x >= 0 ? x : 0) + (x <= 0 ? -x : 0) -> abs x. */ (simplify - (plus:c (max @0 integer_zerop) (max (negate @0) integer_zerop)) - (abs @0)) + (plus:c (max @0 integer_zerop) (max (negate @0) integer_zerop)) + (if (ANY_INTEGRAL_TYPE_P (type) && TYPE_OVERFLOW_UNDEFINED (type)) + (abs @0))) /* X * 1, X / 1 -> X. */ (for op (mult trunc_div ceil_div floor_div round_div exact_div) @@ -1218,6 +1219,17 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) && tree_nop_conversion_p (type, TREE_TYPE (@1))) (lshift @0 @2))) +/* Fold a * !a into 0. */ +(simplify + (mult:c @0 (convert? (eq @0 integer_zerop))) + { build_zero_cst (type); }) +(simplify + (mult:c @0 (vec_cond (eq @0 integer_zerop) @1 integer_zerop)) + { build_zero_cst (type); }) +(simplify + (mult:c @0 (vec_cond (ne @0 integer_zerop) integer_zerop @1)) + { build_zero_cst (type); }) + /* Shifts by precision or greater result in zero. */ (for shift (lshift rshift) (simplify @@ -4218,8 +4230,9 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) /* (x <= 0 ? -x : 0) -> max(-x, 0). */ (simplify - (cond (le @0 integer_zerop@1) (negate@2 @0) integer_zerop@1) - (max @2 @1)) + (cond (le @0 integer_zerop@1) (negate@2 @0) integer_zerop@1) + (if (ANY_INTEGRAL_TYPE_P (type) && TYPE_OVERFLOW_UNDEFINED (type)) + (max @2 @1))) /* (zero_one == 0) ? y : z y -> ((typeof(y))zero_one * z) y */ (for op (bit_xor bit_ior plus) @@ -5149,15 +5162,36 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) /* (c ? a : b) op (c ? d : e) --> c ? (a op d) : (b op e) */ (simplify (op (vec_cond:s @0 @1 @2) (vec_cond:s @0 @3 @4)) - (vec_cond @0 (op! @1 @3) (op! @2 @4))) + (if (TREE_CODE_CLASS (op) != tcc_comparison + || types_match (type, TREE_TYPE (@1)) + || expand_vec_cond_expr_p (type, TREE_TYPE (@0), ERROR_MARK) + || (optimize_vectors_before_lowering_p () + /* The following is optimistic on the side of non-support, we are + missing the legacy vcond{,u,eq} cases. Do this only when + lowering will be able to fixup.. */ + && !expand_vec_cond_expr_p (TREE_TYPE (@1), + TREE_TYPE (@0), ERROR_MARK))) + (vec_cond @0 (op! @1 @3) (op! @2 @4)))) /* (c ? a : b) op d --> c ? (a op d) : (b op d) */ (simplify (op (vec_cond:s @0 @1 @2) @3) - (vec_cond @0 (op! @1 @3) (op! @2 @3))) + (if (TREE_CODE_CLASS (op) != tcc_comparison + || types_match (type, TREE_TYPE (@1)) + || expand_vec_cond_expr_p (type, TREE_TYPE (@0), ERROR_MARK) + || (optimize_vectors_before_lowering_p () + && !expand_vec_cond_expr_p (TREE_TYPE (@1), + TREE_TYPE (@0), ERROR_MARK))) + (vec_cond @0 (op! @1 @3) (op! @2 @3)))) (simplify (op @3 (vec_cond:s @0 @1 @2)) - (vec_cond @0 (op! @3 @1) (op! @3 @2)))) + (if (TREE_CODE_CLASS (op) != tcc_comparison + || types_match (type, TREE_TYPE (@1)) + || expand_vec_cond_expr_p (type, TREE_TYPE (@0), ERROR_MARK) + || (optimize_vectors_before_lowering_p () + && !expand_vec_cond_expr_p (TREE_TYPE (@1), + TREE_TYPE (@0), ERROR_MARK))) + (vec_cond @0 (op! @3 @1) (op! @3 @2))))) #if GIMPLE (match (nop_atomic_bit_test_and_p @0 @1 @4) diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index 2a4231d4536b..3cc5d6081236 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,7 @@ +2024-02-24 Jakub Jelinek + + * objc-encoding.cc (encode_array): Use HOST_WIDE_INT_0 macros. + 2024-01-28 Iain Sandoe * objc-next-runtime-abi-02.cc (build_v2_address_table): Prevent diff --git a/gcc/objc/objc-encoding.cc b/gcc/objc/objc-encoding.cc index 18a3ea6832eb..7cb0e5add7ba 100644 --- a/gcc/objc/objc-encoding.cc +++ b/gcc/objc/objc-encoding.cc @@ -391,10 +391,10 @@ encode_array (tree type, int curtype, int format) /* Else, we are in a struct, and we encode it as a zero-length array. */ - sprintf (buffer, "[" HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT)0); + sprintf (buffer, "[" HOST_WIDE_INT_PRINT_DEC, HOST_WIDE_INT_0); } else if (TREE_INT_CST_LOW (TYPE_SIZE (array_of)) == 0) - sprintf (buffer, "[" HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT)0); + sprintf (buffer, "[" HOST_WIDE_INT_PRINT_DEC, HOST_WIDE_INT_0); else sprintf (buffer, "[" HOST_WIDE_INT_PRINT_DEC, TREE_INT_CST_LOW (an_int_cst) diff --git a/gcc/po/ChangeLog b/gcc/po/ChangeLog index c6225cb8be06..4d2e8b9a62b2 100644 --- a/gcc/po/ChangeLog +++ b/gcc/po/ChangeLog @@ -1,3 +1,11 @@ +2024-03-04 Joseph Myers + + * sv.po: Update. + +2024-02-26 Joseph Myers + + * sv.po, zh_CN.po: Update. + 2024-02-19 Joseph Myers * be.po, da.po, de.po, el.po, es.po, fi.po, fr.po, hr.po, id.po, diff --git a/gcc/po/sv.po b/gcc/po/sv.po index 5c182c385ea0..f24eb1bbd349 100644 --- a/gcc/po/sv.po +++ b/gcc/po/sv.po @@ -1,8 +1,8 @@ # Swedish messages for gcc. -# Copyright © 2000, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Free Software Foundation, Inc. +# Copyright © 2000, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 Free Software Foundation, Inc. # This file is distributed under the same license as the gcc package. # Dennis Björklund , 2000, 2001, 2002. -# Göran Uddeborg , 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023. +# Göran Uddeborg , 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024. # # Reminder to translator: GCC team does not want RCS keywords in the header! # @@ -11,26 +11,28 @@ # bb (basic block) gb (grundblock) # bundle bunt # cast typkonvertering -# crate back +# crate lĂ„r # chunk stycke # clique klick # harden hĂ€rda # kind sort # load ladda +# map avbildning # offset avstĂ„nd # overload överlagra # rank ordning # scope rĂ€ckvidd # store lagra # stride steg +# struct post # tile bricka # thunk snutt msgid "" msgstr "" -"Project-Id-Version: gcc 13.2.0\n" +"Project-Id-Version: gcc 14.1-b20240218\n" "Report-Msgid-Bugs-To: https://gcc.gnu.org/bugs/\n" "POT-Creation-Date: 2024-02-16 21:35+0000\n" -"PO-Revision-Date: 2023-07-29 18:00+0200\n" +"PO-Revision-Date: 2024-03-03 17:38+0100\n" "Last-Translator: Göran Uddeborg \n" "Language-Team: Swedish \n" "Language: sv\n" @@ -338,10 +340,8 @@ msgid "-install_name only allowed with -dynamiclib" msgstr "-install_name Ă€r bara tillĂ„ten med -dynamiclib" #: config/darwin.h:191 -#, fuzzy -#| msgid "-bundle not allowed with -dynamiclib" msgid "-bundle not allowed with -shared" -msgstr "-bundle Ă€r inte tillĂ„ten med -dynamiclib" +msgstr "-bundle Ă€r inte tillĂ„ten med -shared" #: config/darwin.h:192 msgid "-bundle not allowed with -dynamiclib" @@ -1045,7 +1045,7 @@ msgstr "SĂ€tt modulentiteternas standardtillgĂ€nglighet till PRIVATE." #: fortran/lang.opt:721 #, no-c-format msgid "Handle OpenMP allocators for allocatables and pointers." -msgstr "" +msgstr "Hantera OpenMP-allokerare för allokerbara och pekare." #: fortran/lang.opt:725 #, no-c-format @@ -1200,10 +1200,9 @@ msgid "Conform to the ISO Fortran 2018 standard." msgstr "Följ standarden ISO Fortran 2018." #: fortran/lang.opt:896 -#, fuzzy, no-c-format -#| msgid "Conform to the ISO Fortran 2003 standard." +#, no-c-format msgid "Conform to the ISO Fortran 2023 standard." -msgstr "Följ standarden ISO Fortran 2003." +msgstr "Följ standarden ISO Fortran 2023." #: fortran/lang.opt:900 #, no-c-format @@ -1238,12 +1237,12 @@ msgstr "Varna för oĂ€ndligt rekursiva anrop." #: rust/lang.opt:63 #, no-c-format msgid "-frust-crate= Set the crate name for the compilation" -msgstr "-frust-crate= SĂ€tt backnamn för kompileringen" +msgstr "-frust-crate= SĂ€tt lĂ„rnamn (crate) för kompileringen" #: rust/lang.opt:67 #, no-c-format msgid "-frust-extern= Specify where an external library is located" -msgstr "" +msgstr "-frust-extern= Ange var ett externt bibliotek Ă€r placerat" #: rust/lang.opt:71 #, no-c-format @@ -1251,10 +1250,9 @@ msgid "Dump various Rust front end internals." msgstr "Skriv ut diverse intern information frĂ„n Rust-framĂ€nden." #: rust/lang.opt:75 -#, fuzzy, no-c-format -#| msgid "-frust-dump-\tDump Rust frontend internal information." +#, no-c-format msgid "-frust-dump- Dump Rust frontend internal information." -msgstr "-frust-dump-\tSkriv ut Rust-framĂ€ndens interna information." +msgstr "-frust-dump- Skriv ut Rust-framĂ€ndens interna information." #: rust/lang.opt:79 #, no-c-format @@ -1262,21 +1260,19 @@ msgid "Enable experimental compilation of Rust files at your own risk" msgstr "Aktivera experimentell kompilering av Rust-filer pĂ„ egen risk" #: rust/lang.opt:83 -#, fuzzy, no-c-format -#| msgid "-frust-max-recursion-depth=integer" +#, no-c-format msgid "-frust-max-recursion-depth=" -msgstr "-frust-max-recursion-depth=heltal" +msgstr "-frust-max-recursion-depth=" #: rust/lang.opt:87 #, no-c-format msgid "-frust-crate-type=[bin|lib|rlib|dylib|cdylib|staticlib|proc-macro] Crate type to emit" -msgstr "" +msgstr "-frust-crate-type=[bin|lib|rlib|dylib|cdylib|staticlib|proc-macro] LĂ„r (crate) att skapa" #: rust/lang.opt:115 -#, fuzzy, no-c-format -#| msgid "-frust-mangling=[legacy|v0] Choose which version to use for name mangling" +#, no-c-format msgid "-frust-mangling=[legacy|v0] Version to use for name mangling" -msgstr "-frust-mangling=[legacy|v0] VĂ€lj vilken version som skall anvĂ€ndas för namnmangling" +msgstr "-frust-mangling=[legacy|v0] Version att anvĂ€nda för namnmangling" #: rust/lang.opt:128 #, no-c-format @@ -1284,37 +1280,34 @@ msgid "-frust-cfg= Set a config expansion option" msgstr "-frust-cfg= Ange ett konfigurationsutökningsalternativ" #: rust/lang.opt:132 -#, fuzzy, no-c-format -#| msgid "-frust-edition=[2015|2018|2021] Choose which edition to use when compiling rust code" +#, no-c-format msgid "-frust-edition=[2015|2018|2021] Edition to use when compiling rust code" -msgstr "-frust-edition=[2015|2018|2021] VĂ€lj vilken utgĂ„va som skall anvĂ€ndas vid kompilering av rust-kod" +msgstr "-frust-edition=[2015|2018|2021] UtgĂ„va att anvĂ€nda vid kompilering av rust-kod" #: rust/lang.opt:148 -#, fuzzy, no-c-format -#| msgid "Flag to enable embeding metadata directly into object files" +#, no-c-format msgid "Enable embedding metadata directly into object files" -msgstr "Flagga för att akvivera inbĂ€ddad metadata direkt i objektfiler" +msgstr "Aktivera inbĂ€ddad metadata direkt i objektfiler" #: rust/lang.opt:152 #, no-c-format msgid "-frust-metadata-output= Path to output crate metadata" -msgstr "-frust-metadata-output= SökvĂ€g till utdatabackens metadata" +msgstr "-frust-metadata-output= SökvĂ€g till utdatalĂ„rens (crate) metadata" #: rust/lang.opt:160 -#, fuzzy, no-c-format -#| msgid "-frust-compile-until=[ast|attributecheck|expansion|nameresolution|lowering|typecheck|privacy|unsafety|const|copimlation|end] When to stop in the pipeline when compiling Rust code" +#, no-c-format msgid "-frust-compile-until=[ast|attributecheck|expansion|astvalidation|featuregating|nameresolution|lowering|typecheck|privacy|unsafety|const|borrowcheck|compilation|end] The pipeline will run up until this stage when compiling Rust code" -msgstr "-frust-compile-until=[ast|attributecheck|expansion|nameresolution|lowering|typecheck|privacy|unsafety|const|copimlation|end] NĂ€r pipelinen skall stoppas vid kompilering av Rust-kod" +msgstr "-frust-compile-until=[ast|attributecheck|expansion|astvalidation|featuregating|nameresolution|lowering|typecheck|privacy|unsafety|const|borrowcheck|compilation|end] Pipelinen kommer köra fram till detta steg vid kompilering av Rust-kod" #: rust/lang.opt:209 #, no-c-format msgid "Use the temporary and experimental name resolution pipeline instead of the stable one" -msgstr "" +msgstr "AnvĂ€nd den temporĂ€ra och experimentella namnuppslagningspipelinen istĂ€llet för den stabila" #: rust/lang.opt:213 #, no-c-format msgid "Use the WIP borrow checker." -msgstr "" +msgstr "AnvĂ€nd WIP-lĂ„nekontrolleraren." #: c-family/c.opt:182 #, no-c-format @@ -1409,18 +1402,17 @@ msgstr "-MT \tLĂ€gg till ett mĂ„l som inte krĂ€ver citationstecken." #: c-family/c.opt:261 #, no-c-format msgid "Structured format for output dependency information. Supported (\"p1689r5\")." -msgstr "" +msgstr "Strukturerat format för utmatning av beroendeinformation. Stödjs (”p1689r5”)." #: c-family/c.opt:265 -#, fuzzy, no-c-format -#| msgid "Generate C++ Module dependency information." +#, no-c-format msgid "File for output dependency information." -msgstr "Generera C++ modulberoendeinformation." +msgstr "Fil för utdataberoendeinformation." #: c-family/c.opt:269 #, no-c-format msgid "-fdeps-target=obj.o Output file for the compile step." -msgstr "" +msgstr "-fdeps-target=obj.o Utmatningsfil för kompileringssteget." #: c-family/c.opt:273 #, no-c-format @@ -1490,7 +1482,7 @@ msgstr "Varna vid all anvĂ€ndning av alloca." #: c-family/c.opt:340 #, no-c-format msgid "Warn when allocating insufficient storage for the target type of the assigned pointer." -msgstr "" +msgstr "Varna nĂ€r otillrĂ€ckligt med lagring allokeras för mĂ„ltypen för den tilldelade pekaren." #: c-family/c.opt:344 #, no-c-format @@ -1568,16 +1560,14 @@ msgid "Warn when a built-in preprocessor macro is undefined or redefined." msgstr "Varna nĂ€r ett inbyggt preprocessormakro avdefinieras eller omdefinieras." #: c-family/c.opt:438 -#, fuzzy, no-c-format -#| msgid "Warn about features not present in ISO C11, but present in ISO C2X." +#, no-c-format msgid "Warn about features not present in ISO C11, but present in ISO C23." -msgstr "Varna för funktioner som inte finns i ISO C11, men finns i ISO C2X." +msgstr "Varna för funktioner som inte finns i ISO C11, men finns i ISO C23." #: c-family/c.opt:442 -#, fuzzy, no-c-format -#| msgid "Deprecated in favor of -std=c11." +#, no-c-format msgid "Deprecated in favor of -Wc11-c23-compat." -msgstr "Undanbedes till förmĂ„n för -std=c11." +msgstr "Undanbedes till förmĂ„n för -Wc11-c23-compat." #: c-family/c.opt:446 #, no-c-format @@ -1640,10 +1630,9 @@ msgid "Warn about C++23 constructs in code compiled with an older standard." msgstr "Varna för C++23-konstruktioner i kod kompilerad med en Ă€ldre standard." #: c-family/c.opt:503 -#, fuzzy, no-c-format -#| msgid "Warn about C++20 constructs in code compiled with an older standard." +#, no-c-format msgid "Warn about C++26 constructs in code compiled with an older standard." -msgstr "Varna för C++20-konstruktioner i kod kompilerad med en Ă€ldre standard." +msgstr "Varna för C++26-konstruktioner i kod kompilerad med en Ă€ldre standard." #: c-family/c.opt:507 #, fuzzy, no-c-format @@ -1852,7 +1841,7 @@ msgstr "Varna för brott mot stilreglerna i Effective C++." #: c-family/c.opt:683 #, no-c-format msgid "Warn if an additional enum-base is used in an elaborated-type-specifier." -msgstr "" +msgstr "Varna om en ytterligare enum-bas anvĂ€nds i en elaborated-type-specifier." #: c-family/c.opt:687 #, no-c-format @@ -1902,7 +1891,7 @@ msgstr "Varna för semikolon efter funktionsdefinitioner i klassen." #: c-family/c.opt:731 #, no-c-format msgid "Warn when a structure containing a C99 flexible array member as the last field is not at the end of another structure." -msgstr "" +msgstr "Varna nĂ€r en post som innehĂ„ller en flexibel vektormedlem enligt C99 som sista fĂ€lt inte Ă€r vid slutet av en annan post." #: c-family/c.opt:736 #, no-c-format @@ -2309,7 +2298,7 @@ msgstr "Varna för Ă„sidosĂ€ttande initierare utan sidoeffekter." #: c-family/c.opt:1129 #, no-c-format msgid "Warn if the named return value optimization is not performed although it is allowed." -msgstr "" +msgstr "Varna om optimeringen av ett namngivet returvĂ€rde inte utförs trots att det Ă€r tillĂ„tet." #: c-family/c.opt:1133 #, no-c-format @@ -2419,7 +2408,7 @@ msgstr "Varna nĂ€r ett argument skickas till restrict-kvalificerade parameterali #: c-family/c.opt:1226 #, no-c-format msgid "Warn whenever void-returning functions return a non-void expressions, or a return expression is missing in a function not returning void." -msgstr "" +msgstr "Varna nĂ€rhelst void-returnerande funktioner returnerar ett yttryck som inte Ă€v void, eller ett returuttryck saknas i en funktion som inte returnerar void." #: c-family/c.opt:1230 #, no-c-format @@ -3022,7 +3011,7 @@ msgstr "Anta normal C-körmiljö." #: c-family/c.opt:1915 #, no-c-format msgid "Implement P2564 for consteval propagation." -msgstr "" +msgstr "Implementera P2564 för consteval-propagering." #: c-family/c.opt:1919 #, no-c-format @@ -4081,7 +4070,7 @@ msgstr "LĂ€nka standard D-biblioteket dynamiskt i kompileringen." #: m2/lang.opt:35 #, no-c-format msgid "turns on case statement label compile time checking when using an expression of an enum type." -msgstr "" +msgstr "slĂ„r pĂ„ kontroller av etiketter i case-satser vid kompileringstillfĂ€llet nĂ€r ett uttryck av en enum-typ anvĂ€nds." #: m2/lang.opt:39 #, no-c-format @@ -4106,12 +4095,12 @@ msgstr "extra semantiska kontroller vid kompileringstillfĂ€llet, typiskt försö #: m2/lang.opt:55 #, no-c-format msgid "turns on compile time analysis in the first basic block of a procedure detecting access to uninitialized data." -msgstr "" +msgstr "slĂ„r pĂ„ analys vid kompileringstillfĂ€llet i det första grundblocket i en procedurdetekterad Ă„tkomst av oinitierade data." #: m2/lang.opt:59 #, no-c-format msgid "turns on compile time analysis to detect access to uninitialized variables, the checking can be specified by: known,cond,all." -msgstr "" +msgstr "slĂ„r pĂ„ analys vid kompileringstillfĂ€llet för att upptĂ€cka Ă„tkomst av oinitierade variabler, kontrollerandet kan anges med :known,cond,all." #: m2/lang.opt:63 #, no-c-format @@ -4411,7 +4400,7 @@ msgstr "-fgo-embedcfg=\tLista inbĂ€ddade filer via go:embed." #: go/lang.opt:66 #, no-c-format msgid "-fgo-importcfg=\tProvide file that tells where to find imports." -msgstr "" +msgstr "-fgo-importcfg=\tGe fil som sĂ€ger var importer finns." #: go/lang.opt:70 #, no-c-format @@ -4496,22 +4485,22 @@ msgstr "Det maximala djupet av exploderade noder som skall förekomma i en dot-d #: analyzer/analyzer.opt:59 #, no-c-format msgid "The number of bytes at which to ellipsize string literals in analyzer text art diagrams." -msgstr "" +msgstr "Antalet byte vid vilket strĂ€ngliteraler i textkonstdiagram frĂ„n analyseraren skall ha ellips." #: analyzer/analyzer.opt:63 #, no-c-format msgid "The number of literal bytes to show at the head of a string literal in text art when ellipsizing it." -msgstr "" +msgstr "Antalet literala byte att visa vid huvudet av en strĂ€ngliteral i textkonst nĂ€r den har ellips." #: analyzer/analyzer.opt:67 #, no-c-format msgid "The number of literal bytes to show at the tail of a string literal in text art when ellipsizing it." -msgstr "" +msgstr "Antalet literala byt att visa vid slutet av en strĂ€ngliteral i textkonst nĂ€r den har ellips." #: analyzer/analyzer.opt:71 #, no-c-format msgid "The ideal width in characters of text art diagrams generated by the analyzer." -msgstr "" +msgstr "Den ideala bredden i tecken för textkonstdiagram som genereras ava analysatorn." #: analyzer/analyzer.opt:75 #, no-c-format @@ -4775,7 +4764,7 @@ msgstr "BegrĂ€nsa analyseraren till att köra just den namngivna kontrollen." #: analyzer/analyzer.opt:279 #, no-c-format msgid "Add extra annotations to diagrams." -msgstr "" +msgstr "LĂ€gg till extra annotationer till diagram." #: analyzer/analyzer.opt:283 #, no-c-format @@ -4815,7 +4804,7 @@ msgstr "Aktivera transitivitet av begrĂ€nsningar under analysen." #: analyzer/analyzer.opt:311 #, no-c-format msgid "Show events within system headers in analyzer execution paths." -msgstr "" +msgstr "Visa hĂ€ndelser inom systemhuvuden i analyserarens körvĂ€gar." #: analyzer/analyzer.opt:315 #, no-c-format @@ -5880,7 +5869,7 @@ msgstr "-march=\tGenerera kod för angiven RISC-V ISA (t.ex. RV64IM). ISA-strĂ€ #: config/riscv/riscv.opt:91 #, no-c-format msgid "-march=help\tPrint supported -march extensions." -msgstr "" +msgstr "-march=help\tSkriv ut de utökningar av -march som stödjs." #: config/riscv/riscv.opt:103 config/mips/mips.opt:430 #, no-c-format @@ -6027,7 +6016,7 @@ msgstr "Reducera stackjusteringen vid anropsplatsen om möjligt." #: config/riscv/riscv.opt:529 #, no-c-format msgid "Max number of bytes to compare as part of inlined strcmp/strncmp routines (default: 64)." -msgstr "" +msgstr "Max antal byte att jĂ€mföra som en del av inline:ade strcmp/strncmp-rutiner (standard: 64)." #: config/riscv/riscv.opt:533 #, fuzzy, no-c-format @@ -6038,17 +6027,17 @@ msgstr "Giltiga argument till -mcode-readable=:" #: config/riscv/riscv.opt:546 #, no-c-format msgid "-param=riscv-autovec-preference=\tSet the preference of auto-vectorization in the RISC-V port." -msgstr "" +msgstr "-param=riscv-autovec-preference=\tSĂ€tt preferensen för autovektorisering i RISC-V-porteringen." #: config/riscv/riscv.opt:550 #, no-c-format msgid "The RVV possible LMUL (-param=riscv-autovec-lmul=):" -msgstr "" +msgstr "De RVV-möjliga LMUL (-param=riscv-autovec-lmul=):" #: config/riscv/riscv.opt:569 #, no-c-format msgid "-param=riscv-autovec-lmul=\tSet the RVV LMUL of auto-vectorization in the RISC-V port." -msgstr "" +msgstr "-param=riscv-autovec-lmul=\tSĂ€tt RVV LMUL:en för autovektorisering i RISC-V-porteringen." #: config/riscv/riscv.opt:576 #, fuzzy, no-c-format @@ -6059,7 +6048,7 @@ msgstr "Giltiga argument till -mstringop-strategy=:" #: config/riscv/riscv.opt:589 #, no-c-format msgid "-param=vsetvl-strategy=\tSet the optimization level of VSETVL insert pass." -msgstr "" +msgstr "-param=vsetvl-strategy=\tSĂ€tt optimeringsnivĂ„n för VSETVL-infogningspasset." #: config/riscv/riscv.opt:593 config/i386/i386.opt:496 #, no-c-format @@ -6317,7 +6306,7 @@ msgstr "Aktivera approximationen av division. Att aktivera detta reducerar prec #: config/aarch64/aarch64.opt:254 #, no-c-format msgid "Specify when to enable an early register allocation pass. The possibilities are: all functions, functions that have access to strided multi-register instructions, and no functions." -msgstr "" +msgstr "Ange nĂ€r ett tidigt registerallokeringspass skall aktiveras. Möjligheterna Ă€r: alla funktioner, funktioner som har tillgĂ„ng till stegvisa multiregisterinstruktioner och inga funktioner." #: config/aarch64/aarch64.opt:260 #, no-c-format @@ -6342,12 +6331,12 @@ msgstr "Generera kod för att spĂ„ra nĂ€r CPU:n kan spekulera felaktigt." #: config/aarch64/aarch64.opt:294 #, no-c-format msgid "Enable the copy of the AArch64 load/store pair fusion pass that runs before register allocation." -msgstr "" +msgstr "Aktivera kopieringen av sammanslagningspasset av load/store-par för AArch64 som köre före registerallokering." #: config/aarch64/aarch64.opt:299 #, no-c-format msgid "Enable the copy of the AArch64 load/store pair fusion pass that runs after register allocation." -msgstr "" +msgstr "Aktivera kopieringen av sammanslagningspasset av load/store-par för AArch64 som köre efter registerallokering." #: config/aarch64/aarch64.opt:318 #, no-c-format @@ -6367,7 +6356,7 @@ msgstr "Generera lokala anrop till atomĂ€ra operationer utanför linjen." #: config/aarch64/aarch64.opt:337 #, no-c-format msgid "When vectorizing, consider using multiple different approaches and use the cost model to choose the cheapest one." -msgstr "" +msgstr "ÖvervĂ€g vid vektorisering att anvĂ€nda flera olika tillvĂ€gagĂ„ngssĂ€tt och anvĂ€nd kostnadsmodellen för att vĂ€lja den billigaste." #: config/aarch64/aarch64.opt:342 #, no-c-format @@ -6402,22 +6391,22 @@ msgstr "BegrĂ€nsa hur mycket autovektoriseraren fĂ„r rulla ut en slinga." #: config/aarch64/aarch64.opt:372 #, no-c-format msgid "--param=aarch64-ldp-policy=[default|always|never|aligned] Fine-grained policy for load pairs." -msgstr "" +msgstr "--param=aarch64-ldp-policy=[default|always|never|aligned] Finkorning policy för laddningspar." #: config/aarch64/aarch64.opt:376 #, no-c-format msgid "--param=aarch64-stp-policy=[default|always|never|aligned] Fine-grained policy for store pairs." -msgstr "" +msgstr "--param=aarch64-stp-policy=[default|always|never|aligned] Finkorning policy för lagringspar." #: config/aarch64/aarch64.opt:395 #, no-c-format msgid "Limit on number of alias checks performed when attempting to form an ldp/stp." -msgstr "" +msgstr "GrĂ€ns pĂ„ antal aliaskontroller som utförs vid försök att forma en ldp/stp." #: config/aarch64/aarch64.opt:399 #, no-c-format msgid "Param to control which writeback opportunities we try to handle in the load/store pair fusion pass. A value of zero disables writeback handling. One means we try to form pairs involving one or more existing individual writeback accesses where possible. A value of two means we also try to opportunistically form writeback opportunities by folding in trailing destructive updates of the base register used by a pair." -msgstr "" +msgstr "Parameter för att styra vilka Ă„terskrivningsmöjligheter vi försöker hantera i sammanslagningspasset av load/store-par. VĂ€rdet noll avaktiverar Ă„terskrivningshantering. Ett betyder att vi försöker forma par som inbegriper en eller flera Ă„terskrivningsĂ„tkomster nĂ€r möjligt. Ett vĂ€rde pĂ„ tvĂ„ betyder att vi Ă€ven försöker att opportunistiskt forma Ă„terskrivningsmöjligheter genom vikning i avslutande destruktiva uppdateringar av basregistret som anvĂ€nds av ett par." #: config/linux.opt:24 #, no-c-format @@ -7020,7 +7009,7 @@ msgstr "Placera relokerad endast lĂ€sbar data i .data-sektionen." #: config/i386/mingw.opt:23 #, no-c-format msgid "Preprocess, compile or link with specified C RunTime DLL library." -msgstr "" +msgstr "Preprocessa, kompilera eller lĂ€nka med det angivna C körtids-DLL-biblioteket." #: config/i386/mingw.opt:33 #, no-c-format @@ -7374,7 +7363,7 @@ msgstr "KĂ€nd föredragen registervektorlĂ€ngd (att anvĂ€ndas med flaggan -mpref #: config/i386/i386.opt:652 #, no-c-format msgid "Enable floating-point status flags setting SSE vector operations on partial vectors." -msgstr "" +msgstr "Aktivera SSE-vektoroperationer för flyttal som sĂ€tter statusflaggor pĂ„ partiella vektorer." #: config/i386/i386.opt:656 #, no-c-format @@ -8090,12 +8079,12 @@ msgstr "Aktivera vektorisering av trĂ€d." #: config/i386/i386.opt:1331 #, no-c-format msgid "Support code generation for APX features, including EGPR, PUSH2POP2, NDD and PPX." -msgstr "" +msgstr "Stöd kodgenerering för APX-funktioner, inklusive EGPR, PUSH2POP2, NDD och PPX." #: config/i386/i386.opt:1360 #, no-c-format msgid "Enable GPR32 in inline asm when APX_F enabled." -msgstr "" +msgstr "Aktivera GPR32 i inline:ad asm nĂ€r APX_F Ă€r aktiverat." #: config/i386/i386.opt:1364 #, fuzzy, no-c-format @@ -8570,12 +8559,12 @@ msgstr "NĂ€r RAM skall nĂ„s, anvĂ€nd X som hĂ„rdvaran framtvingar, d.v.s. anvĂ€n #: config/avr/avr.opt:99 #, no-c-format msgid "The device has the bitfield NVMCTRL_CTRLB.FLMAP. This option is used internally." -msgstr "" +msgstr "Enheten har bitfĂ€ltet NVMCTRL_CTRLB.FLMAP. Denna flagga anvĂ€nds internt." #: config/avr/avr.opt:103 #, no-c-format msgid "The device has the .rodata section located in the RAM area." -msgstr "" +msgstr "Enheten har sektionen .rodata placerad i RAM-omrĂ„det." #: config/avr/avr.opt:108 #, no-c-format @@ -8915,7 +8904,7 @@ msgstr "Slagra alla argumentregister pĂ„ stacken." #: config/s390/s390.opt:335 #, no-c-format msgid "Assume external symbols to be potentially unaligned. By default all symbols without explicit alignment are assumed to reside on a 2 byte boundary as mandated by the IBM Z ABI." -msgstr "" +msgstr "Anta att externa symboler potentiellt Ă€r ojusterade. Som standard antas alla symboler utan en explicit justering att ligga pĂ„ en 2-bytegrĂ€ns sĂ„ som IBM Z ABI:et krĂ€ver." #: config/rl78/rl78.opt:27 config/rx/elf.opt:26 config/csky/csky.opt:198 #, no-c-format @@ -10235,12 +10224,12 @@ msgstr "-march=ISA\tGenerera kod för den angivna ISA:n." #: config/loongarch/loongarch.opt:98 #, no-c-format msgid "Enable LoongArch SIMD Extension (LSX, 128-bit)." -msgstr "" +msgstr "Aktivera LoongArch SIMD-utvidgningen (LSX, 128-bitar)." #: config/loongarch/loongarch.opt:102 #, no-c-format msgid "Enable LoongArch Advanced SIMD Extension (LASX, 256-bit)." -msgstr "" +msgstr "Aktivera LoongArch Advanced SIMD-utvidgningen (LASX, 256-bit)." #: config/loongarch/loongarch.opt:107 #, no-c-format @@ -10346,7 +10335,7 @@ msgstr "Stöd flaggbevarande add-carry-instruktioner." #: config/loongarch/loongarch.opt:280 #, no-c-format msgid "Support div.w[u] and mod.w[u] instructions with inputs not sign-extended." -msgstr "" +msgstr "Stöd instruktionerna div.w[u] och mod.w[u] med indata som inte Ă€r teckenutvidgat." #: config/loongarch/loongarch.opt:284 #, fuzzy, no-c-format @@ -10363,7 +10352,7 @@ msgstr "Stöd instruktionerna XSAVEC." #: config/loongarch/loongarch.opt:292 #, no-c-format msgid "Do not need load-load barriers (dbar 0x700)." -msgstr "" +msgstr "Behöver inte load-load-barriĂ€rer (dbar 0x700)." #: config/or1k/elf.opt:28 #, no-c-format @@ -13457,7 +13446,7 @@ msgstr "Aktivera operationskoderna ENTER_S och LEAVE_S för ARCv2." #: config/vxworks-smp.opt:25 #, no-c-format msgid "Select VxWorks SMP C runtimes for linking." -msgstr "" +msgstr "VĂ€lj körtids VxWorks SMP C till lĂ€nkning." #: lto/lang.opt:50 #, no-c-format @@ -13717,7 +13706,7 @@ msgstr "Varna vid försök att frigöra ett icke-heap-objekt." #: common.opt:639 #, no-c-format msgid "Warn when -fhardened did not enable an option from its set." -msgstr "" +msgstr "Varna nĂ€r -fardened inte aktiverade nĂ„gon flagga frĂ„n sin uppsĂ€ttning." #: common.opt:650 #, no-c-format @@ -14203,7 +14192,7 @@ msgstr "Utför ett optimeringspass för kopieringspropagering av register." #: common.opt:1263 #, no-c-format msgid "Fold instructions calculating memory offsets to the memory access instruction if possible." -msgstr "" +msgstr "Vik instruktioner som berĂ€knar minnesavstĂ„nd till minnesĂ„tkomstinstruktionen om möjligt." #: common.opt:1267 #, no-c-format @@ -14394,7 +14383,7 @@ msgstr "Visa stackdjup för hĂ€ndelser i vĂ€gar." #: common.opt:1525 #, no-c-format msgid "-fdiagnostics-text-art-charset=[none|ascii|unicode|emoji]\tDetermine which characters to use in text arg diagrams." -msgstr "" +msgstr "-fdiagnostics-text-art-charset=[none|ascii|unicode|emoji]\tBestĂ€m vilka tecken som anvĂ€nds i textargumentdiagram." #: common.opt:1544 #, no-c-format @@ -14659,7 +14648,7 @@ msgstr "Aktivera att grensannolikheter gissas." #: common.opt:1834 #, no-c-format msgid "Enable various security-relevant flags." -msgstr "" +msgstr "Aktivera olika sĂ€kerhetsrelevanta flaggor." #: common.opt:1838 #, no-c-format @@ -14686,17 +14675,17 @@ msgstr "avaktivera pass %s för funktionen %s" #: common.opt:1854 #, no-c-format msgid "Check CFR execution paths also before calls followed by returns of their results." -msgstr "" +msgstr "Kontrollera CFR-körvĂ€gen Ă€ven före anrop som följs av returer av deras resultat." #: common.opt:1858 #, no-c-format msgid "Check CFR execution paths also when exiting a function through an exception." -msgstr "" +msgstr "Kontrollera CFR-körvĂ€gen Ă€ven vid avslut av en funktion genom ett undantag." #: common.opt:1862 #, no-c-format msgid "-fhardcfr-check-noreturn-calls=[always|no-xthrow|nothrow|never]\tCheck CFR execution paths also before calling noreturn functions." -msgstr "" +msgstr "-fhardcfr-check-noreturn-calls=[always|no-xthrow|nothrow|never]\tKontrollera CFR-körvĂ€gar Ă€ven före anrop av noreturn-funktioner." #: common.opt:1885 #, no-c-format @@ -14766,7 +14755,7 @@ msgstr "Inline:a __atomic-operationer nĂ€r en lĂ„sningsfri instruktionssekvens #: common.opt:1968 #, no-c-format msgid "-finline-stringops[=memcmp|memcpy|memmove|memset] Expand supported mem/str operations inline, even if against optimization." -msgstr "" +msgstr "-finline-stringops[=memcmp|memcpy|memmove|memset] Expandera de stödda mem/str operationerna inline, Ă€ven om det Ă€r emot optimeringen." #: common.opt:1999 #, no-c-format @@ -15652,17 +15641,17 @@ msgstr "Behandla spill med tecken som odefinierat. Negeras som -fwrapv -fwrapv- #: common.opt:2931 #, no-c-format msgid "Disable stack scrub entirely, disregarding strub attributes." -msgstr "" +msgstr "Avaktivera helt stackskrubbning, bortse frĂ„n strub-attribut." #: common.opt:2935 #, no-c-format msgid "Enable stack scrub as per attributes, with strict call checking." -msgstr "" +msgstr "Aktivera stackskrubbning enligt attribut, med strikt anropskontroll." #: common.opt:2944 #, no-c-format msgid "Restore default strub mode: as per attributes, with relaxed checking." -msgstr "" +msgstr "ÅterstĂ€ll strub-lĂ€get: enligt attribut, med lĂ€ttare kontroller." #: common.opt:2948 #, fuzzy, no-c-format @@ -15673,7 +15662,7 @@ msgstr "Aktivera hwasan-instrumentering av inbyggda funktioner." #: common.opt:2952 #, no-c-format msgid "Enable at-calls stack scrubbing for all viable functions." -msgstr "" +msgstr "Aktivera stackskrubbning vid anrop för alla möjliga funktioner." #: common.opt:2956 #, fuzzy, no-c-format @@ -15734,7 +15723,7 @@ msgstr "För mĂ„l som normalt anvĂ€nder trampoliner för nĂ€stade funktioner, ge #: common.opt:3016 #, no-c-format msgid "Whether trampolines are generated in executable memory rather than executable stack." -msgstr "" +msgstr "Huruvida trampoliner genereras i körbart minne snarare Ă€n pĂ„ körbar stack." #: common.opt:3034 #, no-c-format @@ -16470,7 +16459,7 @@ msgstr "Skalfaktor att anvĂ€nda pĂ„ antalet satser i en trĂ„dningsvĂ€g som korsa #: params.opt:139 #, no-c-format msgid "Whether the target fully pipelines FMA instructions. If non-zero, reassociation considers the benefit of parallelizing FMA's multiplication part and addition part, assuming FMUL and FMA use the same units that can also do FADD." -msgstr "" +msgstr "Huruvida mĂ„let fullt ut anvĂ€nder pipeline för FMA-instruktioner. Om skilt frĂ„n noll bedömer reassocieringar fördelen av att parallellisera FMA:ers multiplikationsdel och additionsdel, under antagandet att FMUL och FMA anvĂ€nder samma enheter som Ă€ven kan göra FADD." # Undrar om jag fattat syftningen i "critical edges execution count" rĂ€tt! #: params.opt:146 @@ -16526,12 +16515,12 @@ msgstr "Maximalt antal parameter i en SCoP." #: params.opt:186 #, no-c-format msgid "Maximum number of blocks for -fharden-control-flow-redundancy." -msgstr "" +msgstr "Maximalt antal block för -fharden-control-flow-redundancy." #: params.opt:190 #, no-c-format msgid "Maximum number of blocks for in-line -fharden-control-flow-redundancy." -msgstr "" +msgstr "Maximalt antal block för inline -fharden-control-flow-redundancy." #: params.opt:194 #, no-c-format @@ -17592,7 +17581,7 @@ msgstr "Det maximala antalet nĂ€stade anrop att söka i efter styrberoenden unde #: params.opt:1126 #, no-c-format msgid "Maximum number of predicates anded for each predicate ored in the normalized predicate chain." -msgstr "" +msgstr "Maximalt antal predikat med \"and\" för varje predikat med \"or\" i den normaliserade predikatkedjan." #: params.opt:1131 #, fuzzy, no-c-format @@ -22429,15 +22418,15 @@ msgstr "antalet resultat stĂ€mmer inte med antalet vĂ€rden" #: go/gofrontend/expressions.cc:14671 msgid "invalid 3-index slice of object that is not a slice" -msgstr "" +msgstr "ogiltig 3-indexskiva av objekt som inte Ă€r en skiva" #: go/gofrontend/expressions.cc:14674 msgid "attempt to slice object that is not array, slice, or string" -msgstr "" +msgstr "försök att skiva objekt som inte Ă€r en vektor, skiva eller strĂ€ng" #: go/gofrontend/expressions.cc:14677 msgid "attempt to index object that is not array, slice, string, or map" -msgstr "" +msgstr "försök att indexera objekt som inte Ă€r en vektor, skiva, strĂ€ng eller avbildning" #: go/gofrontend/expressions.cc:14730 #, fuzzy @@ -22467,15 +22456,15 @@ msgstr "grĂ€nssnitt eller pekare till grĂ€nssnitt förvĂ€ntades" #: go/gofrontend/expressions.cc:18212 msgid "may only omit types within composite literals of slice, array, or map type" -msgstr "" +msgstr "kan endast utelĂ€mna typer med sammanstatta litteraler av typen skiva, vektor eller avbildning" #: go/gofrontend/expressions.cc:18306 go/gofrontend/expressions.cc:18618 msgid "map composite literal must have keys" -msgstr "" +msgstr "avbildning av sammansatta litteraler mĂ„ste ha nycklar" #: go/gofrontend/expressions.cc:18651 msgid "expected struct, slice, array, or map type for composite literal" -msgstr "" +msgstr "en av typerna post, skiva, vektor eller avbildning förvĂ€ntades för en sammanstatt litteral" #: go/gofrontend/expressions.cc:19266 go/gofrontend/statements.cc:2121 msgid "type assertion only valid for interface types" @@ -22699,7 +22688,7 @@ msgstr "metoden %s%s%s Ă€r mĂ€rkt go:nointerface" #: rust/resolve/rust-ast-resolve-expr.cc:140 #, c-format msgid "You have broken GCC Rust. This is a feature.\n" -msgstr "" +msgstr "Du har haft sönder GCC Rust. Detta Ă€r en finess.\n" #: lto-streamer.h:1033 #, gcc-internal-format, gfc-internal-format @@ -23012,10 +23001,9 @@ msgid "Unrecognized option: %qs" msgstr "OkĂ€nd flagga: %qs" #: rust/lang.opt:90 -#, fuzzy, gcc-internal-format -#| msgid "unknown lam type %qs" +#, gcc-internal-format msgid "unknown crate type: '%qs'" -msgstr "okĂ€nd lam-typ %qs" +msgstr "okĂ€nd lĂ„rtyp (crate): ”%qs”" #: rust/lang.opt:118 #, gcc-internal-format @@ -23174,27 +23162,27 @@ msgstr "%<-msse5%> togs bort" #: config/i386/i386.opt:741 #, gcc-internal-format msgid "AVX512PF support will be removed in GCC 15" -msgstr "" +msgstr "stöd för AVX512PF kommer tas bort i GCC 15" #: config/i386/i386.opt:745 #, gcc-internal-format msgid "AVX512ER support will be removed in GCC 15" -msgstr "" +msgstr "stöd för AVX512ER kommer tas bort i GCC 15" #: config/i386/i386.opt:773 #, gcc-internal-format msgid "AVX5124FMAPS support will be removed in GCC 15" -msgstr "" +msgstr "stöd för AVX5124FMAPS kommer tas bort i GCC 15" #: config/i386/i386.opt:777 #, gcc-internal-format msgid "AVX5124VNNIW support will be removed in GCC 15" -msgstr "" +msgstr "stöd för AVX5124VNNIW kommer tas bort i GCC 15" #: config/i386/i386.opt:972 #, gcc-internal-format msgid "PREFETCHWT1 support will be removed in GCC 15" -msgstr "" +msgstr "stöd för PREFETCHWT1 kommer tas bort i GCC 15" #: config/i386/i386.opt:1286 #, gcc-internal-format @@ -23283,7 +23271,7 @@ msgstr "okĂ€nd stackĂ„teranvĂ€ndningsmodell %qs" #: common.opt:1972 #, gcc-internal-format msgid "unavailable stringop for inlining %qs" -msgstr "" +msgstr "oĂ„tkomlig strĂ€ngoperation för inlining %qs" #: common.opt:2003 #, gcc-internal-format @@ -25685,7 +25673,7 @@ msgstr "%qs Ă€r en okĂ€nd flagga till %<-save-temps%>" #: gcc.cc:5024 #, gcc-internal-format msgid "linker hardening options not enabled by %<-fhardened%> because other link options were specified on the command line" -msgstr "" +msgstr "flaggor för lĂ€nkarhĂ€rdning aktiveras inte av %<-fhardened%> för att andra lĂ€nkflaggor angavs pĂ„ kommandoraden" #: gcc.cc:5048 toplev.cc:712 #, gcc-internal-format @@ -26236,17 +26224,17 @@ msgstr "%s stödjs inte pĂ„ denna mĂ„larkitektur" #: gimple-harden-control-flow.cc:97 #, gcc-internal-format msgid "%qD calls % or similar, %<-fharden-control-flow-redundancy%> is not supported" -msgstr "" +msgstr "%qD anropar % eller liknande, %<-fharden-control-flow-redundancy%> stödjs inte" #: gimple-harden-control-flow.cc:110 #, gcc-internal-format msgid "%qD receives nonlocal gotos, %<-fharden-control-flow-redundancy%> is not supported" -msgstr "" +msgstr "%qD tar emot ickelokala goto, %<-fharden-control-flow-redundancy%> stödjs inte" #: gimple-harden-control-flow.cc:121 #, gcc-internal-format msgid "%qD has more than %u blocks, the requested maximum for %<-fharden-control-flow-redundancy%>" -msgstr "" +msgstr "%qD har fler Ă€n %u block, det begĂ€rda maximumet för %<-fharden-control-flow-redundancy%>" #: gimple-ssa-isolate-paths.cc:290 #, gcc-internal-format @@ -28579,7 +28567,7 @@ msgstr "pass %s stödjer inte kloning" #: ipa-strub.cc:654 #, gcc-internal-format msgid "%qD is not eligible for % on the target system" -msgstr "" +msgstr "%qD Ă€r inte berĂ€ttigat till % pĂ„ mĂ„lsystemet" #: ipa-strub.cc:658 #, fuzzy, gcc-internal-format @@ -28590,37 +28578,37 @@ msgstr "ej stödd konstant adress:" #: ipa-strub.cc:684 #, gcc-internal-format msgid "%qD is not eligible for % because %<-fsplit-stack%> is enabled" -msgstr "" +msgstr "%qD Ă€r inte berĂ€ttigat till % pĂ„ grund av att %<-fsplit-stack%> Ă€r aktiverat" #: ipa-strub.cc:697 #, gcc-internal-format msgid "%qD is not eligible for % because of attribute %" -msgstr "" +msgstr "%qD Ă€r inte berĂ€ttigat till % pĂ„ grund av attriutet %" #: ipa-strub.cc:712 #, gcc-internal-format msgid "%qD is not eligible for % because of attribute %" -msgstr "" +msgstr "%qD Ă€r inte berĂ€ttigat till % pĂ„ grund av attributet %" #: ipa-strub.cc:846 #, gcc-internal-format msgid "%qD is not eligible for internal % because of attribute %" -msgstr "" +msgstr "%qD Ă€r inte berĂ€ttigat till internt % pĂ„ grund av attributet %" #: ipa-strub.cc:870 #, gcc-internal-format msgid "%qD is not eligible for internal % because it calls %qD" -msgstr "" +msgstr "%qD Ă€r inte berĂ€ttigat till internt % pĂ„ grund av att det anropar %qD" #: ipa-strub.cc:884 #, gcc-internal-format msgid "%qD is not eligible for internal % because it contains a non-local goto target" -msgstr "" +msgstr "%qD Ă€r inte berĂ€ttigat till internt % pĂ„ grund av att det innehĂ„ller ett icke-lokalt goto-mĂ„l" #: ipa-strub.cc:897 #, gcc-internal-format msgid "%qD is not eligible for internal % because the address of a local label escapes" -msgstr "" +msgstr "%qD Ă€r inte berĂ€ttigat till internt % pĂ„ grund av att det Ă€r adressen till en lokal etikett smiter" #: ipa-strub.cc:936 #, fuzzy, gcc-internal-format @@ -28637,37 +28625,37 @@ msgstr "för mĂ„nga argument för formatstrĂ€ng" #: ipa-strub.cc:1227 #, gcc-internal-format msgid "%qD requires %, but no viable % mode was found" -msgstr "" +msgstr "%qD krĂ€ver %, men inget möjligt %-lĂ€ge finns" #: ipa-strub.cc:1323 #, gcc-internal-format msgid "% mode %qE selected for %qD, when %qE was requested" -msgstr "" +msgstr "%-lĂ€get %qE valt till %qD, nĂ€r %qE begĂ€rdes" #: ipa-strub.cc:1332 #, gcc-internal-format msgid "the incompatible selection was determined by ultimate alias target %qD" -msgstr "" +msgstr "det inkompatibla valet avgjordes av det slutliga aliasmĂ„let %qD" #: ipa-strub.cc:1679 #, gcc-internal-format msgid "indirect non-% call in % context %qD" -msgstr "" +msgstr "indirekt icke-%-anrop i %-sammanhanget %qD" #: ipa-strub.cc:1698 #, gcc-internal-format msgid "calling % % %qD in non-% context %qD" -msgstr "" +msgstr "anropar % % %qD i icke-%-sammanhanget %qD" #: ipa-strub.cc:1708 #, gcc-internal-format msgid "calling non-% %qD in % context %qD" -msgstr "" +msgstr "anropar icke-% %qD i %-sammanhanget %qD" #: ipa-strub.cc:1712 #, gcc-internal-format msgid "calling %qD using non-% type %qT in % context %qD" -msgstr "" +msgstr "anropar %qD med icke-%-typen %qT i %-sammanhanget %qD" #: ipa-strub.cc:2834 #, fuzzy, gcc-internal-format @@ -29759,12 +29747,12 @@ msgstr "sektionsankare mĂ„ste vara avaktiverade nĂ€r ordningsĂ€ndring pĂ„ toppni #: opts.cc:1105 #, gcc-internal-format msgid "%<-ftrivial-auto-var-init=zero%> is not enabled by %<-fhardened%> because it was specified on the command line" -msgstr "" +msgstr "%<-ftrivial-auto-var-init=zero%> aktiveras inte av %<-fhardened%> eftersom det angavs pĂ„ kommandoraden" #: opts.cc:1155 #, gcc-internal-format msgid "%<-fstack-protector-strong%> is not enabled by %<-fhardened%> because it was specified on the command line" -msgstr "" +msgstr "%<-fstack-protector-strong%> aktiveras inte av %<-fhardened%> eftersom det angavs pĂ„ kommandoraden" #: opts.cc:1200 #, gcc-internal-format @@ -31081,7 +31069,7 @@ msgstr "%<-fstack-clash-protection%> stödjs inte pĂ„ mĂ„l dĂ€r stacken vĂ€xer f #: toplev.cc:1598 #, gcc-internal-format msgid "%<-fstack-clash-protection%> is not enabled by %<-fhardened%> because %<-fstack-check%> was specified on the command line" -msgstr "" +msgstr "%<-fstack-clash-protection%> aktiveras inte av %<-fhardened%> eftersom %<-fstack-check%> specificerades pĂ„" #: toplev.cc:1608 #, gcc-internal-format @@ -31851,7 +31839,7 @@ msgstr "extra klammergrupp vid slutet av initierare" #: tree-cfg.cc:5720 #, gcc-internal-format msgid "probability of edge from entry block not initialized" -msgstr "" +msgstr "sannolikheten för bĂ„gen frĂ„n ingĂ„ngsblocket Ă€r inte initierad" #: tree-cfg.cc:5735 #, fuzzy, gcc-internal-format, gfc-internal-format @@ -33445,12 +33433,12 @@ msgstr "attributet %qE har ingen effekt pĂ„ enhetslokala funktioner" #: c-family/c-attribs.cc:1921 c-family/c-attribs.cc:3492 #, gcc-internal-format msgid "%qE attribute ignored because %qD is not a variable" -msgstr "attributet %qE ignorerat för att %qD inte Ă€r en variabel" +msgstr "attributet %qE ignorerat eftersom %qD inte Ă€r en variabel" #: c-family/c-attribs.cc:1927 #, gcc-internal-format msgid "%qE attribute ignored because %qD is not a local variable" -msgstr "attributet %qE ignorerat för att %qD inte Ă€r en lokal variabel" +msgstr "attributet %qE ignorerat eftersom %qD inte Ă€r en lokal variabel" #: c-family/c-attribs.cc:1952 config/i386/i386-options.cc:4154 #, gcc-internal-format @@ -33591,7 +33579,7 @@ msgstr "minnesjustering kan inte anges för %q+D" #: c-family/c-attribs.cc:2685 #, gcc-internal-format msgid "ignoring attribute %<%E (%u)%> because it conflicts with attribute %<%E (%u)%>" -msgstr "ignorerar attributet %<%E (%u)%> för att det stĂ„r i konflikt med attributet %<%E (%u)%>" +msgstr "ignorerar attributet %<%E (%u)%> eftersom det stĂ„r i konflikt med attributet %<%E (%u)%>" #: c-family/c-attribs.cc:2730 #, gcc-internal-format @@ -33768,7 +33756,7 @@ msgstr "attributet %qE ignorerat typer som inte Ă€r klasser" #: c-family/c-attribs.cc:3403 jit/dummy-frontend.cc:592 #, gcc-internal-format msgid "%qE attribute ignored because %qT is already defined" -msgstr "attributet %qE ignorerat för att %qT redan Ă€r definierat" +msgstr "attributet %qE ignorerat eftersom %qT redan Ă€r definierat" #: c-family/c-attribs.cc:3416 jit/dummy-frontend.cc:605 #, gcc-internal-format @@ -33799,7 +33787,7 @@ msgstr "%qD deklarerades %qs vilket medför standardsynlighet" #: c-family/c-attribs.cc:3500 #, gcc-internal-format msgid "%qE attribute ignored because %qD does not have thread storage duration" -msgstr "attributet %qE ignorerat för att %qD inte har trĂ„dlagringsvaraktighet" +msgstr "attributet %qE ignorerat eftersom %qD inte har trĂ„dlagringsvaraktighet" #: c-family/c-attribs.cc:3522 #, gcc-internal-format @@ -35730,10 +35718,12 @@ msgstr "samma slingiterationsvariabler %qD anvĂ€nda i flera associerade slingor" msgid "two different outer iteration variables %qD and %qD used in a single loop" msgstr "tvĂ„ olika yttre iterationsvariabler %qD och %qD anvĂ€nda i en enda slinga" +# %s blir en oöversĂ€ttbar engelsk text +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114112 #: c-family/c-omp.cc:1810 #, gcc-internal-format msgid "variable %qD used %s is bound in intervening code" -msgstr "" +msgstr "variabeln %qD anvĂ€nd %s Ă€r bunden i mellanliggande kod" #: c-family/c-omp.cc:2409 #, gcc-internal-format @@ -35794,7 +35784,7 @@ msgstr "förĂ„ldrad flagga %<-I-%> anvĂ€nd, anvĂ€nd %<-iquote%> istĂ€llet" #: c-family/c-opts.cc:373 #, gcc-internal-format msgid "%<-fdeps-format=%> unknown format %<%s%>" -msgstr "" +msgstr "%<-fdeps-format=%> okĂ€nt format %<%s%>" #: c-family/c-opts.cc:455 #, gcc-internal-format @@ -35869,7 +35859,7 @@ msgstr "externa TLS-initieringsfunktioner stödjs inte pĂ„ denna mĂ„larkitektur" #: c-family/c-opts.cc:1149 #, gcc-internal-format msgid "%<-fconcepts-ts%> is deprecated and will be removed in GCC 15; please convert your code to C++20 concepts" -msgstr "" +msgstr "%<-fconcepts-ts%> undanbedes och kommer tas bort i GCC 15; konvertera din kod till C++20-koncept" #: c-family/c-opts.cc:1158 #, gcc-internal-format @@ -35894,7 +35884,7 @@ msgstr "nĂ€r beroendefil %s öppnades: %m" #: c-family/c-opts.cc:1381 #, gcc-internal-format msgid "%<-MF%> and %<-fdeps-file=%> cannot share an output file %s: %m" -msgstr "" +msgstr "%<-MF%> och %<-fdeps-file=%> kan inte dela en utdatafil %s: %m" #: c-family/c-opts.cc:1391 #, gcc-internal-format @@ -35929,17 +35919,17 @@ msgstr "%<-fdirectives-only%> Ă€r inkompatibel med %<-traditional%>" #: c-family/c-opts.cc:1634 #, gcc-internal-format msgid "%<_FORTIFY_SOURCE%> is not enabled by %<-fhardened%> because optimizations are turned off" -msgstr "" +msgstr "%<_FORTIFY_SOURCE%> aktiveras inte av %<-fhardened%> eftersom optimeringar Ă€r avslagna" #: c-family/c-opts.cc:1638 #, gcc-internal-format msgid "%<_FORTIFY_SOURCE%> is not enabled by %<-fhardened%> because it was specified in %<-D%> or %<-U%>" -msgstr "" +msgstr "%<_FORTIFY_SOURCE%> aktiveras inte av %<-fhardened%> eftersom det angavs av %<-D%> eller %<-U%>" #: c-family/c-opts.cc:1644 #, gcc-internal-format msgid "%<_GLIBCXX_ASSERTIONS%> is not enabled by %<-fhardened%> because it was specified in %<-D%> or %<-U%>" -msgstr "" +msgstr "%<_GLIBCXX_ASSERTIONS%> aktiveras inte av %<-fhardened%> eftersom det angavs av %<-D%> eller %<-U%>" #: c-family/c-opts.cc:1768 #, gcc-internal-format @@ -37042,7 +37032,7 @@ msgstr "avbrottshanteringrutiner kan endast ha ett pekarargument och ett valfrit #: c-family/c-warn.cc:2293 #, gcc-internal-format msgid "earlier argument should specify number of elements, later size of each element" -msgstr "" +msgstr "tidigare argument skulle ange antalet element, senare storlek pĂ„ varje element" #: c-family/c-warn.cc:2332 #, fuzzy, gcc-internal-format @@ -37537,7 +37527,7 @@ msgstr "%<-march=%s%>: utökningen %qs förekommer mer Ă€n en gĂ„ng." #: common/config/riscv/riscv-common.cc:692 #, gcc-internal-format msgid "%<-march=%s%>: extension %qs starts with 's' but is unsupported standard supervisor extension" -msgstr "" +msgstr "%<-march=%s%>: utvidgningen %qs börjar med ”s” men Ă€r en standardövervakarutvidgning som inte stöjds" #: common/config/riscv/riscv-common.cc:700 #, fuzzy, gcc-internal-format @@ -37988,7 +37978,7 @@ msgstr "argument mĂ„ste vara en 16-bitars konstant omedelbar" #: config/aarch64/aarch64-builtins.cc:2700 #, gcc-internal-format msgid "128-bit system register support requires the % extension" -msgstr "" +msgstr "128-bitars systemregisterstöd krĂ€ver utvidgningen %" #: config/aarch64/aarch64-builtins.cc:2715 #, fuzzy, gcc-internal-format @@ -38065,17 +38055,17 @@ msgstr "ACLE-funktionen %qD Ă€r inkompatibel med anvĂ€ndningen av %qs" #: config/aarch64/aarch64-sve-builtins.cc:1112 #, gcc-internal-format msgid "ACLE function %qD cannot be called when SME streaming mode is enabled" -msgstr "" +msgstr "ACLE-funktionen %qD kan inte anropas nĂ€r SME-strömningslĂ€get Ă€r aktiverat" #: config/aarch64/aarch64-sve-builtins.cc:1119 #, gcc-internal-format msgid "ACLE function %qD can only be called when SME streaming mode is enabled" -msgstr "" +msgstr "ACLE-funktionen %qD kan endast anropas nĂ€r SME-strömningslĂ€get Ă€r aktiverat" #: config/aarch64/aarch64-sve-builtins.cc:1126 #, gcc-internal-format msgid "ACLE function %qD can only be called from a function that has %qs state" -msgstr "" +msgstr "ACLE-funktionen %qD kan endast anropas frĂ„n en funktion som har tillstĂ„ndet %qs" #: config/aarch64/aarch64-sve-builtins.cc:1154 #: config/arm/arm-mve-builtins.cc:571 @@ -38143,7 +38133,7 @@ msgstr "skickar %qT istĂ€llet för det förvĂ€ntade %qT som argument %d till %qE #: config/aarch64/aarch64-sve-builtins.cc:1777 #, gcc-internal-format msgid "passing mismatched tuple types %qT and %qT to arguments %d and %d of %qE" -msgstr "" +msgstr "skickar tupeltyperna %qT och %qT som inte stĂ€mmer överens till argument %d och %d till %qE" #: config/aarch64/aarch64-sve-builtins.cc:1788 #: config/arm/arm-mve-builtins.cc:1104 @@ -38239,12 +38229,12 @@ msgstr "skickar %qT som argument %d till %qE, vilken förvĂ€ntar sig en vektor a #: config/aarch64/aarch64-sve-builtins.cc:2227 #, gcc-internal-format msgid "operations on multiple vectors must be predicated by %qs rather than %qs" -msgstr "" +msgstr "operationer pĂ„ multipla vektorer mĂ„ste föregĂ„s av %qs istĂ€llet för %qs" #: config/aarch64/aarch64-sve-builtins.cc:2230 #, gcc-internal-format msgid "operations on single vectors must be predicated by %qs rather than %qs" -msgstr "" +msgstr "operationer pĂ„ enstaka vektorer mĂ„ste föregĂ„s av %qs istĂ€llet för %qs" #: config/aarch64/aarch64-sve-builtins.cc:2246 #: config/arm/arm-mve-builtins.cc:1248 @@ -38556,7 +38546,7 @@ msgstr "attributet %qE kan inte anvĂ€ndas pĂ„ en SVE-funktionstyp" #: config/aarch64/aarch64.cc:754 #, gcc-internal-format msgid "cannot create a new %qs scope since %qs is shared with callers" -msgstr "" +msgstr "kan inte skapa en ny rĂ€ckvidd %qs eftersom %qs delas med sin anropare" #: config/aarch64/aarch64.cc:770 #, fuzzy, gcc-internal-format @@ -38656,22 +38646,22 @@ msgstr "ACLE-funktionen %qD behöver ISA-utökningen %qs" #: config/aarch64/aarch64.cc:11089 config/aarch64/aarch64.cc:11093 #, gcc-internal-format msgid "call to a function that shares %qs state from a function that has no %qs state" -msgstr "" +msgstr "anrop av en funktion som delar %qs-tillstĂ„nd frĂ„n en funktion som inte har nĂ„got %qs-tillstĂ„nd" #: config/aarch64/aarch64.cc:11096 #, gcc-internal-format msgid "call to a function that shares SME state from a function that has no SME state" -msgstr "" +msgstr "anrop av en funktion som delar SME-tillstĂ„nd frĂ„n en funktion som inte har nĂ„got SME-tillstĂ„nd" #: config/aarch64/aarch64.cc:11154 #, gcc-internal-format msgid "call to a function that shares state other than %qs from a function that has %qs state" -msgstr "" +msgstr "anrop av en funktion som delar andra tillstĂ„nd Ă€n %qs frĂ„n en funktion som inte har nĂ„got %qs-tillstĂ„nd" #: config/aarch64/aarch64.cc:11156 #, gcc-internal-format msgid "use %<__arm_preserves(\"za\")%> if the callee preserves ZA" -msgstr "" +msgstr "anvĂ€nd %<__arm_preserves(\"za\")%> om den anropade bevarar ZA" #: config/aarch64/aarch64.cc:17859 #, gcc-internal-format @@ -39042,12 +39032,12 @@ msgstr "%qD definierades hĂ€r" #: config/aarch64/aarch64.cc:29263 #, gcc-internal-format msgid "non-local gotos in functions with SME state" -msgstr "" +msgstr "icke-lokala goto i en funktion med SME-tillstĂ„nd" #: config/aarch64/aarch64.cc:29558 #, gcc-internal-format msgid "catching non-call exceptions in functions with SME state" -msgstr "" +msgstr "fĂ„ngar ett icke-lokalt undantag i funktioner med SME-tillstĂ„nd" #: config/alpha/alpha.cc:420 #, gcc-internal-format @@ -39406,7 +39396,7 @@ msgstr "ogiltigt argument %<%s%> till %<-mharden-sls=%>" #: config/arm/aarch-common.cc:778 #, gcc-internal-format msgid "argument %<%s%> can only appear alone in %<%s%>" -msgstr "" +msgstr "argumentet %<%s%> ken endast förekomma ensamt i %<%s%>" #: config/arm/arm-builtins.cc:3125 #, gcc-internal-format, gfc-internal-format @@ -40956,22 +40946,22 @@ msgstr "% bör undvikas. AnvĂ€nd istĂ€llet det som pa #: config/i386/i386-options.cc:2104 #, gcc-internal-format msgid "%<-mtune=knl%> support will be removed in GCC 15" -msgstr "" +msgstr "stödet för %<-mtune=knl%> kommer tas bort i GCC 15" #: config/i386/i386-options.cc:2105 #, gcc-internal-format msgid "% support will be removed in GCC 15" -msgstr "" +msgstr "stödet för % kommer tas bort i GCC 15" #: config/i386/i386-options.cc:2110 #, gcc-internal-format msgid "%<-mtune=knm%> support will be removed in GCC 15" -msgstr "" +msgstr "stödet för %<-mtune=knm%> kommer tas bort i GCC 15" #: config/i386/i386-options.cc:2111 #, gcc-internal-format msgid "% support will be removed in GCC 15" -msgstr "" +msgstr "stödet för % kommer tas bort i GCC 15" #. rep; movq isn't available in 32-bit code. #: config/i386/i386-options.cc:2138 @@ -41029,7 +41019,7 @@ msgstr "%<-mabi=%s%> stödjs inte med %<-fsanitize=thread%>" #: config/i386/i386-options.cc:2196 #, gcc-internal-format msgid "%<-mlam=u48%> is not compatible with Hardware-assisted AddressSanitizer, override to %<-mlam=u57%>" -msgstr "" +msgstr "%<-mlam=u48%> Ă€r inte kompatibelt med hĂ„rdvaruassisterad AddressSanitizer, Ă„sidosĂ€tt till %<-mlam=u57%>" #: config/i386/i386-options.cc:2216 config/i386/i386-options.cc:2225 #: config/i386/i386-options.cc:2237 config/i386/i386-options.cc:2248 @@ -41085,22 +41075,22 @@ msgstr "CPU:n du valde stödjer inte instruktionsuppsĂ€ttningen x86-64" #: config/i386/i386-options.cc:2327 #, gcc-internal-format msgid "%<-march=knl%> support will be removed in GCC 15" -msgstr "" +msgstr "stödet för %<-march=knl%> kommer tas bort i GCC 15" #: config/i386/i386-options.cc:2328 #, gcc-internal-format msgid "% support will be removed in GCC 15" -msgstr "" +msgstr "stödet för % kommer tas bort i GCC 15" #: config/i386/i386-options.cc:2333 #, gcc-internal-format msgid "%<-march=knm%> support will be removed in GCC 15" -msgstr "" +msgstr "stödet för %<-march=knm%> kommer tas bort i GCC 15" #: config/i386/i386-options.cc:2334 #, gcc-internal-format msgid "% support will be removed in GCC 15" -msgstr "" +msgstr "stödet för % kommer tas bort i GCC 15" #: config/i386/i386-options.cc:2411 #, gcc-internal-format @@ -41195,7 +41185,7 @@ msgstr "% ignoreras i 64-bitslĂ€ge" #: config/i386/i386-options.cc:2676 #, gcc-internal-format msgid "%<-mno-evex512%> or %<-mno-avx512XXX%> cannot disable AVX10 instructions when AVX10.1-512 is available" -msgstr "" +msgstr "%<-mno-evex512%> eller %<-mno-avx512XXX%> kan inte avaktivera AVX10-instruktioner nĂ€r AVX10.1-512 Ă€r tillgĂ€ngligt" #. We should not emit 512 bit instructions under AVX10.1-256 #. when EVEX512 is enabled w/o any AVX512 features enabled. @@ -41203,22 +41193,22 @@ msgstr "" #: config/i386/i386-options.cc:2690 #, gcc-internal-format msgid "Using %<-mevex512%> without any AVX512 features enabled together with AVX10.1 only will not enable any AVX512 or AVX10.1-512 features, using 256 as max vector size" -msgstr "" +msgstr "Att anvĂ€nda %<-mevex512%> utan nĂ„gra AVX512-funktioner aktiverade tillsammans med endast AVX10.1 kommer inte aktivera nĂ„gra AVX512- eller AVX10.1-512-funktioner, anvĂ€nder 256 som maximal vektorstorlek" #: config/i386/i386-options.cc:2697 config/i386/i386-options.cc:2703 #, gcc-internal-format msgid "Vector size conflicts between AVX10.1 and AVX512, using 512 as max vector size" -msgstr "" +msgstr "Vektorstorleken stĂ„r i konflikt mellan AVX10.1 och AVX512, anvĂ€nder 512 som maximal vektorstorlek" #: config/i386/i386-options.cc:2711 #, gcc-internal-format msgid "%<-mno-avx512XXX%> cannot disable AVX10 instructions when AVX10 is available" -msgstr "" +msgstr "%<-mno-avx512XXX%> kan inte avaktivera AVX10-instruktioner nĂ€r AVX10 Ă€r tillgĂ€ngligt" #: config/i386/i386-options.cc:2721 #, gcc-internal-format msgid "%<-mno-avx10.1, -mno-avx10.1-256, -mno-avx10.1-512%> cannot disable AVX512 instructions when %<-mavx512XXX%>" -msgstr "" +msgstr "%<-mno-avx10.1, -mno-avx10.1-256, -mno-avx10.1-512%> kan inte avaktivera AVX512-instruktioner nĂ€r %<-mavx512XXX%>" #: config/i386/i386-options.cc:2776 #, gcc-internal-format @@ -41323,7 +41313,7 @@ msgstr "%qs Ă€r inte ett giltigt basregister i %<-mstack-protector-guard-reg=%>" #: config/i386/i386-options.cc:3245 #, gcc-internal-format msgid "%<-fcf-protection=full%> is not enabled by %<-fhardened%> because it was specified on the command line" -msgstr "" +msgstr "%<-fcf-protection=full%> Ă€r inte aktiverat av %<-fhardened%> eftersom det angavs pĂ„ kommandoraden" #: config/i386/i386-options.cc:3254 #, gcc-internal-format @@ -41824,17 +41814,17 @@ msgstr "okĂ€nd FPU-typ %<0x%x%>, %qs misslyckades" #: config/loongarch/loongarch-cpu.cc:177 #, gcc-internal-format msgid "floating-point unit %qs differs from PRID preset %qs" -msgstr "" +msgstr "flyttalsenheten %qs skiler frĂ„n PRID-förinstĂ€llningen %qs" #: config/loongarch/loongarch-cpu.cc:201 #, gcc-internal-format msgid "unknown SIMD extension (%qs disabled while %qs is enabled), disabling SIMD" -msgstr "" +msgstr "okĂ€nd SIMD-utvidgning (%qs avaktiverat medan %qs Ă€r aktiverat), avaktiverar SIMD" #: config/loongarch/loongarch-cpu.cc:239 #, gcc-internal-format msgid "detected base architecture %qs, but some of its features are not detected; the detected base architecture may be unreliable, only detected features will be enabled" -msgstr "" +msgstr "detekterade basarkitekturen %qs, men nĂ„gra av dess funktioner detekterades inte; den detekterade basarkitekturen kan vara opĂ„litlig, endast detekterade funktioner kommer aktiveras" #: config/loongarch/loongarch-opts.cc:225 #, gcc-internal-format @@ -41855,12 +41845,12 @@ msgstr "%qs fungerar inte med en korskompilator" #: config/loongarch/loongarch-opts.cc:365 #, gcc-internal-format msgid "enabing %qs promotes %<%s%s%> to %<%s%s%>" -msgstr "" +msgstr "aktivering av %qs befordrar %<%s%s%> till %<%s%s%>" #: config/loongarch/loongarch-opts.cc:377 #, gcc-internal-format msgid "%qs is disabled by %<-m%s%>, because it requires %<%s%s%>" -msgstr "" +msgstr "%qs avaktiveras av %<-m%s%> eftersom det krĂ€ver %<%s%s%>" #: config/loongarch/loongarch-opts.cc:389 #, fuzzy, gcc-internal-format @@ -43248,27 +43238,27 @@ msgstr "okĂ€nd %<#pragma riscv intrinsic%>-flagga %qs" #: config/riscv/riscv-target-attr.cc:120 #, gcc-internal-format msgid "unexpected arch for % attribute: must start with + or rv" -msgstr "" +msgstr "ovĂ€ntad arkitektur till attributet %: mĂ„ste börja med + elller rv" #: config/riscv/riscv-target-attr.cc:132 #, gcc-internal-format msgid "unexpected arch for % attribute: bad string found %<%s%>" -msgstr "" +msgstr "ovĂ€ntat arkitektur till attributet %: felaktig strĂ€ng funnen %<%s%>" #: config/riscv/riscv-target-attr.cc:156 #, gcc-internal-format msgid "% attribute: arch appears more than once" -msgstr "" +msgstr "attributet %: arkitekturen förekommer mer Ă€n en gĂ„ng" #: config/riscv/riscv-target-attr.cc:167 #, gcc-internal-format msgid "% attribute: cpu appears more than once" -msgstr "" +msgstr "attributet %: cpu:n förekommer mer Ă€n en gĂ„ng" #: config/riscv/riscv-target-attr.cc:174 #, gcc-internal-format msgid "% attribute: unknown CPU %qs" -msgstr "" +msgstr "attributet %: okĂ€nd CPU %qs" #: config/riscv/riscv-target-attr.cc:195 #, fuzzy, gcc-internal-format @@ -43279,7 +43269,7 @@ msgstr "mĂ„lattribut stödjs inte pĂ„ denna maskin" #: config/riscv/riscv-target-attr.cc:201 #, gcc-internal-format msgid "% attribute: unknown TUNE %qs" -msgstr "" +msgstr "attributet %: okĂ€nd TUNE %qs" #: config/riscv/riscv-target-attr.cc:240 #, fuzzy, gcc-internal-format @@ -43406,7 +43396,7 @@ msgstr "%<-mdiv%> krĂ€ver %<-march%> för att innefatta utökningen %" #: config/riscv/riscv.cc:8917 #, gcc-internal-format msgid "Current RISC-V GCC does not support VLEN greater than 4096bit for 'V' Extension" -msgstr "" +msgstr "Aktuell RISC-V GCC stödjer inte VLEN större Ă€n 4096 bitar till utökningen ”V”" #: config/riscv/riscv.cc:8923 #, fuzzy, gcc-internal-format @@ -45197,7 +45187,7 @@ msgstr "hopp in i rĂ€ckvidd för identifierare med variabel typ" #: c/c-decl.cc:4093 #, gcc-internal-format msgid "jump skips OpenMP % allocation" -msgstr "" +msgstr "hoppet skippar OpenMP %-allokering" #: c/c-decl.cc:4096 #, gcc-internal-format @@ -46651,7 +46641,7 @@ msgstr "upprĂ€kningsvĂ€rde för %qE Ă€r inte ett konstant heltalsuttryck" #: c/c-decl.cc:12641 #, gcc-internal-format msgid "%<_BitInt%> argument %qE is larger than % %qd" -msgstr "" +msgstr "argumentet %qE till %<_BitInt%> Ă€r större Ă€n % %qd" #: c/c-decl.cc:12689 #, gcc-internal-format @@ -47386,7 +47376,7 @@ msgstr "föreslĂ„r uttryckliga klamrar för att undvika tvetydighet i %" #: c/c-parser.cc:8122 c/c-parser.cc:8187 c/c-parser.cc:8306 cp/parser.cc:14614 #, gcc-internal-format msgid "loop not permitted in intervening code in OpenMP loop body" -msgstr "" +msgstr "en slinga Ă€r inte tillĂ„ten i mellanliggande kod i OpenMP:s slingkropp" #: c/c-parser.cc:8195 #, gcc-internal-format @@ -47875,7 +47865,7 @@ msgstr "absolutvĂ€rdesfunktionen %qD ges ett argument av typen %qT men har en pa #: c/c-parser.cc:12606 cp/parser.cc:8164 #, gcc-internal-format msgid "calls to the OpenMP runtime API are not permitted in intervening code" -msgstr "" +msgstr "anrop av OpenMP:s körtids-API Ă€r inte tillĂ„tet i mellanliggande kod" #: c/c-parser.cc:12980 #, gcc-internal-format @@ -47955,7 +47945,7 @@ msgstr "%<#pragma GCC unroll%> krĂ€ver ett tilldelningsuttryck som berĂ€knas til #: c/c-parser.cc:14470 cp/parser.cc:50733 #, gcc-internal-format msgid "intervening code must not contain OpenMP directives" -msgstr "" +msgstr "mellanliggande kod fĂ„r inte innehĂ„lla OpemMP-direktiv" #: c/c-parser.cc:14490 c/c-parser.cc:23558 c/c-parser.cc:23867 #: c/c-parser.cc:23930 c/c-parser.cc:24040 cp/parser.cc:46383 @@ -48442,7 +48432,7 @@ msgstr "%<#pragma acc %s data%> har ingen dataflyttningsklausul" #: c/c-parser.cc:20109 cp/parser.cc:47244 #, gcc-internal-format msgid "% construct requires % clause" -msgstr "" +msgstr "konstruktionen % krĂ€ver en klausul %" #: c/c-parser.cc:20338 cp/parser.cc:3367 #, gcc-internal-format @@ -48499,7 +48489,7 @@ msgstr "mallparametern %qD deklarerad hĂ€r" #: c/c-parser.cc:20580 #, gcc-internal-format msgid "variable %qD used in the % clause must not be modified between declaration of %qD and its % directive" -msgstr "" +msgstr "variabeln %qD anvĂ€nd i klausulen % fĂ„r inte Ă€ndras mellan deklarationen av %qD och dess direktiv %" #: c/c-parser.cc:20583 #, fuzzy, gcc-internal-format @@ -48538,7 +48528,7 @@ msgstr "%qD förekommer mer Ă€n en gĂ„ng i %-klausuler" #: c/c-parser.cc:20714 #, gcc-internal-format msgid "% clause required for static variable %qD" -msgstr "" +msgstr "klausulen % krĂ€vs för den statiska variabeln %qD" #: c/c-parser.cc:20721 #, fuzzy, gcc-internal-format @@ -48671,7 +48661,7 @@ msgstr "uttrycket % Ă€r inte ett l-vĂ€rde-uttryck" #: c/c-parser.cc:21851 cp/parser.cc:43744 #, gcc-internal-format msgid "the % expression %qE should be the same as the % argument %qE" -msgstr "" +msgstr "uttrycket %qE till % skall vara detsamma som argumentet %qE till %" #: c/c-parser.cc:21882 cp/parser.cc:43780 #, gcc-internal-format @@ -49226,7 +49216,7 @@ msgstr "det gĂ„r inte att blanda operander av typerna decimalt flyttal och annat #: c/c-typeck.cc:926 #, gcc-internal-format msgid "%<_Complex _BitInt(%d)%> unsupported" -msgstr "" +msgstr "%<_Complex _BitInt(%d)%> stödjs inte" #: c/c-typeck.cc:1472 #, fuzzy, gcc-internal-format @@ -51364,7 +51354,7 @@ msgstr " en Ă€rvd konstruerare Ă€r inte en kandidat för initiering frĂ„n ett u #: cp/call.cc:4109 #, gcc-internal-format msgid "some candidates omitted; use %<-fdiagnostics-all-candidates%> to display them" -msgstr "" +msgstr "nĂ„gra kandidater uteslutna; anvĂ€nd %<-fdiagnostics-all-candidates%> för att visa dem" #: cp/call.cc:4190 cp/call.cc:4735 #, gcc-internal-format @@ -51836,7 +51826,7 @@ msgstr "anvĂ€ndning av multiversionsfunktion utan ett standardfall" #: cp/call.cc:10002 #, gcc-internal-format msgid "use %<-fdiagnostics-all-candidates%> to display considered candidates" -msgstr "" +msgstr "anvĂ€nd %<-fdiagnostics-all-candidates%> för att visa kandidater som övervĂ€gts" #: cp/call.cc:10125 #, gcc-internal-format @@ -52134,7 +52124,7 @@ msgstr "den temporĂ€ra destruerades vid slutet av det fullstĂ€ndiga uttrycket %q #: cp/call.cc:14550 #, gcc-internal-format msgid "explicit conversion function was not considered" -msgstr "" +msgstr "en explicit konverteringsfunktion övervĂ€gdes inte" #: cp/class.cc:322 #, gcc-internal-format @@ -52426,7 +52416,7 @@ msgstr "pekarmedlemmen %q+D Ă€r deklarerad hĂ€r" #: cp/class.cc:4316 #, gcc-internal-format msgid "layout of %qs member of type %qT changes in %qs" -msgstr "" +msgstr "layouten av %qs-medlemmen av typen %qT Ă€ndras i %qs" #: cp/class.cc:4709 #, gcc-internal-format @@ -52775,7 +52765,7 @@ msgstr "%qD Ă€r inte anvĂ€ndbar som en %-funktion eftersom:" #: cp/constexpr.cc:1320 cp/constexpr.cc:6349 #, gcc-internal-format msgid "destroying %qE outside its lifetime" -msgstr "" +msgstr "förstör %qE utanför dess livstid" #: cp/constexpr.cc:1611 cp/constexpr.cc:3308 #: rust/backend/rust-constexpr.cc:3326 rust/backend/rust-constexpr.cc:3589 @@ -52941,7 +52931,7 @@ msgstr "%qE Ă€r inte ett konstant uttryck" #: cp/constexpr.cc:3547 #, gcc-internal-format msgid "address of non-static constexpr variable %qD may differ on each invocation of the enclosing function; add % to give it a constant address" -msgstr "" +msgstr "adressen till den icke-statiska constexpr-variabeln %qD kan skilja vid varje uppstar av den omgivande funktionen; ligg till % för att ge den en konstant adress" #: cp/constexpr.cc:3623 #, gcc-internal-format @@ -53195,12 +53185,12 @@ msgstr "Ă€ndring av den aktiva medlemmen av en union %qD till %qD under initieri #: cp/constexpr.cc:6517 #, gcc-internal-format msgid "%qD does not implicitly begin its lifetime because %qT does not have a non-deleted trivial default constructor, use % instead" -msgstr "" +msgstr "%qD börjar inte implicit sin livstid eftersom %qT inte har nĂ„gon oraderad trivial standardkonstruerare, anvĂ€nd % istĂ€llet" #: cp/constexpr.cc:6524 #, gcc-internal-format msgid "initializing %qD requires a member access expression as the left operand of the assignment" -msgstr "" +msgstr "initiering av %qD krĂ€ver ett medlemsĂ„tkomstuttryck som vĂ€nster operand i tilldelningen" #: cp/constexpr.cc:6536 rust/backend/rust-constexpr.cc:2822 #, gcc-internal-format @@ -54249,7 +54239,7 @@ msgstr "bĂ„da grenarna av en %-sats markerad som %qs" #: cp/cp-gimplify.cc:536 #, gcc-internal-format msgid "%qD was promoted to an immediate function because its body contains an immediate-escalating expression %qE" -msgstr "" +msgstr "%qD befordrades till en omedelbar funktion eftersom dess kropp innehĂ„ller ett uttryck %qE som omedelbareskalerar" #: cp/cp-gimplify.cc:539 #, fuzzy, gcc-internal-format @@ -54922,7 +54912,7 @@ msgstr "statisk datamedlem %qD i namnlös klass" #: cp/decl.cc:2120 #, gcc-internal-format msgid "variable at namespace scope is not name-independent" -msgstr "" +msgstr "en variabel i namnrymdsrĂ€ckvidd Ă€r inte namnoberoende" #: cp/decl.cc:2123 #, fuzzy, gcc-internal-format @@ -55121,7 +55111,7 @@ msgstr "hopp till case-etikett" #: cp/decl.cc:3694 #, gcc-internal-format msgid " as a possible target of computed goto" -msgstr "" +msgstr " som ett möjligt mĂ„l för berĂ€knad goto" #: cp/decl.cc:3696 #, gcc-internal-format @@ -56032,7 +56022,7 @@ msgstr "vĂ€ndeklaration Ă€r inte i klassdefinition" #: cp/decl.cc:10597 #, gcc-internal-format msgid "friend function template with constraints that depend on outer template parameters must be a definition" -msgstr "" +msgstr "en vĂ€nfunktionsmall med begrĂ€nsningar som beror pĂ„ yttre mallparametrar mĂ„ste vara en definition" #: cp/decl.cc:10646 #, gcc-internal-format @@ -56726,7 +56716,7 @@ msgstr " medlemsfunktionstypen %qT Ă€r inte ett giltigt mallargument" #: cp/decl.cc:13377 #, gcc-internal-format msgid "the type of a pointer to explicit object member function is a regular pointer to function type" -msgstr "" +msgstr "typen pĂ„ en pekare till en explicit objektmedlemsfunktion Ă€r en vanlig pekare pĂ„ en funktionstyp" #: cp/decl.cc:13381 #, fuzzy, gcc-internal-format @@ -56737,7 +56727,7 @@ msgstr "typedef fĂ„r inte vara en medlemsfunktionsdefinition" #: cp/decl.cc:13402 #, gcc-internal-format msgid "only the first parameter of a member function can be declared as an explicit object parameter" -msgstr "" +msgstr "endast den första parametern till en medlemsfunktion kan deklareras som en explicit objektparameter" #: cp/decl.cc:13407 #, fuzzy, gcc-internal-format @@ -56905,7 +56895,7 @@ msgstr "implicita mallar fĂ„r inte vara %" #: cp/decl.cc:13722 #, gcc-internal-format msgid "an explicit object member function cannot be %" -msgstr "" +msgstr "en explicit objektmedlemsfunktion kan inte vara %" #: cp/decl.cc:13748 #, gcc-internal-format @@ -60498,7 +60488,7 @@ msgstr "typer fĂ„r inte definieras i %<__builtin_offsetof%>" #: cp/parser.cc:8400 cp/parser.cc:8429 #, gcc-internal-format msgid "cannot use multidimensional subscript in OpenMP array section" -msgstr "" +msgstr "kan inte anvĂ€nda multidimensionellt index i OpenMP-vektorsektionen" #: cp/parser.cc:8687 cp/typeck.cc:3052 #, gcc-internal-format @@ -60603,7 +60593,7 @@ msgstr "typer fĂ„r inte definieras i %<__builtin_offsetof%>" #: cp/parser.cc:11229 #, gcc-internal-format msgid "trailing argument to %<__type_pack_element%> is not a type" -msgstr "" +msgstr "avslutande argument till %<__type_pack_element%> Ă€r inte en typ" #: cp/parser.cc:11329 #, gcc-internal-format @@ -60719,7 +60709,7 @@ msgstr "en parameterdeklaration före lambdadeklarationsspecificerare Ă€r endast #: cp/parser.cc:11932 cp/pt.cc:14718 #, gcc-internal-format msgid "a lambda with captures may not have an explicit object parameter of an unrelated type" -msgstr "" +msgstr "ett lambda med fĂ„ngster kan inte ha en explicit objektparameter av en orelaterad typ" #: cp/parser.cc:11945 #, fuzzy, gcc-internal-format @@ -60730,17 +60720,17 @@ msgstr "lambdaspecificeraren % med lambdafĂ„ngst" #: cp/parser.cc:11954 #, gcc-internal-format msgid "the passed in closure object will not be mutated because it is taken by value" -msgstr "" +msgstr "det inskickade höljesobjektet kommer inte muteras eftersom det tas via vĂ€rde" #: cp/parser.cc:11958 #, gcc-internal-format msgid "declare the explicit object parameter as non-const reference instead" -msgstr "" +msgstr "deklarera den explicita objektparametern som en icke-const-referens istĂ€llet" #: cp/parser.cc:11962 #, gcc-internal-format msgid "explicit object parameter is already a mutable reference" -msgstr "" +msgstr "explicit objektparameter Ă€r redan en muterbar referens" #: cp/parser.cc:11969 #, fuzzy, gcc-internal-format @@ -60986,7 +60976,7 @@ msgstr "import-deklaration mĂ„ste vara pĂ„ global rĂ€ckvidd" #: cp/parser.cc:15241 #, gcc-internal-format msgid "import specifying a module-partition must appear after a named module-declaration" -msgstr "" +msgstr "att importspecificera en mudulpartition mĂ„ste förekomma efter en namngiven moduldeklaration" #: cp/parser.cc:15253 #, gcc-internal-format @@ -61501,7 +61491,7 @@ msgstr "typer fĂ„r inte definieras i enum-bas" #: cp/parser.cc:21618 #, gcc-internal-format msgid "declaration of enumeration with fixed underlying type and no enumerator list is only permitted as a standalone declaration" -msgstr "" +msgstr "deklaration av en upprĂ€kning med fixerad underliggande typ och ingen upprĂ€knarlista Ă€r endast tillĂ„tet som en fristĂ„ende deklaration" #: cp/parser.cc:21622 #, gcc-internal-format @@ -64695,7 +64685,7 @@ msgstr "begĂ€rd minnesjustering Ă€r inte en heltalskonstant" #: cp/semantics.cc:4656 #, gcc-internal-format msgid "%<__type_pack_element%> index is negative" -msgstr "" +msgstr "indexet till %<__type_pack_element%> Ă€r negativt" #: cp/semantics.cc:4662 #, fuzzy, gcc-internal-format @@ -65009,17 +64999,17 @@ msgstr "%<#pragma omp atomic update%> anvĂ€nder tvĂ„ olika uttryck för minne" #: cp/semantics.cc:11509 #, gcc-internal-format msgid "% message must be a string literal or object with % and % members" -msgstr "" +msgstr "meddelandet i % mĂ„ste vara en strĂ€ngliteral eller ett objekt med medlemmarna % och %" #: cp/semantics.cc:11525 #, gcc-internal-format msgid "% message % must be implicitly convertible to %" -msgstr "" +msgstr "meddelandet % till % mĂ„ste vara implicit konverterbart till %" #: cp/semantics.cc:11534 #, gcc-internal-format msgid "% message % must be implicitly convertible to %" -msgstr "" +msgstr "meddelandet % till % mĂ„ste vara implicit konverterbart till %" #: cp/semantics.cc:11592 #, fuzzy, gcc-internal-format @@ -65030,7 +65020,7 @@ msgstr "%-uttryck mĂ„ste vara ett konstant heltalsuttryck" #: cp/semantics.cc:11600 #, gcc-internal-format msgid "% message % %qE too large" -msgstr "" +msgstr "meddelandet % till % %qE Ă€r för stort" #: cp/semantics.cc:11627 #, fuzzy, gcc-internal-format @@ -66273,7 +66263,7 @@ msgstr "ogiltig kovariant returtyp för %q#D" #: cp/typeck.cc:11311 #, gcc-internal-format msgid "not eliding copy on return in %qD" -msgstr "" +msgstr "utelĂ€mnar inte kopiering vid retur i %qD" #: cp/typeck.cc:11898 #, gcc-internal-format @@ -66793,7 +66783,7 @@ msgstr "det gĂ„r inte att konvertera %qH till %qI nĂ€r argument skickas" #: d/d-convert.cc:759 #, gcc-internal-format msgid "parameters of type % {aka %qs} are decayed to pointer types, and require % to be converted back into a static array type" -msgstr "" +msgstr "parametrar av typen % {Ă€vĂ€n kĂ€nda som %qs} degenereras till pekartyper, och krĂ€ver % för att konverteras tillbaka till en statisk vektortyp" #: d/d-lang.cc:463 #, gcc-internal-format @@ -67023,7 +67013,7 @@ msgstr "%<-fmoduleinfo%> stödjs inte för denna mĂ„larkitektur" #: d/toir.cc:245 #, gcc-internal-format msgid "calling %qE without side effects discards return value of type %qT; prepend a % if intentional" -msgstr "" +msgstr "anrop av %qE utan sidoeffekter slĂ€nger returvĂ€rdet av typen %qT; lĂ€gg till en % före om det Ă€r avsiktligt" #: d/toir.cc:419 d/toir.cc:444 #, gcc-internal-format @@ -69886,7 +69876,7 @@ msgstr "Formella argumentnamnen till MODULE PROCEDURE stĂ€mmer inte (%s/%s) vid #: fortran/decl.cc:6809 #, gcc-internal-format msgid "MODULE PROCEDURE formal argument is alternate return and conflicts with %qs in the separate declaration at %C" -msgstr "" +msgstr "Formella argument till MODULE PROCEDURE Ă€r alternativ retur och i konflikt med %qs i den separata deklarationen vid %C" #: fortran/decl.cc:6814 #, gcc-internal-format, gfc-internal-format @@ -72115,7 +72105,7 @@ msgstr "Aktuellt argument till %qs skall vara en ALLOCATABLE vid %L" #: fortran/interface.cc:3693 #, gcc-internal-format msgid "Actual argument for %qs at %L is a function result and the dummy argument is ALLOCATABLE" -msgstr "" +msgstr "Aktuella argument till %qs vid %L Ă€r ett funktionsresultat och attrappargumentet Ă€r ALLOCATABLE" #: fortran/interface.cc:3731 #, gcc-internal-format @@ -74682,7 +74672,7 @@ msgstr "Listobjektet skall inte vara co-indexerat vid %C" #: fortran/openmp.cc:492 #, gcc-internal-format msgid "%qs at %L is part of the common block % and may only be specificed implicitly via the named common block" -msgstr "" +msgstr "%qs vid %L Ă€r del av common-blocket % och kan endast anges implicit via det namngivna common-blocket" #: fortran/openmp.cc:517 fortran/openmp.cc:618 fortran/openmp.cc:948 #: fortran/openmp.cc:6135 @@ -74798,7 +74788,7 @@ msgstr "%qs-direktivet nĂ€mnt bĂ„da gĂ„ngerna i ABSENT- och CONTAINS-klausuler i #: fortran/openmp.cc:1745 #, gcc-internal-format, gfc-internal-format msgid "Duplicate %s modifier at %L in USES_ALLOCATORS clause" -msgstr "" +msgstr "Dubblerad %s-modifierare vid %L i en USES_ALLOCATORS-klausul" #: fortran/openmp.cc:1779 #, fuzzy, gcc-internal-format @@ -75127,7 +75117,7 @@ msgstr "IN, OUT, INOUT, INOUTSET eller MUTEXINOUTSET förvĂ€ntades följt av %<) #: fortran/openmp.cc:4771 #, gcc-internal-format, gfc-internal-format msgid "The same depend object should be used as DEPOBJ argument at %L and as DESTROY argument at %L" -msgstr "" +msgstr "Samma beroendeobjekt skall anvĂ€ndas som DEPOBJ-argument vid %L och som DESTROY-argument vid %L" #: fortran/openmp.cc:4785 #, gcc-internal-format, gfc-internal-format @@ -75242,7 +75232,7 @@ msgstr "Listpost %qs vid %L satt i föregĂ„ende OMP DECLARE TARGET-direktiv till #: fortran/openmp.cc:5547 fortran/openmp.cc:5601 #, gcc-internal-format, gfc-internal-format msgid "DEVICE_TYPE must be ANY when used with INDIRECT at %L" -msgstr "" +msgstr "DEVICE_TYPE mĂ„ste vara ANY nĂ€r anvĂ€nt med INDIRECT vid %L" #: fortran/openmp.cc:5557 #, gcc-internal-format, gfc-internal-format @@ -75663,7 +75653,7 @@ msgstr "Den implicit deklarerade subrutinen %s anvĂ€nds i !$OMP DECLARE REDUCTIO #: fortran/openmp.cc:7349 #, gcc-internal-format msgid "Unexpected function-result variable %qs at %L in declarative !$OMP ALLOCATE" -msgstr "" +msgstr "OvĂ€ntad funktionsresultatvariabel %qs vid %L i deklarativt !$OMP ALLOCATE" #: fortran/openmp.cc:7355 #, fuzzy, gcc-internal-format @@ -75674,12 +75664,12 @@ msgstr "Procedurpekare %qs i %s-klausul vid %L" #: fortran/openmp.cc:7361 #, gcc-internal-format msgid "Argument %qs at %L to declarative !$OMP ALLOCATE directive must be a variable" -msgstr "" +msgstr "Argumentet %qs vid %L till deklarativt !$OMP ALLOCATE-direktiv mĂ„ste vara en variabel" #: fortran/openmp.cc:7368 #, gcc-internal-format msgid "Argument %qs at %L to declarative !$OMP ALLOCATE shall be in the same scope as the variable declaration" -msgstr "" +msgstr "Argumentet %qs vid %L till deklarativt !$OMP ALLOCATE skall ligga i samma rĂ€ckvidd som variabeldeklarationen" #: fortran/openmp.cc:7375 #, fuzzy, gcc-internal-format @@ -75690,37 +75680,37 @@ msgstr "Skickat objekt-attrappargument till %qs vid %L fĂ„r inte vara ALLOCATABL #: fortran/openmp.cc:7381 #, gcc-internal-format msgid "Unexpected coarray argument %qs as argument at %L to declarative !$OMP ALLOCATE" -msgstr "" +msgstr "OvĂ€ntat co-vektorargument %qs som argument vid %L till deklarativt !$OMP ALLOCATE" #: fortran/openmp.cc:7389 #, gcc-internal-format msgid "Duplicated common block % in !$OMP ALLOCATE at %L" -msgstr "" +msgstr "Dubblerat common-block % i !$OMP ALLOCATE vid %L" #: fortran/openmp.cc:7396 #, gcc-internal-format msgid "Duplicated variable %qs in !$OMP ALLOCATE at %L" -msgstr "" +msgstr "Dubblerad variabel %qs i !$OMP ALLOCATE vid %L" #: fortran/openmp.cc:7407 #, gcc-internal-format msgid "Sorry, EQUIVALENCE object %qs not supported with !$OMP ALLOCATE at %L" -msgstr "" +msgstr "TyvĂ€rr, EQUIVALENCE-objektet %qs stödjs inte med !$OMP ALLOCATE vid %L" #: fortran/openmp.cc:7416 #, gcc-internal-format msgid "Sorry, Cray pointers and pointees such as %qs are not supported with !$OMP ALLOCATE at %L" -msgstr "" +msgstr "TyvĂ€rr, Cray-pekare och -utpekade sĂ„som %qs stödjs inte med !$OMP ALLOCATE vid %L" #: fortran/openmp.cc:7425 #, gcc-internal-format msgid "Unexpected allocatable variable %qs at %L in declarative !$OMP ALLOCATE directive" -msgstr "" +msgstr "OvĂ€ntad allokerbar variabel %qs vid %L i deklarativt !$OMP ALLOCATE-direktiv" #: fortran/openmp.cc:7430 #, gcc-internal-format msgid "Unexpected pointer variable %qs at %L in declarative !$OMP ALLOCATE directive" -msgstr "" +msgstr "OvĂ€ntad pekarvariabel %qs vid %L i deklarativt !$OMP ALLOCATE-direktiv" #: fortran/openmp.cc:7441 fortran/openmp.cc:7996 #, fuzzy, gcc-internal-format, gfc-internal-format @@ -75731,12 +75721,12 @@ msgstr "En ALIGN-modifierare krĂ€ver vid %L ett skalĂ€rt positivt konstant helta #: fortran/openmp.cc:7456 #, gcc-internal-format msgid "An ALLOCATOR clause is required as the list item %<%s%s%s%> at %L has the SAVE attribute" -msgstr "" +msgstr "En ALLOCATOR-klausul krĂ€vs dĂ„ listelementet %<%s%s%s%> vid %L har attributet SAVE" #: fortran/openmp.cc:7461 #, gcc-internal-format msgid "Predefined allocator required in ALLOCATOR clause at %L as the list item %<%s%s%s%> at %L has the SAVE attribute" -msgstr "" +msgstr "En fördefinierad allokerare krĂ€vs i ALLOCATOR-klausulen vid %L dĂ„ listelementet %<%s%s%s%> vid %L har attributet SAVE" #: fortran/openmp.cc:7475 fortran/openmp.cc:7980 #, gcc-internal-format @@ -75890,27 +75880,27 @@ msgstr "%qs angivet i en %-klausul vid %L men inte i en explicit priv #: fortran/openmp.cc:8139 #, gcc-internal-format msgid "%qs listed in % statement at %L but it is neither explicitly in listed in the % directive nor exists a directive without argument list" -msgstr "" +msgstr "%qs listad i %-satsen vid %L men den varken Ă€r explicit listat i direktivet % eller finns som ett direktiv utan argumentlista" #: fortran/openmp.cc:8150 #, gcc-internal-format msgid "Unexpected coarray %qs in % at %L, implicitly listed in % at %L" -msgstr "" +msgstr "OvĂ€ntad co-vektor %qs i % i %L, implicit listad i % vid %L" #: fortran/openmp.cc:8175 #, gcc-internal-format msgid "ALLOCATORS directive at %L inside a target region must specify an ALLOCATOR modifier for %qs" -msgstr "" +msgstr "Direktivet ALLOCATORS vid %L inuti en mĂ„lregion mĂ„ste ange en ALLOCATOR-modifierare för %qs" #: fortran/openmp.cc:8179 #, gcc-internal-format msgid "ALLOCATE directive at %L inside a target region must specify an ALLOCATOR clause for %qs" -msgstr "" +msgstr "Direktivet ALLOCATE vid %L inuti en mĂ„lregion moste ange en ALLOCATOR-klausul för %qs" #: fortran/openmp.cc:8183 #, gcc-internal-format, gfc-internal-format msgid "ALLOCATE directive at %L inside a target region must specify an ALLOCATOR clause" -msgstr "" +msgstr "Direktivet ALLOCATE vid %L inuti en mĂ„lregion mĂ„ste ange en ALLOCATOR-klausul" #: fortran/openmp.cc:8206 #, gcc-internal-format @@ -76092,7 +76082,7 @@ msgstr "Listposten %qs i %s-klausul vid %L mĂ„ste vara TYPE(C_PTR)" #: fortran/openmp.cc:8709 #, gcc-internal-format msgid "Memspace %qs at %L in USES_ALLOCATORS must be a predefined memory space" -msgstr "" +msgstr "Memspace %qs vid %L i USES_ALLOCATORS mĂ„ste vara ett fördefinierat minnesutrymme" #: fortran/openmp.cc:8717 #, fuzzy, gcc-internal-format @@ -76103,17 +76093,17 @@ msgstr "%qs vid %L skall vara en skalĂ€r av typen integer(kind=omp_event_handle_ #: fortran/openmp.cc:8725 #, gcc-internal-format msgid "Allocator %qs at %L in USES_ALLOCATORS must either a variable or a predefined allocator" -msgstr "" +msgstr "Allokeraren %qs vid %L i USES_ALLOCATORS mĂ„ste vara antingen en variabel eller en fördefinierad allokerare" #: fortran/openmp.cc:8730 #, gcc-internal-format msgid "A memory space or traits array may not be specified for predefined allocator %qs at %L" -msgstr "" +msgstr "Ett minnesutrymme eller en egenskapsvektor fĂ„r inte anges för den fördefinierade allokeraren %qs vid %L" #: fortran/openmp.cc:8741 #, gcc-internal-format msgid "Traits array %qs in USES_ALLOCATORS %L must be a one-dimensional named constant array of type %" -msgstr "" +msgstr "Egenskapsvektorn %qs i USES_ALLOCATORS %L mĂ„ste vara en endimensionell namngiven konstantvektor av typen %" #: fortran/openmp.cc:8771 #, gcc-internal-format @@ -76249,7 +76239,7 @@ msgstr "en %-klausul vid %L fĂ„r inte anvĂ€ndas tillsammans med en % construct at %L requires % clause" -msgstr "" +msgstr "Konstruktionen % vid %L krĂ€ver en %-klausul" #: fortran/openmp.cc:9380 #, gcc-internal-format, gfc-internal-format @@ -76395,17 +76385,17 @@ msgstr "Med INSCAN vid %L, slingkropp med !$OMP SCAN förvĂ€ntades mellan tvĂ„ s #: fortran/openmp.cc:9955 #, gcc-internal-format, gfc-internal-format msgid "!$OMP SCAN at %L with zero executable statements in preceding structured block sequence" -msgstr "" +msgstr "!$OMP SCAN vid %L med noll körbara satser i föregĂ„ende strukturerade blocksekvens" #: fortran/openmp.cc:9962 #, gcc-internal-format, gfc-internal-format msgid "!$OMP SCAN at %L with zero executable statements in succeeding structured block sequence" -msgstr "" +msgstr "!$OMP SCAN vid %L med noll körbara satser i efterföljande strukturerade blocksekvens" #: fortran/openmp.cc:10176 #, gcc-internal-format, gfc-internal-format msgid "%s cannot contain loop in intervening code at %L" -msgstr "" +msgstr "%s kan inte innehĂ„lla en slinga i mellanliggande kod vid %L" #: fortran/openmp.cc:10256 #, gcc-internal-format, gfc-internal-format diff --git a/gcc/po/zh_CN.po b/gcc/po/zh_CN.po index 185ead3eeeb3..3f83462e0435 100644 --- a/gcc/po/zh_CN.po +++ b/gcc/po/zh_CN.po @@ -32,10 +32,10 @@ # msgid "" msgstr "" -"Project-Id-Version: gcc 13.2.0\n" +"Project-Id-Version: gcc 14.1-b20240218\n" "Report-Msgid-Bugs-To: https://gcc.gnu.org/bugs/\n" "POT-Creation-Date: 2024-02-16 21:35+0000\n" -"PO-Revision-Date: 2024-02-17 18:57-0500\n" +"PO-Revision-Date: 2024-02-24 14:20-0500\n" "Last-Translator: Boyuan Yang <073plan@gmail.com>\n" "Language-Team: Chinese (simplified) \n" "Language: zh_CN\n" @@ -44,7 +44,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" "X-Bugs: Report translation errors to the Language-Team address.\n" -"X-Generator: Poedit 2.4.3\n" +"X-Generator: Poedit 3.4.2\n" #: cif-code.def:39 msgid "function not considered for inlining" @@ -1737,10 +1737,9 @@ msgid "Warn about C++23 constructs in code compiled with an older standard." msgstr "ćŻčäœżç”šèŸƒæ—§æ ‡ć‡†çŒ–èŻ‘çš„ä»Łç ç»™ć‡ș C++23 æž„é€ çš„è­Šć‘Šă€‚" #: c-family/c.opt:503 -#, fuzzy, no-c-format -#| msgid "Warn about C++20 constructs in code compiled with an older standard." +#, no-c-format msgid "Warn about C++26 constructs in code compiled with an older standard." -msgstr "ćŻčäœżç”šèŸƒæ—§æ ‡ć‡†çŒ–èŻ‘çš„ä»Łç ç»™ć‡ș C++20 æž„é€ çš„è­Šć‘Šă€‚" +msgstr "ćŻčäœżç”šèŸƒæ—§æ ‡ć‡†çŒ–èŻ‘çš„ä»Łç ç»™ć‡ș C++26 æž„é€ çš„è­Šć‘Šă€‚" #: c-family/c.opt:507 #, no-c-format @@ -1850,10 +1849,9 @@ msgid "Warn when all constructors and destructors are private." msgstr "ćœ“æ‰€æœ‰æž„é€ ć‡œæ•°ć’Œæžæž„ć‡œæ•°éƒœæ˜Żç§æœ‰æ—¶ç»™ć‡șè­Šć‘Š" #: c-family/c.opt:588 -#, fuzzy, no-c-format -#| msgid "Warn about implicit declarations" +#, no-c-format msgid "Warn about dangling else." -msgstr "ćŻčéšćŒć‡œæ•°ćŁ°æ˜Žç»™ć‡șè­Šć‘Š" +msgstr "ćŻčæ‚Źç©ș的 else 给ć‡șè­Šć‘Šă€‚" #: c-family/c.opt:592 c-family/c.opt:596 #, no-c-format @@ -1868,24 +1866,22 @@ msgstr "" #: c-family/c.opt:604 #, no-c-format msgid "Warn about __TIME__, __DATE__ and __TIMESTAMP__ usage." -msgstr "" +msgstr "ćœ“ __TIME__、__DATE__ 撌 __TIMESTAMP__ èą«äœżç”šæ—¶ç»™ć‡șè­Šć‘Šă€‚" #: c-family/c.opt:608 -#, fuzzy, no-c-format -#| msgid "Warn when a declaration is found after a statement" +#, no-c-format msgid "Warn when a declaration is found after a statement." -msgstr "ćœ“ćŁ°æ˜Žć‡șçŽ°ćœšèŻ­ć„ćŽæ—¶ç»™ć‡șè­Šć‘Š" +msgstr "ćœ“ćŁ°æ˜Žć‡șçŽ°ćœšèŻ­ć„ćŽæ—¶ç»™ć‡șè­Šć‘Šă€‚" #: c-family/c.opt:612 -#, fuzzy, no-c-format -#| msgid "Warn about unprototyped function declarations" +#, no-c-format msgid "Warn for missing parameter types in function declarations." -msgstr "äœżç”šäș†éžćŽŸćž‹çš„ć‡œæ•°ćŁ°æ˜Žæ—¶ç»™ć‡șè­Šć‘Š" +msgstr "ćœ“ć‡œæ•°ç”Ÿć‘œäž­çŒșć€±ć‚æ•°ç±»ćž‹æ—¶ç»™ć‡șè­Šć‘Šă€‚" #: c-family/c.opt:616 -#, fuzzy, no-c-format +#, no-c-format msgid "Warn when deleting a pointer to incomplete type." -msgstr "æéą†æŒ‡ć‘äžćźŒć…šç±»ćž‹çš„æŒ‡é’ˆ" +msgstr "ćœšćˆ é™€äžć…Œćźčç±»ćž‹çš„æŒ‡é’ˆæ—¶ç»™ć‡șè­Šć‘Šă€‚" #: c-family/c.opt:620 #, fuzzy, no-c-format @@ -2013,10 +2009,9 @@ msgid "Warn if \"defined\" is used outside #if." msgstr "ćœ“ \"defined\" 朹 #if äč‹ć€–äœżç”šæ—¶ç»™ć‡șè­Šć‘Šă€‚" #: c-family/c.opt:727 -#, fuzzy, no-c-format -#| msgid "Warn about implicit function declarations" +#, no-c-format msgid "Warn about semicolon after in-class function definition." -msgstr "ćŻčéšćŒć‡œæ•°ćŁ°æ˜Žç»™ć‡șè­Šć‘Š" +msgstr "" #: c-family/c.opt:731 #, no-c-format @@ -2059,10 +2054,9 @@ msgid "Warn if passing too many arguments to a function for its format string." msgstr "ćœ“äŒ é€’ç»™æ ŒćŒć­—çŹŠäžČçš„ć‚æ•°ć€Șć€šæ—¶ç»™ć‡șè­Šć‘Š" #: c-family/c.opt:760 -#, fuzzy, no-c-format -#| msgid "Warn about format strings that are not literals" +#, no-c-format msgid "Warn about format strings that are not literals." -msgstr "ćœ“æ ŒćŒć­—çŹŠäžČäžæ˜Żć­—éąé‡æ—¶ç»™ć‡șè­Šć‘Š" +msgstr "ćœ“æ ŒćŒć­—çŹŠäžČäžæ˜Żć­—éąé‡æ—¶ç»™ć‡șè­Šć‘Šă€‚" #: c-family/c.opt:764 #, no-c-format @@ -2430,10 +2424,9 @@ msgid "Warn about potentially suboptimal choices related to OpenACC parallelism. msgstr "" #: c-family/c.opt:1101 -#, fuzzy, no-c-format -#| msgid "Warn about \"suspicious\" constructs" +#, no-c-format msgid "Warn about suspicious OpenMP code." -msgstr "ćŻčâ€œćŻç–‘â€çš„æž„é€ ç»™ć‡șè­Šć‘Š" +msgstr "ćŻč揯疑的 OpenMP 代码给ć‡șè­Šć‘Šă€‚" #: c-family/c.opt:1105 #, no-c-format @@ -2503,10 +2496,9 @@ msgid "Warn when converting the type of pointers to member functions." msgstr "ćœ“æ”čć˜æˆć‘˜ć‡œæ•°æŒ‡é’ˆçš„ç±»ćž‹æ—¶ç»™ć‡șè­Šć‘Š" #: c-family/c.opt:1165 -#, fuzzy, no-c-format -#| msgid "Warn about function pointer arithmetic" +#, no-c-format msgid "Warn about function pointer arithmetic." -msgstr "ćœ“ćœšçź—æœŻèĄšèŸŸćŒäž­äœżç”šć‡œæ•°æŒ‡é’ˆæ—¶ç»™ć‡șè­Šć‘Š" +msgstr "ćœ“ćœšçź—æœŻèĄšèŸŸćŒäž­äœżç”šć‡œæ•°æŒ‡é’ˆæ—¶ç»™ć‡șè­Šć‘Šă€‚" #: c-family/c.opt:1169 #, fuzzy, no-c-format @@ -2521,16 +2513,14 @@ msgid "Warn when a pointer is compared with a zero character constant." msgstr "äœżç”šć€šć­—èŠ‚ć­—çŹŠé›†çš„ć­—çŹŠćžžé‡æ—¶ç»™ć‡șè­Šć‘Š" #: c-family/c.opt:1177 -#, fuzzy, no-c-format -#| msgid "Warn when a pointer is cast to an integer of a different size" +#, no-c-format msgid "Warn when a pointer is cast to an integer of a different size." -msgstr "氆侀äžȘæŒ‡é’ˆèœŹæąäžșć€§ć°äžćŒçš„æ•Žæ•°æ—¶ç»™ć‡șè­Šć‘Š" +msgstr "氆侀äžȘæŒ‡é’ˆèœŹæąäžșć€§ć°äžćŒçš„æ•Žæ•°æ—¶ç»™ć‡șè­Šć‘Šă€‚" #: c-family/c.opt:1181 -#, fuzzy, no-c-format -#| msgid "Warn about misuses of pragmas" +#, no-c-format msgid "Warn about misuses of pragmas." -msgstr "ćŻčé”™èŻŻäœżç”šçš„ pragma ćŠ ä»„è­Šć‘Š" +msgstr "ćŻčé”™èŻŻäœżç”šçš„ pragma 给ć‡șè­Šć‘Šă€‚" #: c-family/c.opt:1185 #, no-c-format @@ -2554,15 +2544,14 @@ msgid "Warn when a range-based for-loop is creating unnecessary copies." msgstr "" #: c-family/c.opt:1201 -#, fuzzy, no-c-format -#| msgid "Warn about multiple declarations of the same object" +#, no-c-format msgid "Warn about multiple declarations of the same object." -msgstr "ćŻč搌侀äžȘćŻčè±Ąć€šæŹĄćŁ°æ˜Žæ—¶ç»™ć‡șè­Šć‘Š" +msgstr "ćŻč搌侀äžȘćŻčè±Ąć€šæŹĄćŁ°æ˜Žæ—¶ç»™ć‡șè­Šć‘Šă€‚" #: c-family/c.opt:1205 #, no-c-format msgid "Warn about redundant calls to std::move." -msgstr "" +msgstr "ćŻčć€šäœ™çš„ std::move 调甚给ć‡șè­Šć‘Šă€‚" #: c-family/c.opt:1209 #, no-c-format @@ -2852,10 +2841,9 @@ msgid "Warn about invalid forms of delimited or named escape sequences." msgstr "" #: c-family/c.opt:1449 -#, fuzzy, no-c-format -#| msgid "Warn about unrecognized pragmas" +#, no-c-format msgid "Warn about unrecognized pragmas." -msgstr "ćŻčæ— æł•èŻ†ćˆ«çš„ pragma ćŠ ä»„è­Šć‘Š" +msgstr "ćŻčæ— æł•èŻ†ćˆ«çš„ pragma ćŠ ä»„è­Šć‘Šă€‚" #: c-family/c.opt:1453 #, fuzzy, no-c-format @@ -3231,10 +3219,9 @@ msgid "Use traditional GNU semantics for inline functions." msgstr "äžșć†…è”ć‡œæ•°äœżç”šäŒ ç»Ÿçš„ GNU èŻ­äč‰ă€‚" #: c-family/c.opt:1907 -#, fuzzy, no-c-format -#| msgid "Assume normal C execution environment" +#, no-c-format msgid "Assume normal C execution environment." -msgstr "ć‡ćźšäž€èˆŹçš„ C æ‰§èĄŒçŽŻćąƒ" +msgstr "ć‡ćźšäž€èˆŹçš„ C æ‰§èĄŒçŽŻćąƒă€‚" #: c-family/c.opt:1915 #, no-c-format @@ -3803,10 +3790,9 @@ msgid "Conform to the ISO 2023 C++ draft standard (experimental and incomplete s msgstr "達ćŸȘ ISO 2023 C++ æ ‡ć‡†è‰æĄˆïŒˆèŻ•éȘŒæ€§èŽšçš„äžćźŒć…šæ”ŻæŒïŒ‰ă€‚" #: c-family/c.opt:2480 c-family/c.opt:2484 -#, fuzzy, no-c-format -#| msgid "Conform to the ISO 2023 C++ draft standard (experimental and incomplete support)." +#, no-c-format msgid "Conform to the ISO 2026 C++ draft standard (experimental and incomplete support)." -msgstr "達ćŸȘ ISO 2023 C++ æ ‡ć‡†è‰æĄˆïŒˆèŻ•éȘŒæ€§èŽšçš„äžćźŒć…šæ”ŻæŒïŒ‰ă€‚" +msgstr "達ćŸȘ ISO 2026 C++ æ ‡ć‡†è‰æĄˆïŒˆèŻ•éȘŒæ€§èŽšçš„äžćźŒć…šæ”ŻæŒïŒ‰ă€‚" #: c-family/c.opt:2488 c-family/c.opt:2642 #, no-c-format @@ -3825,16 +3811,14 @@ msgid "Conform to the ISO 2017 C standard (published in 2018)." msgstr "達ćŸȘ ISO 2017 C æ ‡ć‡†ïŒˆäșŽ2018ćčŽć‘ćžƒïŒ‰ă€‚" #: c-family/c.opt:2504 c-family/c.opt:2654 -#, fuzzy, no-c-format -#| msgid "Conform to the ISO 202X C standard draft (experimental and incomplete support)." +#, no-c-format msgid "Conform to the ISO 2023 C standard draft (expected to be published in 2024) (experimental and incomplete support)." -msgstr "達ćŸȘ ISO 202X C++ æ ‡ć‡†è‰æĄˆïŒˆèŻ•éȘŒæ€§èŽšçš„äžćźŒć…šæ”ŻæŒïŒ‰ă€‚" +msgstr "達ćŸȘ ISO 2023 C++ æ ‡ć‡†è‰æĄˆïŒˆéą„èźĄäșŽ2024ćčŽć‘ćžƒïŒ‰ïŒˆèŻ•éȘŒæ€§èŽšçš„äžćźŒć…šæ”ŻæŒïŒ‰ă€‚" #: c-family/c.opt:2508 -#, fuzzy, no-c-format -#| msgid "Deprecated in favor of -std=c11." +#, no-c-format msgid "Deprecated in favor of -std=c23." -msgstr "ć·ČćŒƒç”šïŒŒèŻ·æ”č甹 -std=c11。" +msgstr "ć·ČćŒƒç”šïŒŒèŻ·æ”č甹 -std=c23。" #: c-family/c.opt:2512 c-family/c.opt:2516 c-family/c.opt:2626 #, no-c-format @@ -3887,10 +3871,9 @@ msgid "Conform to the ISO 2017 C++ standard with GNU extensions." msgstr "達ćŸȘ ISO 2017 C++ æ ‡ć‡†ïŒŒäčŸæ”ŻæŒ GNU æ‰©ć±•ă€‚" #: c-family/c.opt:2562 c-family/c.opt:2566 -#, fuzzy, no-c-format -#| msgid "Conform to the ISO 201z(7?) C++ draft standard with GNU extensions (experimental and incomplete support)" +#, no-c-format msgid "Conform to the ISO 2020 C++ standard with GNU extensions (experimental and incomplete support)." -msgstr "達ćŸȘ ISO 201z(7?) C++ æ ‡ć‡†è‰æĄˆć’Œ GNU æ‰©ć±•(èŻ•éȘŒæ€§èŽšçš„äžćźŒć…šæ”ŻæŒ)" +msgstr "達ćŸȘ ISO 2020 C++ æ ‡ć‡†ć’Œ GNU æ‰©ć±•ïŒˆèŻ•éȘŒæ€§èŽšçš„äžćźŒć…šæ”ŻæŒïŒ‰" #: c-family/c.opt:2570 c-family/c.opt:2574 #, fuzzy, no-c-format @@ -3915,10 +3898,9 @@ msgid "Deprecated in favor of -std=gnu11." msgstr "ć·ČćŒƒç”šïŒŒèŻ·æ”č甹 -std=gnu11。" #: c-family/c.opt:2594 c-family/c.opt:2598 -#, fuzzy, no-c-format -#| msgid "Conform to the ISO 1990 C standard with GNU extensions" +#, no-c-format msgid "Conform to the ISO 2017 C standard (published in 2018) with GNU extensions." -msgstr "達ćŸȘ ISO 1990 C æ ‡ć‡†ïŒŒäčŸæ”ŻæŒ GNU æ‰©ć±•" +msgstr "達ćŸȘ ISO 2017 C æ ‡ć‡†ïŒˆć‘ćžƒäșŽ2018ćčŽïŒ‰ïŒŒäčŸæ”ŻæŒ GNU æ‰©ć±•" #: c-family/c.opt:2602 #, fuzzy, no-c-format @@ -3927,10 +3909,9 @@ msgid "Conform to the ISO 2023 C standard draft (expected to be published in 202 msgstr "達ćŸȘ ISO 201z(7?) C++ æ ‡ć‡†è‰æĄˆć’Œ GNU æ‰©ć±•(èŻ•éȘŒæ€§èŽšçš„äžćźŒć…šæ”ŻæŒ)" #: c-family/c.opt:2606 -#, fuzzy, no-c-format -#| msgid "Deprecated in favor of -std=gnu11." +#, no-c-format msgid "Deprecated in favor of -std=gnu23." -msgstr "ć·ČćŒƒç”šïŒŒèŻ·æ”č甹 -std=gnu11。" +msgstr "ć·ČćŒƒç”šïŒŒèŻ·æ”č甹 -std=gnu23。" #: c-family/c.opt:2610 c-family/c.opt:2614 #, no-c-format @@ -4112,13 +4093,12 @@ msgstr "ç”Ÿæˆæ–‡æĄŁă€‚" #: d/lang.opt:268 #, no-c-format msgid "-fdoc-dir=\tWrite documentation file to directory ." -msgstr "" +msgstr "-fdoc-dir=\tć°†æ–‡æĄŁć†™ć…„æŒ‡ćźšç›źćœ• 侭。" #: d/lang.opt:272 -#, fuzzy, no-c-format -#| msgid "-o \tPlace output into " +#, no-c-format msgid "-fdoc-file=\tWrite documentation to ." -msgstr "-o <文件>\tć°†èŸ“ć‡șć†™ć…„æ–‡ä»¶" +msgstr "-o <文件>\tć°†æ–‡æĄŁć†™ć…„æŒ‡ćźš <文件>。" #: d/lang.opt:276 #, no-c-format @@ -5432,16 +5412,14 @@ msgid "Do not generate a single exit point for each function." msgstr "䞍äžșæŻäžȘć‡œæ•°ç”Ÿæˆć•äž€çš„é€€ć‡șç‚č" #: config/mmix/mmix.opt:95 -#, fuzzy, no-c-format -#| msgid "Set start-address of the program" +#, no-c-format msgid "Set start-address of the program." -msgstr "èźŸćźšçš‹ćșçš„è”·ć§‹ćœ°ć€" +msgstr "èźŸćźšçš‹ćșçš„è”·ć§‹ćœ°ć€ă€‚" #: config/mmix/mmix.opt:99 -#, fuzzy, no-c-format -#| msgid "Set start-address of data" +#, no-c-format msgid "Set start-address of data." -msgstr "èźŸćźšæ•°æźçš„è”·ć§‹ćœ°ć€" +msgstr "èźŸćźšæ•°æźçš„è”·ć§‹ćœ°ć€ă€‚" #: config/darwin.opt:34 #, fuzzy, no-c-format @@ -5491,10 +5469,9 @@ msgid "Generate code for the kernel or loadable kernel extensions." msgstr "äžșć†…æ žæˆ–ćŻćŠ èœœć†…æ žæ‰©ć±•ç”Ÿæˆä»Łç " #: config/darwin.opt:75 -#, fuzzy, no-c-format -#| msgid "The earliest MacOS X version on which this program will run" +#, no-c-format msgid "The earliest macOS version on which this program will run." -msgstr "èż™äžȘ繋ćșćŻèƒœćœšć…¶äžŠèżèĄŒçš„最早的 MacOS X ç‰ˆæœŹ" +msgstr "èż™äžȘ繋ćșćŻèƒœćœšć…¶äžŠèżèĄŒçš„最早的 macOS ç‰ˆæœŹă€‚" #: config/darwin.opt:80 #, no-c-format @@ -5638,12 +5615,12 @@ msgstr "" #: config/darwin.opt:198 #, no-c-format msgid "Abbreviation for \"-g -fno-eliminate-unused-debug-symbols\"." -msgstr "" +msgstr "\"-g -fno-eliminate-unused-debug-symbols\" çš„çŒ©ć†™ă€‚" #: config/darwin.opt:202 #, no-c-format msgid "Abbreviation for \"-g -feliminate-unused-debug-symbols\"." -msgstr "" +msgstr "\"-g -feliminate-unused-debug-symbols\" çš„çŒ©ć†™ă€‚" #: config/darwin.opt:206 #, no-c-format @@ -5876,16 +5853,14 @@ msgid "(Obsolete and unhandled by ld64, ignored)\tld should produce an executabl msgstr "" #: config/bfin/bfin.opt:40 config/msp430/msp430.opt:3 config/c6x/c6x.opt:38 -#, fuzzy, no-c-format -#| msgid "Use simulator runtime" +#, no-c-format msgid "Use simulator runtime." -msgstr "äœżç”šä»żçœŸć™šèżèĄŒæ—¶" +msgstr "äœżç”šä»żçœŸć™šèżèĄŒæ—¶ă€‚" #: config/bfin/bfin.opt:44 config/arm/arm.opt:120 -#, fuzzy, no-c-format -#| msgid "Specify the name of the target CPU" +#, no-c-format msgid "Specify the name of the target CPU." -msgstr "æŒ‡ćźšç›źæ ‡ CPU 的損称" +msgstr "æŒ‡ćźšç›źæ ‡ CPU 的損称。" #: config/bfin/bfin.opt:48 #, fuzzy, no-c-format @@ -5894,10 +5869,9 @@ msgid "Omit frame pointer for leaf functions." msgstr "äžșć¶ć‡œæ•°(äžè°ƒç”šć…¶ä»–ć‡œæ•°çš„ć‡œæ•°)ćżœç•„æĄ†æž¶æŒ‡é’ˆ" #: config/bfin/bfin.opt:52 -#, fuzzy, no-c-format -#| msgid "Program is entirely located in low 64k of memory" +#, no-c-format msgid "Program is entirely located in low 64k of memory." -msgstr "繋ćșćźŒć…šäœäșŽć†…ć­˜çš„äœŽ 64K" +msgstr "繋ćșćźŒć…šäœäșŽć†…ć­˜çš„äœŽ 64K。" #: config/bfin/bfin.opt:56 #, fuzzy, no-c-format @@ -6007,10 +5981,9 @@ msgid "Known M68K ISAs (for use with the -march= option):" msgstr "ć·Č矄 M68K ISA (甹äșŽ -march= 选éĄč)" #: config/m68k/ieee.opt:24 config/i386/i386.opt:389 -#, fuzzy, no-c-format -#| msgid "Use IEEE math for fp comparisons" +#, no-c-format msgid "Use IEEE math for fp comparisons." -msgstr "æ”źç‚čæ•°é—Žçš„æŻ”èŸƒäž„æ Œé”ćŸȘ IEEE æ ‡ć‡†" +msgstr "æ”źç‚čæ•°é—Žçš„æŻ”èŸƒäž„æ Œé”ćŸȘ IEEE æ ‡ć‡†ă€‚" #: config/m68k/m68k.opt:30 #, no-c-format @@ -6488,10 +6461,9 @@ msgid "Specify stringop expansion strategy." msgstr "" #: config/m32c/m32c.opt:23 -#, fuzzy, no-c-format -#| msgid "-msim\tUse simulator runtime" +#, no-c-format msgid "-msim\tUse simulator runtime." -msgstr "-msim\täœżç”šä»żçœŸć™šèżèĄŒæ—¶" +msgstr "-msim\täœżç”šä»żçœŸć™šèżèĄŒæ—¶ă€‚" #: config/m32c/m32c.opt:27 #, fuzzy, no-c-format @@ -6963,16 +6935,14 @@ msgid "Do not inline integer division." msgstr "äžć†…è”æ•Žæ•°é™€æł•ă€‚" #: config/ia64/ia64.opt:94 -#, fuzzy, no-c-format -#| msgid "Generate inline square root, optimize for latency" +#, no-c-format msgid "Generate inline square root, optimize for latency." -msgstr "ç”Ÿæˆć†…è”çš„ćčłæ–čæ čäžșæœ€ć°ć»¶èżŸäŒ˜ćŒ–" +msgstr "ç”Ÿæˆć†…è”çš„ćčłæ–čæ čäžșæœ€ć°ć»¶èżŸäŒ˜ćŒ–ă€‚" #: config/ia64/ia64.opt:98 -#, fuzzy, no-c-format -#| msgid "Generate inline square root, optimize for throughput" +#, no-c-format msgid "Generate inline square root, optimize for throughput." -msgstr "ç”Ÿæˆć†…è”çš„ćčłæ–čæ čäžșæœ€ć€§ćžćé‡äŒ˜ćŒ–" +msgstr "ç”Ÿæˆć†…è”çš„ćčłæ–čæ čäžșæœ€ć€§ćžćé‡äŒ˜ćŒ–ă€‚" #: config/ia64/ia64.opt:102 #, no-c-format @@ -7221,10 +7191,9 @@ msgid "Target the FT32B architecture." msgstr "ç›źæ ‡äžș AM33 怄理晚" #: config/ft32/ft32.opt:39 -#, fuzzy, no-c-format -#| msgid "Enable MeP Coprocessor" +#, no-c-format msgid "Enable FT32B code compression." -msgstr "搯甹 MeP ćć€„ç†ć™š" +msgstr "搯甹 FT32B ä»Łç ćŽ‹çŒ©ă€‚" #: config/ft32/ft32.opt:43 #, no-c-format @@ -7454,40 +7423,34 @@ msgid "Use windowed registers ABI." msgstr "äœżç”šæ”źç‚č毄歘晹" #: config/i386/cygming.opt:23 -#, fuzzy, no-c-format -#| msgid "Create console application" +#, no-c-format msgid "Create console application." -msgstr "戛ć»șć‘œä»€èĄŒçš‹ćș" +msgstr "戛ć»șæŽ§ćˆ¶ć°çš‹ćșă€‚" #: config/i386/cygming.opt:27 -#, fuzzy, no-c-format -#| msgid "Generate code for a DLL" +#, no-c-format msgid "Generate code for a DLL." -msgstr "ç”ŸæˆćŠšæ€é“ŸæŽ„ćș“的代码" +msgstr "ç”ŸæˆćŠšæ€é“ŸæŽ„ćș“的代码。" #: config/i386/cygming.opt:31 -#, fuzzy, no-c-format -#| msgid "Ignore dllimport for functions" +#, no-c-format msgid "Ignore dllimport for functions." -msgstr "ćżœç•„ć‡œæ•°çš„ dllimport ć±žæ€§" +msgstr "ćżœç•„ć‡œæ•°çš„ dllimport ć±žæ€§ă€‚" #: config/i386/cygming.opt:35 -#, fuzzy, no-c-format -#| msgid "Use Mingw-specific thread support" +#, no-c-format msgid "Use Mingw-specific thread support." -msgstr "äœżç”š Mingw ç‰č漚的çșżçš‹æ”ŻæŒ" +msgstr "äœżç”š Mingw ç‰č漚的çșżçš‹æ”ŻæŒă€‚" #: config/i386/cygming.opt:39 -#, fuzzy, no-c-format -#| msgid "Set Windows defines" +#, no-c-format msgid "Set Windows defines." -msgstr "èźŸćźš Windows 漚äč‰" +msgstr "èźŸćźš Windows 漚äč‰ă€‚" #: config/i386/cygming.opt:43 -#, fuzzy, no-c-format -#| msgid "Create GUI application" +#, no-c-format msgid "Create GUI application." -msgstr "戛ć»șć›Ÿćœąç•Œéąçš‹ćș" +msgstr "戛ć»șć›Ÿćœąç•Œéąćș”甚皋ćșă€‚" #: config/i386/cygming.opt:47 #, fuzzy, no-c-format @@ -7602,10 +7565,9 @@ msgid "Generate code for given CPU." msgstr "äžș给柚的 CPU ç”Ÿæˆä»Łç ă€‚" #: config/i386/i386.opt:282 config/bpf/bpf.opt:98 -#, fuzzy, no-c-format -#| msgid "Use given assembler dialect" +#, no-c-format msgid "Use given assembler dialect." -msgstr "äœżç”šç»™ćźšçš„æ±‡çŒ–éŁŽæ Œ" +msgstr "äœżç”šç»™ćźšçš„æ±‡çŒ–éŁŽæ Œă€‚" #: config/i386/i386.opt:286 #, fuzzy, no-c-format @@ -7626,15 +7588,14 @@ msgid "-mlarge-data-threshold=\tData greater than given threshold will g msgstr "朹 x86-64 äž­ç­‰æšĄćŒäž‹ć€§äșŽæŒ‡ćźšé˜ˆć€Œçš„æ•°æźć°†èą«ć­˜æ”Ÿćœš .ldata 节䞭" #: config/i386/i386.opt:304 -#, fuzzy, no-c-format -#| msgid "Use given x86-64 code model" +#, no-c-format msgid "Use given x86-64 code model." -msgstr "äœżç”šç»™ćźšçš„ x86-64 ä»Łç æšĄćŒ" +msgstr "äœżç”šç»™ćźšçš„ x86-64 ä»Łç æšĄćŒă€‚" #: config/i386/i386.opt:327 -#, fuzzy, no-c-format +#, no-c-format msgid "Use given address mode." -msgstr "äœżç”š UTF-8 æšĄćŒ" +msgstr "äœżç”šç»™ćźšçš„ćœ°ć€æšĄćŒă€‚" #: config/i386/i386.opt:331 #, no-c-format @@ -7642,10 +7603,9 @@ msgid "Known address mode (for use with the -maddress-mode= option):" msgstr "ć·ČçŸ„ćŻ»ć€æšĄćŒ (甹äșŽ -mcmodel= 选éĄč)" #: config/i386/i386.opt:344 -#, fuzzy, no-c-format -#| msgid "Generate sin, cos, sqrt for FPU" +#, no-c-format msgid "Generate sin, cos, sqrt for FPU." -msgstr "äžș FPU 生成 sin、cos 撌 sqrt 指什" +msgstr "äžș FPU 生成 sin、cos 撌 sqrt æŒ‡ä»€ă€‚" #: config/i386/i386.opt:348 #, fuzzy, no-c-format diff --git a/gcc/pretty-print.cc b/gcc/pretty-print.cc index 67c213bbaf21..eb59bf424b7c 100644 --- a/gcc/pretty-print.cc +++ b/gcc/pretty-print.cc @@ -2813,13 +2813,16 @@ test_pp_format () ASSERT_PP_FORMAT_2 ("17 12345678", "%llo %x", (long long)15, 0x12345678); ASSERT_PP_FORMAT_2 ("cafebabe 12345678", "%llx %x", (long long)0xcafebabe, 0x12345678); - ASSERT_PP_FORMAT_2 ("-27 12345678", "%wd %x", (HOST_WIDE_INT)-27, 0x12345678); - ASSERT_PP_FORMAT_2 ("-5 12345678", "%wi %x", (HOST_WIDE_INT)-5, 0x12345678); - ASSERT_PP_FORMAT_2 ("10 12345678", "%wu %x", (unsigned HOST_WIDE_INT)10, + ASSERT_PP_FORMAT_2 ("-27 12345678", "%wd %x", HOST_WIDE_INT_C (-27), 0x12345678); - ASSERT_PP_FORMAT_2 ("17 12345678", "%wo %x", (HOST_WIDE_INT)15, 0x12345678); - ASSERT_PP_FORMAT_2 ("0xcafebabe 12345678", "%wx %x", (HOST_WIDE_INT)0xcafebabe, + ASSERT_PP_FORMAT_2 ("-5 12345678", "%wi %x", HOST_WIDE_INT_C (-5), 0x12345678); + ASSERT_PP_FORMAT_2 ("10 12345678", "%wu %x", HOST_WIDE_INT_UC (10), + 0x12345678); + ASSERT_PP_FORMAT_2 ("17 12345678", "%wo %x", HOST_WIDE_INT_C (15), + 0x12345678); + ASSERT_PP_FORMAT_2 ("0xcafebabe 12345678", "%wx %x", + HOST_WIDE_INT_C (0xcafebabe), 0x12345678); ASSERT_PP_FORMAT_2 ("-27 12345678", "%zd %x", (ssize_t)-27, 0x12345678); ASSERT_PP_FORMAT_2 ("-5 12345678", "%zi %x", (ssize_t)-5, 0x12345678); ASSERT_PP_FORMAT_2 ("10 12345678", "%zu %x", (size_t)10, 0x12345678); diff --git a/gcc/profile-count.cc b/gcc/profile-count.cc index 0cb1220e0785..b26f38e33e47 100644 --- a/gcc/profile-count.cc +++ b/gcc/profile-count.cc @@ -84,34 +84,24 @@ const char *profile_quality_display_names[] = "precise" }; -/* Dump THIS to BUFFER. */ +/* Dump THIS to F. */ void -profile_count::dump (char *buffer, struct function *fun) const +profile_count::dump (FILE *f, struct function *fun) const { if (!initialized_p ()) - sprintf (buffer, "uninitialized"); + fprintf (f, "uninitialized"); else if (fun && initialized_p () && fun->cfg && ENTRY_BLOCK_PTR_FOR_FN (fun)->count.initialized_p ()) - sprintf (buffer, "%" PRId64 " (%s, freq %.4f)", m_val, + fprintf (f, "%" PRId64 " (%s, freq %.4f)", m_val, profile_quality_display_names[m_quality], to_sreal_scale (ENTRY_BLOCK_PTR_FOR_FN (fun)->count).to_double ()); else - sprintf (buffer, "%" PRId64 " (%s)", m_val, + fprintf (f, "%" PRId64 " (%s)", m_val, profile_quality_display_names[m_quality]); } -/* Dump THIS to F. */ - -void -profile_count::dump (FILE *f, struct function *fun) const -{ - char buffer[64]; - dump (buffer, fun); - fputs (buffer, f); -} - /* Dump THIS to stderr. */ void diff --git a/gcc/profile-count.h b/gcc/profile-count.h index b773b4ec47c2..b3d776475e2c 100644 --- a/gcc/profile-count.h +++ b/gcc/profile-count.h @@ -1299,9 +1299,6 @@ struct GTY(()) profile_count /* Output THIS to F. */ void dump (FILE *f, struct function *fun = NULL) const; - /* Output THIS to BUFFER. */ - void dump (char *buffer, struct function *fun = NULL) const; - /* Print THIS to stderr. */ void debug () const; diff --git a/gcc/rtlanal.cc b/gcc/rtlanal.cc index ec65cf173b46..d38455bc559b 100644 --- a/gcc/rtlanal.cc +++ b/gcc/rtlanal.cc @@ -5184,7 +5184,7 @@ nonzero_bits1 (const_rtx x, scalar_int_mode mode, const_rtx known_x, case FFS: case POPCOUNT: /* This is at most the number of bits in the mode. */ - nonzero = ((unsigned HOST_WIDE_INT) 2 << (floor_log2 (mode_width))) - 1; + nonzero = (HOST_WIDE_INT_UC (2) << (floor_log2 (mode_width))) - 1; break; case CLZ: diff --git a/gcc/rust/ChangeLog b/gcc/rust/ChangeLog index b04423a6f639..b37ca0e56f43 100644 --- a/gcc/rust/ChangeLog +++ b/gcc/rust/ChangeLog @@ -1,3 +1,54 @@ +2024-03-04 Mark Wielaard + + * lang.opt.urls: Regenerate. + +2024-02-21 0xn4utilus + + * checks/errors/rust-ast-validation.cc (ASTValidation::visit): + Add variadic check on all parameters. + +2024-02-21 Owen Avery + + * backend/rust-compile-pattern.cc + (CompilePatternLet::visit): + Lookup type of sub-pattern, not tuple pattern itself. + +2024-02-21 Marc PoulhiĂšs + + * backend/rust-builtins.cc + (BuiltinsContext::register_rust_mappings): Add powi and reformat. + * backend/rust-builtins.h: Add missing copyright header. + +2024-02-21 Arthur Cohen + + * expand/rust-macro-expand.h (struct MacroExpander): Nitpick: fix + formatting of emitted error. + +2024-02-21 Owen Avery + + * resolve/rust-ast-resolve-item.cc + (flatten_glob): Use Import class. + (flatten_rebind): Likewise. + (flatten_list): Likewise. + (flatten): Likewise. + (flatten_use_dec_to_paths): Likewise. + (flatten_use_dec_to_imports): Likewise. + (ResolveItem::visit): Likewise. + (Import::add_prefix): New. + (rust_flatten_nested_glob): Adjust test. + (rust_flatten_glob): Likewise. + (rust_flatten_rebind_none): Likewise. + (rust_flatten_rebind): Likewise. + (rust_flatten_rebind_nested): Likewise. + (rust_flatten_list): Likewise. + * resolve/rust-ast-resolve-item.h + (class Import): New. + +2024-02-21 Arthur Cohen + + * typecheck/rust-hir-type-check-implitem.h: Fix typo in field + (region_costraints -> region_constraints). + 2024-02-07 Kushal Pal * parse/rust-parse-impl.h (Parser::parse_trait_item): diff --git a/gcc/rust/lang.opt.urls b/gcc/rust/lang.opt.urls index 9cf8987e7344..3d899ae97b0a 100644 --- a/gcc/rust/lang.opt.urls +++ b/gcc/rust/lang.opt.urls @@ -24,6 +24,9 @@ UrlSuffix(gcc/Warning-Options.html#index-Wno-unused-const-variable) Wunused-result UrlSuffix(gcc/Warning-Options.html#index-Wno-unused-result) +Winfinite-recursion +UrlSuffix(gcc/Warning-Options.html#index-Winfinite-recursion) + o UrlSuffix(gcc/Overall-Options.html#index-o) diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc index 36dd52279178..dceaa13333ca 100644 --- a/gcc/simplify-rtx.cc +++ b/gcc/simplify-rtx.cc @@ -7846,7 +7846,7 @@ simplify_context::simplify_subreg (machine_mode outermode, rtx op, { rtx tem = simplify_subreg (int_outermode, op, innermode, byte); if (tem) - return simplify_gen_subreg (outermode, tem, int_outermode, byte); + return lowpart_subreg (outermode, tem, int_outermode); } /* If OP is a vector comparison and the subreg is not changing the diff --git a/gcc/stor-layout.cc b/gcc/stor-layout.cc index 4cf249133e9d..e34be19689c0 100644 --- a/gcc/stor-layout.cc +++ b/gcc/stor-layout.cc @@ -476,6 +476,32 @@ bitwise_type_for_mode (machine_mode mode) return inner_type; } +/* Find a mode that can be used for efficient bitwise operations on SIZE + bits, if one exists. */ + +opt_machine_mode +bitwise_mode_for_size (poly_uint64 size) +{ + if (known_le (size, (unsigned int) MAX_FIXED_MODE_SIZE)) + return mode_for_size (size, MODE_INT, true); + + machine_mode mode, ret = VOIDmode; + FOR_EACH_MODE_FROM (mode, MIN_MODE_VECTOR_INT) + if (known_eq (GET_MODE_BITSIZE (mode), size) + && (ret == VOIDmode || GET_MODE_INNER (mode) == QImode) + && have_regs_of_mode[mode] + && targetm.vector_mode_supported_p (mode)) + { + if (GET_MODE_INNER (mode) == QImode) + return mode; + else if (ret == VOIDmode) + ret = mode; + } + if (ret != VOIDmode) + return ret; + return opt_machine_mode (); +} + /* Find a mode that is suitable for representing a vector with NUNITS elements of mode INNERMODE, if one exists. The returned mode can be either an integer mode or a vector mode. */ diff --git a/gcc/stor-layout.h b/gcc/stor-layout.h index 7fbc312bdf8b..096ca8117627 100644 --- a/gcc/stor-layout.h +++ b/gcc/stor-layout.h @@ -102,6 +102,8 @@ extern opt_machine_mode mode_for_size_tree (const_tree, enum mode_class, int); extern tree bitwise_type_for_mode (machine_mode); +extern opt_machine_mode bitwise_mode_for_size (poly_uint64); + /* Given a VAR_DECL, PARM_DECL or RESULT_DECL, clears the results of a previous call to layout_decl and calls it again. */ extern void relayout_decl (tree); diff --git a/gcc/system.h b/gcc/system.h index b0edab028854..ab29fc197764 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -194,27 +194,8 @@ extern int fprintf_unlocked (FILE *, const char *, ...); #undef fread_unlocked #undef fwrite_unlocked -/* Include before "safe-ctype.h" to avoid GCC poisoning - the ctype macros through safe-ctype.h */ - -#ifdef __cplusplus -#ifdef INCLUDE_STRING -# include -#endif -#endif - -/* There are an extraordinary number of issues with . - The last straw is that it varies with the locale. Use libiberty's - replacement instead. */ -#include "safe-ctype.h" - -#include - -#include - -#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO -extern int errno; -#endif +/* Include C++ standard headers before "safe-ctype.h" to avoid GCC + poisoning the ctype macros through safe-ctype.h */ #ifdef __cplusplus #if defined (INCLUDE_ALGORITHM) || !defined (HAVE_SWAP_IN_UTILITY) @@ -229,6 +210,9 @@ extern int errno; #ifdef INCLUDE_SET # include #endif +#ifdef INCLUDE_STRING +# include +#endif #ifdef INCLUDE_VECTOR # include #endif @@ -245,6 +229,19 @@ extern int errno; # include #endif +/* There are an extraordinary number of issues with . + The last straw is that it varies with the locale. Use libiberty's + replacement instead. */ +#include "safe-ctype.h" + +#include + +#include + +#if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO +extern int errno; +#endif + /* Some of glibc's string inlines cause warnings. Plus we'd rather rely on (and therefore test) GCC's string builtins. */ #define __NO_STRING_INLINES diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c9c2db7b67f5..fce619c24d10 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,3485 @@ +2024-03-08 Martin Jambor + + PR ipa/113757 + * g++.dg/ipa/pr113757.C: New test. + +2024-03-08 David Faust + + * gcc.target/bpf/inline-memops-threshold-1.c: New test. + * gcc.target/bpf/inline-memops-threshold-2.c: New test. + +2024-03-08 Richard Earnshaw + + PR target/113542 + * gcc.target/arm/bics_3.c: Adjust code to something which should + always result in BICS. + +2024-03-08 David Faust + + * gcc.target/bpf/memset-1.c: Move error test case to... + * gcc.target/bpf/memset-2.c: ... here. New test. + +2024-03-08 Wilco Dijkstra + + PR target/113915 + * gcc.target/arm/builtin-bswap.x: Fix test to avoid emitting CBZ. + +2024-03-08 Jakub Jelinek + + PR rtl-optimization/113617 + PR target/114233 + * g++.dg/other/pr113617.C: Define -DSHARED when linking with -shared. + * g++.dg/other/pr113617-aux.cc: Add definitions for used methods and + templates not defined elsewhere. + +2024-03-08 Jakub Jelinek + + PR target/38534 + * gcc.target/i386/pr38534-1.c: Add -mnoreturn-no-callee-saved-registers + to dg-options. + * gcc.target/i386/pr38534-2.c: Likewise. + * gcc.target/i386/pr38534-3.c: Likewise. + * gcc.target/i386/pr38534-4.c: Likewise. + * gcc.target/i386/pr38534-5.c: Likewise. + * gcc.target/i386/pr38534-6.c: Likewise. + * gcc.target/i386/pr114097-1.c: Likewise. + * gcc.target/i386/stack-check-17.c: Likewise. + +2024-03-08 Jakub Jelinek + + * g++.dg/ext/atomic-5.C: New test. + +2024-03-08 Jakub Jelinek + + PR debug/113918 + * c-c++-common/dwarf2/pr113918.c: New test. + +2024-03-08 Jakub Jelinek + + PR c++/113802 + * g++.dg/cpp23/explicit-obj-diagnostics3.C (S0, S1, S2, S3, S4): Don't + expect any diagnostics on f and fd member function templates, add + similar templates with ...Selves instead of Selves as k and kd and + expect diagnostics for those. Expect extra diagnostics in error + recovery for g and gd member function templates. + +2024-03-08 Richard Biener + + PR testsuite/108355 + * gcc.dg/tree-ssa/ssa-fre-104.c: Align e. + +2024-03-08 Gaius Mulley + + * gm2/iso/pass/arrayconst.mod: New test. + * gm2/iso/pass/arrayconst2.mod: New test. + * gm2/iso/pass/arrayconst3.mod: New test. + * gm2/iso/pass/arrayconst4.mod: New test. + +2024-03-08 demin.han + + PR target/114264 + * gcc.dg/vect/costmodel/riscv/rvv/pr114264.c: New test. + +2024-03-08 Haochen Gui + + * gcc.target/powerpc/fwprop-1.c: New. + +2024-03-07 Nathaniel Shead + + PR c++/114229 + * g++.dg/modules/virt-2_b.C: Update test to acknowledge that we + now emit vtables here too. + * g++.dg/modules/virt-3_a.C: New test. + * g++.dg/modules/virt-3_b.C: New test. + * g++.dg/modules/virt-3_c.C: New test. + * g++.dg/modules/virt-3_d.C: New test. + +2024-03-07 Patrick Palka + + PR c++/103994 + * g++.dg/modules/pr99425-1_b.H: s/alias/decl in dump scan. + * g++.dg/modules/tpl-alias-1_a.H: Likewise. + * g++.dg/modules/tpl-alias-2_a.H: New test. + * g++.dg/modules/tpl-alias-2_b.C: New test. + +2024-03-07 Wilco Dijkstra + + PR target/113618 + * gcc.target/aarch64/pr113618.c: New test. + +2024-03-07 Patrick Palka + + PR c++/110730 + PR c++/105512 + * g++.dg/modules/hello-2_a.C: New test. + * g++.dg/modules/hello-2_b.C: New test. + * g++.dg/modules/namespace-6_a.H: New test. + * g++.dg/modules/namespace-6_b.C: New test. + +2024-03-07 Francois-Xavier Coudert + + PR target/114233 + * lib/target-supports.exp: Fix test for C++. + +2024-03-07 Robin Dapp + + * gcc.target/aarch64/pr114196.c: New test. + * gcc.target/riscv/rvv/autovec/pr114196.c: New test. + +2024-03-07 Marek Polacek + + PR c++/110031 + * g++.dg/cpp1z/inline-var11.C: New test. + +2024-03-07 Jeevitha Palanisamy + + PR target/113950 + * gcc.target/powerpc/pr113950.c: New testcase. + +2024-03-07 Eric Botcazou + + * gnat.dg/predicate15.adb: New test. + +2024-03-07 Nathaniel Shead + + PR c++/98356 + * g++.dg/pr98356.C: New test. + +2024-03-07 Nathaniel Shead + + PR c++/98881 + * g++.dg/modules/tpl-tpl-parm-3.h: New test. + * g++.dg/modules/tpl-tpl-parm-3_a.H: New test. + * g++.dg/modules/tpl-tpl-parm-3_b.C: New test. + * g++.dg/modules/tpl-tpl-parm-3_c.C: New test. + +2024-03-07 Jakub Jelinek + + PR rtl-optimization/110079 + * gcc.dg/pr110079.c: New test. + +2024-03-07 Jakub Jelinek + + PR middle-end/105533 + * gcc.dg/pr105533.c: New test. + +2024-03-07 chenxiaolong + + * gcc.target/loongarch/vector/lasx/lasx-xvfrint_s.c: Replace + ASSERTEQ_64 with the macro ASSERTEQ_32. + * gcc.target/loongarch/vector/lasx/lasx-xvshuf_b.c: Modify the expected + test results of some functions according to the function of the vector + instruction. + * gcc.target/loongarch/vector/lsx/lsx-vfrint_s.c: Same + modification as lasx-xvfrint_s.c. + * gcc.target/loongarch/vector/lsx/lsx-vshuf.c: Same + modification as lasx-xvshuf_b.c. + * gcc.target/loongarch/vector/simd_correctness_check.h: Use the llabs() + function instead of abs() to check the correctness of the results. + +2024-03-07 Jakub Jelinek + + PR tree-optimization/114009 + * gcc.dg/tree-ssa/pr114009.c: New test. + +2024-03-07 Jerry DeLisle + + PR libfortran/105456 + * gfortran.dg/pr105456.f90: Revise using '%' characters + in users error message. + +2024-03-06 Robin Dapp + + * gcc.target/riscv/rvv/autovec/pr114200.c: New test. + * gcc.target/riscv/rvv/autovec/pr114202.c: New test. + +2024-03-06 Robin Dapp + + * gcc.dg/vect/costmodel/riscv/rvv/vse-slp-1.c: New test. + * gcc.dg/vect/costmodel/riscv/rvv/vse-slp-2.c: New test. + +2024-03-06 Wilco Dijkstra + + PR target/113915 + * gcc.target/arm/builtin-bswap-1.c: Fix test to allow conditional + execution both for Arm and Thumb-2. + +2024-03-06 Jeff Law + + PR target/113001 + PR target/112871 + * gcc.target/riscv/zicond-ice-3.c: New test. + * gcc.target/riscv/zicond-ice-4.c: New test. + +2024-03-06 Harald Anlauf + + PR fortran/103707 + PR fortran/106987 + * gfortran.dg/pr99350.f90: + * gfortran.dg/arithmetic_overflow_3.f90: New test. + +2024-03-06 Marek Polacek + + PR c++/114114 + * g++.dg/cpp0x/noexcept84.C: New test. + +2024-03-06 Thomas Schwinge + + * gcc.target/gcn/sram-ecc-3.c: Adjust. + * gcc.target/gcn/sram-ecc-4.c: Likewise. + * gcc.target/gcn/sram-ecc-7.c: Likewise. + * gcc.target/gcn/sram-ecc-8.c: Likewise. + +2024-03-06 Richard Biener + + PR tree-optimization/114239 + * gcc.dg/vect/vect-early-break_122-pr114239.c: New testcase. + +2024-03-06 Xi Ruoyao + + * gcc.target/loongarch/vfcmp-f.c: Rewrite to avoid named + registers. + * gcc.target/loongarch/vfcmp-d.c: Likewise. + * gcc.target/loongarch/xvfcmp-f.c: Likewise. + * gcc.target/loongarch/xvfcmp-d.c: Likewise. + +2024-03-06 Nathaniel Shead + + PR c++/113629 + * g++.dg/cpp23/explicit-obj-conv-op.C: New test. + +2024-03-06 Richard Biener + + PR tree-optimization/114249 + * gcc.dg/vect/bb-slp-pr114249.c: New testcase. + +2024-03-06 Richard Biener + + PR tree-optimization/114246 + * gcc.dg/torture/pr114246.c: New testcase. + +2024-03-06 Jakub Jelinek + + PR rtl-optimization/114190 + * gcc.target/i386/avx-pr114190.c: New test. + +2024-03-06 Jerry DeLisle + + PR libfortran/105456 + * gfortran.dg/pr105456-nmlr.f90: New test. + * gfortran.dg/pr105456-nmlw.f90: New test. + * gfortran.dg/pr105456-ruf.f90: New test. + * gfortran.dg/pr105456-wf.f90: New test. + * gfortran.dg/pr105456-wuf.f90: New test. + +2024-03-06 Patrick Palka + + * g++.dg/modules/friend-7.h: New test. + * g++.dg/modules/friend-7_a.H: New test. + * g++.dg/modules/friend-7_b.C: New test. + +2024-03-05 Cupertino Miranda + Indu Bhagat + + PR debug/114186 + * gcc.dg/debug/ctf/ctf-array-6.c: Add test. + +2024-03-05 Richard Sandiford + + PR sanitizer/97696 + * gcc.target/aarch64/sve/pr97696.c: New test. + +2024-03-05 Richard Sandiford + + * gcc.target/aarch64/sme/strided_1.c (test5): Remove. + +2024-03-05 Saurabh Jha + + PR target/112337 + * gcc.target/arm/pr112337.c: Check for, then use the right MVE + options. + +2024-03-05 Xi Ruoyao + + * gcc.target/loongarch/regname-fp-s9.c: New test. + +2024-03-05 Roger Sayle + + * gcc.target/avr/torture/insv-anyshift-hi.c: New test. + * gcc.target/avr/torture/insv-anyshift-si.c: New test. + +2024-03-05 Richard Biener + + PR tree-optimization/114231 + * gcc.dg/vect/pr114231.c: New testcase. + +2024-03-05 Jakub Jelinek + + PR rtl-optimization/114211 + * gcc.dg/pr114211.c: New test. + +2024-03-05 Jakub Jelinek + + PR middle-end/114157 + * gcc.dg/bitint-98.c: New test. + * gcc.target/i386/avx2-pr114157.c: New test. + * gcc.target/i386/avx512f-pr114157.c: New test. + +2024-03-05 Jakub Jelinek + + PR target/114116 + * gcc.target/i386/pr38534-1.c: Allow push/pop of bp. + * gcc.target/i386/pr38534-4.c: Likewise. + * gcc.target/i386/pr38534-2.c: Likewise. + * gcc.target/i386/pr38534-3.c: Likewise. + * gcc.target/i386/pr114097-1.c: Likewise. + * gcc.target/i386/stack-check-17.c: Expect no pop on ! ia32. + +2024-03-05 Patrick Palka + + * g++.dg/modules/friend-6_a.C: Pass -Wno-global-module instead + of -Wno-pedantic. Remove now unnecessary preprocessing + directives from GMF. + +2024-03-04 Nathaniel Shead + + * g++.dg/modules/using-12.C: New test. + * g++.dg/modules/using-13.h: New test. + * g++.dg/modules/using-13_a.C: New test. + * g++.dg/modules/using-13_b.C: New test. + +2024-03-04 David Faust + + * gcc.target/bpf/memset-1.c: New test. + +2024-03-04 Jan Dubiec + + * gcc.c-torture/execute/20101011-1.c: Do not test on H8 series. + +2024-03-04 Richard Biener + + PR tree-optimization/114197 + * gcc.dg/torture/pr114197.c: New testcase. + +2024-03-04 Richard Biener + + PR tree-optimization/114203 + * gcc.dg/torture/pr114203.c: New testcase. + +2024-03-04 Jakub Jelinek + + PR middle-end/114209 + * gcc.dg/bitint-97.c: New test. + +2024-03-04 Xi Ruoyao + + PR testsuite/113418 + * gcc.dg/pr104992.c (dg-options): Use -fdump-tree-forwprop2 + instead of -fdump-tree-optimized. + (dg-final): Scan forwprop2 dump instead of optimized, and remove + the use of vect_int_mod. + * lib/target-supports.exp (check_effective_target_vect_int_mod): + Remove because it's not used anymore. + +2024-03-04 Jakub Jelinek + + PR target/114184 + * gcc.target/i386/pr114184.c: New test. + +2024-03-04 Roger Sayle + + PR target/114187 + * g++.target/i386/pr114187.C: New test case. + +2024-03-03 Greg McGary + + * gcc.c-torture/execute/pr113010.c: New test. + +2024-03-03 Iain Buclaw + + PR d/114171 + * gdc.dg/torture/pr114171.d: New test. + +2024-03-01 Patrick Palka + + PR c++/104919 + PR c++/106009 + * g++.dg/modules/tdef-7.h: Remove outdated comment. + * g++.dg/modules/tdef-7_b.C: Don't expect two TYPE_DECLs. + * g++.dg/modules/enum-13_a.C: New test. + * g++.dg/modules/enum-13_b.C: New test. + +2024-03-01 Nathaniel Shead + + PR c++/114170 + * g++.dg/modules/var-tpl-2_a.H: New test. + * g++.dg/modules/var-tpl-2_b.C: New test. + +2024-03-01 Nathaniel Shead + + PR c++/114005 + * g++.dg/modules/pr114005_a.C: New test. + * g++.dg/modules/pr114005_b.C: New test. + +2024-03-01 Jeff Law + + * gcc.target/riscv/rvv/autovec/vls/calling-convention-1.c: Turn off + second phase scheduler. + * gcc.target/riscv/rvv/autovec/vls/calling-convention-2.c: Likewise. + * gcc.target/riscv/rvv/autovec/vls/calling-convention-3.c: Likewise. + * gcc.target/riscv/rvv/autovec/vls/calling-convention-4.c: Likewise. + * gcc.target/riscv/rvv/autovec/vls/calling-convention-5.c: Likewise. + * gcc.target/riscv/rvv/autovec/vls/calling-convention-6.c: Likewise. + * gcc.target/riscv/rvv/autovec/vls/calling-convention-7.c: Likewise. + +2024-03-01 Patrick Palka + + * g++.dg/modules/cexpr-4_a.C: New test. + * g++.dg/modules/cexpr-4_b.C: New test. + +2024-03-01 Marek Polacek + + PR c++/110358 + PR c++/109642 + * g++.dg/ext/attr-no-dangling1.C: New test. + * g++.dg/ext/attr-no-dangling2.C: New test. + * g++.dg/ext/attr-no-dangling3.C: New test. + * g++.dg/ext/attr-no-dangling4.C: New test. + * g++.dg/ext/attr-no-dangling5.C: New test. + * g++.dg/ext/attr-no-dangling6.C: New test. + * g++.dg/ext/attr-no-dangling7.C: New test. + * g++.dg/ext/attr-no-dangling8.C: New test. + * g++.dg/ext/attr-no-dangling9.C: New test. + +2024-03-01 David Faust + + * gcc.dg/debug/ctf/ctf-file-scope-1.c (SFOO): Make array member + fixed-length. + +2024-03-01 Harald Anlauf + + PR fortran/104819 + * gfortran.dg/assumed_rank_9.f90: Adjust testcase use of NULL(). + * gfortran.dg/pr101329.f90: Adjust testcase to conform to interp. + * gfortran.dg/null_actual_4.f90: New test. + +2024-03-01 Patrick Palka + + PR c++/110025 + PR c++/114138 + * g++.dg/cpp23/auto-fncast16.C: New test. + * g++.dg/cpp23/auto-fncast17.C: New test. + * g++.dg/cpp23/auto-fncast18.C: New test. + +2024-03-01 Jakub Jelinek + + PR c++/92687 + * g++.dg/cpp1z/decomp59.C: New test. + +2024-03-01 Jakub Jelinek + Tobias Burnus + + PR c++/110347 + * g++.dg/gomp/target-lambda-1.C: Moved to become a + run-time test under testsuite/libgomp.c++. + +2024-03-01 Jakub Jelinek + + PR debug/114015 + * gcc.dg/debug/dwarf2/pr114015.c: New test. + +2024-03-01 xuli + + * g++.target/riscv/rvv/base/attribute-riscv_vector_cc-error.C: New test. + * gcc.target/riscv/rvv/base/attribute-riscv_vector_cc-callee-saved.c: New test. + * gcc.target/riscv/rvv/base/attribute-riscv_vector_cc-error.c: New test. + +2024-03-01 Pan Li + + PR target/112817 + * g++.target/riscv/rvv/base/pr111296.C: Replace + param=riscv-autovec-preference to mrvv-vector-bits. + * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-6.c: Ditto. + * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-8.c: Ditto. + * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-12.c: Ditto. + * gcc.dg/vect/costmodel/riscv/rvv/pr113112-1.c: Ditto. + * gcc.dg/vect/costmodel/riscv/rvv/pr113112-2.c: Ditto. + * gcc.dg/vect/costmodel/riscv/rvv/pr113112-3.c: Ditto. + * gcc.dg/vect/costmodel/riscv/rvv/pr113112-4.c: Ditto. + * gcc.dg/vect/costmodel/riscv/rvv/pr113112-5.c: Ditto. + * gcc.dg/vect/costmodel/riscv/rvv/pr113247-2.c: Ditto. + * gcc.dg/vect/costmodel/riscv/rvv/pr113247-4.c: Ditto. + * gcc.dg/vect/costmodel/riscv/rvv/pr113281-2.c: Ditto. + * gcc.dg/vect/costmodel/riscv/rvv/pr113281-4.c: Ditto. + * gcc.target/riscv/rvv/autovec/align-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/align-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/copysign-run.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/copysign-rv32gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/copysign-rv64gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/copysign-zvfh-run.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/fmax-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/fmax_run-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/fmax_zvfh-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/fmax_zvfh_run-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/fmin-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/fmin_run-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/fmin_zvfh-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/fmin_zvfh_run-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/mulh-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/mulh-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/mulh_run-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/mulh_run-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/narrow-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/narrow-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/narrow-3.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/narrow_run-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/narrow_run-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/narrow_run-3.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/shift-immediate.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/shift-run.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/shift-rv32gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/shift-rv64gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/shift-scalar-run.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/shift-scalar-rv32gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/shift-scalar-rv64gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/shift-scalar-template.h: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vadd-run-nofm.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vadd-run.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vadd-rv32gcv-nofm.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vadd-rv32gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vadd-rv64gcv-nofm.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vadd-rv64gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vadd-zvfh-run.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vand-run.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vand-rv32gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vand-rv64gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vcompress-avlprop-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vdiv-run-nofm.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vdiv-run.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vdiv-rv32gcv-nofm.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vdiv-rv32gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vdiv-rv64gcv-nofm.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vdiv-rv64gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vdiv-zvfh-run.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vmax-run.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vmax-rv32gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vmax-rv64gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vmax-zvfh-run.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vmin-run.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vmin-rv32gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vmin-rv64gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vmin-zvfh-run.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vmul-run-nofm.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vmul-run.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vmul-rv32gcv-nofm.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vmul-rv32gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vmul-rv64gcv-nofm.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vmul-rv64gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vmul-zvfh-run.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vor-run.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vor-rv32gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vor-rv64gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vrem-run.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vrem-rv32gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vrem-rv64gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vsub-run-nofm.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vsub-run.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vsub-rv32gcv-nofm.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vsub-rv32gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vsub-rv64gcv-nofm.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vsub-rv64gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vsub-zvfh-run.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vxor-run.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vxor-rv32gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/binop/vxor-rv64gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/bug-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/bug-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/bug-3.c: Ditto. + * gcc.target/riscv/rvv/autovec/bug-4.c: Ditto. + * gcc.target/riscv/rvv/autovec/bug-5.c: Ditto. + * gcc.target/riscv/rvv/autovec/bug-6.c: Ditto. + * gcc.target/riscv/rvv/autovec/bug-8.c: Ditto. + * gcc.target/riscv/rvv/autovec/cmp/vcond-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cmp/vcond-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cmp/vcond-3.c: Ditto. + * gcc.target/riscv/rvv/autovec/cmp/vcond-4.c: Ditto. + * gcc.target/riscv/rvv/autovec/cmp/vcond_run-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cmp/vcond_run-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cmp/vcond_run-3.c: Ditto. + * gcc.target/riscv/rvv/autovec/cmp/vcond_run-4.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_arith-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_arith-10.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_arith-11.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_arith-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_arith-3.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_arith-4.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_arith-5.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_arith-6.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_arith-7.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_arith-8.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_arith-9.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_arith_run-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_arith_run-10.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_arith_run-11.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_arith_run-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_arith_run-3.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_arith_run-4.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_arith_run-5.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_arith_run-6.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_arith_run-7.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_arith_run-8.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_arith_run-9.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_float2float-rv32-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_float2float-rv32-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_float2float-rv64-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_float2float-rv64-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_float2float_run-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_float2float_run-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int-rv32-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int-rv32-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int-rv64-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int-rv64-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_run-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_run-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_zvfh-rv32-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_zvfh-rv32-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_zvfh-rv64-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_zvfh-rv64-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_zvfh_run-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_float2int_zvfh_run-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_int2float-rv32-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_int2float-rv32-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_int2float-rv64-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_int2float-rv64-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_int2float_run-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_int2float_run-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv32-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv32-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv64-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv64-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int_run-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int_run-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_copysign-run.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_copysign-rv32gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_copysign-rv64gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_copysign-zvfh-run.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_fadd-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_fadd-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_fadd-3.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_fadd-4.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_fadd_run-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_fadd_run-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_fadd_run-3.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_fadd_run-4.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_fma_fnma-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_fma_fnma-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_fma_fnma-3.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_fma_fnma-4.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_fma_fnma-5.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_fma_fnma-6.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_fma_fnma-7.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_fma_fnma-8.c: + * gcc.target/riscv/rvv/autovec/cond/cond_fma_fnma_run-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_fma_fnma_run-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_fma_fnma_run-3.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_fma_fnma_run-4.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_fma_fnma_run-5.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fma_fnma_run-6.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fma_fnma_run-7.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fma_fnma_run-8.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmax-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmax-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmax-3.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmax-4.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmax_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmax_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmax_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmax_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmax_zvfh-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmax_zvfh-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmax_zvfh-3.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmax_zvfh-4.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmax_zvfh_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmax_zvfh_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmax_zvfh_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmax_zvfh_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmin-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmin-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmin-3.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmin-4.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmin_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmin_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmin_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmin_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmin_zvfh-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmin_zvfh-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmin_zvfh-3.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmin_zvfh-4.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmin_zvfh_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmin_zvfh_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmin_zvfh_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmin_zvfh_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fms_fnms-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fms_fnms-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fms_fnms-3.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fms_fnms-4.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fms_fnms-5.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fms_fnms-6.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fms_fnms_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fms_fnms_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fms_fnms_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fms_fnms_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fms_fnms_run-5.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fms_fnms_run-6.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmul-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmul-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmul-3.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmul-4.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmul-5.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmul_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmul_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmul_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmul_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_fmul_run-5.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_logical_min_max-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_logical_min_max-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_logical_min_max-3.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_logical_min_max-4.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_logical_min_max-5.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_logical_min_max_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_logical_min_max_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_logical_min_max_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_logical_min_max_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_logical_min_max_run-5.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_mulh-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_mulh-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_mulh_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_mulh_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_narrow_shift-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_narrow_shift-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_narrow_shift-3.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_narrow_shift_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_narrow_shift_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_narrow_shift_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_shift-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_shift-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_shift-3.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_shift-4.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_shift-5.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_shift-6.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_shift-7.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_shift-8.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_shift-9.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_shift_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_shift_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_shift_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_shift_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_shift_run-5.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_shift_run-6.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_shift_run-7.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_shift_run-8.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_shift_run-9.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_sqrt-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_sqrt-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_sqrt-zvfh-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_sqrt-zvfh-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_sqrt_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_sqrt_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_sqrt_run-zvfh-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_sqrt_run-zvfh-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_unary-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_unary-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_unary-3.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_unary-4.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_unary-5.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_unary-6.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_unary-7.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_unary-8.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_unary_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_unary_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_unary_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_unary_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_unary_run-5.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_unary_run-6.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_unary_run-7.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_unary_run-8.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-3.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-4.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-5.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-6.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-7.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-8.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_widen_complicate-9.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_widen_reduc-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_widen_reduc-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_widen_reduc_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/cond_widen_reduc_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/cond/pr111401.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vec-narrow-int64-float16.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vec-widen-float16-int64.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfcvt-itof-run.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfcvt-itof-rv32gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfcvt-itof-rv64gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfcvt-itof-zvfh-run.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfcvt_rtz-run.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfcvt_rtz-rv32gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfcvt_rtz-rv64gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfcvt_rtz-zvfh-run.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfncvt-ftoi-run.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfncvt-ftoi-rv32gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfncvt-ftoi-rv64gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfncvt-ftoi-zvfh-run.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfncvt-itof-run.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfncvt-itof-rv32gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfncvt-itof-rv64gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfncvt-itof-zvfh-run.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfncvt-run.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfncvt-rv32gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfncvt-rv64gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfncvt-zvfh-run.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfwcvt-ftoi-run.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfwcvt-ftoi-rv32gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfwcvt-ftoi-rv64gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfwcvt-ftoi-zvfh-run.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfwcvt-itof-run.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfwcvt-itof-rv32gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfwcvt-itof-rv64gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfwcvt-itof-zvfh-run.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfwcvt-run.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfwcvt-rv32gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfwcvt-rv64gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vfwcvt-zvfh-run.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vncvt-run.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vncvt-rv32gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vncvt-rv64gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vsext-run.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vsext-rv32gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vsext-rv64gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vzext-run.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vzext-rv32gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/conversions/vzext-rv64gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/fixed-vlmax-1.c: Diito. + * gcc.target/riscv/rvv/autovec/fold-min-poly.c: Diito. + * gcc.target/riscv/rvv/autovec/gather-scatter/strided_load-1.c: Diito. + * gcc.target/riscv/rvv/autovec/gather-scatter/strided_load-2.c: Diito. + * gcc.target/riscv/rvv/autovec/gather-scatter/strided_store-1.c: Diito. + * gcc.target/riscv/rvv/autovec/gather-scatter/strided_store-2.c: Diito. + * gcc.target/riscv/rvv/autovec/madd-split2-1.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/gimple_fold-1.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/live-1.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/live-2.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/live_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/live_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/multiple_rgroup-1.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/multiple_rgroup-2.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/multiple_rgroup-3.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/multiple_rgroup-4.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/multiple_rgroup_zbb.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/select_vl-1.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/select_vl-2.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/single_rgroup-1.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/single_rgroup-2.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/single_rgroup-3.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/single_rgroup_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/single_rgroup_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/single_rgroup_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp-1.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp-10.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp-11.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp-12.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp-13.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp-14.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp-15.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp-16.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp-17.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp-18.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp-19.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp-2.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp-3.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp-4.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp-5.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp-6.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp-7.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp-8.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp-9.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp_run-10.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp_run-11.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp_run-12.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp_run-13.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp_run-14.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp_run-15.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp_run-16.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp_run-17.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp_run-18.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp_run-19.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp_run-5.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp_run-6.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp_run-7.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp_run-8.c: Diito. + * gcc.target/riscv/rvv/autovec/partial/slp_run-9.c: Diito. + * gcc.target/riscv/rvv/autovec/post-ra-avl.c: Diito. + * gcc.target/riscv/rvv/autovec/pr110950.c: Diito. + * gcc.target/riscv/rvv/autovec/pr110964.c: Diito. + * gcc.target/riscv/rvv/autovec/pr110989.c: Diito. + * gcc.target/riscv/rvv/autovec/pr111232.c: Diito. + * gcc.target/riscv/rvv/autovec/pr111295.c: Diito. + * gcc.target/riscv/rvv/autovec/pr111313.c: Diito. + * gcc.target/riscv/rvv/autovec/pr112326.c: Diito. + * gcc.target/riscv/rvv/autovec/pr112552.c: Diito. + * gcc.target/riscv/rvv/autovec/pr112554.c: Diito. + * gcc.target/riscv/rvv/autovec/pr112561.c: Diito. + * gcc.target/riscv/rvv/autovec/pr112597-1.c: Diito. + * gcc.target/riscv/rvv/autovec/pr112599-1.c: Diito. + * gcc.target/riscv/rvv/autovec/pr112599-3.c: Diito. + * gcc.target/riscv/rvv/autovec/pr112694-1.c: Diito. + * gcc.target/riscv/rvv/autovec/pr112854.c: Diito. + * gcc.target/riscv/rvv/autovec/pr112872.c: Diito. + * gcc.target/riscv/rvv/autovec/pr112999.c: Diito. + * gcc.target/riscv/rvv/autovec/pr113393-1.c: Diito. + * gcc.target/riscv/rvv/autovec/pr113393-2.c: Diito. + * gcc.target/riscv/rvv/autovec/pr113393-3.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last-1.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last-10.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last-11.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last-12.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last-13.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last-14.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last-2.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last-3.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last-4.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last-5.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last-6.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last-7.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last-8.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last-9.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last_run-10.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last_run-11.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last_run-12.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last_run-13.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last_run-14.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last_run-5.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last_run-6.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last_run-7.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last_run-8.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/extract_last_run-9.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc-1.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc-10.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc-2.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc-3.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc-4.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc-5.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc-6.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc-7.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc-8.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc-9.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_call-1.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_call-2.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_call-3.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_call-4.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_call-5.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_run-10.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_run-5.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_run-6.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_run-7.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_run-8.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_strict-1.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_strict-2.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_strict-3.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_strict-4.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_strict-5.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_strict-6.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_strict-7.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_strict_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_strict_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_zvfh-10.c: Diito. + * gcc.target/riscv/rvv/autovec/reduc/reduc_zvfh_run-10.c: Diito. + * gcc.target/riscv/rvv/autovec/scalable-1.c: Diito. + * gcc.target/riscv/rvv/autovec/series-1.c: Diito. + * gcc.target/riscv/rvv/autovec/series_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/slp-mask-1.c: Diito. + * gcc.target/riscv/rvv/autovec/slp-mask-run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_load-1.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_load-2.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_load-3.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_load-4.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_load-5.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_load-6.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_load-7.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_load_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_load_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_load_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_load_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_load_run-5.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_load_run-6.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_load_run-7.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_store-1.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_store-2.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_store-3.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_store-4.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_store-5.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_store-6.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_store-7.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_store_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_store_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_store_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_store_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_store_run-5.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_store_run-6.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/mask_struct_store_run-7.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect-1.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect-10.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect-11.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect-12.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect-13.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect-14.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect-15.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect-16.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect-17.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect-18.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect-2.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect-3.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect-4.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect-5.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect-6.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect-7.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect-8.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect-9.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect_run-10.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect_run-11.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect_run-12.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect_run-13.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect_run-14.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect_run-15.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect_run-16.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect_run-17.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect_run-18.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect_run-5.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect_run-6.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect_run-7.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect_run-8.c: Diito. + * gcc.target/riscv/rvv/autovec/struct/struct_vect_run-9.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop-1.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop-10.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop-11.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop-12.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop-2.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop-3.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop-4.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop-5.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop-6.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop-7.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop-8.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop-9.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-1.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-10.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-11.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-12.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-2.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-3.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-4.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-5.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-6.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-7.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-8.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm-9.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm_run-10.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm_run-11.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm_run-12.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm_run-5.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm_run-6.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm_run-7.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm_run-8.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_nofm_run-9.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run-10.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run-11.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run-12.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run-5.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run-6.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run-7.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run-8.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run-9.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-1.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-10.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-11.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-12.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-2.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-3.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-4.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-5.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-6.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-7.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-8.c: Diito. + * gcc.target/riscv/rvv/autovec/ternop/ternop_run_zvfh-9.c: Diito. + * gcc.target/riscv/rvv/autovec/unop/abs-run.c: Diito. + * gcc.target/riscv/rvv/autovec/unop/abs-rv32gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/unop/abs-rv64gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/unop/abs-zvfh-run.c: Diito. + * gcc.target/riscv/rvv/autovec/unop/popcount-1.c: Diito. + * gcc.target/riscv/rvv/autovec/unop/popcount-2.c: Diito. + * gcc.target/riscv/rvv/autovec/unop/vfsqrt-run.c: Diito. + * gcc.target/riscv/rvv/autovec/unop/vfsqrt-rv32gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/unop/vfsqrt-rv64gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/unop/vfsqrt-zvfh-run.c: Diito. + * gcc.target/riscv/rvv/autovec/unop/vneg-run.c: Diito. + * gcc.target/riscv/rvv/autovec/unop/vneg-rv32gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/unop/vneg-rv64gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/unop/vneg-zvfh-run.c: Diito. + * gcc.target/riscv/rvv/autovec/unop/vnot-run.c: Diito. + * gcc.target/riscv/rvv/autovec/unop/vnot-rv32gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/unop/vnot-rv64gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/v-1.c: Diito. + * gcc.target/riscv/rvv/autovec/v-2.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/bitmask-1.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/bitmask-10.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/bitmask-11.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/bitmask-12.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/bitmask-13.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/bitmask-14.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/bitmask-2.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/bitmask-3.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/bitmask-4.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/bitmask-5.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/bitmask-6.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/bitmask-7.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/bitmask-8.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/bitmask-9.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/combine-1.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/combine-merge_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/combine-merge_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/compress-1.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/compress-2.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/compress-3.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/compress-4.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/compress-5.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/compress-6.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/compress_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/compress_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/compress_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/compress_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/compress_run-5.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/compress_run-6.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/consecutive-1.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/consecutive-2.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/consecutive_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/consecutive_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/full-vec-move1.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/init-repeat-sequence-run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/init-repeat-sequence-run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/init-repeat-sequence-run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/insert_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/insert_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge-1.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge-2.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge-3.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge-4.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge-5.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge-6.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge-7.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-5.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-6.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/merge_run-7.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/perm_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/perm_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/perm_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/perm_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/perm_run-5.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/perm_run-6.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/perm_run-7.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/pr110985.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/repeat_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/repeat_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/repeat_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/repeat_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/repeat_run-5.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/repeat_run-6.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/trailing-1.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/trailing-2.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/trailing_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/vls-vlmax/trailing_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/vls/calling-convention-1.c: Diito. + * gcc.target/riscv/rvv/autovec/vls/calling-convention-10.c: Diito. + * gcc.target/riscv/rvv/autovec/vls/calling-convention-2.c: Diito. + * gcc.target/riscv/rvv/autovec/vls/calling-convention-3.c: Diito. + * gcc.target/riscv/rvv/autovec/vls/calling-convention-4.c: Diito. + * gcc.target/riscv/rvv/autovec/vls/calling-convention-5.c: Diito. + * gcc.target/riscv/rvv/autovec/vls/calling-convention-6.c: Diito. + * gcc.target/riscv/rvv/autovec/vls/calling-convention-7.c: Diito. + * gcc.target/riscv/rvv/autovec/vls/calling-convention-8.c: Diito. + * gcc.target/riscv/rvv/autovec/vls/calling-convention-9.c: Diito. + * gcc.target/riscv/rvv/autovec/vls/calling-convention-run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/vls/calling-convention-run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/vls/calling-convention-run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/vls/calling-convention-run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/vls/calling-convention-run-5.c: Diito. + * gcc.target/riscv/rvv/autovec/vls/calling-convention-run-6.c: Diito. + * gcc.target/riscv/rvv/autovec/vls/pr110994.c: Diito. + * gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv32.c: Diito. + * gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv64.c: Diito. + * gcc.target/riscv/rvv/autovec/vmv-imm-run.c: Diito. + * gcc.target/riscv/rvv/autovec/vmv-imm-rv32.c: Diito. + * gcc.target/riscv/rvv/autovec/vmv-imm-rv64.c: Diito. + * gcc.target/riscv/rvv/autovec/vreinterpet-fixed.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/vec-avg-run.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/vec-avg-rv32gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/vec-avg-rv64gcv.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen-1.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen-10.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen-11.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen-12.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen-2.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen-3.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen-4.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen-5.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen-6.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen-7.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen-8.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen-9.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen-complicate-1.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen-complicate-2.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen-complicate-3.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen-complicate-4.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen-complicate-5.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen-complicate-6.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen-complicate-7.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen-complicate-8.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen-complicate-9.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_reduc-1.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_reduc_order-1.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_reduc_order-2.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_reduc_order_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_reduc_order_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_reduc_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_run-1.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_run-10.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_run-11.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_run-12.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_run-2.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_run-3.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_run-4.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_run-5.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_run-6.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_run-7.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_run-8.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_run-9.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_run_zvfh-1.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_run_zvfh-10.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_run_zvfh-11.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_run_zvfh-12.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_run_zvfh-2.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_run_zvfh-3.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_run_zvfh-5.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_run_zvfh-6.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_run_zvfh-7.c: Diito. + * gcc.target/riscv/rvv/autovec/widen/widen_run_zvfh-8.c: Diito. + * gcc.target/riscv/rvv/autovec/zve32f-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve32f-2.c: Diito. + * gcc.target/riscv/rvv/autovec/zve32f-3.c: Diito. + * gcc.target/riscv/rvv/autovec/zve32f_zvl1024b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve32f_zvl128b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve32f_zvl128b-2.c: Diito. + * gcc.target/riscv/rvv/autovec/zve32f_zvl2048b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve32f_zvl256b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve32f_zvl4096b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve32f_zvl512b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve32x-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve32x-2.c: Diito. + * gcc.target/riscv/rvv/autovec/zve32x-3.c: Diito. + * gcc.target/riscv/rvv/autovec/zve32x_zvl1024b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve32x_zvl128b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve32x_zvl128b-2.c: Diito. + * gcc.target/riscv/rvv/autovec/zve32x_zvl2048b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve32x_zvl256b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve32x_zvl4096b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve32x_zvl512b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64d-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64d-2.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64d-3.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64d_zvl1024b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64d_zvl128b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64d_zvl128b-2.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64d_zvl2048b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64d_zvl256b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64d_zvl4096b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64d_zvl512b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64f-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64f-2.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64f-3.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64f_zvl1024b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64f_zvl128b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64f_zvl128b-2.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64f_zvl2048b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64f_zvl256b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64f_zvl4096b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64f_zvl512b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64x-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64x-2.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64x-3.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64x_zvl1024b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64x_zvl128b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64x_zvl128b-2.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64x_zvl2048b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64x_zvl256b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64x_zvl4096b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zve64x_zvl512b-1.c: Diito. + * gcc.target/riscv/rvv/autovec/zvfhmin-1.c: Diito. + * gcc.target/riscv/rvv/base/abi-callee-saved-1-fixed-1.c: Diito. + * gcc.target/riscv/rvv/base/abi-callee-saved-1-fixed-2.c: Diito. + * gcc.target/riscv/rvv/base/cpymem-1.c: Diito. + * gcc.target/riscv/rvv/base/cpymem-2.c: Diito. + * gcc.target/riscv/rvv/base/cpymem-strategy-3.c: Diito. + * gcc.target/riscv/rvv/base/cpymem-strategy-4.c: Diito. + * gcc.target/riscv/rvv/base/float-point-dynamic-frm-77.c: Diito. + * gcc.target/riscv/rvv/base/float-point-frm-autovec-1.c: Diito. + * gcc.target/riscv/rvv/base/float-point-frm-autovec-2.c: Diito. + * gcc.target/riscv/rvv/base/float-point-frm-autovec-3.c: Diito. + * gcc.target/riscv/rvv/base/float-point-frm-autovec-4.c: Diito. + * gcc.target/riscv/rvv/base/poly-selftest-1.c: Diito. + * gcc.target/riscv/rvv/base/pr110119-1.c: Diito. + * gcc.target/riscv/rvv/base/pr110119-2.c: Diito. + * gcc.target/riscv/rvv/base/pr111720-0.c: Diito. + * gcc.target/riscv/rvv/base/pr111720-1.c: Diito. + * gcc.target/riscv/rvv/base/pr111720-10.c: Diito. + * gcc.target/riscv/rvv/base/pr111720-2.c: Diito. + * gcc.target/riscv/rvv/base/pr111720-3.c: Diito. + * gcc.target/riscv/rvv/base/pr111720-4.c: Diito. + * gcc.target/riscv/rvv/base/pr111720-5.c: Diito. + * gcc.target/riscv/rvv/base/pr111720-6.c: Diito. + * gcc.target/riscv/rvv/base/pr111720-7.c: Diito. + * gcc.target/riscv/rvv/base/pr111720-8.c: Diito. + * gcc.target/riscv/rvv/base/pr111720-9.c: Diito. + * gcc.target/riscv/rvv/base/vf_avl-1.c: Diito. + * gcc.target/riscv/rvv/base/vf_avl-2.c: Diito. + * gcc.target/riscv/rvv/base/vf_avl-3.c: Diito. + * gcc.target/riscv/rvv/base/vf_avl-4.c: Diito. + * gcc.target/riscv/rvv/base/zvl-unimplemented-1.c: Diito. + * gcc.target/riscv/rvv/base/zvl-unimplemented-2.c: Diito. + * gcc.target/riscv/rvv/rvv.exp: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_multiple-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_multiple-10.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_multiple-11.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_multiple-12.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_multiple-13.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_multiple-14.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_multiple-15.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_multiple-16.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_multiple-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_multiple-3.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_multiple-4.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_multiple-5.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_multiple-6.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_multiple-7.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_multiple-8.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_multiple-9.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_prop-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_prop-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-10.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-100.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-101.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-102.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-103.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-104.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-105.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-106.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-107.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-108.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-109.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-11.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-12.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-13.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-14.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-15.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-16.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-17.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-18.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-19.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-20.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-21.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-22.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-23.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-24.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-25.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-26.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-27.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-28.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-29.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-3.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-30.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-31.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-32.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-33.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-34.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-35.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-36.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-37.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-38.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-39.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-4.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-40.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-41.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-42.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-43.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-44.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-45.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-46.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-47.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-48.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-49.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-5.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-50.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-51.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-52.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-53.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-54.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-55.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-56.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-57.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-58.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-59.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-6.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-60.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-61.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-62.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-63.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-64.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-65.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-66.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-67.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-68.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-69.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-7.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-70.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-71.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-72.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-73.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-74.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-75.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-76.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-77.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-78.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-79.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-8.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-80.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-81.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-82.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-83.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-84.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-85.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-86.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-87.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-88.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-89.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-9.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-90.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-91.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-92.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-93.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-94.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-95.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-96.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-97.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-98.c: Diito. + * gcc.target/riscv/rvv/vsetvl/avl_single-99.c: Diito. + * gcc.target/riscv/rvv/vsetvl/dump-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/ffload-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/ffload-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/ffload-3.c: Diito. + * gcc.target/riscv/rvv/vsetvl/ffload-5.c: Diito. + * gcc.target/riscv/rvv/vsetvl/ffload-6.c: Diito. + * gcc.target/riscv/rvv/vsetvl/ffload-7.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_bb_prop-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_bb_prop-10.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_bb_prop-11.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_bb_prop-12.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_bb_prop-13.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_bb_prop-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_bb_prop-3.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_bb_prop-4.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_bb_prop-5.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_bb_prop-6.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_bb_prop-7.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_bb_prop-8.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_bb_prop-9.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_conflict-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_conflict-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_conflict-3.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_conflict-4.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_conflict-5.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-10.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-11.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-12.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-13.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-14.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-15.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-16.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-17.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-3.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-4.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-5.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-6.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-7.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-8.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_loop_invariant-9.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_switch-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_switch-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_switch-3.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_switch-4.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_switch-5.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_switch-6.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_switch-7.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_switch-8.c: Diito. + * gcc.target/riscv/rvv/vsetvl/imm_switch-9.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr108270.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr109399.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr109547.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr109615.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr109743-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr109743-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr109743-3.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr109743-4.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr109748.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr109773-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr109773-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr109974.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr111037-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr111037-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr111037-3.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr111037-4.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr111234.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr111255.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr111927.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr111947.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr112092-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr112092-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr112713-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr112713-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr112776.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr112813-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr112929-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr112988-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr113248.c: Diito. + * gcc.target/riscv/rvv/vsetvl/pr113696.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-10.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-11.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-12.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-13.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-14.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-15.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-16.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-17.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-18.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-19.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-20.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-21.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-22.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-23.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-24.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-25.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-26.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-27.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-28.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-29.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-3.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-30.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-31.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-32.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-33.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-34.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-35.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-36.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-37.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-38.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-39.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-4.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-40.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-41.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-42.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-43.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-44.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-45.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-46.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-5.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-6.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-7.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-8.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-9.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-10.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-11.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-12.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-13.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-14.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-15.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-16.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-17.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-18.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-19.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-20.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-21.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-22.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-23.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-24.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-25.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-26.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-27.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-28.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-3.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-4.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-5.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-6.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-7.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-8.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_bb_prop-9.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_call-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_call-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_call-3.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_call-4.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_complex_loop-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_complex_loop-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-10.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-11.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-12.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-13.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-3.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-4.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-5.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-6.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-7.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-8.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_conflict-9.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-10.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-11.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-12.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-13.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-14.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-15.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-16.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-17.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-18.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-19.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-20.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-21.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-22.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-23.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-24.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-25.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-26.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-27.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-28.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-3.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-4.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-5.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-6.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-7.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-8.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_miss_default-9.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-10.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-11.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-12.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-13.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-14.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-15.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-16.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-17.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-18.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-19.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-20.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-21.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-22.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-23.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-24.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-25.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-26.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-27.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-28.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-3.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-4.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-5.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-6.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-7.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-8.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_phi-9.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-10.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-11.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-12.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-13.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-14.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-15.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-16.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-17.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-18.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-19.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-3.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-4.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-5.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-6.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-7.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-8.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-9.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-3.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-4.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-5.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-6.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-7.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_single_vtype-8.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-10.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-11.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-12.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-13.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-14.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-15.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-16.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-3.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-4.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-5.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-6.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-7.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-8.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-9.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-10.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-11.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-12.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-13.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-14.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-15.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-16.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-17.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-18.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-19.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-20.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-21.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-22.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-23.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-24.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-3.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-4.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-5.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-6.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-7.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-8.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl-9.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl_bug-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl_bug-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl_int.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvl_pre-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvlmax-1.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvlmax-10.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvlmax-11.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvlmax-12.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvlmax-13.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvlmax-14.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvlmax-15.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvlmax-16.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvlmax-17.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvlmax-18.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvlmax-19.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvlmax-2.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvlmax-20.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvlmax-3.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvlmax-4.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvlmax-5.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvlmax-6.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvlmax-7.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvlmax-8.c: Diito. + * gcc.target/riscv/rvv/vsetvl/vsetvlmax-9.c: Diito. + * gcc.target/riscv/rvv/vsetvl/wredsum_vlmax.c: Diito. + * gcc.target/riscv/rvv/base/rvv-vector-bits-1.c: New test. + * gcc.target/riscv/rvv/base/rvv-vector-bits-2.c: New test. + * gcc.target/riscv/rvv/base/rvv-vector-bits-3.c: New test. + * gcc.target/riscv/rvv/base/rvv-vector-bits-4.c: New test. + * gcc.target/riscv/rvv/base/rvv-vector-bits-5.c: New test. + * gcc.target/riscv/rvv/base/rvv-vector-bits-6.c: New test. + +2024-03-01 Jakub Jelinek + + PR middle-end/114156 + * gcc.dg/bitint-96.c: New test. + +2024-02-29 David Malcolm + + PR analyzer/114159 + * c-c++-common/analyzer/call-summaries-pr114159.c: New test. + +2024-02-29 Georg-Johann Lay + + PR target/114132 + * gcc.target/avr/pr114132-1.c: New test. + * gcc.target/avr/torture/pr114132-2.c: New test. + +2024-02-29 Marek Polacek + + PR c++/113987 + * g++.dg/warn/Wuninitialized-15.C: Turn dg-warning into dg-bogus. + * g++.dg/warn/Wuninitialized-34.C: New test. + +2024-02-29 Gaius Mulley + + PR modula2/102344 + * gm2/pim/pass/TestLong4.mod: Rewrite. + * gm2/cpp/pass/testlong4.mod: New test. + +2024-02-29 Andrew Pinski + + PR target/108174 + * gcc.target/aarch64/acle/memtag_4.c: New test. + +2024-02-29 Xi Ruoyao + + * gcc.target/loongarch/crc-sext.c: New test; + +2024-02-29 Nathaniel Shead + + PR c++/111710 + * g++.dg/modules/lambda-7.h: New test. + * g++.dg/modules/lambda-7_a.H: New test. + * g++.dg/modules/lambda-7_b.C: New test. + * g++.dg/modules/lambda-7_c.C: New test. + +2024-02-29 Kito Cheng + + * gcc.target/riscv/pr114130.c: New. + +2024-02-29 Alexander Westbrooks + + PR fortran/82943 + PR fortran/86148 + PR fortran/86268 + * gfortran.dg/pdt_4.f03: Update modified error message. + * gfortran.dg/pdt_34.f03: New test. + * gfortran.dg/pdt_35.f03: New test. + * gfortran.dg/pdt_36.f03: New test. + * gfortran.dg/pdt_37.f03: New test. + +2024-02-28 Jakub Jelinek + Patrick Palka + + PR c++/113976 + * g++.dg/cpp1y/var-templ87.C: New test. + +2024-02-28 Cupertino Miranda + + PR target/113453 + PR target/113453 + * gcc.target/bpf/btfext-funcinfo-nocore.c: Add. + * gcc.target/bpf/btfext-funcinfo.c: Add. + * gcc.target/bpf/core-attr-5.c: Fix regexp. + * gcc.target/bpf/core-attr-6.c: Fix regexp. + * gcc.target/bpf/core-builtin-fieldinfo-offset-1.c: Fix regexp. + * gcc.target/bpf/core-section-1.c: Fix regexp. + +2024-02-28 Harald Anlauf + + * gfortran.dg/pr101026.f: Let variables used in specification + expression be passed as dummy arguments + +2024-02-28 Richard Biener + + PR tree-optimization/113831 + PR tree-optimization/108355 + * gcc.dg/tree-ssa/ssa-fre-104.c: XFAIL. + +2024-02-28 Richard Biener + + PR tree-optimization/114121 + * gcc.dg/torture/pr114121.c: New testcase. + +2024-02-28 Jakub Jelinek + + PR testsuite/111462 + * gcc.dg/tree-ssa/ssa-sink-18.c: XFAIL also on powerpc64. + +2024-02-28 Rainer Orth + + PR tree-optimization/91567 + * gcc.dg/tree-ssa/builtin-snprintf-6.c (scan-tree-dump-times): + Treat i?86-*-* like x86_64-*-*. + +2024-02-28 Jakub Jelinek + + PR tree-optimization/114075 + * gcc.dg/gomp/pr114075.c: New test. + +2024-02-28 Jakub Jelinek + + PR tree-optimization/114041 + * gcc.dg/graphite/run-id-pr114041-1.c: New test. + * gcc.dg/graphite/run-id-pr114041-2.c: New test. + +2024-02-28 Jakub Jelinek + + PR tree-optimization/113988 + * gcc.dg/bitint-91.c: New test. + +2024-02-28 Jakub Jelinek + + * gcc.dg/c23-stdarg-6.c: New test. + +2024-02-28 Nathaniel Shead + + PR c++/113970 + PR c++/114013 + * g++.dg/cpp1z/inline-var10.C: New test. + +2024-02-27 Uros Bizjak + + PR target/113871 + * gcc.target/i386/pr113871-5a.c: New test. + * gcc.target/i386/pr113871-5b.c: New test. + +2024-02-27 Eric Botcazou + + * gnat.dg/opt104.ads, gnat.dg/opt104.adb: New test. + +2024-02-27 David Malcolm + + PR analyzer/111881 + * c-c++-common/analyzer/conditionals-pr111881.c: New test. + +2024-02-27 Richard Biener + + PR tree-optimization/114074 + * 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. + +2024-02-27 Jakub Jelinek + + PR rtl-optimization/114044 + * gcc.dg/bitint-95.c: New test. + +2024-02-27 Richard Biener + + PR tree-optimization/114081 + * gcc.dg/vect/vect-early-break_121-pr114081.c: New testcase. + +2024-02-27 Rainer Orth + + 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). + +2024-02-26 Harald Anlauf + + PR fortran/114012 + * gfortran.dg/pr114012.f90: New test. + +2024-02-26 Jakub Jelinek + H.J. Lu + + PR rtl-optimization/113617 + * g++.dg/other/pr113617.C: New test. + * g++.dg/other/pr113617.h: New test. + * g++.dg/other/pr113617-aux.cc: New test. + +2024-02-26 Jakub Jelinek + + PR c/114042 + * gcc.dg/builtin-stdc-bit-2.c: Adjust testcase for actual builtin + names rather than names of builtin replacements. + +2024-02-26 Richard Biener + + PR tree-optimization/114099 + * gcc.dg/vect/vect-early-break_120-pr114099.c: New testcase. + +2024-02-26 Richard Biener + + PR tree-optimization/114068 + * gcc.dg/vect/vect-early-break_118-pr114068.c: New testcase. + * gcc.dg/vect/vect-early-break_119-pr114068.c: Likewise. + +2024-02-26 Eric Botcazou + + * gnat.dg/access10.adb: New test. + +2024-02-26 H.J. Lu + + PR target/114097 + * gcc.target/i386/pr114097-1.c: New test. + +2024-02-26 Rainer Orth + + PR ipa/61159 + * gcc.c-torture/compile/pr61159.c: xfail on Solaris/x86 with as. + +2024-02-26 Jakub Jelinek + + PR tree-optimization/114090 + * gcc.dg/pr114090.c: New test. + +2024-02-26 Jakub Jelinek + + PR middle-end/114084 + * gcc.dg/bitint-94.c: New test. + +2024-02-26 Richard Biener + + PR middle-end/114070 + * gcc.dg/torture/pr114070.c: New testcase. + +2024-02-26 Jakub Jelinek + + PR target/114094 + * gcc.target/i386/pr114094.c: New test. + +2024-02-26 H.J. Lu + + PR target/114098 + * gcc.target/i386/amxtile-4.c: New test. + +2024-02-25 Jerry DeLisle + + PR libfortran/105456 + * gfortran.dg/pr105456.f90: New test. + +2024-02-24 Richard Sandiford + + PR tree-optimization/113205 + * gcc.dg/torture/pr113205.c: New test. + +2024-02-24 Jakub Jelinek + + PR middle-end/114073 + * gcc.dg/bitint-93.c: New test. + +2024-02-24 Richard Sandiford + + * gcc.dg/rtl/aarch64/pr113295-1.c: Restrict to aarc64*-*-*. + +2024-02-23 Steve Kargl + Harald Anlauf + + PR fortran/114024 + * gfortran.dg/allocate_with_source_27.f90: New test. + * gfortran.dg/allocate_with_source_28.f90: New test. + +2024-02-23 Robin Dapp + + * gcc.target/riscv/rvv/autovec/pr114028.c: New test. + +2024-02-23 Jakub Jelinek + + PR c++/113083 + * g++.dg/cpp0x/constexpr-113083.C: New test. + +2024-02-23 Richard Sandiford + + PR target/113613 + * gcc.target/aarch64/pr113613.c: New test. + +2024-02-23 Richard Sandiford + + PR target/113295 + * gcc.target/aarch64/pr113295-2.c: New test. + +2024-02-23 Richard Sandiford + + PR target/113295 + * gcc.dg/rtl/aarch64/pr113295-1.c: New test. + +2024-02-23 H.J. Lu + + * gcc.target/i386/apx-ndd-tls-1b.c: New test. + * lib/target-supports.exp + (check_effective_target_code_6_gottpoff_reloc): New. + +2024-02-23 Richard Earnshaw + + PR target/108120 + * gcc.target/arm/neon-recip-div-1.c: New file. + +2024-02-23 Jakub Jelinek + + PR rtl-optimization/114054 + * gcc.dg/bitint-92.c: New test. + +2024-02-23 Jakub Jelinek + + PR tree-optimization/114040 + * gcc.dg/torture/bitint-60.c: New test. + * gcc.dg/torture/bitint-61.c: New test. + +2024-02-23 Rainer Orth + + * gcc.dg/vect/vect-bic-bitmask-12.c: Move dg-skip-if down. + * gcc.dg/vect/vect-bic-bitmask-23.c: Likewise. + +2024-02-23 Rainer Orth + + * gcc.dg/plugin/crash-test-write-though-null-sarif.c + (scan-sarif-file): Allow for "Segmentation Fault", too. + +2024-02-22 Marek Polacek + + * g++.dg/warn/Wmismatched-new-delete-8.C: Use __SIZE_TYPE__. + +2024-02-22 Jakub Jelinek + + PR c/114007 + * gcc.dg/c23-attr-syntax-6.c: Adjust testcase for :: being valid + even in -std=c11 even without __extension__ and : : etc. not being + valid anymore even with __extension__. + * gcc.dg/c23-attr-syntax-7.c: Likewise. + * gcc.dg/c23-attr-syntax-8.c: New test. + +2024-02-22 Andrew Pinski + + PR tree-optimization/109804 + * g++.dg/warn/Wmismatched-new-delete-8.C: New test. + +2024-02-22 Tamar Christina + + PR target/112375 + * gcc.target/aarch64/vget_set_lane_1.c: Update test output. + +2024-02-22 Gaius Mulley + + PR modula2/114055 + * gm2/pim/fail/forloopby.mod: New test. + * gm2/pim/pass/forloopby2.mod: New test. + +2024-02-22 Richard Biener + + PR tree-optimization/114048 + * gcc.dg/torture/pr114048.c: New testcase. + +2024-02-22 Richard Biener + + PR tree-optimization/114027 + * gcc.dg/vect/pr114027.c: New testcase. + +2024-02-22 Jakub Jelinek + + PR tree-optimization/113993 + * gcc.dg/tree-ssa/pr113993.c: New test. + +2024-02-22 Jakub Jelinek + + PR tree-optimization/114038 + * gcc.dg/torture/bitint-59.c: New test. + +2024-02-22 Kewen Lin + + PR target/109987 + * lib/target-supports.exp + (check_effective_target_powerpc_p8vector_ok): Remove. + (check_effective_target_powerpc_p9vector_ok): Remove. + (check_p8vector_hw_available): Replace -mpower8-vector with + -mcpu=power8. + (check_p9vector_hw_available): Replace -mpower9-vector with + -mcpu=power9. + (check_ppc_float128_hw_available): Likewise. + (check_vect_support_and_set_flags): Replace -mpower8-vector with + -mcpu=power8, replace -mpower9-vector with -mcpu=power9 or + nothing if check_power10_hw_available and place -mcpu=970 first + if needed to avoid possible overriding. + * g++.target/powerpc/altivec-19.C: Replace powerpc_p9vector_ok with + powerpc_vsx_ok and append -mvsx to dg-options. + * gcc.target/powerpc/bfp/scalar-cmp-exp-eq-0.c: Likewise. + * gcc.target/powerpc/bfp/scalar-cmp-exp-eq-1.c: Likewise. + * gcc.target/powerpc/bfp/scalar-cmp-exp-eq-2.c: Likewise. + * gcc.target/powerpc/bfp/scalar-cmp-exp-gt-0.c: Likewise. + * gcc.target/powerpc/bfp/scalar-cmp-exp-gt-1.c: Likewise. + * gcc.target/powerpc/bfp/scalar-cmp-exp-gt-2.c: Likewise. + * gcc.target/powerpc/bfp/scalar-cmp-exp-lt-0.c: Likewise. + * gcc.target/powerpc/bfp/scalar-cmp-exp-lt-1.c: Likewise. + * gcc.target/powerpc/bfp/scalar-cmp-exp-lt-2.c: Likewise. + * gcc.target/powerpc/bfp/scalar-cmp-exp-unordered-0.c: Likewise. + * gcc.target/powerpc/bfp/scalar-cmp-exp-unordered-1.c: Likewise. + * gcc.target/powerpc/bfp/scalar-cmp-exp-unordered-2.c: Likewise. + * gcc.target/powerpc/bfp/scalar-extract-exp-0.c: Likewise. + * gcc.target/powerpc/bfp/scalar-extract-exp-1.c: Likewise. + * gcc.target/powerpc/bfp/scalar-extract-exp-3.c: Likewise. + * gcc.target/powerpc/bfp/scalar-extract-exp-4.c: Likewise. + * gcc.target/powerpc/bfp/scalar-extract-exp-5.c: Likewise. + * gcc.target/powerpc/bfp/scalar-extract-sig-0.c: Likewise. + * gcc.target/powerpc/bfp/scalar-extract-sig-1.c: Likewise. + * gcc.target/powerpc/bfp/scalar-extract-sig-2.c: Likewise. + * gcc.target/powerpc/bfp/scalar-extract-sig-3.c: Likewise. + * gcc.target/powerpc/bfp/scalar-extract-sig-4.c: Likewise. + * gcc.target/powerpc/bfp/scalar-extract-sig-5.c: Likewise. + * gcc.target/powerpc/bfp/scalar-insert-exp-0.c: Likewise. + * gcc.target/powerpc/bfp/scalar-insert-exp-1.c: Likewise. + * gcc.target/powerpc/bfp/scalar-insert-exp-10.c: Likewise. + * gcc.target/powerpc/bfp/scalar-insert-exp-11.c: Likewise. + * gcc.target/powerpc/bfp/scalar-insert-exp-2.c: Likewise. + * gcc.target/powerpc/bfp/scalar-insert-exp-3.c: Likewise. + * gcc.target/powerpc/bfp/scalar-insert-exp-4.c: Likewise. + * gcc.target/powerpc/bfp/scalar-insert-exp-5.c: Likewise. + * gcc.target/powerpc/bfp/scalar-insert-exp-6.c: Likewise. + * gcc.target/powerpc/bfp/scalar-insert-exp-7.c: Likewise. + * gcc.target/powerpc/bfp/scalar-insert-exp-8.c: Likewise. + * gcc.target/powerpc/bfp/scalar-insert-exp-9.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-data-class-0.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-data-class-1.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-data-class-10.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-data-class-11.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-data-class-2.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-data-class-3.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-data-class-4.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-data-class-5.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-data-class-6.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-data-class-7.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-data-class-8.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-data-class-9.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-neg-0.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-neg-1.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-neg-2.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-neg-3.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-neg-4.c: Likewise. + * gcc.target/powerpc/bfp/scalar-test-neg-5.c: Likewise. + * gcc.target/powerpc/bfp/vec-extract-exp-0.c: Likewise. + * gcc.target/powerpc/bfp/vec-extract-exp-1.c: Likewise. + * gcc.target/powerpc/bfp/vec-extract-exp-2.c: Likewise. + * gcc.target/powerpc/bfp/vec-extract-exp-3.c: Likewise. + * gcc.target/powerpc/bfp/vec-extract-sig-0.c: Likewise. + * gcc.target/powerpc/bfp/vec-extract-sig-1.c: Likewise. + * gcc.target/powerpc/bfp/vec-extract-sig-2.c: Likewise. + * gcc.target/powerpc/bfp/vec-extract-sig-3.c: Likewise. + * gcc.target/powerpc/bfp/vec-insert-exp-0.c: Likewise. + * gcc.target/powerpc/bfp/vec-insert-exp-1.c: Likewise. + * gcc.target/powerpc/bfp/vec-insert-exp-2.c: Likewise. + * gcc.target/powerpc/bfp/vec-insert-exp-3.c: Likewise. + * gcc.target/powerpc/bfp/vec-insert-exp-4.c: Likewise. + * gcc.target/powerpc/bfp/vec-insert-exp-5.c: Likewise. + * gcc.target/powerpc/bfp/vec-insert-exp-6.c: Likewise. + * gcc.target/powerpc/bfp/vec-insert-exp-7.c: Likewise. + * gcc.target/powerpc/bfp/vec-test-data-class-0.c: Likewise. + * gcc.target/powerpc/bfp/vec-test-data-class-1.c: Likewise. + * gcc.target/powerpc/bfp/vec-test-data-class-2.c: Likewise. + * gcc.target/powerpc/bfp/vec-test-data-class-3.c: Likewise. + * gcc.target/powerpc/bfp/vec-test-data-class-4.c: Likewise. + * gcc.target/powerpc/bfp/vec-test-data-class-5.c: Likewise. + * gcc.target/powerpc/bfp/vec-test-data-class-6.c: Likewise. + * gcc.target/powerpc/bfp/vec-test-data-class-7.c: Likewise. + * gcc.target/powerpc/builtins-3-p9.c: Likewise. + * gcc.target/powerpc/byte-in-either-range-0.c: Likewise. + * gcc.target/powerpc/byte-in-either-range-1.c: Likewise. + * gcc.target/powerpc/byte-in-range-0.c: Likewise. + * gcc.target/powerpc/byte-in-range-1.c: Likewise. + * gcc.target/powerpc/byte-in-set-0.c: Likewise. + * gcc.target/powerpc/byte-in-set-1.c: Likewise. + * gcc.target/powerpc/byte-in-set-2.c: Likewise. + * gcc.target/powerpc/clone1.c: Likewise. + * gcc.target/powerpc/ctz-3.c: Likewise. + * gcc.target/powerpc/ctz-4.c: Likewise. + * gcc.target/powerpc/darn-0.c: Likewise. + * gcc.target/powerpc/darn-1.c: Likewise. + * gcc.target/powerpc/darn-2.c: Likewise. + * gcc.target/powerpc/dform-3.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-0.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-1.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-10.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-11.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-12.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-13.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-14.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-15.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-16.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-17.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-18.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-19.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-2.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-20.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-21.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-22.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-23.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-24.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-25.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-26.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-27.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-28.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-29.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-3.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-30.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-31.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-32.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-33.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-34.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-35.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-36.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-37.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-38.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-39.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-4.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-40.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-41.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-42.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-43.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-44.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-45.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-46.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-47.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-48.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-49.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-5.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-50.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-51.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-52.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-53.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-54.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-55.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-56.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-57.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-58.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-59.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-6.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-60.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-61.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-62.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-63.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-64.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-65.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-66.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-67.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-68.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-69.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-7.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-70.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-71.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-72.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-73.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-74.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-75.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-76.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-77.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-78.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-79.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-8.c: Likewise. + * gcc.target/powerpc/dfp/dtstsfi-9.c: Likewise. + * gcc.target/powerpc/direct-move-vector.c: Likewise. + * gcc.target/powerpc/float128-type-2.c: Likewise. + * gcc.target/powerpc/fold-vec-abs-int-fwrapv.p9.c: Likewise. + * gcc.target/powerpc/fold-vec-abs-int.p9.c: Likewise. + * gcc.target/powerpc/fold-vec-abs-longlong-fwrapv.p9.c: Likewise. + * gcc.target/powerpc/fold-vec-abs-longlong.p9.c: Likewise. + * gcc.target/powerpc/fold-vec-cmp-char.p9.c: Likewise. + * gcc.target/powerpc/fold-vec-cmp-short.p9.c: Likewise. + * gcc.target/powerpc/fold-vec-extract-char.p9.c: Likewise. + * gcc.target/powerpc/fold-vec-extract-float.p9.c: Likewise. + * gcc.target/powerpc/fold-vec-extract-int.p9.c: Likewise. + * gcc.target/powerpc/fold-vec-extract-longlong.p9.c: Likewise. + * gcc.target/powerpc/fold-vec-extract-short.p9.c: Likewise. + * gcc.target/powerpc/fold-vec-insert-char-p9.c: Likewise. + * gcc.target/powerpc/fold-vec-insert-float-p9.c: Likewise. + * gcc.target/powerpc/fold-vec-insert-int-p9.c: Likewise. + * gcc.target/powerpc/fold-vec-insert-short-p9.c: Likewise. + * gcc.target/powerpc/fold-vec-mult-int128-p9.c: Likewise. + * gcc.target/powerpc/fold-vec-neg-int.p9.c: Likewise. + * gcc.target/powerpc/fold-vec-neg-longlong.p9.c: Likewise. + * gcc.target/powerpc/p9-dimode1.c: Likewise. + * gcc.target/powerpc/p9-dimode2.c: Likewise. + * gcc.target/powerpc/p9-extract-1.c: Likewise. + * gcc.target/powerpc/p9-extract-2.c: Likewise. + * gcc.target/powerpc/p9-extract-3.c: Likewise. + * gcc.target/powerpc/p9-extract-4.c: Likewise. + * gcc.target/powerpc/p9-fpcvt-1.c: Likewise. + * gcc.target/powerpc/p9-fpcvt-2.c: Likewise. + * gcc.target/powerpc/p9-fpcvt-3.c: Likewise. + * gcc.target/powerpc/p9-lxvx-stxvx-1.c: Likewise. + * gcc.target/powerpc/p9-lxvx-stxvx-2.c: Likewise. + * gcc.target/powerpc/p9-lxvx-stxvx-3.c: Likewise. + * gcc.target/powerpc/p9-minmax-1.c: Likewise. + * gcc.target/powerpc/p9-minmax-2.c: Likewise. + * gcc.target/powerpc/p9-minmax-3.c: Likewise. + * gcc.target/powerpc/p9-novsx.c: Likewise. + * gcc.target/powerpc/p9-permute.c: Likewise. + * gcc.target/powerpc/p9-sign_extend-runnable.c: Likewise. + * gcc.target/powerpc/p9-splat-1.c: Likewise. + * gcc.target/powerpc/p9-splat-2.c: Likewise. + * gcc.target/powerpc/p9-splat-3.c: Likewise. + * gcc.target/powerpc/p9-splat-4.c: Likewise. + * gcc.target/powerpc/p9-splat-5.c: Likewise. + * gcc.target/powerpc/p9-vbpermd.c: Likewise. + * gcc.target/powerpc/p9-vec-length-epil-1.c: Likewise. + * gcc.target/powerpc/p9-vec-length-epil-2.c: Likewise. + * gcc.target/powerpc/p9-vec-length-epil-3.c: Likewise. + * gcc.target/powerpc/p9-vec-length-epil-4.c: Likewise. + * gcc.target/powerpc/p9-vec-length-epil-5.c: Likewise. + * gcc.target/powerpc/p9-vec-length-epil-6.c: Likewise. + * gcc.target/powerpc/p9-vec-length-epil-7.c: Likewise. + * gcc.target/powerpc/p9-vec-length-epil-8.c: Likewise. + * gcc.target/powerpc/p9-vec-length-full-1.c: Likewise. + * gcc.target/powerpc/p9-vec-length-full-2.c: Likewise. + * gcc.target/powerpc/p9-vec-length-full-3.c: Likewise. + * gcc.target/powerpc/p9-vec-length-full-4.c: Likewise. + * gcc.target/powerpc/p9-vec-length-full-5.c: Likewise. + * gcc.target/powerpc/p9-vec-length-full-6.c: Likewise. + * gcc.target/powerpc/p9-vec-length-full-7.c: Likewise. + * gcc.target/powerpc/p9-vec-length-full-8.c: Likewise. + * gcc.target/powerpc/p9-vneg.c: Likewise. + * gcc.target/powerpc/p9-vparity.c: Likewise. + * gcc.target/powerpc/p9-vpermr.c: Likewise. + * gcc.target/powerpc/p9-xxbr-1.c: Likewise. + * gcc.target/powerpc/p9-xxbr-2.c: Likewise. + * gcc.target/powerpc/p9-xxbr-3.c: Likewise. + * gcc.target/powerpc/ppc-fortran/pr80108-1.f90: Likewise. + * gcc.target/powerpc/ppc-round3.c: Likewise. + * gcc.target/powerpc/pr103124.c: Likewise. + * gcc.target/powerpc/pr104015-1.c: Likewise. + * gcc.target/powerpc/pr106769-p9.c: Likewise. + * gcc.target/powerpc/pr107412.c: Likewise. + * gcc.target/powerpc/pr110429.c: Likewise. + * gcc.target/powerpc/pr66144-1.c: Likewise. + * gcc.target/powerpc/pr71186.c: Likewise. + * gcc.target/powerpc/pr71309.c: Likewise. + * gcc.target/powerpc/pr71670.c: Likewise. + * gcc.target/powerpc/pr71698.c: Likewise. + * gcc.target/powerpc/pr71720.c: Likewise. + * gcc.target/powerpc/pr72853.c: Likewise. + * gcc.target/powerpc/pr78056-1.c: Likewise. + * gcc.target/powerpc/pr78658.c: Likewise. + * gcc.target/powerpc/pr78953.c: Likewise. + * gcc.target/powerpc/pr79004.c: Likewise. + * gcc.target/powerpc/pr79038-1.c: Likewise. + * gcc.target/powerpc/pr79179.c: Likewise. + * gcc.target/powerpc/pr79251.p9.c: Likewise. + * gcc.target/powerpc/pr79799-1.c: Likewise. + * gcc.target/powerpc/pr79799-2.c: Likewise. + * gcc.target/powerpc/pr79799-3.c: Likewise. + * gcc.target/powerpc/pr79799-5.c: Likewise. + * gcc.target/powerpc/pr80695-p9.c: Likewise. + * gcc.target/powerpc/pr81348.c: Likewise. + * gcc.target/powerpc/pr81622.c: Likewise. + * gcc.target/powerpc/pr84154-3.c: Likewise. + * gcc.target/powerpc/pr90763.c: Likewise. + * gcc.target/powerpc/pr96933-1.c: Likewise. + * gcc.target/powerpc/sad-vectorize-1.c: Likewise. + * gcc.target/powerpc/sad-vectorize-2.c: Likewise. + * gcc.target/powerpc/signbit-2.c: Likewise. + * gcc.target/powerpc/vadsdu-0.c: Likewise. + * gcc.target/powerpc/vadsdu-1.c: Likewise. + * gcc.target/powerpc/vadsdu-2.c: Likewise. + * gcc.target/powerpc/vadsdu-3.c: Likewise. + * gcc.target/powerpc/vadsdu-4.c: Likewise. + * gcc.target/powerpc/vadsdu-5.c: Likewise. + * gcc.target/powerpc/vadsdub-1.c: Likewise. + * gcc.target/powerpc/vadsdub-2.c: Likewise. + * gcc.target/powerpc/vadsduh-1.c: Likewise. + * gcc.target/powerpc/vadsduh-2.c: Likewise. + * gcc.target/powerpc/vadsduw-1.c: Likewise. + * gcc.target/powerpc/vadsduw-2.c: Likewise. + * gcc.target/powerpc/vec-extract-4.c: Likewise. + * gcc.target/powerpc/vec-init-3.c: Likewise. + * gcc.target/powerpc/vec-minmax-1.c: Likewise. + * gcc.target/powerpc/vec-minmax-2.c: Likewise. + * gcc.target/powerpc/vec-set-char.c: Likewise. + * gcc.target/powerpc/vec-set-int.c: Likewise. + * gcc.target/powerpc/vec-set-short.c: Likewise. + * gcc.target/powerpc/vec_reve_2.c: Likewise. + * gcc.target/powerpc/vector_float.c: Likewise. + * gcc.target/powerpc/vslv-0.c: Likewise. + * gcc.target/powerpc/vslv-1.c: Likewise. + * gcc.target/powerpc/vsrv-0.c: Likewise. + * gcc.target/powerpc/vsrv-1.c: Likewise. + * gcc.target/powerpc/vsu/vec-all-ne-0.c: Likewise. + * gcc.target/powerpc/vsu/vec-all-ne-1.c: Likewise. + * gcc.target/powerpc/vsu/vec-all-ne-10.c: Likewise. + * gcc.target/powerpc/vsu/vec-all-ne-11.c: Likewise. + * gcc.target/powerpc/vsu/vec-all-ne-12.c: Likewise. + * gcc.target/powerpc/vsu/vec-all-ne-13.c: Likewise. + * gcc.target/powerpc/vsu/vec-all-ne-14.c: Likewise. + * gcc.target/powerpc/vsu/vec-all-ne-2.c: Likewise. + * gcc.target/powerpc/vsu/vec-all-ne-3.c: Likewise. + * gcc.target/powerpc/vsu/vec-all-ne-4.c: Likewise. + * gcc.target/powerpc/vsu/vec-all-ne-5.c: Likewise. + * gcc.target/powerpc/vsu/vec-all-ne-6.c: Likewise. + * gcc.target/powerpc/vsu/vec-all-ne-7.c: Likewise. + * gcc.target/powerpc/vsu/vec-all-ne-8.c: Likewise. + * gcc.target/powerpc/vsu/vec-all-ne-9.c: Likewise. + * gcc.target/powerpc/vsu/vec-all-nez-1.c: Likewise. + * gcc.target/powerpc/vsu/vec-all-nez-2.c: Likewise. + * gcc.target/powerpc/vsu/vec-all-nez-3.c: Likewise. + * gcc.target/powerpc/vsu/vec-all-nez-4.c: Likewise. + * gcc.target/powerpc/vsu/vec-all-nez-5.c: Likewise. + * gcc.target/powerpc/vsu/vec-all-nez-6.c: Likewise. + * gcc.target/powerpc/vsu/vec-all-nez-7.c: Likewise. + * gcc.target/powerpc/vsu/vec-any-eq-0.c: Likewise. + * gcc.target/powerpc/vsu/vec-any-eq-1.c: Likewise. + * gcc.target/powerpc/vsu/vec-any-eq-10.c: Likewise. + * gcc.target/powerpc/vsu/vec-any-eq-11.c: Likewise. + * gcc.target/powerpc/vsu/vec-any-eq-12.c: Likewise. + * gcc.target/powerpc/vsu/vec-any-eq-13.c: Likewise. + * gcc.target/powerpc/vsu/vec-any-eq-14.c: Likewise. + * gcc.target/powerpc/vsu/vec-any-eq-2.c: Likewise. + * gcc.target/powerpc/vsu/vec-any-eq-3.c: Likewise. + * gcc.target/powerpc/vsu/vec-any-eq-4.c: Likewise. + * gcc.target/powerpc/vsu/vec-any-eq-5.c: Likewise. + * gcc.target/powerpc/vsu/vec-any-eq-6.c: Likewise. + * gcc.target/powerpc/vsu/vec-any-eq-7.c: Likewise. + * gcc.target/powerpc/vsu/vec-any-eq-8.c: Likewise. + * gcc.target/powerpc/vsu/vec-any-eq-9.c: Likewise. + * gcc.target/powerpc/vsu/vec-any-eqz-1.c: Likewise. + * gcc.target/powerpc/vsu/vec-any-eqz-2.c: Likewise. + * gcc.target/powerpc/vsu/vec-any-eqz-3.c: Likewise. + * gcc.target/powerpc/vsu/vec-any-eqz-4.c: Likewise. + * gcc.target/powerpc/vsu/vec-any-eqz-5.c: Likewise. + * gcc.target/powerpc/vsu/vec-any-eqz-6.c: Likewise. + * gcc.target/powerpc/vsu/vec-any-eqz-7.c: Likewise. + * gcc.target/powerpc/vsu/vec-cmpne-0.c: Likewise. + * gcc.target/powerpc/vsu/vec-cmpne-1.c: Likewise. + * gcc.target/powerpc/vsu/vec-cmpne-2.c: Likewise. + * gcc.target/powerpc/vsu/vec-cmpne-3.c: Likewise. + * gcc.target/powerpc/vsu/vec-cmpne-4.c: Likewise. + * gcc.target/powerpc/vsu/vec-cmpne-5.c: Likewise. + * gcc.target/powerpc/vsu/vec-cmpne-6.c: Likewise. + * gcc.target/powerpc/vsu/vec-cmpne-8.c: Likewise. + * gcc.target/powerpc/vsu/vec-cmpne-9.c: Likewise. + * gcc.target/powerpc/vsu/vec-cmpnez-1.c: Likewise. + * gcc.target/powerpc/vsu/vec-cmpnez-2.c: Likewise. + * gcc.target/powerpc/vsu/vec-cmpnez-3.c: Likewise. + * gcc.target/powerpc/vsu/vec-cmpnez-4.c: Likewise. + * gcc.target/powerpc/vsu/vec-cmpnez-5.c: Likewise. + * gcc.target/powerpc/vsu/vec-cmpnez-6.c: Likewise. + * gcc.target/powerpc/vsu/vec-cmpnez-7.c: Likewise. + * gcc.target/powerpc/vsu/vec-cntlz-lsbb-0.c: Likewise. + * gcc.target/powerpc/vsu/vec-cntlz-lsbb-1.c: Likewise. + * gcc.target/powerpc/vsu/vec-cntlz-lsbb-2.c: Likewise. + * gcc.target/powerpc/vsu/vec-cntlz-lsbb-3.c: Likewise. + * gcc.target/powerpc/vsu/vec-cntlz-lsbb-4.c: Likewise. + * gcc.target/powerpc/vsu/vec-cnttz-lsbb-0.c: Likewise. + * gcc.target/powerpc/vsu/vec-cnttz-lsbb-1.c: Likewise. + * gcc.target/powerpc/vsu/vec-cnttz-lsbb-2.c: Likewise. + * gcc.target/powerpc/vsu/vec-cnttz-lsbb-3.c: Likewise. + * gcc.target/powerpc/vsu/vec-cnttz-lsbb-4.c: Likewise. + * gcc.target/powerpc/vsu/vec-xl-len-0.c: Likewise. + * gcc.target/powerpc/vsu/vec-xl-len-1.c: Likewise. + * gcc.target/powerpc/vsu/vec-xl-len-10.c: Likewise. + * gcc.target/powerpc/vsu/vec-xl-len-11.c: Likewise. + * gcc.target/powerpc/vsu/vec-xl-len-12.c: Likewise. + * gcc.target/powerpc/vsu/vec-xl-len-13.c: Likewise. + * gcc.target/powerpc/vsu/vec-xl-len-2.c: Likewise. + * gcc.target/powerpc/vsu/vec-xl-len-3.c: Likewise. + * gcc.target/powerpc/vsu/vec-xl-len-4.c: Likewise. + * gcc.target/powerpc/vsu/vec-xl-len-5.c: Likewise. + * gcc.target/powerpc/vsu/vec-xl-len-6.c: Likewise. + * gcc.target/powerpc/vsu/vec-xl-len-7.c: Likewise. + * gcc.target/powerpc/vsu/vec-xl-len-8.c: Likewise. + * gcc.target/powerpc/vsu/vec-xl-len-9.c: Likewise. + * gcc.target/powerpc/vsu/vec-xlx-0.c: Likewise. + * gcc.target/powerpc/vsu/vec-xlx-1.c: Likewise. + * gcc.target/powerpc/vsu/vec-xlx-2.c: Likewise. + * gcc.target/powerpc/vsu/vec-xlx-3.c: Likewise. + * gcc.target/powerpc/vsu/vec-xlx-4.c: Likewise. + * gcc.target/powerpc/vsu/vec-xlx-5.c: Likewise. + * gcc.target/powerpc/vsu/vec-xlx-6.c: Likewise. + * gcc.target/powerpc/vsu/vec-xlx-7.c: Likewise. + * gcc.target/powerpc/vsu/vec-xrx-0.c: Likewise. + * gcc.target/powerpc/vsu/vec-xrx-1.c: Likewise. + * gcc.target/powerpc/vsu/vec-xrx-2.c: Likewise. + * gcc.target/powerpc/vsu/vec-xrx-3.c: Likewise. + * gcc.target/powerpc/vsu/vec-xrx-4.c: Likewise. + * gcc.target/powerpc/vsu/vec-xrx-5.c: Likewise. + * gcc.target/powerpc/vsu/vec-xrx-6.c: Likewise. + * gcc.target/powerpc/vsu/vec-xrx-7.c: Likewise. + * gcc.target/powerpc/vsu/vec-xst-len-0.c: Likewise. + * gcc.target/powerpc/vsu/vec-xst-len-1.c: Likewise. + * gcc.target/powerpc/vsu/vec-xst-len-10.c: Likewise. + * gcc.target/powerpc/vsu/vec-xst-len-11.c: Likewise. + * gcc.target/powerpc/vsu/vec-xst-len-12.c: Likewise. + * gcc.target/powerpc/vsu/vec-xst-len-13.c: Likewise. + * gcc.target/powerpc/vsu/vec-xst-len-2.c: Likewise. + * gcc.target/powerpc/vsu/vec-xst-len-3.c: Likewise. + * gcc.target/powerpc/vsu/vec-xst-len-4.c: Likewise. + * gcc.target/powerpc/vsu/vec-xst-len-5.c: Likewise. + * gcc.target/powerpc/vsu/vec-xst-len-6.c: Likewise. + * gcc.target/powerpc/vsu/vec-xst-len-7.c: Likewise. + * gcc.target/powerpc/vsu/vec-xst-len-8.c: Likewise. + * gcc.target/powerpc/vsu/vec-xst-len-9.c: Likewise. + * gcc.target/powerpc/vsx-builtin-msum.c: Likewise. + * gcc.target/powerpc/vsx-himode.c: Likewise. + * gcc.target/powerpc/vsx-himode2.c: Likewise. + * gcc.target/powerpc/vsx-himode3.c: Likewise. + * gcc.target/powerpc/vsx-qimode.c: Likewise. + * gcc.target/powerpc/vsx-qimode2.c: Likewise. + * gcc.target/powerpc/vsx-qimode3.c: Likewise. + * g++.target/powerpc/pr65240-1.C: Replace powerpc_p8vector_ok with + powerpc_vsx_ok and append -mvsx to dg-options. + * g++.target/powerpc/pr65240-2.C: Likewise. + * g++.target/powerpc/pr65240-3.C: Likewise. + * g++.target/powerpc/pr65242.C: Likewise. + * g++.target/powerpc/pr67211.C: Likewise. + * g++.target/powerpc/pr71294.C: Likewise. + * g++.target/powerpc/pr84279.C: Likewise. + * g++.target/powerpc/pr93974.C: Likewise. + * gcc.target/powerpc/atomic-p8.c: Likewise. + * gcc.target/powerpc/atomic_load_store-p8.c: Likewise. + * gcc.target/powerpc/bcd-2.c: Likewise. + * gcc.target/powerpc/bcd-3.c: Likewise. + * gcc.target/powerpc/bool2-p8.c: Likewise. + * gcc.target/powerpc/bool3-p8.c: Likewise. + * gcc.target/powerpc/builtins-1.c: Likewise. + * gcc.target/powerpc/builtins-3-p8.c: Likewise. + * gcc.target/powerpc/builtins-5.c: Likewise. + * gcc.target/powerpc/builtins-9.c: Likewise. + * gcc.target/powerpc/crypto-builtin-1.c: Likewise. + * gcc.target/powerpc/crypto-builtin-2.c: Likewise. + * gcc.target/powerpc/direct-move-double1.c: Likewise. + * gcc.target/powerpc/direct-move-float1.c: Likewise. + * gcc.target/powerpc/direct-move-long1.c: Likewise. + * gcc.target/powerpc/direct-move-vint1.c: Likewise. + * gcc.target/powerpc/float128-type-1.c: Likewise. + * gcc.target/powerpc/fold-vec-extract-char.p8.c: Likewise. + * gcc.target/powerpc/fold-vec-extract-double.p8.c: Likewise. + * gcc.target/powerpc/fold-vec-extract-float.p8.c: Likewise. + * gcc.target/powerpc/fold-vec-extract-int.p8.c: Likewise. + * gcc.target/powerpc/fold-vec-extract-longlong.p8.c: Likewise. + * gcc.target/powerpc/fold-vec-extract-short.p8.c: Likewise. + * gcc.target/powerpc/fold-vec-insert-char-p8.c: Likewise. + * gcc.target/powerpc/fold-vec-insert-float-p8.c: Likewise. + * gcc.target/powerpc/fold-vec-insert-int-p8.c: Likewise. + * gcc.target/powerpc/fold-vec-insert-longlong.c: Likewise. + * gcc.target/powerpc/fold-vec-insert-short-p8.c: Likewise. + * gcc.target/powerpc/fold-vec-neg-char.c: Likewise. + * gcc.target/powerpc/fold-vec-neg-floatdouble.c: Likewise. + * gcc.target/powerpc/fold-vec-neg-int.p8.c: Likewise. + * gcc.target/powerpc/fold-vec-neg-short.c: Likewise. + * gcc.target/powerpc/fold-vec-select-double.c: Likewise. + * gcc.target/powerpc/fold-vec-store-builtin_vec_xst-longlong.c: Likewise. + * gcc.target/powerpc/fusion.c: Likewise. + * gcc.target/powerpc/fusion2.c: Likewise. + * gcc.target/powerpc/mul-vectorize-1.c: Likewise. + * gcc.target/powerpc/p8-vec-xl-xst-v2.c: Likewise. + * gcc.target/powerpc/p8-vec-xl-xst.c: Likewise. + * gcc.target/powerpc/p8vector-builtin-1.c: Likewise. + * gcc.target/powerpc/p8vector-builtin-2.c: Likewise. + * gcc.target/powerpc/p8vector-builtin-3.c: Likewise. + * gcc.target/powerpc/p8vector-builtin-4.c: Likewise. + * gcc.target/powerpc/p8vector-builtin-5.c: Likewise. + * gcc.target/powerpc/p8vector-builtin-6.c: Likewise. + * gcc.target/powerpc/p8vector-builtin-7.c: Likewise. + * gcc.target/powerpc/p8vector-fp.c: Likewise. + * gcc.target/powerpc/p8vector-int128-1.c: Likewise. + * gcc.target/powerpc/p8vector-ldst.c: Likewise. + * gcc.target/powerpc/p8vector-vbpermq.c: Likewise. + * gcc.target/powerpc/p8vector-vectorize-1.c: Likewise. + * gcc.target/powerpc/p8vector-vectorize-2.c: Likewise. + * gcc.target/powerpc/p8vector-vectorize-3.c: Likewise. + * gcc.target/powerpc/p8vector-vectorize-4.c: Likewise. + * gcc.target/powerpc/p8vector-vectorize-5.c: Likewise. + * gcc.target/powerpc/ppc-round2.c: Likewise. + * gcc.target/powerpc/pr100866-1.c: Likewise. + * gcc.target/powerpc/pr100866-2.c: Likewise. + * gcc.target/powerpc/pr104239-1.c: Likewise. + * gcc.target/powerpc/pr104239-2.c: Likewise. + * gcc.target/powerpc/pr104239-3.c: Likewise. + * gcc.target/powerpc/pr106769-p8.c: Likewise. + * gcc.target/powerpc/pr108396.c: Likewise. + * gcc.target/powerpc/pr111449-1.c: Likewise. + * gcc.target/powerpc/pr57744.c: Likewise. + * gcc.target/powerpc/pr58673-1.c: Likewise. + * gcc.target/powerpc/pr58673-2.c: Likewise. + * gcc.target/powerpc/pr60137.c: Likewise. + * gcc.target/powerpc/pr60203.c: Likewise. + * gcc.target/powerpc/pr66144-2.c: Likewise. + * gcc.target/powerpc/pr66144-3.c: Likewise. + * gcc.target/powerpc/pr68163.c: Likewise. + * gcc.target/powerpc/pr69548.c: Likewise. + * gcc.target/powerpc/pr70669.c: Likewise. + * gcc.target/powerpc/pr71977-1.c: Likewise. + * gcc.target/powerpc/pr71977-2.c: Likewise. + * gcc.target/powerpc/pr72717.c: Likewise. + * gcc.target/powerpc/pr78056-3.c: Likewise. + * gcc.target/powerpc/pr78056-4.c: Likewise. + * gcc.target/powerpc/pr78102.c: Likewise. + * gcc.target/powerpc/pr78543.c: Likewise. + * gcc.target/powerpc/pr78604.c: Likewise. + * gcc.target/powerpc/pr79251.p8.c: Likewise. + * gcc.target/powerpc/pr79354.c: Likewise. + * gcc.target/powerpc/pr79544.c: Likewise. + * gcc.target/powerpc/pr79907.c: Likewise. + * gcc.target/powerpc/pr79951.c: Likewise. + * gcc.target/powerpc/pr80315-1.c: Likewise. + * gcc.target/powerpc/pr80315-2.c: Likewise. + * gcc.target/powerpc/pr80315-3.c: Likewise. + * gcc.target/powerpc/pr80315-4.c: Likewise. + * gcc.target/powerpc/pr80510-2.c: Likewise. + * gcc.target/powerpc/pr80695-p8.c: Likewise. + * gcc.target/powerpc/pr80718.c: Likewise. + * gcc.target/powerpc/pr84154-2.c: Likewise. + * gcc.target/powerpc/pr88558-p8.c: Likewise. + * gcc.target/powerpc/pr88845.c: Likewise. + * gcc.target/powerpc/pr91903.c: Likewise. + * gcc.target/powerpc/pr92923-2.c: Likewise. + * gcc.target/powerpc/pr96933-2.c: Likewise. + * gcc.target/powerpc/pr97019.c: Likewise. + * gcc.target/powerpc/pragma_power8.c: Likewise. + * gcc.target/powerpc/signbit-1.c: Likewise. + * gcc.target/powerpc/swaps-p8-1.c: Likewise. + * gcc.target/powerpc/swaps-p8-12.c: Likewise. + * gcc.target/powerpc/swaps-p8-14.c: Likewise. + * gcc.target/powerpc/swaps-p8-15.c: Likewise. + * gcc.target/powerpc/swaps-p8-16.c: Likewise. + * gcc.target/powerpc/swaps-p8-17.c: Likewise. + * gcc.target/powerpc/swaps-p8-18.c: Likewise. + * gcc.target/powerpc/swaps-p8-19.c: Likewise. + * gcc.target/powerpc/swaps-p8-2.c: Likewise. + * gcc.target/powerpc/swaps-p8-22.c: Likewise. + * gcc.target/powerpc/swaps-p8-23.c: Likewise. + * gcc.target/powerpc/swaps-p8-24.c: Likewise. + * gcc.target/powerpc/swaps-p8-25.c: Likewise. + * gcc.target/powerpc/swaps-p8-26.c: Likewise. + * gcc.target/powerpc/swaps-p8-27.c: Likewise. + * gcc.target/powerpc/swaps-p8-3.c: Likewise. + * gcc.target/powerpc/swaps-p8-30.c: Likewise. + * gcc.target/powerpc/swaps-p8-33.c: Likewise. + * gcc.target/powerpc/swaps-p8-36.c: Likewise. + * gcc.target/powerpc/swaps-p8-39.c: Likewise. + * gcc.target/powerpc/swaps-p8-4.c: Likewise. + * gcc.target/powerpc/swaps-p8-42.c: Likewise. + * gcc.target/powerpc/swaps-p8-45.c: Likewise. + * gcc.target/powerpc/swaps-p8-46.c: Likewise. + * gcc.target/powerpc/swaps-p8-5.c: Likewise. + * gcc.target/powerpc/unpack-vectorize-3.c: Likewise. + * gcc.target/powerpc/upper-regs-sf.c: Likewise. + * gcc.target/powerpc/vec-cmp.c: Likewise. + * gcc.target/powerpc/vec-extract-1.c: Likewise. + * gcc.target/powerpc/vec-extract-3.c: Likewise. + * gcc.target/powerpc/vec-extract-5.c: Likewise. + * gcc.target/powerpc/vec-extract-6.c: Likewise. + * gcc.target/powerpc/vec-extract-7.c: Likewise. + * gcc.target/powerpc/vec-extract-8.c: Likewise. + * gcc.target/powerpc/vec-extract-9.c: Likewise. + * gcc.target/powerpc/vec-init-10.c: Likewise. + * gcc.target/powerpc/vec-init-6.c: Likewise. + * gcc.target/powerpc/vec-init-7.c: Likewise. + * gcc.target/powerpc/vsx-extract-3.c: Likewise. + * gcc.target/powerpc/vsx-extract-4.c: Likewise. + * gcc.target/powerpc/vsx-extract-5.c: Likewise. + * gcc.target/powerpc/vsx-simode.c: Likewise. + * gcc.target/powerpc/vsx-simode2.c: Likewise. + * gcc.target/powerpc/vsx-simode3.c: Likewise. + * gcc.target/powerpc/builtins-4-int128-runnable.c: Replace + powerpc_p8vector_ok with powerpc_vsx_ok, replace -mpower8-vector + with -mvsx, and add dg-additional-options -mdejagnu-cpu=power8 + if !has_arch_pwr8. + * gcc.target/powerpc/builtins-mergew-mergow.c: Likewise. + * gcc.target/powerpc/direct-move-float3.c: Likewise. + * gcc.target/powerpc/divkc3-2.c: Likewise. + * gcc.target/powerpc/divkc3-3.c: Likewise. + * gcc.target/powerpc/fold-vec-abs-longlong-fwrapv.c: Likewise. + * gcc.target/powerpc/fold-vec-abs-longlong.c: Likewise. + * gcc.target/powerpc/fold-vec-add-4.c: Likewise. + * gcc.target/powerpc/fold-vec-add-7.c: Likewise. + * gcc.target/powerpc/fold-vec-cmp-int.h: Likewise. + * gcc.target/powerpc/fold-vec-cmp-longlong.c: Likewise. + * gcc.target/powerpc/fold-vec-cmp-short.h: Likewise. + * gcc.target/powerpc/fold-vec-cntlz-char.c: Likewise. + * gcc.target/powerpc/fold-vec-cntlz-int.c: Likewise. + * gcc.target/powerpc/fold-vec-cntlz-longlong.c: Likewise. + * gcc.target/powerpc/fold-vec-cntlz-short.c: Likewise. + * gcc.target/powerpc/fold-vec-ld-longlong.c: Likewise. + * gcc.target/powerpc/fold-vec-logical-eqv-char.c: Likewise. + * gcc.target/powerpc/fold-vec-logical-eqv-float.c: Likewise. + * gcc.target/powerpc/fold-vec-logical-eqv-floatdouble.c: Likewise. + * gcc.target/powerpc/fold-vec-logical-eqv-int.c: Likewise. + * gcc.target/powerpc/fold-vec-logical-eqv-longlong.c: Likewise. + * gcc.target/powerpc/fold-vec-logical-eqv-short.c: Likewise. + * gcc.target/powerpc/fold-vec-logical-ors-longlong.c: Likewise. + * gcc.target/powerpc/fold-vec-logical-other-char.c: Likewise. + * gcc.target/powerpc/fold-vec-logical-other-int.c: Likewise. + * gcc.target/powerpc/fold-vec-logical-other-longlong.c: Likewise. + * gcc.target/powerpc/fold-vec-logical-other-short.c: Likewise. + * gcc.target/powerpc/fold-vec-mergehl-longlong.c: Likewise. + * gcc.target/powerpc/fold-vec-minmax-longlong.c: Likewise. + * gcc.target/powerpc/fold-vec-mult-int.c: Likewise. + * gcc.target/powerpc/fold-vec-mult-longlong.c: Likewise. + * gcc.target/powerpc/fold-vec-neg-int.c: Likewise. + * gcc.target/powerpc/fold-vec-neg-longlong.h: Likewise. + * gcc.target/powerpc/fold-vec-pack-double.c: Likewise. + * gcc.target/powerpc/fold-vec-pack-longlong.c: Likewise. + * gcc.target/powerpc/fold-vec-shift-left-longlong-fwrapv.c: Likewise. + * gcc.target/powerpc/fold-vec-shift-left-longlong.c: Likewise. + * gcc.target/powerpc/fold-vec-shift-longlong.c: Likewise. + * gcc.target/powerpc/fold-vec-st-longlong.c: Likewise. + * gcc.target/powerpc/fold-vec-sub-int128.c: Likewise. + * gcc.target/powerpc/fold-vec-sub-longlong.c: Likewise. + * gcc.target/powerpc/fold-vec-unpack-float.c: Likewise. + * gcc.target/powerpc/fold-vec-unpack-int.c: Likewise. + * gcc.target/powerpc/mmx-packs.c: Likewise. + * gcc.target/powerpc/mmx-packssdw-1.c: Likewise. + * gcc.target/powerpc/mmx-packsswb-1.c: Likewise. + * gcc.target/powerpc/mmx-packuswb-1.c: Likewise. + * gcc.target/powerpc/mmx-paddb-1.c: Likewise. + * gcc.target/powerpc/mmx-paddd-1.c: Likewise. + * gcc.target/powerpc/mmx-paddsb-1.c: Likewise. + * gcc.target/powerpc/mmx-paddsw-1.c: Likewise. + * gcc.target/powerpc/mmx-paddusb-1.c: Likewise. + * gcc.target/powerpc/mmx-paddusw-1.c: Likewise. + * gcc.target/powerpc/mmx-paddw-1.c: Likewise. + * gcc.target/powerpc/mmx-pcmpeqb-1.c: Likewise. + * gcc.target/powerpc/mmx-pcmpeqd-1.c: Likewise. + * gcc.target/powerpc/mmx-pcmpeqw-1.c: Likewise. + * gcc.target/powerpc/mmx-pcmpgtb-1.c: Likewise. + * gcc.target/powerpc/mmx-pcmpgtd-1.c: Likewise. + * gcc.target/powerpc/mmx-pcmpgtw-1.c: Likewise. + * gcc.target/powerpc/mmx-pmaddwd-1.c: Likewise. + * gcc.target/powerpc/mmx-pmulhw-1.c: Likewise. + * gcc.target/powerpc/mmx-pmullw-1.c: Likewise. + * gcc.target/powerpc/mmx-pslld-1.c: Likewise. + * gcc.target/powerpc/mmx-psllw-1.c: Likewise. + * gcc.target/powerpc/mmx-psrad-1.c: Likewise. + * gcc.target/powerpc/mmx-psraw-1.c: Likewise. + * gcc.target/powerpc/mmx-psrld-1.c: Likewise. + * gcc.target/powerpc/mmx-psrlw-1.c: Likewise. + * gcc.target/powerpc/mmx-psubb-2.c: Likewise. + * gcc.target/powerpc/mmx-psubd-2.c: Likewise. + * gcc.target/powerpc/mmx-psubsb-1.c: Likewise. + * gcc.target/powerpc/mmx-psubsw-1.c: Likewise. + * gcc.target/powerpc/mmx-psubusb-1.c: Likewise. + * gcc.target/powerpc/mmx-psubusw-1.c: Likewise. + * gcc.target/powerpc/mmx-psubw-2.c: Likewise. + * gcc.target/powerpc/mmx-punpckhbw-1.c: Likewise. + * gcc.target/powerpc/mmx-punpckhdq-1.c: Likewise. + * gcc.target/powerpc/mmx-punpckhwd-1.c: Likewise. + * gcc.target/powerpc/mmx-punpcklbw-1.c: Likewise. + * gcc.target/powerpc/mmx-punpckldq-1.c: Likewise. + * gcc.target/powerpc/mmx-punpcklwd-1.c: Likewise. + * gcc.target/powerpc/mulkc3-2.c: Likewise. + * gcc.target/powerpc/mulkc3-3.c: Likewise. + * gcc.target/powerpc/p8vector-builtin-8.c: Likewise. + * gcc.target/powerpc/pr37191.c: Likewise. + * gcc.target/powerpc/pr83862.c: Likewise. + * gcc.target/powerpc/pr84154-1.c: Likewise. + * gcc.target/powerpc/pr84220-sld2.c: Likewise. + * gcc.target/powerpc/pr85456.c: Likewise. + * gcc.target/powerpc/pr86731-longlong.c: Likewise. + * gcc.target/powerpc/sse-addps-1.c: Likewise. + * gcc.target/powerpc/sse-addss-1.c: Likewise. + * gcc.target/powerpc/sse-andnps-1.c: Likewise. + * gcc.target/powerpc/sse-andps-1.c: Likewise. + * gcc.target/powerpc/sse-cmpss-1.c: Likewise. + * gcc.target/powerpc/sse-cvtpi16ps-1.c: Likewise. + * gcc.target/powerpc/sse-cvtpi32ps-1.c: Likewise. + * gcc.target/powerpc/sse-cvtpi32x2ps-1.c: Likewise. + * gcc.target/powerpc/sse-cvtpi8ps-1.c: Likewise. + * gcc.target/powerpc/sse-cvtpspi16-1.c: Likewise. + * gcc.target/powerpc/sse-cvtpspi8-1.c: Likewise. + * gcc.target/powerpc/sse-cvtpu16ps-1.c: Likewise. + * gcc.target/powerpc/sse-cvtpu8ps-1.c: Likewise. + * gcc.target/powerpc/sse-cvtsi2ss-1.c: Likewise. + * gcc.target/powerpc/sse-cvtsi2ss-2.c: Likewise. + * gcc.target/powerpc/sse-cvtss2si-1.c: Likewise. + * gcc.target/powerpc/sse-cvtss2si-2.c: Likewise. + * gcc.target/powerpc/sse-cvttss2si-1.c: Likewise. + * gcc.target/powerpc/sse-cvttss2si-2.c: Likewise. + * gcc.target/powerpc/sse-divps-1.c: Likewise. + * gcc.target/powerpc/sse-divss-1.c: Likewise. + * gcc.target/powerpc/sse-maxps-1.c: Likewise. + * gcc.target/powerpc/sse-maxps-2.c: Likewise. + * gcc.target/powerpc/sse-maxss-1.c: Likewise. + * gcc.target/powerpc/sse-minps-1.c: Likewise. + * gcc.target/powerpc/sse-minps-2.c: Likewise. + * gcc.target/powerpc/sse-minss-1.c: Likewise. + * gcc.target/powerpc/sse-movaps-1.c: Likewise. + * gcc.target/powerpc/sse-movaps-2.c: Likewise. + * gcc.target/powerpc/sse-movhlps-1.c: Likewise. + * gcc.target/powerpc/sse-movhps-1.c: Likewise. + * gcc.target/powerpc/sse-movhps-2.c: Likewise. + * gcc.target/powerpc/sse-movlhps-1.c: Likewise. + * gcc.target/powerpc/sse-movlps-1.c: Likewise. + * gcc.target/powerpc/sse-movlps-2.c: Likewise. + * gcc.target/powerpc/sse-movmskb-1.c: Likewise. + * gcc.target/powerpc/sse-movmskps-1.c: Likewise. + * gcc.target/powerpc/sse-movss-1.c: Likewise. + * gcc.target/powerpc/sse-movss-2.c: Likewise. + * gcc.target/powerpc/sse-movss-3.c: Likewise. + * gcc.target/powerpc/sse-mulps-1.c: Likewise. + * gcc.target/powerpc/sse-mulss-1.c: Likewise. + * gcc.target/powerpc/sse-orps-1.c: Likewise. + * gcc.target/powerpc/sse-pavgw-1.c: Likewise. + * gcc.target/powerpc/sse-pmaxsw-1.c: Likewise. + * gcc.target/powerpc/sse-pmaxub-1.c: Likewise. + * gcc.target/powerpc/sse-pminsw-1.c: Likewise. + * gcc.target/powerpc/sse-pminub-1.c: Likewise. + * gcc.target/powerpc/sse-pmulhuw-1.c: Likewise. + * gcc.target/powerpc/sse-psadbw-1.c: Likewise. + * gcc.target/powerpc/sse-rcpps-1.c: Likewise. + * gcc.target/powerpc/sse-rsqrtps-1.c: Likewise. + * gcc.target/powerpc/sse-shufps-1.c: Likewise. + * gcc.target/powerpc/sse-sqrtps-1.c: Likewise. + * gcc.target/powerpc/sse-subps-1.c: Likewise. + * gcc.target/powerpc/sse-subss-1.c: Likewise. + * gcc.target/powerpc/sse-ucomiss-1.c: Likewise. + * gcc.target/powerpc/sse-ucomiss-2.c: Likewise. + * gcc.target/powerpc/sse-ucomiss-3.c: Likewise. + * gcc.target/powerpc/sse-ucomiss-4.c: Likewise. + * gcc.target/powerpc/sse-ucomiss-5.c: Likewise. + * gcc.target/powerpc/sse-ucomiss-6.c: Likewise. + * gcc.target/powerpc/sse-unpckhps-1.c: Likewise. + * gcc.target/powerpc/sse-unpcklps-1.c: Likewise. + * gcc.target/powerpc/sse-xorps-1.c: Likewise. + * gcc.target/powerpc/sse2-addpd-1.c: Likewise. + * gcc.target/powerpc/sse2-addsd-1.c: Likewise. + * gcc.target/powerpc/sse2-andnpd-1.c: Likewise. + * gcc.target/powerpc/sse2-andpd-1.c: Likewise. + * gcc.target/powerpc/sse2-cmppd-1.c: Likewise. + * gcc.target/powerpc/sse2-cmpsd-1.c: Likewise. + * gcc.target/powerpc/sse2-comisd-1.c: Likewise. + * gcc.target/powerpc/sse2-comisd-2.c: Likewise. + * gcc.target/powerpc/sse2-comisd-3.c: Likewise. + * gcc.target/powerpc/sse2-comisd-4.c: Likewise. + * gcc.target/powerpc/sse2-comisd-5.c: Likewise. + * gcc.target/powerpc/sse2-comisd-6.c: Likewise. + * gcc.target/powerpc/sse2-cvtdq2pd-1.c: Likewise. + * gcc.target/powerpc/sse2-cvtdq2ps-1.c: Likewise. + * gcc.target/powerpc/sse2-cvtpd2dq-1.c: Likewise. + * gcc.target/powerpc/sse2-cvtpd2ps-1.c: Likewise. + * gcc.target/powerpc/sse2-cvtps2dq-1.c: Likewise. + * gcc.target/powerpc/sse2-cvtps2pd-1.c: Likewise. + * gcc.target/powerpc/sse2-cvtsd2si-1.c: Likewise. + * gcc.target/powerpc/sse2-cvtsd2si-2.c: Likewise. + * gcc.target/powerpc/sse2-cvtsd2ss-1.c: Likewise. + * gcc.target/powerpc/sse2-cvtsi2sd-1.c: Likewise. + * gcc.target/powerpc/sse2-cvtsi2sd-2.c: Likewise. + * gcc.target/powerpc/sse2-cvtss2sd-1.c: Likewise. + * gcc.target/powerpc/sse2-cvttpd2dq-1.c: Likewise. + * gcc.target/powerpc/sse2-cvttps2dq-1.c: Likewise. + * gcc.target/powerpc/sse2-cvttsd2si-1.c: Likewise. + * gcc.target/powerpc/sse2-cvttsd2si-2.c: Likewise. + * gcc.target/powerpc/sse2-divpd-1.c: Likewise. + * gcc.target/powerpc/sse2-divsd-1.c: Likewise. + * gcc.target/powerpc/sse2-maxpd-1.c: Likewise. + * gcc.target/powerpc/sse2-maxsd-1.c: Likewise. + * gcc.target/powerpc/sse2-minpd-1.c: Likewise. + * gcc.target/powerpc/sse2-minsd-1.c: Likewise. + * gcc.target/powerpc/sse2-mmx.c: Likewise. + * gcc.target/powerpc/sse2-movhpd-1.c: Likewise. + * gcc.target/powerpc/sse2-movhpd-2.c: Likewise. + * gcc.target/powerpc/sse2-movlpd-1.c: Likewise. + * gcc.target/powerpc/sse2-movlpd-2.c: Likewise. + * gcc.target/powerpc/sse2-movmskpd-1.c: Likewise. + * gcc.target/powerpc/sse2-movq-1.c: Likewise. + * gcc.target/powerpc/sse2-movq-2.c: Likewise. + * gcc.target/powerpc/sse2-movq-3.c: Likewise. + * gcc.target/powerpc/sse2-movsd-1.c: Likewise. + * gcc.target/powerpc/sse2-movsd-2.c: Likewise. + * gcc.target/powerpc/sse2-movsd-3.c: Likewise. + * gcc.target/powerpc/sse2-mulpd-1.c: Likewise. + * gcc.target/powerpc/sse2-mulsd-1.c: Likewise. + * gcc.target/powerpc/sse2-orpd-1.c: Likewise. + * gcc.target/powerpc/sse2-packssdw-1.c: Likewise. + * gcc.target/powerpc/sse2-packsswb-1.c: Likewise. + * gcc.target/powerpc/sse2-packuswb-1.c: Likewise. + * gcc.target/powerpc/sse2-paddb-1.c: Likewise. + * gcc.target/powerpc/sse2-paddd-1.c: Likewise. + * gcc.target/powerpc/sse2-paddq-1.c: Likewise. + * gcc.target/powerpc/sse2-paddsb-1.c: Likewise. + * gcc.target/powerpc/sse2-paddsw-1.c: Likewise. + * gcc.target/powerpc/sse2-paddusb-1.c: Likewise. + * gcc.target/powerpc/sse2-paddusw-1.c: Likewise. + * gcc.target/powerpc/sse2-paddw-1.c: Likewise. + * gcc.target/powerpc/sse2-pand-1.c: Likewise. + * gcc.target/powerpc/sse2-pandn-1.c: Likewise. + * gcc.target/powerpc/sse2-pavgb-1.c: Likewise. + * gcc.target/powerpc/sse2-pavgw-1.c: Likewise. + * gcc.target/powerpc/sse2-pcmpeqb-1.c: Likewise. + * gcc.target/powerpc/sse2-pcmpeqd-1.c: Likewise. + * gcc.target/powerpc/sse2-pcmpeqw-1.c: Likewise. + * gcc.target/powerpc/sse2-pcmpgtb-1.c: Likewise. + * gcc.target/powerpc/sse2-pcmpgtd-1.c: Likewise. + * gcc.target/powerpc/sse2-pcmpgtw-1.c: Likewise. + * gcc.target/powerpc/sse2-pextrw.c: Likewise. + * gcc.target/powerpc/sse2-pinsrw.c: Likewise. + * gcc.target/powerpc/sse2-pmaddwd-1.c: Likewise. + * gcc.target/powerpc/sse2-pmaxsw-1.c: Likewise. + * gcc.target/powerpc/sse2-pmaxub-1.c: Likewise. + * gcc.target/powerpc/sse2-pminsw-1.c: Likewise. + * gcc.target/powerpc/sse2-pminub-1.c: Likewise. + * gcc.target/powerpc/sse2-pmovmskb-1.c: Likewise. + * gcc.target/powerpc/sse2-pmulhuw-1.c: Likewise. + * gcc.target/powerpc/sse2-pmulhw-1.c: Likewise. + * gcc.target/powerpc/sse2-pmullw-1.c: Likewise. + * gcc.target/powerpc/sse2-pmuludq-1.c: Likewise. + * gcc.target/powerpc/sse2-por-1.c: Likewise. + * gcc.target/powerpc/sse2-psadbw-1.c: Likewise. + * gcc.target/powerpc/sse2-pshufd-1.c: Likewise. + * gcc.target/powerpc/sse2-pshufhw-1.c: Likewise. + * gcc.target/powerpc/sse2-pshuflw-1.c: Likewise. + * gcc.target/powerpc/sse2-pslld-1.c: Likewise. + * gcc.target/powerpc/sse2-pslld-2.c: Likewise. + * gcc.target/powerpc/sse2-pslldq-1.c: Likewise. + * gcc.target/powerpc/sse2-psllq-1.c: Likewise. + * gcc.target/powerpc/sse2-psllq-2.c: Likewise. + * gcc.target/powerpc/sse2-psllw-1.c: Likewise. + * gcc.target/powerpc/sse2-psllw-2.c: Likewise. + * gcc.target/powerpc/sse2-psrad-1.c: Likewise. + * gcc.target/powerpc/sse2-psrad-2.c: Likewise. + * gcc.target/powerpc/sse2-psraw-1.c: Likewise. + * gcc.target/powerpc/sse2-psraw-2.c: Likewise. + * gcc.target/powerpc/sse2-psrld-1.c: Likewise. + * gcc.target/powerpc/sse2-psrld-2.c: Likewise. + * gcc.target/powerpc/sse2-psrldq-1.c: Likewise. + * gcc.target/powerpc/sse2-psrlq-1.c: Likewise. + * gcc.target/powerpc/sse2-psrlq-2.c: Likewise. + * gcc.target/powerpc/sse2-psrlw-1.c: Likewise. + * gcc.target/powerpc/sse2-psrlw-2.c: Likewise. + * gcc.target/powerpc/sse2-psubb-1.c: Likewise. + * gcc.target/powerpc/sse2-psubd-1.c: Likewise. + * gcc.target/powerpc/sse2-psubq-1.c: Likewise. + * gcc.target/powerpc/sse2-psubsb-1.c: Likewise. + * gcc.target/powerpc/sse2-psubsw-1.c: Likewise. + * gcc.target/powerpc/sse2-psubusb-1.c: Likewise. + * gcc.target/powerpc/sse2-psubusw-1.c: Likewise. + * gcc.target/powerpc/sse2-psubw-1.c: Likewise. + * gcc.target/powerpc/sse2-punpckhbw-1.c: Likewise. + * gcc.target/powerpc/sse2-punpckhdq-1.c: Likewise. + * gcc.target/powerpc/sse2-punpckhqdq-1.c: Likewise. + * gcc.target/powerpc/sse2-punpckhwd-1.c: Likewise. + * gcc.target/powerpc/sse2-punpcklbw-1.c: Likewise. + * gcc.target/powerpc/sse2-punpckldq-1.c: Likewise. + * gcc.target/powerpc/sse2-punpcklqdq-1.c: Likewise. + * gcc.target/powerpc/sse2-punpcklwd-1.c: Likewise. + * gcc.target/powerpc/sse2-pxor-1.c: Likewise. + * gcc.target/powerpc/sse2-shufpd-1.c: Likewise. + * gcc.target/powerpc/sse2-sqrtpd-1.c: Likewise. + * gcc.target/powerpc/sse2-subpd-1.c: Likewise. + * gcc.target/powerpc/sse2-subsd-1.c: Likewise. + * gcc.target/powerpc/sse2-ucomisd-1.c: Likewise. + * gcc.target/powerpc/sse2-ucomisd-2.c: Likewise. + * gcc.target/powerpc/sse2-ucomisd-3.c: Likewise. + * gcc.target/powerpc/sse2-ucomisd-4.c: Likewise. + * gcc.target/powerpc/sse2-ucomisd-5.c: Likewise. + * gcc.target/powerpc/sse2-ucomisd-6.c: Likewise. + * gcc.target/powerpc/sse2-unpckhpd-1.c: Likewise. + * gcc.target/powerpc/sse2-unpcklpd-1.c: Likewise. + * gcc.target/powerpc/sse2-xorpd-1.c: Likewise. + * gcc.target/powerpc/sse3-addsubpd.c: Likewise. + * gcc.target/powerpc/sse3-addsubps.c: Likewise. + * gcc.target/powerpc/sse3-haddpd.c: Likewise. + * gcc.target/powerpc/sse3-haddps.c: Likewise. + * gcc.target/powerpc/sse3-hsubpd.c: Likewise. + * gcc.target/powerpc/sse3-hsubps.c: Likewise. + * gcc.target/powerpc/sse3-lddqu.c: Likewise. + * gcc.target/powerpc/sse3-movddup.c: Likewise. + * gcc.target/powerpc/sse3-movshdup.c: Likewise. + * gcc.target/powerpc/sse3-movsldup.c: Likewise. + * gcc.target/powerpc/sse4_1-blendpd.c: Likewise. + * gcc.target/powerpc/sse4_1-blendps-2.c: Likewise. + * gcc.target/powerpc/sse4_1-blendps.c: Likewise. + * gcc.target/powerpc/sse4_1-blendvpd.c: Likewise. + * gcc.target/powerpc/sse4_1-blendvps.c: Likewise. + * gcc.target/powerpc/sse4_1-ceilpd.c: Likewise. + * gcc.target/powerpc/sse4_1-ceilps.c: Likewise. + * gcc.target/powerpc/sse4_1-ceilsd.c: Likewise. + * gcc.target/powerpc/sse4_1-ceilss.c: Likewise. + * gcc.target/powerpc/sse4_1-floorpd.c: Likewise. + * gcc.target/powerpc/sse4_1-floorps.c: Likewise. + * gcc.target/powerpc/sse4_1-floorsd.c: Likewise. + * gcc.target/powerpc/sse4_1-floorss.c: Likewise. + * gcc.target/powerpc/sse4_1-pblendvb.c: Likewise. + * gcc.target/powerpc/sse4_1-pblendw-2.c: Likewise. + * gcc.target/powerpc/sse4_1-pblendw.c: Likewise. + * gcc.target/powerpc/sse4_1-pcmpeqq.c: Likewise. + * gcc.target/powerpc/sse4_1-pinsrb.c: Likewise. + * gcc.target/powerpc/sse4_1-pinsrd.c: Likewise. + * gcc.target/powerpc/sse4_1-pinsrq.c: Likewise. + * gcc.target/powerpc/sse4_1-pmovsxbq.c: Likewise. + * gcc.target/powerpc/sse4_1-pmovsxdq.c: Likewise. + * gcc.target/powerpc/sse4_1-pmovsxwq.c: Likewise. + * gcc.target/powerpc/sse4_1-pmuldq.c: Likewise. + * gcc.target/powerpc/sse4_1-ptest-1.c: Likewise. + * gcc.target/powerpc/sse4_1-roundpd-2.c: Likewise. + * gcc.target/powerpc/sse4_1-roundpd-3.c: Likewise. + * gcc.target/powerpc/sse4_2-pcmpgtq.c: Likewise. + * gcc.target/powerpc/ssse3-pabsb.c: Likewise. + * gcc.target/powerpc/ssse3-pabsd.c: Likewise. + * gcc.target/powerpc/ssse3-pabsw.c: Likewise. + * gcc.target/powerpc/ssse3-palignr.c: Likewise. + * gcc.target/powerpc/ssse3-phaddd.c: Likewise. + * gcc.target/powerpc/ssse3-phaddsw.c: Likewise. + * gcc.target/powerpc/ssse3-phaddw.c: Likewise. + * gcc.target/powerpc/ssse3-phsubd.c: Likewise. + * gcc.target/powerpc/ssse3-phsubsw.c: Likewise. + * gcc.target/powerpc/ssse3-phsubw.c: Likewise. + * gcc.target/powerpc/ssse3-pmaddubsw.c: Likewise. + * gcc.target/powerpc/ssse3-pmulhrsw.c: Likewise. + * gcc.target/powerpc/ssse3-pshufb.c: Likewise. + * gcc.target/powerpc/ssse3-psignb.c: Likewise. + * gcc.target/powerpc/ssse3-psignd.c: Likewise. + * gcc.target/powerpc/ssse3-psignw.c: Likewise. + * gcc.target/powerpc/vec-cmp-sel.c: Likewise. + * gcc.target/powerpc/vec-sld-modulo.c: Likewise. + * gcc.target/powerpc/vec-srad-modulo.c: Likewise. + * gcc.target/powerpc/vec-srd-modulo.c: Likewise. + * gcc.target/powerpc/amo1.c: Replace powerpc_p9vector_ok with + powerpc_vsx_ok, replace -mpower9-vector with -mvsx, and add + dg-additional-options -mdejagnu-cpu=power9 if !has_arch_pwr9. + * gcc.target/powerpc/amo2.c: Likewise. + * gcc.target/powerpc/dform-1.c: Likewise. + * gcc.target/powerpc/dform-2.c: Likewise. + * gcc.target/powerpc/float128-5.c: Likewise. + * gcc.target/powerpc/float128-complex-2.c: Likewise. + * gcc.target/powerpc/float128-fma1.c: Likewise. + * gcc.target/powerpc/float128-hw.c: Likewise. + * gcc.target/powerpc/float128-hw10.c: Likewise. + * gcc.target/powerpc/float128-hw11.c: Likewise. + * gcc.target/powerpc/float128-hw2.c: Likewise. + * gcc.target/powerpc/float128-hw3.c: Likewise. + * gcc.target/powerpc/float128-hw4.c: Likewise. + * gcc.target/powerpc/float128-hw5.c: Likewise. + * gcc.target/powerpc/float128-hw6.c: Likewise. + * gcc.target/powerpc/float128-hw7.c: Likewise. + * gcc.target/powerpc/float128-hw8.c: Likewise. + * gcc.target/powerpc/float128-hw9.c: Likewise. + * gcc.target/powerpc/float128-minmax.c: Likewise. + * gcc.target/powerpc/float128-odd.c: Likewise. + * gcc.target/powerpc/float128-sqrt1.c: Likewise. + * gcc.target/powerpc/fold-vec-cmp-int.p9.c: Likewise. + * gcc.target/powerpc/gnuattr2.c: Likewise. + * gcc.target/powerpc/pr71656-1.c: Likewise. + * gcc.target/powerpc/pr71656-2.c: Likewise. + * gcc.target/powerpc/pr81959.c: Likewise. + * gcc.target/powerpc/pr82748-1.c: Likewise. + * gcc.target/powerpc/pr82748-2.c: Likewise. + * gcc.target/powerpc/pr111449-2.c: Replace powerpc_p8vector_ok + with powerpc_vsx_ok. + * gcc.target/powerpc/pr98914.c: Likewise. + * gcc.target/powerpc/versioned-copy-loop.c: Replace + powerpc_p8vector_ok with powerpc_vsx_ok and append -mvsx to + dg-options. + * gcc.target/powerpc/clone2.c: Replace powerpc_p9vector_ok with + powerpc_vsx_ok. + * gcc.target/powerpc/p9-options-1.c: Replace powerpc_p9vector_ok + with powerpc_vsx_ok, replace -mno-power9-vector with -mno-vsx. + * gcc.target/powerpc/pr84226.c: Replace powerpc_p9vector_ok with + powerpc_vsx_ok and append -mvsx to dg-options. + * g++.dg/pr69667.C: Replace powerpc_p8vector_ok with + powerpc_vsx_ok and append -mvsx to dg-options. + * gcc.dg/vect/costmodel/ppc/costmodel-slp-perm.c: Replace + powerpc_p9vector_ok with powerpc_vsx_ok and replace + -mpower9-vector with -mvsx. + * gcc.dg/vect/pr109011-1.c: Replace powerpc_p8vector_ok with + powerpc_vsx_ok, and replace -mpower8-vector with + -mdejagnu-cpu=power8 -mvsx or -mvsx under different conditions. + * gcc.dg/vect/pr109011-2.c: Replace powerpc_p9vector_ok + with powerpc_vsx_ok, and replace -mpower9-vector with + -mdejagnu-cpu=power9 -mvsx or -mvsx under different conditions. + * gcc.dg/vect/pr109011-4.c: Likewise. + * gcc.dg/vect/pr109011-3.c: Replace powerpc_p8vector_ok with + powerpc_vsx_ok, and replace -mpower8-vector -mno-power9-vector + with -mdejagnu-cpu=power8 -mvsx. + * gcc.dg/vect/pr109011-5.c: Likewise. + * gcc.target/powerpc/altivec-35.c: Remove -mno-power8-vector. + * gcc.target/powerpc/vsx-vector-7.c: Replace -mno-power8-vector + with -mdejagnu-cpu=power7. + * gcc.dg/vect/O3-pr70130.c: Replace -mcpu=power7 with options + -mdejagnu-cpu=power7 -mvsx and remove option -mno-power9-vector + -mno-power8-vector. + * gfortran.dg/vect/pr45714-b.f: Likewise. + * gcc.dg/vect/pr48765.c: Remove dg-skip-if and replace -mcpu=power7 + with option -mdejagnu-cpu=power6. + * gcc.target/powerpc/pr78056-2.c: Likewise. + * gcc.target/powerpc/altivec-2-runnable.c: Replace + powerpc_p8vector_ok with powerpc_vsx_ok, remove -mpower8-vector + and add dg-additional-options -mdejagnu-cpu=power8 if !has_arch_pwr8. + * gcc.target/powerpc/altivec-37.c: Likewise. + * gcc.target/powerpc/fold-vec-abs-longlong-fwrapv.p8.c: Replace + powerpc_p8vector_ok with powerpc_vsx_ok and replace -mpower8-vector + with -mvsx. + * gcc.target/powerpc/fold-vec-abs-longlong.p8.c: Likewise. + * gcc.target/powerpc/fold-vec-cmp-char.p8.c: Likewise. + * gcc.target/powerpc/fold-vec-cmp-int.p8.c: Likewise. + * gcc.target/powerpc/fold-vec-cmp-short.p8.c: Likewise. + * gcc.target/powerpc/fold-vec-mergeeo-floatdouble.c: Likewise. + * gcc.target/powerpc/fold-vec-mergeeo-int.c: Likewise. + * gcc.target/powerpc/fold-vec-mergeeo-longlong.c: Likewise. + * gcc.target/powerpc/fold-vec-mult-int128-p8.c: Likewise. + * gcc.target/powerpc/fold-vec-neg-longlong.p8.c: Likewise. + * gcc.target/powerpc/pr104124.c: Likewise. + * gcc.target/powerpc/vec-cmpne-long.c: Likewise. + * gcc.target/powerpc/pr86731-fwrapv-longlong.c: Replace + powerpc_p8vector_ok with powerpc_vsx_ok, replace -mpower8-vector with + -mvsx and add dg-additional-options -mdejagnu-cpu=power8 if + !has_arch_pwr8. + * gcc.target/powerpc/pr80098-1.c: Replace powerpc_p9vector_ok with + powerpc_vsx_ok and replace -mno-power9-vector with -mno-vsx. + * gcc.target/powerpc/pr80098-2.c: Replace powerpc_p8vector_ok with + powerpc_vsx_ok and replace -mno-power8-vector with -mno-vsx. + * gcc.target/powerpc/pragma_misc9.c: Replace powerpc_p9vector_ok + with powerpc_vsx_ok. + +2024-02-22 Pan Li + + PR target/114017 + * gcc.target/riscv/predef-__riscv_v_intrinsic.c: Update the + version to 0.12. + * gcc.target/riscv/rvv/base/pr114017-1.c: New test. + +2024-02-22 Fangrui Song + + * gcc.target/riscv/asm-raw-symbol.c: New test. + +2024-02-21 Edwin Lu + + PR target/113249 + * gcc.target/riscv/rvv/autovec/vls/calling-convention-1.c: + Rearrange and adjust asm-checker times + * gcc.target/riscv/rvv/autovec/vls/calling-convention-2.c: Ditto + * gcc.target/riscv/rvv/autovec/vls/calling-convention-3.c: Ditto + * gcc.target/riscv/rvv/autovec/vls/calling-convention-4.c: Ditto + * gcc.target/riscv/rvv/autovec/vls/calling-convention-5.c: Ditto + * gcc.target/riscv/rvv/autovec/vls/calling-convention-6.c: Ditto + * gcc.target/riscv/rvv/autovec/vls/calling-convention-7.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-12.c: + Rearrange assembly + * gcc.target/riscv/rvv/base/binop_vx_constraint-16.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-17.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-19.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-21.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-23.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-25.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-27.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-29.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-31.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-33.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-35.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-4.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-40.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-44.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-8.c: Ditto + * gcc.target/riscv/rvv/base/shift_vx_constraint-1.c: Ditto + * gcc.target/riscv/rvv/vsetvl/avl_single-107.c: Change expected vsetvl + +2024-02-21 Edwin Lu + + PR target/113249 + * g++.target/riscv/rvv/base/bug-1.C: Use default scheduling + * gcc.target/riscv/rvv/autovec/reduc/reduc_call-2.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-102.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-108.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-114.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-119.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-12.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-16.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-17.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-19.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-21.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-23.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-25.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-27.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-29.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-31.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-33.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-35.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-4.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-40.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-44.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-50.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-56.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-62.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-68.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-74.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-79.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-8.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-84.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-90.c: Ditto + * gcc.target/riscv/rvv/base/binop_vx_constraint-96.c: Ditto + * gcc.target/riscv/rvv/base/float-point-dynamic-frm-30.c: Ditto + * gcc.target/riscv/rvv/base/pr108185-1.c: Ditto + * gcc.target/riscv/rvv/base/pr108185-2.c: Ditto + * gcc.target/riscv/rvv/base/pr108185-3.c: Ditto + * gcc.target/riscv/rvv/base/pr108185-4.c: Ditto + * gcc.target/riscv/rvv/base/pr108185-5.c: Ditto + * gcc.target/riscv/rvv/base/pr108185-6.c: Ditto + * gcc.target/riscv/rvv/base/pr108185-7.c: Ditto + * gcc.target/riscv/rvv/base/shift_vx_constraint-1.c: Ditto + * gcc.target/riscv/rvv/vsetvl/pr111037-3.c: Ditto + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-28.c: Ditto + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-29.c: Ditto + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-32.c: Ditto + * gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-33.c: Ditto + * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-17.c: Ditto + * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-18.c: Ditto + * gcc.target/riscv/rvv/vsetvl/vlmax_single_block-19.c: Ditto + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-10.c: Ditto + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-11.c: Ditto + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-12.c: Ditto + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-4.c: Ditto + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-5.c: Ditto + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-6.c: Ditto + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-7.c: Ditto + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-8.c: Ditto + * gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-9.c: Ditto + * gfortran.dg/vect/vect-8.f90: Ditto + +2024-02-21 Edwin Lu + + PR target/113742 + * gcc.target/riscv/pr113742.c: change mcpu to mtune and add march + +2024-02-21 David Faust + + * gcc.target/bpf/memcpy-1.c: New test. + * gcc.target/bpf/memmove-1.c: New test. + * gcc.target/bpf/memmove-2.c: New test. + +2024-02-21 Gaius Mulley + + PR modula2/114026 + * gm2/extensions/run/pass/callingc10.mod: New test. + * gm2/extensions/run/pass/callingc11.mod: New test. + * gm2/extensions/run/pass/callingc9.mod: New test. + * gm2/extensions/run/pass/strconst.def: New test. + * gm2/pim/fail/forloop.mod: New test. + * gm2/pim/pass/forloop2.mod: New test. + +2024-02-21 0xn4utilus + + * rust/compile/issue-2850.rs: New test. + +2024-02-21 Owen Avery + + * rust/compile/issue-2847-b.rs: New test. + +2024-02-21 Marc PoulhiĂšs + + * rust/compile/torture/intrinsics-math.rs: Adjust pow test, add + test for powi. + +2024-02-21 Arthur Cohen + + * rust/compile/rustc_const_stable.rs: New test. + +2024-02-21 Owen Avery + + * rust/compile/use_2.rs: New test. + +2024-02-21 Arthur Cohen + + * rust/execute/torture/matches_macro.rs: New test. + +2024-02-21 Tamar Christina + + * g++.target/aarch64/acle/ls64.C: Add +ls64. + * g++.target/aarch64/acle/ls64_lto.C: Likewise. + * gcc.target/aarch64/acle/ls64_lto.c: Likewise. + * gcc.target/aarch64/acle/pr110100.c: Likewise. + * gcc.target/aarch64/acle/pr110132.c: Likewise. + * gcc.target/aarch64/options_set_28.c: Drop check for nols64. + * gcc.target/aarch64/pragma_cpp_predefs_2.c: Correct header checks. + +2024-02-21 Tamar Christina + + PR fortran/107071 + * gfortran.dg/ieee/modes_1.f90: skip aarch64, arm. + +2024-02-21 Richard Sandiford + + * gcc.target/aarch64/sme/locally_streaming_1_ts.c: New test. + * gcc.target/aarch64/sme/sibcall_7_ts.c: Likewise. + +2024-02-21 Richard Sandiford + + * gcc.target/aarch64/sme/sibcall_9.c: New test. + +2024-02-21 Richard Sandiford + + * gcc.target/aarch64/sme/zt0_state_5.c (test3): Expect ZT0 rather + than ZA to be zeroed. + (test5): Remove zeroing of ZA. + +2024-02-21 Richard Sandiford + + * gcc.target/aarch64/sme/zt0_state_5.c (test3, test5): Expect + zero { za }s. + +2024-02-21 Richard Sandiford + + PR target/113995 + * gcc.target/aarch64/sme/locally_streaming_1.c: Require + -fno-stack-clash-protection. + * gcc.target/aarch64/sme/locally_streaming_1_scp.c: New test. + +2024-02-21 Richard Sandiford + + PR target/113220 + * gcc.target/aarch64/sme/call_sm_switch_5.c: Add + -fno-stack-clash-protection. + * gcc.target/aarch64/sme/call_sm_switch_5_scp.c: New test. + * gcc.target/aarch64/sme/sibcall_6_scp.c: New test. + * gcc.target/aarch64/sme/za_state_4.c: Add + -fno-stack-clash-protection. + * gcc.target/aarch64/sme/za_state_4_scp.c: New test. + * gcc.target/aarch64/sme/za_state_5.c: Add + -fno-stack-clash-protection. + * gcc.target/aarch64/sme/za_state_5_scp.c: New test. + +2024-02-21 Ilya Leoshkevich + + * gcc.target/s390/zvector/autovec-double-signaling-eq.c: + Preserve exceptions. + * gcc.target/s390/zvector/autovec-float-signaling-eq.c: + Likewise. + +2024-02-21 David Malcolm + + PR analyzer/113999 + * c-c++-common/analyzer/strlen-pr113999.c: New test. + * gcc.dg/analyzer/strlen-1.c: More test coverage. + +2024-02-21 David Malcolm + + PR analyzer/113998 + * c-c++-common/analyzer/overlapping-buffers-pr113998.c: New test. + 2024-02-20 Peter Hill PR fortran/105658 diff --git a/gcc/testsuite/c-c++-common/analyzer/call-summaries-pr114159.c b/gcc/testsuite/c-c++-common/analyzer/call-summaries-pr114159.c new file mode 100644 index 000000000000..19b545a1154d --- /dev/null +++ b/gcc/testsuite/c-c++-common/analyzer/call-summaries-pr114159.c @@ -0,0 +1,20 @@ +/* Verify we don't ICE on this case with these options. */ + +/* { dg-additional-options "-fanalyzer-call-summaries --param=analyzer-max-svalue-depth=0 -Wno-analyzer-symbol-too-complex" } */ + +int foo_i; +void bar() {} +void foo() { + if (foo_i) + bar(); + else + goto f1; + bar(); +f1: + bar(); +} +int main() { + foo(); + foo(); + return 0; +} diff --git a/gcc/testsuite/c-c++-common/analyzer/conditionals-pr111881.c b/gcc/testsuite/c-c++-common/analyzer/conditionals-pr111881.c new file mode 100644 index 000000000000..ecf165feeec2 --- /dev/null +++ b/gcc/testsuite/c-c++-common/analyzer/conditionals-pr111881.c @@ -0,0 +1,8 @@ +/* Verify we don't ICE on certain float conditionals. */ + +/* { dg-additional-options "-Ofast" } */ + +int test_pr111881 (float sf1) +{ + return sf1 <= 0 || sf1 >= 7 ? 0 : sf1; +} diff --git a/gcc/testsuite/c-c++-common/dwarf2/pr113918.c b/gcc/testsuite/c-c++-common/dwarf2/pr113918.c new file mode 100644 index 000000000000..f72a6c4338f0 --- /dev/null +++ b/gcc/testsuite/c-c++-common/dwarf2/pr113918.c @@ -0,0 +1,33 @@ +/* PR debug/113918 */ +/* { dg-do compile } */ +/* { dg-options "-gdwarf-5 -dA -fno-merge-debug-strings" } */ + +struct S { + union { + int i; + long long j; + }; + struct { + int k; + long long l; + }; + union { + int m; + long long n; + } u; + struct { + int o; + long long p; + } v; +} s; + +int +main () +{ + s.i = 1; + s.k = 2; + s.u.m = 3; + s.v.o = 4; +} + +/* { dg-final { scan-assembler-times "DW_AT_export_symbols" 4 } } */ diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-113083.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-113083.C new file mode 100644 index 000000000000..3829ac589c49 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-113083.C @@ -0,0 +1,16 @@ +// PR c++/113083 +// { dg-do compile { target c++11 } } +// { dg-options "-Os" } + +struct A { constexpr A (); }; + +void +foo () +{ + A b; +} + +constexpr +A::A () +{ +} diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept84.C b/gcc/testsuite/g++.dg/cpp0x/noexcept84.C new file mode 100644 index 000000000000..06f33264f77c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept84.C @@ -0,0 +1,32 @@ +// PR c++/114114 +// { dg-do compile { target c++11 } } + +template +constexpr void +test () +{ + constexpr bool is_yes = B; + struct S { + constexpr S() noexcept(is_yes) { } + }; + S s; +} + +constexpr bool foo() { return true; } + +template +constexpr void +test2 () +{ + constexpr T (*pfn)() = &foo; + struct S { + constexpr S() noexcept(pfn()) { } + }; + S s; +} + +int main() +{ + test(); + test2(); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ87.C b/gcc/testsuite/g++.dg/cpp1y/var-templ87.C new file mode 100644 index 000000000000..e62d06d172c5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ87.C @@ -0,0 +1,43 @@ +// PR c++/113976 +// { dg-do run { target c++14 } } + +int +foo () +{ + return 42; +} + +template +const int a = foo (); +const int *b = &a <0>; +template +const int c = foo (); +template const int c <0>; +template +const int d = foo (); +const int *e = &d <0>; +template const int d <0>; +template +const int f = foo (); +template const int f <0>; +const int *g = &f <0>; +struct S { int a, b; }; +template +const S h = { 42, foo () }; +const S *i = &h <0>; +template +const S j = { 42, foo () }; +template const S j <0>; +template +const S k = { 42, foo () }; +const S *l = &k <0>; +template const S k <0>; +template +const S m = { 42, foo () }; +template const S m <0>; +const S *n = &m <0>; + +int +main () +{ +} diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp59.C b/gcc/testsuite/g++.dg/cpp1z/decomp59.C new file mode 100644 index 000000000000..52a72fa9c08e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/decomp59.C @@ -0,0 +1,63 @@ +// PR c++/92687 +// { dg-do compile { target c++11 } } +// { dg-options "" } + +namespace std { + template struct tuple_size; + template struct tuple_element; +} + +struct A { + int i; + template int& get() { return i; } +}; + +template<> struct std::tuple_size { static const int value = 2; }; +template struct std::tuple_element { using type = int; }; + +template +struct is_reference { + static const bool value = false; +}; + +template +struct is_reference +{ + static const bool value = true; +}; + +template +struct is_reference +{ + static const bool value = true; +}; + +template +void +foo () +{ + auto [x, y] = A {}; // { dg-warning "structured bindings only available with" "" { target c++14_down } } + static_assert (!is_reference::value, ""); +} + +void +bar () +{ + auto [x, y] = A {}; // { dg-warning "structured bindings only available with" "" { target c++14_down } } + static_assert (!is_reference::value, ""); +} + +template +void +baz () +{ + auto [x, y] = T {}; // { dg-warning "structured bindings only available with" "" { target c++14_down } } + static_assert (!is_reference::value, ""); +} + +void +qux () +{ + foo<0> (); + baz (); +} diff --git a/gcc/testsuite/g++.dg/cpp1z/inline-var10.C b/gcc/testsuite/g++.dg/cpp1z/inline-var10.C new file mode 100644 index 000000000000..8a198556778f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/inline-var10.C @@ -0,0 +1,33 @@ +// PR c++/114013 +// { dg-do link { target c++17 } } + +struct S { int a, b; }; + +template +constexpr struct S var[8] = {}; + +template <> +constexpr inline struct S var<6>[8] = { + { 1, 1 }, { 2, 0 }, { 3, 1 }, { 4, 0 }, + { 5, 1 }, { 6, 0 }, { 7, 1 }, { 8, 0 } +}; + +[[gnu::noipa]] void +foo (S) +{ +} + +template +void +bar (int x) +{ + foo (var[x]); +} + +volatile int x; + +int +main () +{ + bar <6> (x); +} diff --git a/gcc/testsuite/g++.dg/cpp1z/inline-var11.C b/gcc/testsuite/g++.dg/cpp1z/inline-var11.C new file mode 100644 index 000000000000..d92911ed3a93 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/inline-var11.C @@ -0,0 +1,32 @@ +// PR c++/110031 +// { dg-do compile { target c++17 } } + +template +[[deprecated]] +inline constexpr bool t = true ; + +template +struct enableif; + +template<> +struct enableif +{ + using y = int; +}; +template +using enableif_t = typename enableif::y; + +template > = 0> // { dg-warning "deprecated" } +struct A { A(T &&) { }}; + +template +struct A { + A(T &&) = delete; + A() = delete; +}; + +int main(void) +{ + A a(5.3); // { dg-error "use of deleted function" } + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp23/auto-fncast16.C b/gcc/testsuite/g++.dg/cpp23/auto-fncast16.C new file mode 100644 index 000000000000..e2c13f6b050b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp23/auto-fncast16.C @@ -0,0 +1,12 @@ +// PR c++/110025 +// { dg-do compile { target c++23 } } + +template +struct A { }; + +template +A f(); + +int main() { + f<0>(); +} diff --git a/gcc/testsuite/g++.dg/cpp23/auto-fncast17.C b/gcc/testsuite/g++.dg/cpp23/auto-fncast17.C new file mode 100644 index 000000000000..25186dfdbf23 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp23/auto-fncast17.C @@ -0,0 +1,15 @@ +// PR c++/110025 +// { dg-do compile { target c++23 } } + +template struct tuple; + +template +using constant_t = int; + +template +using constants_t = tuple...>; + +using ty0 = constants_t<>; +using ty1 = constants_t<1>; +using ty2 = constants_t<1, 2>; +using ty3 = constants_t<1, 2, 3>; diff --git a/gcc/testsuite/g++.dg/cpp23/auto-fncast18.C b/gcc/testsuite/g++.dg/cpp23/auto-fncast18.C new file mode 100644 index 000000000000..4656723684f9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp23/auto-fncast18.C @@ -0,0 +1,69 @@ +// PR c++/114138 +// { dg-do compile { target c++23 } } + +namespace std { + template + T&& declval() noexcept requires true; + + template + void declval() noexcept; + + namespace detail { + struct none_such; + template + using none_such_t = none_such; + + template + extern const none_such_t _getter_for; + + template + using _decay_t = decltype(auto(declval())); + + static_assert(__is_same_as(_decay_t, void)); + } + + template + using _result_of_t = decltype(Fn(declval()...)); + + template + using tuple_element_t = _result_of_t>, char(*)[I+1], Tuple>; + + template + struct pair { + First first; + Second second; + }; + + template + inline constexpr bool _is_pair = false; + + template + inline constexpr bool _is_pair> = true; + + template + concept Pair = _is_pair()))>; + + template + requires (I <= 1) + decltype(auto) get(P&& p) noexcept { + if constexpr (I == 0) { + return (static_cast(p).first); + } else { + return (static_cast(p).second); + } + } + + namespace detail { + inline constexpr auto _pair_getter = + [](char(*)[J], Pair&& p) noexcept -> decltype(auto) { + return std::get(static_cast(p)); + }; + + template + inline constexpr auto _getter_for> = _pair_getter; + } + +} + +static_assert(__is_same_as(int&, std::tuple_element_t<0, std::pair&>)); +static_assert(__is_same_as(float&&, std::tuple_element_t<1, std::pair&&>)); diff --git a/gcc/testsuite/g++.dg/cpp23/explicit-obj-conv-op.C b/gcc/testsuite/g++.dg/cpp23/explicit-obj-conv-op.C new file mode 100644 index 000000000000..a6ae4ea1dda5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp23/explicit-obj-conv-op.C @@ -0,0 +1,49 @@ +// PR c++/113629 +// { dg-do compile { target c++23 } } + +template constexpr bool is_lvalue = false; +template constexpr bool is_lvalue = true; + +struct A { + constexpr operator bool(this auto&& self) { + return is_lvalue; + } +}; + +constexpr A a; +static_assert(static_cast(a)); +static_assert((bool)a); +static_assert(!static_cast(A{})); +static_assert(!(bool)A{}); + +struct B : A {}; + +constexpr B b; +static_assert(static_cast(b)); +static_assert((bool)b); +static_assert(!static_cast(B{})); +static_assert(!(bool)B{}); + +struct C { + template + explicit constexpr operator R(this T&&) { + return is_lvalue; + } +}; + +constexpr C c; +static_assert(static_cast(c)); +static_assert((bool)c); +static_assert(!static_cast(C{})); +static_assert(!(bool)C{}); + +struct D { + explicit constexpr operator bool(this const D&) { return true; } + explicit constexpr operator bool(this const D&&) { return false; } +}; + +constexpr D d; +static_assert(static_cast(d)); +static_assert((bool)d); +static_assert(!static_cast(D{})); +static_assert(!(bool)D{}); diff --git a/gcc/testsuite/g++.dg/cpp23/explicit-obj-diagnostics3.C b/gcc/testsuite/g++.dg/cpp23/explicit-obj-diagnostics3.C index 304cf029f8f0..f6a892eb0691 100644 --- a/gcc/testsuite/g++.dg/cpp23/explicit-obj-diagnostics3.C +++ b/gcc/testsuite/g++.dg/cpp23/explicit-obj-diagnostics3.C @@ -24,101 +24,140 @@ void S::f12(this S s = {}) {} // { dg-error "an explicit object parameter may no struct S0 { template - void f(this Selves...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } + void f(this Selves...) {} template void g(this Selves... selves) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } + // { dg-error "contains no parameter packs" "" { target *-*-* } .-1 } void h(this auto...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } void j(this auto... selves) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } + template + void k(this Selves...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } + template - void fd(this Selves...); // { dg-error "an explicit object parameter cannot be a function parameter pack" } + void fd(this Selves...); template void gd(this Selves... selves); // { dg-error "an explicit object parameter cannot be a function parameter pack" } + // { dg-error "contains no parameter packs" "" { target *-*-* } .-1 } void hd(this auto...); // { dg-error "an explicit object parameter cannot be a function parameter pack" } void jd(this auto... selves); // { dg-error "an explicit object parameter cannot be a function parameter pack" } + + template + void kd(this Selves...); // { dg-error "an explicit object parameter cannot be a function parameter pack" } }; struct S1 { template - void f(this Selves&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } + void f(this Selves&...) {} template void g(this Selves&... selves) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } + // { dg-error "contains no parameter packs" "" { target *-*-* } .-1 } void h(this auto&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } void j(this auto&... selves) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } + template + void k(this Selves&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } + template - void fd(this Selves&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" } + void fd(this Selves&...); template void gd(this Selves&... selves); // { dg-error "an explicit object parameter cannot be a function parameter pack" } + // { dg-error "contains no parameter packs" "" { target *-*-* } .-1 } void hd(this auto&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" } void jd(this auto&... selves); // { dg-error "an explicit object parameter cannot be a function parameter pack" } + + template + void kd(this Selves&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" } }; struct S2 { template - void f(this Selves&&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } + void f(this Selves&&...) {} template void g(this Selves&&... selves) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } + // { dg-error "contains no parameter packs" "" { target *-*-* } .-1 } void h(this auto&&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } void j(this auto&&... selves) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } + template + void k(this Selves&&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } + template - void fd(this Selves&&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" } + void fd(this Selves&&...); template void gd(this Selves&&... selves); // { dg-error "an explicit object parameter cannot be a function parameter pack" } + // { dg-error "contains no parameter packs" "" { target *-*-* } .-1 } void hd(this auto&&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" } void jd(this auto&&... selves); // { dg-error "an explicit object parameter cannot be a function parameter pack" } + + template + void kd(this Selves&&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" } }; struct S3 { template - void f(this Selves const&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } + void f(this Selves const&...) {} template void g(this Selves const&... selves) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } + // { dg-error "contains no parameter packs" "" { target *-*-* } .-1 } void h(this auto const&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } void j(this auto const&... selves) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } + template + void k(this Selves const&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } + template - void fd(this Selves const&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" } + void fd(this Selves const&...); template void gd(this Selves const&... selves); // { dg-error "an explicit object parameter cannot be a function parameter pack" } + // { dg-error "contains no parameter packs" "" { target *-*-* } .-1 } void hd(this auto const&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" } void jd(this auto const&... selves); // { dg-error "an explicit object parameter cannot be a function parameter pack" } + + template + void kd(this Selves const&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" } }; struct S4 { template - void f(this Selves const&&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } + void f(this Selves const&&...) {} template void g(this Selves const&&... selves) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } + // { dg-error "contains no parameter packs" "" { target *-*-* } .-1 } void h(this auto const&&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } void j(this auto const&&... selves) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } + template + void k(this Selves const&&...) {} // { dg-error "an explicit object parameter cannot be a function parameter pack" } + template - void fd(this Selves const&&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" } + void fd(this Selves const&&...); template void gd(this Selves const&&... selves); // { dg-error "an explicit object parameter cannot be a function parameter pack" } + // { dg-error "contains no parameter packs" "" { target *-*-* } .-1 } void hd(this auto const&&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" } void jd(this auto const&&... selves); // { dg-error "an explicit object parameter cannot be a function parameter pack" } -}; + template + void kd(this Selves const&&...); // { dg-error "an explicit object parameter cannot be a function parameter pack" } +}; diff --git a/gcc/testsuite/g++.dg/ext/atomic-5.C b/gcc/testsuite/g++.dg/ext/atomic-5.C new file mode 100644 index 000000000000..fa9cda8c0097 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/atomic-5.C @@ -0,0 +1,42 @@ +// { dg-do compile { target c++14 } } + +template +void +foo (long double *ptr, long double *val, long double *ret) +{ + __atomic_exchange (ptr, val, ret, __ATOMIC_RELAXED); +} + +template +bool +bar (long double *ptr, long double *exp, long double *des) +{ + return __atomic_compare_exchange (ptr, exp, des, false, + __ATOMIC_RELAXED, __ATOMIC_RELAXED); +} + +bool +baz (long double *p, long double *q, long double *r) +{ + foo<0> (p, q, r); + foo<1> (p + 1, q + 1, r + 1); + return bar<0> (p + 2, q + 2, r + 2) || bar<1> (p + 3, q + 3, r + 3); +} + +constexpr int +qux (long double *ptr, long double *val, long double *ret) +{ + __atomic_exchange (ptr, val, ret, __ATOMIC_RELAXED); + return 0; +} + +constexpr bool +corge (long double *ptr, long double *exp, long double *des) +{ + return __atomic_compare_exchange (ptr, exp, des, false, + __ATOMIC_RELAXED, __ATOMIC_RELAXED); +} + +long double a[6]; +const int b = qux (a, a + 1, a + 2); +const bool c = corge (a + 3, a + 4, a + 5); diff --git a/gcc/testsuite/g++.dg/ext/attr-no-dangling1.C b/gcc/testsuite/g++.dg/ext/attr-no-dangling1.C new file mode 100644 index 000000000000..dff34e894360 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attr-no-dangling1.C @@ -0,0 +1,40 @@ +// { dg-do compile { target c++11 } } +// { dg-options "-Wdangling-reference" } + +int g = 42; + +struct [[gnu::no_dangling]] A { + ~A(); + int *i; + int &foo() { return *i; } +}; + +struct A2 { + ~A2(); + int *i; + [[gnu::no_dangling]] int &foo() { return *i; } + [[gnu::no_dangling]] static int &bar (const int &) { return *&g; } +}; + +union [[gnu::no_dangling]] U { }; + +A a() { return A{&g}; } +A2 a2() { return A2{&g}; } + +class X { }; +const X x1; +const X x2; + +[[gnu::no_dangling]] const X& get(const int& i) +{ + return i == 0 ? x1 : x2; +} + +void +test () +{ + [[maybe_unused]] const X& x = get (10); // { dg-bogus "dangling" } + [[maybe_unused]] const int &i = a().foo(); // { dg-bogus "dangling" } + [[maybe_unused]] const int &j = a2().foo(); // { dg-bogus "dangling" } + [[maybe_unused]] const int &k = a2().bar(10); // { dg-bogus "dangling" } +} diff --git a/gcc/testsuite/g++.dg/ext/attr-no-dangling2.C b/gcc/testsuite/g++.dg/ext/attr-no-dangling2.C new file mode 100644 index 000000000000..4cdc97ea7c4e --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attr-no-dangling2.C @@ -0,0 +1,29 @@ +// { dg-do compile { target c++11 } } +// Negative tests. + +struct [[no_dangling]] A { // { dg-warning "ignored" } + [[no_dangling]] int &foo (int &); // { dg-warning "ignored" } +}; + +[[no_dangling]] int &bar (int &); // { dg-warning "ignored" } + +[[gnu::no_dangling]] int i; // { dg-warning "ignored" } +[[gnu::no_dangling]] double d; // { dg-warning "ignored" } +[[gnu::no_dangling]] typedef int T; // { dg-warning "ignored" } + +[[gnu::no_dangling()]] int &fn1 (int &); // { dg-error "parentheses" } +[[gnu::no_dangling("a")]] int &fn2 (int &); // { dg-error "must be an expression" } +[[gnu::no_dangling(true, true)]] int &fn3 (int &); // { dg-error "wrong number of arguments" } + +enum [[gnu::no_dangling]] E { // { dg-warning "ignored" } + X [[gnu::no_dangling]] // { dg-warning "ignored" } +}; + +[[gnu::no_dangling]]; // { dg-warning "ignored" } + +void +g () +{ + goto L; +[[gnu::no_dangling]] L:; // { dg-warning "ignored" } +} diff --git a/gcc/testsuite/g++.dg/ext/attr-no-dangling3.C b/gcc/testsuite/g++.dg/ext/attr-no-dangling3.C new file mode 100644 index 000000000000..764b104fd3c1 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attr-no-dangling3.C @@ -0,0 +1,24 @@ +// { dg-do compile { target c++11 } } +// { dg-options "-Wdangling-reference" } + +template +struct [[gnu::no_dangling]] Span { + T* data_; + int len_; + // So that our heuristic doesn't suppress the warning anyway. + ~Span(); + + [[nodiscard]] constexpr auto operator[](int n) const noexcept -> T& { return data_[n]; } + [[nodiscard]] constexpr auto front() const noexcept -> T& { return data_[0]; } + [[nodiscard]] constexpr auto back() const noexcept -> T& { return data_[len_ - 1]; } +}; + +auto get() -> Span; + +auto f() -> int { + int const& a = get().front(); // { dg-bogus "dangling" } + int const& b = get().back(); // { dg-bogus "dangling" } + int const& c = get()[0]; // { dg-bogus "dangling" } + + return a + b + c; +} diff --git a/gcc/testsuite/g++.dg/ext/attr-no-dangling4.C b/gcc/testsuite/g++.dg/ext/attr-no-dangling4.C new file mode 100644 index 000000000000..e910723d9852 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attr-no-dangling4.C @@ -0,0 +1,14 @@ +// { dg-do compile { target c++11 } } + +#if !__has_attribute(no_dangling) +#error unsupported +#endif + +#ifdef __has_cpp_attribute +# if !__has_cpp_attribute(no_dangling) +# error no_dangling +# endif +#endif + +struct [[gnu::no_dangling]] S { }; +static_assert (__builtin_has_attribute (S, no_dangling), ""); diff --git a/gcc/testsuite/g++.dg/ext/attr-no-dangling5.C b/gcc/testsuite/g++.dg/ext/attr-no-dangling5.C new file mode 100644 index 000000000000..ec5075482c45 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attr-no-dangling5.C @@ -0,0 +1,31 @@ +// PR c++/110358 +// { dg-do compile { target c++20 } } +// { dg-options "-Wdangling-reference" } + +template +struct Span { + T* data_; + int len_; + ~Span(); + + [[nodiscard]] constexpr auto operator[](int n) const noexcept -> T& { return data_[n]; } +}; + +template <> +struct [[gnu::no_dangling]] Span { + int* data_; + int len_; + ~Span(); + + [[nodiscard]] constexpr auto operator[](int n) const noexcept -> int& { return data_[n]; } +}; + +auto getch() -> Span; +auto geti() -> Span; + +void +f () +{ + [[maybe_unused]] const auto &a = getch()[0]; // { dg-warning "dangling reference" } + [[maybe_unused]] const auto &b = geti()[0]; // { dg-bogus "dangling reference" } +} diff --git a/gcc/testsuite/g++.dg/ext/attr-no-dangling6.C b/gcc/testsuite/g++.dg/ext/attr-no-dangling6.C new file mode 100644 index 000000000000..235a5fd86c55 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attr-no-dangling6.C @@ -0,0 +1,65 @@ +// PR c++/110358 +// { dg-do compile { target c++20 } } +// { dg-options "-Wdangling-reference" } + +class X { }; +const X x1; +const X x2; + +constexpr bool val () { return true; } +struct ST { static constexpr bool value = true; }; +struct SF { static constexpr bool value = false; }; + +template +[[gnu::no_dangling(T::value)]] +const X& get (const int& i) +{ + return i == 0 ? x1 : x2; +} + +template +[[gnu::no_dangling(B)]] +const X& foo (const int& i) +{ + return i == 0 ? x1 : x2; +} + +[[gnu::no_dangling(val ())]] +const X& bar (const int& i) +{ + return i == 0 ? x1 : x2; +} + +[[gnu::no_dangling(!val ())]] +const X& baz (const int& i) +{ + return i == 0 ? x1 : x2; +} + +template +struct [[gnu::no_dangling(T::value)]] +Span { + T* data_; + int len_; + ~Span(); + + [[nodiscard]] constexpr auto operator[](int n) const noexcept -> T& { return data_[n]; } +}; + +auto geti() -> Span; +auto gety() -> Span; + +void +test () +{ + [[maybe_unused]] const X& x1 = get (10); // { dg-bogus "dangling" } + [[maybe_unused]] const X& x2 = get (10); // { dg-warning "dangling" } + [[maybe_unused]] const X& x3 = foo (10); // { dg-bogus "dangling" } + [[maybe_unused]] const X& x4 = foo (10); // { dg-warning "dangling" } + [[maybe_unused]] const X& x7 = foo<> (10); // { dg-bogus "dangling" } + [[maybe_unused]] const X& x5 = bar (10); // { dg-bogus "dangling" } + [[maybe_unused]] const X& x6 = baz (10); // { dg-warning "dangling" } + + [[maybe_unused]] const auto &b1 = geti()[0]; // { dg-bogus "dangling" } + [[maybe_unused]] const auto &b2 = gety()[0]; // { dg-warning "dangling" } +} diff --git a/gcc/testsuite/g++.dg/ext/attr-no-dangling7.C b/gcc/testsuite/g++.dg/ext/attr-no-dangling7.C new file mode 100644 index 000000000000..3c392ed409f8 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attr-no-dangling7.C @@ -0,0 +1,31 @@ +// PR c++/110358 +// { dg-do compile { target c++20 } } +// { dg-options "-Wdangling-reference" } + +class X { }; +const X x1; +const X x2; + +template +[[gnu::no_dangling(N)]] const X& get(const int& i); // { dg-error "parameter packs not expanded" } + +template +[[gnu::no_dangling(T::x)]] // { dg-error "member" } +const X& foo(const int& i); + +bool val () { return true; } + +[[gnu::no_dangling(val ())]] // { dg-error "call" } +const X& bar (const int& i); + +[[gnu::no_dangling(20)]] const X& fn1 (const int &); + +void +test () +{ + [[maybe_unused]] const X& x1 = bar (10); // { dg-warning "dangling" } + [[maybe_unused]] const X& x2 = foo (10); // { dg-error "no matching" } + [[maybe_unused]] const X& x3 // { dg-warning "dangling" } + = fn1 (10); // { dg-error "narrowing" } +} + diff --git a/gcc/testsuite/g++.dg/ext/attr-no-dangling8.C b/gcc/testsuite/g++.dg/ext/attr-no-dangling8.C new file mode 100644 index 000000000000..8208d751a4bb --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attr-no-dangling8.C @@ -0,0 +1,30 @@ +// PR c++/110358 +// { dg-do compile { target c++20 } } +// { dg-options "-Wdangling-reference" } + +template constexpr bool is_reference_v = false; +template constexpr bool is_reference_v = true; +template constexpr bool is_reference_v = true; + +template +struct [[gnu::no_dangling(is_reference_v)]] S { + int &foo (const int &); +}; + +template +struct X { + template + struct [[gnu::no_dangling(is_reference_v && is_reference_v)]] Y { + int &foo (const int &); + }; +}; + +void +g () +{ + [[maybe_unused]] const int &x0 = S().foo (42); // { dg-bogus "dangling" } + [[maybe_unused]] const int &x1 = S().foo (42); // { dg-warning "dangling" } + [[maybe_unused]] const auto &x2 = X::Y<>().foo (42); // { dg-warning "dangling" } + [[maybe_unused]] const auto &x3 = X::Y<>().foo (42); // { dg-bogus "dangling" } +} + diff --git a/gcc/testsuite/g++.dg/ext/attr-no-dangling9.C b/gcc/testsuite/g++.dg/ext/attr-no-dangling9.C new file mode 100644 index 000000000000..65b4f7145a92 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attr-no-dangling9.C @@ -0,0 +1,25 @@ +// PR c++/110358 +// { dg-do compile { target c++20 } } +// { dg-options "-Wdangling-reference" } + +template +struct bool_constant { + static constexpr bool value = B; + constexpr operator bool() const { return value; } +}; + +using true_type = bool_constant; +using false_type = bool_constant; + +struct S { + template + [[gnu::no_dangling(B)]] int &foo (const int &); +}; + +void +g () +{ + [[maybe_unused]] const int &x0 = S().foo (42); // { dg-warning "dangling" } + [[maybe_unused]] const int &x1 = S().foo (42); // { dg-bogus "dangling" } +} + diff --git a/gcc/testsuite/g++.dg/gomp/target-lambda-1.C b/gcc/testsuite/g++.dg/gomp/target-lambda-1.C deleted file mode 100644 index 5ce8ceadb194..000000000000 --- a/gcc/testsuite/g++.dg/gomp/target-lambda-1.C +++ /dev/null @@ -1,94 +0,0 @@ -// We use 'auto' without a function return type, so specify dialect here -// { dg-additional-options "-std=c++14 -fdump-tree-gimple" } -#include -#include - -template -void -omp_target_loop (int begin, int end, L loop) -{ - #pragma omp target teams distribute parallel for - for (int i = begin; i < end; i++) - loop (i); -} - -struct S -{ - int a, len; - int *ptr; - - auto merge_data_func (int *iptr, int &b) - { - auto fn = [=](void) -> bool - { - bool mapped; - #pragma omp target map(from:mapped) - { - mapped = (ptr != NULL && iptr != NULL); - if (mapped) - { - for (int i = 0; i < len; i++) - ptr[i] += a + b + iptr[i]; - } - } - return mapped; - }; - return fn; - } -}; - -int x = 1; - -int main (void) -{ - const int N = 10; - int *data1 = new int[N]; - int *data2 = new int[N]; - memset (data1, 0xab, sizeof (int) * N); - memset (data1, 0xcd, sizeof (int) * N); - - int val = 1; - int &valref = val; - #pragma omp target enter data map(alloc: data1[:N], data2[:N]) - - omp_target_loop (0, N, [=](int i) { data1[i] = val; }); - omp_target_loop (0, N, [=](int i) { data2[i] = valref + 1; }); - - #pragma omp target update from(data1[:N], data2[:N]) - - for (int i = 0; i < N; i++) - { - if (data1[i] != 1) abort (); - if (data2[i] != 2) abort (); - } - - #pragma omp target exit data map(delete: data1[:N], data2[:N]) - - int b = 8; - S s = { 4, N, data1 }; - auto f = s.merge_data_func (data2, b); - - if (f ()) abort (); - - #pragma omp target enter data map(to: data1[:N]) - if (f ()) abort (); - - #pragma omp target enter data map(to: data2[:N]) - if (!f ()) abort (); - - #pragma omp target exit data map(from: data1[:N], data2[:N]) - - for (int i = 0; i < N; i++) - { - if (data1[i] != 0xf) abort (); - if (data2[i] != 2) abort (); - } - - return 0; -} - -/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* firstprivate\(b\) map\(alloc:MEM.* \[len: 0\]\) map\(firstprivate:iptr \[pointer assign, bias: 0\]\) map\(alloc:MEM.* \[len: 0\]\) map\(firstprivate:this \[pointer assign, bias: 0\]\) map\(to:\*__closure \[len: [0-9]+\]\) map\(firstprivate:__closure \[pointer assign, bias: 0\]\) map\(tofrom:\*_[0-9]+ \[len: [0-9]+\]\) map\(always_pointer:__closure->__this \[pointer assign, bias: 0\]\) map\(from:mapped \[len: [0-9]+\]\) map\(alloc:\*_[0-9]+ \[len: 0\]\) map\(alloc:\*_[0-9]+ \[len: 0\]\) map\(attach_zero_length_array_section:__closure->__iptr \[bias: 0\]\) map\(attach_zero_length_array_section:_[0-9]+->ptr \[bias: 0\]\)} "gimple" } } */ - -/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* firstprivate\(end\) firstprivate\(begin\) map\(to:loop \[len: [0-9]+\]\) map\(alloc:\*_[0-9]+ \[len: 0\]\) map\(attach_zero_length_array_section:loop\.__data1 \[bias: 0\]\)} "gimple" } } */ - -/* { dg-final { scan-tree-dump {#pragma omp target num_teams.* firstprivate\(end\) firstprivate\(begin\) map\(to:loop \[len: [0-9]+\]\) map\(alloc:\*_[0-9]+ \[len: 0\]\) map\(attach_zero_length_array_section:loop\.__data2 \[bias: 0\]\)} "gimple" } } */ diff --git a/gcc/testsuite/g++.dg/ipa/pr113757.C b/gcc/testsuite/g++.dg/ipa/pr113757.C new file mode 100644 index 000000000000..885d4010a100 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr113757.C @@ -0,0 +1,14 @@ +// { dg-do compile } +// { dg-options "-O2 -fPIC" } +// { dg-require-effective-target fpic } + +long size(); +struct ll { virtual int hh(); }; +ll *slice_owner; +int ll::hh() { __builtin_exit(0); } +int nn() { + if (size()) + return 0; + return slice_owner->hh(); +} +int (*a)() = nn; diff --git a/gcc/testsuite/g++.dg/modules/cexpr-4_a.C b/gcc/testsuite/g++.dg/modules/cexpr-4_a.C new file mode 100644 index 000000000000..44eea35a09f2 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/cexpr-4_a.C @@ -0,0 +1,10 @@ +// { dg-additional-options "-fmodules-ts" } +export module Cexpr4; +// { dg-module-cmi "Cexpr4" } + +struct A { int m = 42; }; + +constexpr A a; + +export +inline int f() { return a.m; } diff --git a/gcc/testsuite/g++.dg/modules/cexpr-4_b.C b/gcc/testsuite/g++.dg/modules/cexpr-4_b.C new file mode 100644 index 000000000000..8ead58e4ddbf --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/cexpr-4_b.C @@ -0,0 +1,6 @@ +// { dg-additional-options "-fmodules-ts" } +import Cexpr4; + +int v = f(); + +struct B { }; diff --git a/gcc/testsuite/g++.dg/modules/enum-13_a.C b/gcc/testsuite/g++.dg/modules/enum-13_a.C new file mode 100644 index 000000000000..1d0c86d939ab --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/enum-13_a.C @@ -0,0 +1,23 @@ +// PR c++/104919 +// PR c++/106009 +// { dg-additional-options -fmodules-ts } +// { dg-module-cmi Enum13 } + +export module Enum13; + +export +constexpr int f() { + enum E { e = 42 }; + return e; +} + +template +constexpr int ft(T) { + enum E { e = 43 }; + return e; +} + +export +constexpr int g() { + return ft(0); +} diff --git a/gcc/testsuite/g++.dg/modules/enum-13_b.C b/gcc/testsuite/g++.dg/modules/enum-13_b.C new file mode 100644 index 000000000000..16d4a7c8ac58 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/enum-13_b.C @@ -0,0 +1,8 @@ +// PR c++/104919 +// PR c++/106009 +// { dg-additional-options -fmodules-ts } + +import Enum13; + +static_assert(f() == 42); +static_assert(g() == 43); diff --git a/gcc/testsuite/g++.dg/modules/friend-6_a.C b/gcc/testsuite/g++.dg/modules/friend-6_a.C index 7493e8f262fc..13f771088d0a 100644 --- a/gcc/testsuite/g++.dg/modules/friend-6_a.C +++ b/gcc/testsuite/g++.dg/modules/friend-6_a.C @@ -1,11 +1,9 @@ -// { dg-additional-options "-fmodules-ts -Wno-pedantic" } +// { dg-additional-options "-fmodules-ts -Wno-global-module" } // { dg-module-cmi friend_6 } module; -# 1 "" 1 template struct Trans_NS___cxx11_basic_string { template friend class basic_stringbuf; }; template struct Trans_NS___cxx11_basic_string; -# 6 "" 2 export module friend_6; diff --git a/gcc/testsuite/g++.dg/modules/friend-7.h b/gcc/testsuite/g++.dg/modules/friend-7.h new file mode 100644 index 000000000000..c0f00394f3bb --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/friend-7.h @@ -0,0 +1,5 @@ +template +struct A { + template struct B { }; + template friend struct B; +}; diff --git a/gcc/testsuite/g++.dg/modules/friend-7_a.H b/gcc/testsuite/g++.dg/modules/friend-7_a.H new file mode 100644 index 000000000000..e750e4c7d8d8 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/friend-7_a.H @@ -0,0 +1,3 @@ +// { dg-additional-options "-fmodule-header" } +// { dg-module-cmi {} } +#include "friend-7.h" diff --git a/gcc/testsuite/g++.dg/modules/friend-7_b.C b/gcc/testsuite/g++.dg/modules/friend-7_b.C new file mode 100644 index 000000000000..eb5e45a3f431 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/friend-7_b.C @@ -0,0 +1,6 @@ +// { dg-additional-options "-fmodules-ts" } +#include "friend-7.h" +import "friend-7_a.H"; + +A a; +A::B b; diff --git a/gcc/testsuite/g++.dg/modules/hello-2_a.C b/gcc/testsuite/g++.dg/modules/hello-2_a.C new file mode 100644 index 000000000000..a8f8b813839f --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/hello-2_a.C @@ -0,0 +1,11 @@ +// PR c++/105512 +// { dg-additional-options -fmodules-ts } +// { dg-module-cmi Hello2 } + +module; +#include +export module Hello2; + +export std::string tester() { + return "hello world\n"; +} diff --git a/gcc/testsuite/g++.dg/modules/hello-2_b.C b/gcc/testsuite/g++.dg/modules/hello-2_b.C new file mode 100644 index 000000000000..dafd3c2f7a1b --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/hello-2_b.C @@ -0,0 +1,10 @@ +// PR c++/105512 +// { dg-additional-options -fmodules-ts } +// { dg-module-do run } + +#include +import Hello2; + +int main() { + std::cout << tester(); +} diff --git a/gcc/testsuite/g++.dg/modules/lambda-7.h b/gcc/testsuite/g++.dg/modules/lambda-7.h new file mode 100644 index 000000000000..6f6080c13240 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/lambda-7.h @@ -0,0 +1,42 @@ +struct S { + int (*a)(int) = [](int x) { return x * 2; }; + + int b(int x, int (*f)(int) = [](int x) { return x * 3; }) { + return f(x); + } + + static int c(int x, int (*f)(int) = [](int x) { return x * 4; }) { + return f(x); + } +}; + +inline int d(int x, int (*f)(int) = [](int x) { return x * 5; }) { + return f(x); +} + +// unevaluated lambdas +#if __cplusplus >= 202002L +struct E : decltype([](int x) { return x * 6; }) { + decltype([](int x) { return x * 7; }) f; +}; + +template +struct G : decltype([](int x) { return x * 8; }) { + decltype([](int x) { return x * 9; }) h; +}; + +template <> +struct G : decltype([](int x) { return x * 10; }) { + decltype([](int x) { return x * 11; }) i; +}; +#endif + +// concepts +#if __cpp_concepts >= 201907L +template +concept J = requires { []{ T(); }; }; + +template +concept K = []{ return sizeof(T) == 1; }(); +#endif + diff --git a/gcc/testsuite/g++.dg/modules/lambda-7_a.H b/gcc/testsuite/g++.dg/modules/lambda-7_a.H new file mode 100644 index 000000000000..5197114f76ca --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/lambda-7_a.H @@ -0,0 +1,4 @@ +// { dg-additional-options "-fmodule-header -Wno-subobject-linkage" } +// { dg-module-cmi {} } + +#include "lambda-7.h" diff --git a/gcc/testsuite/g++.dg/modules/lambda-7_b.C b/gcc/testsuite/g++.dg/modules/lambda-7_b.C new file mode 100644 index 000000000000..2d781e930678 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/lambda-7_b.C @@ -0,0 +1,5 @@ +// { dg-additional-options "-fmodules-ts -fno-module-lazy -Wno-subobject-linkage" } +// Test for ODR deduplication + +#include "lambda-7.h" +import "lambda-7_a.H"; diff --git a/gcc/testsuite/g++.dg/modules/lambda-7_c.C b/gcc/testsuite/g++.dg/modules/lambda-7_c.C new file mode 100644 index 000000000000..f283681fa96c --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/lambda-7_c.C @@ -0,0 +1,41 @@ +// { dg-module-do run } +// { dg-additional-options "-fmodules-ts -fno-module-lazy -Wno-subobject-linkage" } + +import "lambda-7_a.H"; + +int main() { + S s; + if (s.a(10) != 20) + __builtin_abort(); + if (s.b(10) != 30) + __builtin_abort(); + if (s.c(10) != 40) + __builtin_abort(); + if (d(10) != 50) + __builtin_abort(); + +#if __cplusplus >= 202002L + E e; + if (e(10) != 60) + __builtin_abort(); + if (e.f(10) != 70) + __builtin_abort(); + + G g1; + if (g1(10) != 80) + __builtin_abort(); + if (g1.h(10) != 90) + __builtin_abort(); + + G g2; + if (g2(10) != 100) + __builtin_abort(); + if (g2.i(10) != 110) + __builtin_abort(); +#endif + +#if __cpp_concepts >= 201907L + static_assert(J); + static_assert(K); +#endif +} diff --git a/gcc/testsuite/g++.dg/modules/namespace-6_a.H b/gcc/testsuite/g++.dg/modules/namespace-6_a.H new file mode 100644 index 000000000000..b412cbe6cbfe --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/namespace-6_a.H @@ -0,0 +1,10 @@ +// PR c++/110730 +// { dg-additional-options -fmodule-header } +// { dg-module-cmi {} } + +namespace std::filesystem { + inline namespace __cxx11 __attribute__((__abi_tag__("cxx11", "foo"))) { + struct path { }; + } + inline path current_path() { return {}; }; +} diff --git a/gcc/testsuite/g++.dg/modules/namespace-6_b.C b/gcc/testsuite/g++.dg/modules/namespace-6_b.C new file mode 100644 index 000000000000..2ce41c7c9c7c --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/namespace-6_b.C @@ -0,0 +1,7 @@ +// PR c++/110730 +// { dg-additional-options -fmodules-ts } + +import "namespace-6_a.H"; + +int main() { std::filesystem::current_path(); } +// { dg-final { scan-assembler _ZNSt10filesystem12current_pathB5cxx11B3fooEv } } diff --git a/gcc/testsuite/g++.dg/modules/pr114005_a.C b/gcc/testsuite/g++.dg/modules/pr114005_a.C new file mode 100644 index 000000000000..404683484eca --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr114005_a.C @@ -0,0 +1,8 @@ +// { dg-additional-options "-fmodules-ts" } +// { dg-module-cmi M } + +module; +#include + +export module M; +export constexpr std::initializer_list foo{ 1, 2, 3 }; diff --git a/gcc/testsuite/g++.dg/modules/pr114005_b.C b/gcc/testsuite/g++.dg/modules/pr114005_b.C new file mode 100644 index 000000000000..88317ce11f84 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr114005_b.C @@ -0,0 +1,7 @@ +// { dg-additional-options "-fmodules-ts" } + +import M; + +int main() { + return foo.size(); +} diff --git a/gcc/testsuite/g++.dg/modules/pr99425-1_b.H b/gcc/testsuite/g++.dg/modules/pr99425-1_b.H index 53d28b4ef5e9..e75b3129dd3e 100644 --- a/gcc/testsuite/g++.dg/modules/pr99425-1_b.H +++ b/gcc/testsuite/g++.dg/modules/pr99425-1_b.H @@ -15,5 +15,5 @@ inline void widget (Cont parm) ssize (parm); } -// { dg-final { scan-lang-dump {Read:-[0-9]*'s alias spec merge key \(new\) type_decl:'::make_signed_t'\n ... Read:-[0-9]*'s type spec merge key \(new\) type_decl:'::make_signed'\n Read:-[0-9]*'s named merge key \(matched\) template_decl:'::template ssize'} module } } +// { dg-final { scan-lang-dump {Read:-[0-9]*'s decl spec merge key \(new\) type_decl:'::make_signed_t'\n ... Read:-[0-9]*'s type spec merge key \(new\) type_decl:'::make_signed'\n Read:-[0-9]*'s named merge key \(matched\) template_decl:'::template ssize'} module } } diff --git a/gcc/testsuite/g++.dg/modules/tdef-7.h b/gcc/testsuite/g++.dg/modules/tdef-7.h index 5bc21e176cb4..6125f0460e29 100644 --- a/gcc/testsuite/g++.dg/modules/tdef-7.h +++ b/gcc/testsuite/g++.dg/modules/tdef-7.h @@ -1,7 +1,5 @@ constexpr void duration_cast () { - // the constexpr's body's clone merely duplicates the TYPE_DECL, it - // doesn't create a kosher typedef typedef int __to_rep; } diff --git a/gcc/testsuite/g++.dg/modules/tdef-7_b.C b/gcc/testsuite/g++.dg/modules/tdef-7_b.C index c526ca8dd4fb..ea76458715b7 100644 --- a/gcc/testsuite/g++.dg/modules/tdef-7_b.C +++ b/gcc/testsuite/g++.dg/modules/tdef-7_b.C @@ -5,5 +5,5 @@ import "tdef-7_a.H"; // { dg-final { scan-lang-dump-times {merge key \(matched\) function_decl:'::duration_cast} 1 module } } // { dg-final { scan-lang-dump-not {merge key \(new\)} module } } -// { dg-final { scan-lang-dump-times {merge key \(unique\) type_decl:'#null#'} 2 module } } +// { dg-final { scan-lang-dump-times {merge key \(unique\) type_decl:'#null#'} 1 module } } // { dg-final { scan-lang-dump-times {Cloned:-[0-9]* typedef integer_type:'::duration_cast::__to_rep'} 1 module } } diff --git a/gcc/testsuite/g++.dg/modules/tpl-alias-1_a.H b/gcc/testsuite/g++.dg/modules/tpl-alias-1_a.H index 37002ee9ae1b..14a25be586f2 100644 --- a/gcc/testsuite/g++.dg/modules/tpl-alias-1_a.H +++ b/gcc/testsuite/g++.dg/modules/tpl-alias-1_a.H @@ -6,4 +6,4 @@ // { dg-final { scan-lang-dump {Writing decl tmpl spec:-[0-9]* template_decl:'::allocator_traits<::allocator>::template rebind_alloc<_Up>'} module } } // { dg-final { scan-lang-dump {Writing decl tmpl spec:-[0-9]* type_decl:'::allocator_traits<::allocator>::template rebind_alloc<_Up>'} module } } -// { dg-final { scan-lang-dump {Writing:-[0-9]*'s alias spec merge key \(specialization\) type_decl:'::allocator_traits<::allocator>::rebind_alloc'} module } } +// { dg-final { scan-lang-dump {Writing:-[0-9]*'s decl spec merge key \(specialization\) type_decl:'::allocator_traits<::allocator>::rebind_alloc'} module } } diff --git a/gcc/testsuite/g++.dg/modules/tpl-alias-2_a.H b/gcc/testsuite/g++.dg/modules/tpl-alias-2_a.H new file mode 100644 index 000000000000..76917f778e0d --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/tpl-alias-2_a.H @@ -0,0 +1,15 @@ +// PR c++/103994 +// { dg-additional-options -fmodule-header } +// { dg-module-cmi {} } + +template +struct A { + template using key_arg = int; +}; + +struct B { + template + void f() { + using type = A::key_arg; + } +}; diff --git a/gcc/testsuite/g++.dg/modules/tpl-alias-2_b.C b/gcc/testsuite/g++.dg/modules/tpl-alias-2_b.C new file mode 100644 index 000000000000..44fa5f42757d --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/tpl-alias-2_b.C @@ -0,0 +1,9 @@ +// PR c++/103994 +// { dg-additional-options -fmodules-ts } + +import "tpl-alias-2_a.H"; + +int main() { + B b; + b.f(); +} diff --git a/gcc/testsuite/g++.dg/modules/tpl-tpl-parm-3.h b/gcc/testsuite/g++.dg/modules/tpl-tpl-parm-3.h new file mode 100644 index 000000000000..b0dcf353c239 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/tpl-tpl-parm-3.h @@ -0,0 +1,12 @@ +// PR c++/98881 + +template struct X {}; + +template