diff options
117 files changed, 1923 insertions, 428 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4800410..f857416 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,154 @@ +2025-02-13 Robin Dapp <rdapp.gcc@gmail.com> + + PR target/118832 + * config/riscv/riscv-v.cc (expand_const_vector): Expand as + vlmax insn during lra. + +2025-02-13 Marek Polacek <polacek@redhat.com> + + PR driver/117739 + * doc/invoke.texi: Tweak wording for -Whardened. + * gcc.cc (driver_handle_option): If -z lazy or -z norelro was + specified, don't enable linker hardening. + (process_command): Don't check warn_hardened. + +2025-02-13 Ed Catmur <ed@catmur.uk> + Jason Merrill <jason@redhat.com> + + PR c++/70536 + * dwarf2out.cc (gen_formal_parameter_pack_die): Add name attr. + +2025-02-13 Jakub Jelinek <jakub@redhat.com> + + PR debug/118790 + * gengtype.cc (write_roots): Remove cache variable, instead break from + the loop on match and test o for NULL. If the cache option has + non-empty string argument, call the specified function with v->name + as argument before calling gt_cleare_cache on it. + * tree.cc (gt_value_expr_mark_2, gt_value_expr_mark_1, + gt_value_expr_mark): New functions. + (value_expr_for_decl): Use GTY ((cache ("gt_value_expr_mark"))) rather + than just GTY ((cache)). + * doc/gty.texi (cache): Document optional argument of cache option. + +2025-02-13 Christophe Lyon <christophe.lyon@linaro.org> + + PR target/114522 + * config/arm/arm-builtins.cc (arm_fold_aes_op): New function. + (arm_general_gimple_fold_builtin): New function. + * config/arm/arm-builtins.h (arm_general_gimple_fold_builtin): New + prototype. + * config/arm/arm.cc (arm_gimple_fold_builtin): Call + arm_general_gimple_fold_builtin as needed. + +2025-02-13 Jakub Jelinek <jakub@redhat.com> + + PR c++/118822 + PR c++/118833 + * tree-iterator.h (tsi_split_stmt_list): Declare. + * tree-iterator.cc (tsi_split_stmt_list): New function. + +2025-02-13 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * configure.ac (gcc_cv_ld_eh_frame_ciev3): Remove. + * configure, config.in: Regenerate. + * config/sol2.cc (solaris_override_options): Remove. + * config/sol2.h (SUBTARGET_OVERRIDE_OPTIONS): Remove. + * config/sol2-protos.h (solaris_override_options): Remove. + +2025-02-13 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * doc/install.texi (Specific, *-*-solaris2*): Updates for newer + Solaris 11.4 SRUs and binutils 2.44. + +2025-02-13 Stefan Schulze Frielinghaus <stefansf@gcc.gnu.org> + + PR target/118835 + * config/s390/s390.cc (s390_valid_shift_count): Reject shift + count operands which do not trivially fit the scheme of + address operands. + +2025-02-13 Richard Biener <rguenther@suse.de> + + PR tree-optimization/118817 + * tree-ssa-sccvn.cc (vn_nary_simplify): Do not process + CONSTRUCTOR NARY or update from CONSTRUCTOR simplified + gimple_match_op. + +2025-02-12 Andrew Pinski <quic_apinski@quicinc.com> + + PR rtl-optimization/102150 + * loop-invariant.cc (find_invariant_insn): Treat inline-asm similar to + trapping instruction and only move them if always executed. + +2025-02-12 Andrew Pinski <quic_apinski@quicinc.com> + + PR rtl-optimization/102150 + * ifcvt.cc (cheap_bb_rtx_cost_p): Return false if the insn + has an inline-asm in it. + +2025-02-12 Georg-Johann Lay <avr@gjlay.de> + + * config/avr/avr.opt.urls: Add -mcall-main. + +2025-02-12 Georg-Johann Lay <avr@gjlay.de> + + PR target/118806 + * config/avr/avr.opt (-mcall-main): New option and... + (avropt_call_main): ...variable. + * config/avr/avr.cc (avr_no_call_main_p): New variable. + (avr_insert_attributes) [-mno-call-main, main]: Add attributes + noreturn and section(".init9") to main. Set avr_no_call_main_p. + (avr_file_end) [avr_no_call_main_p]: Define symbol __call_main. + * doc/invoke.texi (AVR Options) <-mno-call-main>: Document. + <-mnodevicelib>: Extend explanation. + +2025-02-12 Alex Coplan <alex.coplan@arm.com> + + PR tree-optimization/117790 + * tree-vect-loop-manip.cc (slpeel_tree_duplicate_loop_to_edge_cfg): + Set profile counts for {main,alt}_loop_exit_block. + +2025-02-12 Vineet Gupta <vineetg@rivosinc.com> + + * config/riscv/vector.md: vncvt substitute vnsrl. + vnsrl with x0 replace with immediate 0. + vneg substitute vrsub. + +2025-02-12 Jin Ma <jinma@linux.alibaba.com> + + PR target/118601 + * config/riscv/riscv-string.cc (expand_block_move): Check with new + constraint 'vl' instead of 'K'. + (expand_vec_setmem): Likewise. + (expand_vec_cmpmem): Likewise. + * config/riscv/riscv-v.cc (force_vector_length_operand): Likewise. + (expand_load_store): Likewise. + (expand_strided_load): Likewise. + (expand_strided_store): Likewise. + (expand_lanes_load_store): Likewise. + +2025-02-12 Sandra Loosemore <sloosemore@baylibre.com> + + * doc/install.texi: Add missing comma after @xref to fix warning. + +2025-02-12 Sandra Loosemore <sloosemore@baylibre.com> + + * doc/extend.texi: Fix a bunch of typos and other writing bugs. + * doc/invoke.texi: Likewise. + +2025-02-12 Sandra Loosemore <sloosemore@baylibre.com> + + * Makefile.in (TEXI_GCCINT_FILES): Remove interface.texi. + * doc/gccint.texi (Top): Remove menu entry for the "interface" node, + and include of interface.texi. + * doc/interface.texi: Delete. + +2025-02-12 Yangyu Chen <cyy@cyyself.name> + + * config/riscv/riscv-feature-bits.h (RISCV_VENDOR_FEATURE_BITS_LENGTH): Drop. + (struct riscv_vendor_feature_bits): Drop. + 2025-02-11 Jeff Law <jlaw@ventanamicro.com> PR target/115478 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 4bcf0fa..c2b6f8f 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20250212 +20250214 diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 8b035a6..fea2e37 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,13 @@ +2025-02-13 Jakub Jelinek <jakub@redhat.com> + + PR c++/118822 + PR c++/118833 + * c-common.h (WHILE_COND_CLEANUP): Change description in comment. + (FOR_COND_CLEANUP): Likewise. + * c-gimplify.cc (genericize_c_loop): Adjust for COND_CLEANUP + being CLEANUP_STMT/TRY_FINALLY_EXPR trailing nesting depth + instead of actual cleanup. + 2025-02-11 Jason Merrill <jason@redhat.com> PR c++/188574 diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index bc23843..ea6c297 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -1518,7 +1518,8 @@ extern tree build_userdef_literal (tree suffix_id, tree value, /* WHILE_STMT accessors. These give access to the condition of the while statement, the body, and name of the while statement, and - condition preparation statements and its cleanup, respectively. */ + condition preparation statements and number of its nested cleanups, + respectively. */ #define WHILE_COND(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 0) #define WHILE_BODY(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 1) #define WHILE_NAME(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 2) @@ -1533,7 +1534,8 @@ extern tree build_userdef_literal (tree suffix_id, tree value, /* FOR_STMT accessors. These give access to the init statement, condition, update expression, body and name of the for statement, - and condition preparation statements and its cleanup, respectively. */ + and condition preparation statements and number of its nested cleanups, + respectively. */ #define FOR_INIT_STMT(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 0) #define FOR_COND(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 1) #define FOR_EXPR(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 2) diff --git a/gcc/c-family/c-gimplify.cc b/gcc/c-family/c-gimplify.cc index d53e0c2..dc5e80d 100644 --- a/gcc/c-family/c-gimplify.cc +++ b/gcc/c-family/c-gimplify.cc @@ -258,8 +258,10 @@ expr_loc_or_loc (const_tree expr, location_t or_loc) for C++ for/while loops with variable declaration as condition. COND_PREP is a BIND_EXPR with the declaration and initialization of the condition variable, into which COND, BODY, continue label if needed and INCR if - non-NULL should be appended, and COND_CLEANUP are statements which should - be evaluated after that or if anything in COND, BODY or INCR throws. */ + non-NULL should be appended, and COND_CLEANUP is number of nested + CLEANUP_STMT -> TRY_FINALLY_EXPR statements at the end. If non-NULL, + COND, BODY, continue label if needed and INCR if non-NULL should be + appended to the body of the COND_CLEANUP's nested TRY_FINALLY_EXPR. */ static void genericize_c_loop (tree *stmt_p, location_t start_locus, tree cond, tree body, @@ -278,7 +280,6 @@ genericize_c_loop (tree *stmt_p, location_t start_locus, tree cond, tree body, walk_tree_1 (&cond_prep, func, data, NULL, lh); walk_tree_1 (&cond, func, data, NULL, lh); walk_tree_1 (&incr, func, data, NULL, lh); - walk_tree_1 (&cond_cleanup, func, data, NULL, lh); blab = begin_bc_block (bc_break, start_locus); clab = begin_bc_block (bc_continue, start_locus); @@ -309,36 +310,24 @@ genericize_c_loop (tree *stmt_p, location_t start_locus, tree cond, tree body, EXPR; goto top; - or - - try { - if (COND); else break; - BODY; - cont: - EXPR; - } finally { - COND_CLEANUP - } - - appended into COND_PREP body. */ + appended into COND_PREP body or body of some TRY_FINALLY_EXPRs + at the end of COND_PREP. */ gcc_assert (cond_is_first && TREE_CODE (cond_prep) == BIND_EXPR); tree top = build1 (LABEL_EXPR, void_type_node, create_artificial_label (start_locus)); exit = build1 (GOTO_EXPR, void_type_node, LABEL_EXPR_LABEL (top)); append_to_statement_list (top, &outer_stmt_list); append_to_statement_list (cond_prep, &outer_stmt_list); - stmt_list = BIND_EXPR_BODY (cond_prep); - BIND_EXPR_BODY (cond_prep) = NULL_TREE; stmt_list_p = &BIND_EXPR_BODY (cond_prep); - if (cond_cleanup && TREE_SIDE_EFFECTS (cond_cleanup)) - { - t = build2_loc (EXPR_LOCATION (cond_cleanup), TRY_FINALLY_EXPR, - void_type_node, NULL_TREE, cond_cleanup); - append_to_statement_list (t, &stmt_list); - *stmt_list_p = stmt_list; - stmt_list_p = &TREE_OPERAND (t, 0); - stmt_list = NULL_TREE; - } + if (cond_cleanup) + for (unsigned depth = tree_to_uhwi (cond_cleanup); depth; --depth) + { + t = tsi_stmt (tsi_last (*stmt_list_p)); + gcc_assert (TREE_CODE (t) == TRY_FINALLY_EXPR); + stmt_list_p = &TREE_OPERAND (t, 0); + } + stmt_list = *stmt_list_p; + *stmt_list_p = NULL_TREE; tree after_cond = create_artificial_label (cond_locus); tree goto_after_cond = build1 (GOTO_EXPR, void_type_node, after_cond); t = build1 (GOTO_EXPR, void_type_node, get_bc_label (bc_break)); diff --git a/gcc/config.in b/gcc/config.in index 3b06533..45ae9fb 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -1773,12 +1773,6 @@ #endif -/* Define 0/1 if your linker supports CIE v3 in .eh_frame. */ -#ifndef USED_FOR_TARGET -#undef HAVE_LD_EH_FRAME_CIEV3 -#endif - - /* Define if your linker supports .eh_frame_hdr. */ #undef HAVE_LD_EH_FRAME_HDR diff --git a/gcc/config/arm/arm-builtins.cc b/gcc/config/arm/arm-builtins.cc index e860607..c56ab5d 100644 --- a/gcc/config/arm/arm-builtins.cc +++ b/gcc/config/arm/arm-builtins.cc @@ -45,6 +45,9 @@ #include "arm-builtins.h" #include "stringpool.h" #include "attribs.h" +#include "basic-block.h" +#include "gimple.h" +#include "ssa.h" #define SIMD_MAX_BUILTIN_ARGS 7 @@ -4053,4 +4056,56 @@ arm_cde_end_args (tree fndecl) } } +/* Fold a call to vaeseq_u8 and vaesdq_u8. + That is `vaeseq_u8 (x ^ y, 0)` gets folded + into `vaeseq_u8 (x, y)`.*/ +static gimple * +arm_fold_aes_op (gcall *stmt) +{ + tree arg0 = gimple_call_arg (stmt, 0); + tree arg1 = gimple_call_arg (stmt, 1); + if (integer_zerop (arg0)) + arg0 = arg1; + else if (!integer_zerop (arg1)) + return nullptr; + if (TREE_CODE (arg0) != SSA_NAME) + return nullptr; + if (!has_single_use (arg0)) + return nullptr; + auto *s = dyn_cast<gassign *> (SSA_NAME_DEF_STMT (arg0)); + if (!s || gimple_assign_rhs_code (s) != BIT_XOR_EXPR) + return nullptr; + gimple_call_set_arg (stmt, 0, gimple_assign_rhs1 (s)); + gimple_call_set_arg (stmt, 1, gimple_assign_rhs2 (s)); + return stmt; +} + +/* Try to fold STMT, given that it's a call to the built-in function with + subcode FCODE. Return the new statement on success and null on + failure. */ +gimple * +arm_general_gimple_fold_builtin (unsigned int fcode, gcall *stmt) +{ + gimple *new_stmt = NULL; + + switch (fcode) + { + case ARM_BUILTIN_CRYPTO_AESE: + case ARM_BUILTIN_CRYPTO_AESD: + new_stmt = arm_fold_aes_op (stmt); + break; + } + + /* GIMPLE assign statements (unlike calls) require a non-null lhs. If we + created an assign statement with a null lhs, then fix this by assigning + to a new (and subsequently unused) variable. */ + if (new_stmt && is_gimple_assign (new_stmt) && !gimple_assign_lhs (new_stmt)) + { + tree new_lhs = make_ssa_name (gimple_call_return_type (stmt)); + gimple_assign_set_lhs (new_stmt, new_lhs); + } + + return new_stmt; +} + #include "gt-arm-builtins.h" diff --git a/gcc/config/arm/arm-builtins.h b/gcc/config/arm/arm-builtins.h index 1fa85b6..3a64661 100644 --- a/gcc/config/arm/arm-builtins.h +++ b/gcc/config/arm/arm-builtins.h @@ -32,6 +32,7 @@ enum resolver_ident { }; enum resolver_ident arm_describe_resolver (tree); unsigned arm_cde_end_args (tree); +gimple *arm_general_gimple_fold_builtin (unsigned int, gcall *); #define ENTRY(E, M, Q, S, T, G) E, enum arm_simd_type diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc index a95ddf8..00499a2 100644 --- a/gcc/config/arm/arm.cc +++ b/gcc/config/arm/arm.cc @@ -76,6 +76,7 @@ #include "aarch-common.h" #include "aarch-common-protos.h" #include "machmode.h" +#include "arm-builtins.h" /* This file should be included last. */ #include "target-def.h" @@ -2859,7 +2860,9 @@ arm_gimple_fold_builtin (gimple_stmt_iterator *gsi) switch (code & ARM_BUILTIN_CLASS) { case ARM_BUILTIN_GENERAL: + new_stmt = arm_general_gimple_fold_builtin (subcode, stmt); break; + case ARM_BUILTIN_MVE: new_stmt = arm_mve::gimple_fold_builtin (subcode, stmt); } diff --git a/gcc/config/avr/avr.cc b/gcc/config/avr/avr.cc index 9bfb378..bb00e33 100644 --- a/gcc/config/avr/avr.cc +++ b/gcc/config/avr/avr.cc @@ -230,6 +230,9 @@ bool avr_need_clear_bss_p = false; bool avr_need_copy_data_p = false; bool avr_has_rodata_p = false; +/* To track if we satisfy __call_main from AVR-LibC. */ +bool avr_no_call_main_p = false; + /* Counts how often pass avr-fuse-add has been executed. Is is kept in sync with cfun->machine->n_avr_fuse_add_executed and serves as an insn condition for shift insn splitters. */ @@ -11712,6 +11715,45 @@ avr_insert_attributes (tree node, tree *attributes) NULL, *attributes); } +#if defined WITH_AVRLIBC + if (avropt_call_main == 0 + && TREE_CODE (node) == FUNCTION_DECL + && MAIN_NAME_P (DECL_NAME (node))) + { + const char *s_section_name = nullptr; + + if (tree a_sec = lookup_attribute ("section", *attributes)) + if (TREE_VALUE (a_sec)) + if (tree t_section_name = TREE_VALUE (TREE_VALUE (a_sec))) + if (TREE_CODE (t_section_name) == STRING_CST) + s_section_name = TREE_STRING_POINTER (t_section_name); + + bool in_init9_p = s_section_name && !strcmp (s_section_name, ".init9"); + + if (s_section_name && !in_init9_p) + { + warning (OPT_Wattributes, "%<section(\"%s\")%> attribute on main" + " function inhibits %<-mno-call-main%>", s_section_name); + } + else + { + if (!lookup_attribute ("noreturn", *attributes)) + *attributes = tree_cons (get_identifier ("noreturn"), + NULL_TREE, *attributes); + // Put main into section .init9 so that it is executed even + // though it's not called. + if (!in_init9_p) + { + tree init9 = build_string (1 + strlen (".init9"), ".init9"); + tree arg = build_tree_list (NULL_TREE, init9); + *attributes = tree_cons (get_identifier ("section"), + arg, *attributes); + } + avr_no_call_main_p = true; + } + } // -mno-call-main +#endif // AVR-LibC + avr_handle_isr_attribute (node, attributes, "signal"); avr_handle_isr_attribute (node, attributes, "interrupt"); @@ -12311,6 +12353,15 @@ avr_file_end (void) if (avr_need_clear_bss_p) fputs (".global __do_clear_bss\n", asm_out_file); + + /* Don't let __call_main call main() and exit(). + Defining this symbol will keep the code from being pulled + in from lib<mcu>.a as requested by AVR-LibC's gcrt1.S. + We invoke main() by other means: putting it in .init9. */ + + if (avr_no_call_main_p) + fputs (".global __call_main\n" + "__call_main = 0\n", asm_out_file); } diff --git a/gcc/config/avr/avr.opt b/gcc/config/avr/avr.opt index 0184b40..d22a118 100644 --- a/gcc/config/avr/avr.opt +++ b/gcc/config/avr/avr.opt @@ -42,6 +42,10 @@ mn-flash= Target RejectNegative Joined Var(avropt_n_flash) UInteger Init(-1) This option is used internally. Set the number of 64 KiB flash segments. +mcall-main +Target Var(avropt_call_main) UInteger Init(1) +Call main and exit (default). + mskip-bug Target Mask(SKIP_BUG) This option is used internally. Indicate presence of a processor erratum. Do not skip 32-bit instructions. diff --git a/gcc/config/avr/avr.opt.urls b/gcc/config/avr/avr.opt.urls index 5470fe7..64cf060 100644 --- a/gcc/config/avr/avr.opt.urls +++ b/gcc/config/avr/avr.opt.urls @@ -17,6 +17,9 @@ UrlSuffix(gcc/AVR-Options.html#index-mgas-isr-prologues) mn-flash= UrlSuffix(gcc/AVR-Options.html#index-mn-flash) +mcall-main +UrlSuffix(gcc/AVR-Options.html#index-mcall-main) + mskip-bug UrlSuffix(gcc/AVR-Options.html#index-mskip-bug) diff --git a/gcc/config/riscv/riscv-string.cc b/gcc/config/riscv/riscv-string.cc index 97e20bd..408eb07 100644 --- a/gcc/config/riscv/riscv-string.cc +++ b/gcc/config/riscv/riscv-string.cc @@ -1275,7 +1275,7 @@ expand_block_move (rtx dst_in, rtx src_in, rtx length_in, bool movmem_p) machine_mode mask_mode = riscv_vector::get_vector_mode (BImode, GET_MODE_NUNITS (info.vmode)).require (); rtx mask = CONSTM1_RTX (mask_mode); - if (!satisfies_constraint_K (cnt)) + if (!satisfies_constraint_vl (cnt)) cnt= force_reg (Pmode, cnt); rtx m_ops[] = {vec, mask, src}; emit_nonvlmax_insn (code_for_pred_mov (info.vmode), @@ -1626,7 +1626,7 @@ expand_vec_setmem (rtx dst_in, rtx length_in, rtx fill_value_in) } else { - if (!satisfies_constraint_K (info.avl)) + if (!satisfies_constraint_vl (info.avl)) info.avl = force_reg (Pmode, info.avl); emit_nonvlmax_insn (code_for_pred_broadcast (info.vmode), riscv_vector::UNARY_OP, broadcast_ops, info.avl); @@ -1694,7 +1694,7 @@ expand_vec_cmpmem (rtx result_out, rtx blk_a_in, rtx blk_b_in, rtx length_in) } else { - if (!satisfies_constraint_K (length_in)) + if (!satisfies_constraint_vl (length_in)) length_in = force_reg (Pmode, length_in); rtx memmask = CONSTM1_RTX (mask_mode); diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc index 9847439..7cc15f3 100644 --- a/gcc/config/riscv/riscv-v.cc +++ b/gcc/config/riscv/riscv-v.cc @@ -1265,7 +1265,16 @@ expand_const_vector (rtx target, rtx src) element. Use element width = 64 and broadcast a vector with all element equal to 0x0706050403020100. */ rtx ele = builder.get_merged_repeating_sequence (); - rtx dup = expand_vector_broadcast (builder.new_mode (), ele); + rtx dup; + if (lra_in_progress) + { + dup = gen_reg_rtx (builder.new_mode ()); + rtx ops[] = {dup, ele}; + emit_vlmax_insn (code_for_pred_broadcast + (builder.new_mode ()), UNARY_OP, ops); + } + else + dup = expand_vector_broadcast (builder.new_mode (), ele); emit_move_insn (result, gen_lowpart (mode, dup)); } else @@ -1523,10 +1532,20 @@ expand_const_vector (rtx target, rtx src) base2 = gen_int_mode (rtx_to_poly_int64 (base2), new_smode); expand_vec_series (tmp2, base2, gen_int_mode (step2, new_smode)); - rtx shifted_tmp2 = expand_simple_binop ( - new_mode, ASHIFT, tmp2, - gen_int_mode (builder.inner_bits_size (), Pmode), NULL_RTX, - false, OPTAB_DIRECT); + rtx shifted_tmp2; + rtx shift = gen_int_mode (builder.inner_bits_size (), Xmode); + if (lra_in_progress) + { + shifted_tmp2 = gen_reg_rtx (new_mode); + rtx shift_ops[] = {shifted_tmp2, tmp2, shift}; + emit_vlmax_insn (code_for_pred_scalar + (ASHIFT, new_mode), BINARY_OP, + shift_ops); + } + else + shifted_tmp2 = expand_simple_binop (new_mode, ASHIFT, tmp2, + shift, NULL_RTX, false, + OPTAB_DIRECT); rtx tmp3 = gen_reg_rtx (new_mode); rtx ior_ops[] = {tmp3, tmp1, shifted_tmp2}; emit_vlmax_insn (code_for_pred (IOR, new_mode), BINARY_OP, @@ -1539,9 +1558,20 @@ expand_const_vector (rtx target, rtx src) rtx vid = gen_reg_rtx (mode); expand_vec_series (vid, const0_rtx, const1_rtx); /* Transform into { 0, 0, 1, 1, 2, 2, ... }. */ - rtx shifted_vid - = expand_simple_binop (mode, LSHIFTRT, vid, const1_rtx, - NULL_RTX, false, OPTAB_DIRECT); + rtx shifted_vid; + if (lra_in_progress) + { + shifted_vid = gen_reg_rtx (mode); + rtx shift = gen_int_mode (1, Xmode); + rtx shift_ops[] = {shifted_vid, vid, shift}; + emit_vlmax_insn (code_for_pred_scalar + (ASHIFT, mode), BINARY_OP, + shift_ops); + } + else + shifted_vid = expand_simple_binop (mode, LSHIFTRT, vid, + const1_rtx, NULL_RTX, + false, OPTAB_DIRECT); rtx tmp1 = gen_reg_rtx (mode); rtx tmp2 = gen_reg_rtx (mode); expand_vec_series (tmp1, base1, @@ -2103,7 +2133,7 @@ get_unknown_min_value (machine_mode mode) static rtx force_vector_length_operand (rtx vl) { - if (CONST_INT_P (vl) && !satisfies_constraint_K (vl)) + if (CONST_INT_P (vl) && !satisfies_constraint_vl (vl)) return force_reg (Pmode, vl); return vl; } @@ -4130,7 +4160,7 @@ expand_load_store (rtx *ops, bool is_load) } else { - if (!satisfies_constraint_K (len)) + if (!satisfies_constraint_vl (len)) len = force_reg (Pmode, len); if (is_load) { @@ -4165,7 +4195,7 @@ expand_strided_load (machine_mode mode, rtx *ops) emit_vlmax_insn (icode, BINARY_OP_TAMA, emit_ops); else { - len = satisfies_constraint_K (len) ? len : force_reg (Pmode, len); + len = satisfies_constraint_vl (len) ? len : force_reg (Pmode, len); emit_nonvlmax_insn (icode, BINARY_OP_TAMA, emit_ops, len); } } @@ -4191,7 +4221,7 @@ expand_strided_store (machine_mode mode, rtx *ops) } else { - len = satisfies_constraint_K (len) ? len : force_reg (Pmode, len); + len = satisfies_constraint_vl (len) ? len : force_reg (Pmode, len); vl_type = get_avl_type_rtx (NONVLMAX); } @@ -4642,7 +4672,7 @@ expand_lanes_load_store (rtx *ops, bool is_load) } else { - if (!satisfies_constraint_K (len)) + if (!satisfies_constraint_vl (len)) len = force_reg (Pmode, len); if (is_load) { diff --git a/gcc/config/riscv/vector.md b/gcc/config/riscv/vector.md index cf22b39..8ee43cf 100644 --- a/gcc/config/riscv/vector.md +++ b/gcc/config/riscv/vector.md @@ -3904,7 +3904,10 @@ (match_operand:V_VLSI 3 "register_operand" "vr,vr, vr, vr")) (match_operand:V_VLSI 2 "vector_merge_operand" "vu, 0, vu, 0")))] "TARGET_VECTOR" - "v<insn>.v\t%0,%3%p1" + { + /* vneg.v = vrsub vd,vs,x0 = vrsub vd,vs,0. */ + return (<CODE> == NEG) ? "vrsub.vi\t%0,%3,0%p1" : "v<insn>.v\t%0,%3%p1"; + } [(set_attr "type" "vialu") (set_attr "mode" "<MODE>") (set_attr "vl_op_idx" "4") @@ -4258,7 +4261,13 @@ (match_operand 4 "pmode_reg_or_uimm5_operand" " rK, rK, rK, rK, rK, rK"))) (match_operand:<V_DOUBLE_TRUNC> 2 "vector_merge_operand" " vu, 0, vu, 0, vu, 0")))] "TARGET_VECTOR" - "vn<insn>.w%o4\t%0,%3,%4%p1" + { + /* vnsrl vd,vs,x0 = vnsrl vd,vs,0. */ + if (REG_P (operands[4]) && REGNO (operands[4]) == 0) + return "vn<insn>.wi\t%0,%3,0%p1"; + + return "vn<insn>.w%o4\t%0,%3,%4%p1"; + } [(set_attr "type" "vnshift") (set_attr "mode" "<V_DOUBLE_TRUNC>") (set_attr "spec_restriction" "none,none,thv,thv,none,none")]) @@ -4279,7 +4288,8 @@ (match_operand:VWEXTI 3 "register_operand" " 0, 0, 0, 0, vr, vr")) (match_operand:<V_DOUBLE_TRUNC> 2 "vector_merge_operand" " vu, 0, vu, 0, vu, 0")))] "TARGET_VECTOR" - "vncvt.x.x.w\t%0,%3%p1" + ;; vncvt.x.x.w = vnsrl vd,vs,x0 = vnsrl vd,vs,0 + "vnsrl.wi\t%0,%3,0%p1"; [(set_attr "type" "vnshift") (set_attr "mode" "<V_DOUBLE_TRUNC>") (set_attr "vl_op_idx" "4") diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc index 1d96df4..29aef50 100644 --- a/gcc/config/s390/s390.cc +++ b/gcc/config/s390/s390.cc @@ -3510,26 +3510,31 @@ s390_valid_shift_count (rtx op, HOST_WIDE_INT implicit_mask) /* Check for an and with proper constant. */ if (GET_CODE (op) == AND) - { - rtx op1 = XEXP (op, 0); - rtx imm = XEXP (op, 1); + { + rtx op1 = XEXP (op, 0); + rtx imm = XEXP (op, 1); - if (GET_CODE (op1) == SUBREG && subreg_lowpart_p (op1)) - op1 = XEXP (op1, 0); + if (GET_CODE (op1) == SUBREG && subreg_lowpart_p (op1)) + op1 = XEXP (op1, 0); - if (!(register_operand (op1, GET_MODE (op1)) || GET_CODE (op1) == PLUS)) - return false; + if (!(register_operand (op1, GET_MODE (op1)) || GET_CODE (op1) == PLUS)) + return false; - if (!immediate_operand (imm, GET_MODE (imm))) - return false; + /* Accept only CONST_INT as immediates, i.e., reject shift count operands + which do not trivially fit the scheme of address operands. Especially + since strip_address_mutations() expects expressions of the form + (and ... (const_int ...)) and fails for + (and ... (const_wide_int ...)). */ + if (!const_int_operand (imm, GET_MODE (imm))) + return false; - HOST_WIDE_INT val = INTVAL (imm); - if (implicit_mask > 0 - && (val & implicit_mask) != implicit_mask) - return false; + HOST_WIDE_INT val = INTVAL (imm); + if (implicit_mask > 0 + && (val & implicit_mask) != implicit_mask) + return false; - op = op1; - } + op = op1; + } /* Check the rest. */ return s390_decompose_addrstyle_without_index (op, NULL, NULL); diff --git a/gcc/config/sol2-protos.h b/gcc/config/sol2-protos.h index 2462b47..70dd958 100644 --- a/gcc/config/sol2-protos.h +++ b/gcc/config/sol2-protos.h @@ -24,7 +24,6 @@ extern void solaris_elf_asm_comdat_section (const char *, unsigned int, tree); extern void solaris_file_end (void); extern void solaris_insert_attributes (tree, tree *); extern void solaris_output_init_fini (FILE *, tree); -extern void solaris_override_options (void); /* In sol2-c.cc. */ extern void solaris_register_pragmas (void); diff --git a/gcc/config/sol2.cc b/gcc/config/sol2.cc index 9bd9722..f46bcfa 100644 --- a/gcc/config/sol2.cc +++ b/gcc/config/sol2.cc @@ -291,12 +291,3 @@ solaris_file_end (void) solaris_comdat_htab->traverse <void *, solaris_define_comdat_signature> (NULL); } - -void -solaris_override_options (void) -{ - /* Older versions of Solaris ld cannot handle CIE version 3 in .eh_frame. - Don't emit DWARF3/4 unless specifically selected if so. */ - if (!HAVE_LD_EH_FRAME_CIEV3 && !OPTION_SET_P (dwarf_version)) - dwarf_version = 2; -} diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h index 9618b43..2405c10 100644 --- a/gcc/config/sol2.h +++ b/gcc/config/sol2.h @@ -119,11 +119,6 @@ along with GCC; see the file COPYING3. If not see TARGET_SUB_OS_CPP_BUILTINS(); \ } while (0) -#define SUBTARGET_OVERRIDE_OPTIONS \ - do { \ - solaris_override_options (); \ - } while (0) - #if DEFAULT_ARCH32_P #define MULTILIB_DEFAULTS { "m32" } #else diff --git a/gcc/configure b/gcc/configure index e36d1d9..69a9cf7 100755 --- a/gcc/configure +++ b/gcc/configure @@ -32335,46 +32335,6 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld_eh_frame_hdr" >&5 $as_echo "$gcc_cv_ld_eh_frame_hdr" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking linker CIEv3 in .eh_frame support" >&5 -$as_echo_n "checking linker CIEv3 in .eh_frame support... " >&6; } -gcc_cv_ld_eh_frame_ciev3=no -if test $in_tree_ld = yes ; then - if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 \ - && test $in_tree_ld_is_elf = yes; then - gcc_cv_ld_eh_frame_ciev3=yes - fi -elif test x$gcc_cv_ld != x; then - if echo "$ld_ver" | grep GNU > /dev/null; then - gcc_cv_ld_eh_frame_ciev3=yes - if test 0"$ld_date" -lt 20040513; then - if test -n "$ld_date"; then - # If there was date string, but was earlier than 2004-05-13, fail - gcc_cv_ld_eh_frame_ciev3=no - elif test "$ld_vers_major" -lt 2; then - gcc_cv_ld_eh_frame_ciev3=no - elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 16; then - gcc_cv_ld_eh_frame_ciev3=no - fi - fi - else - case "$target" in - *-*-solaris2*) - # Sun ld added support for CIE v3 in .eh_frame in Solaris 11.1. - if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 2324; then - gcc_cv_ld_eh_frame_ciev3=yes - fi - ;; - esac - fi -fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_LD_EH_FRAME_CIEV3 `if test x"$gcc_cv_ld_eh_frame_ciev3" = xyes; then echo 1; else echo 0; fi` -_ACEOF - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld_eh_frame_ciev3" >&5 -$as_echo "$gcc_cv_ld_eh_frame_ciev3" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker position independent executable support" >&5 $as_echo_n "checking linker position independent executable support... " >&6; } gcc_cv_ld_pie=no diff --git a/gcc/configure.ac b/gcc/configure.ac index 8fab93c..845827a 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -6101,42 +6101,6 @@ if test x"$gcc_cv_ld_eh_frame_hdr" = xyes; then fi AC_MSG_RESULT($gcc_cv_ld_eh_frame_hdr) -AC_MSG_CHECKING(linker CIEv3 in .eh_frame support) -gcc_cv_ld_eh_frame_ciev3=no -if test $in_tree_ld = yes ; then - if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2 \ - && test $in_tree_ld_is_elf = yes; then - gcc_cv_ld_eh_frame_ciev3=yes - fi -elif test x$gcc_cv_ld != x; then - if echo "$ld_ver" | grep GNU > /dev/null; then - gcc_cv_ld_eh_frame_ciev3=yes - if test 0"$ld_date" -lt 20040513; then - if test -n "$ld_date"; then - # If there was date string, but was earlier than 2004-05-13, fail - gcc_cv_ld_eh_frame_ciev3=no - elif test "$ld_vers_major" -lt 2; then - gcc_cv_ld_eh_frame_ciev3=no - elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 16; then - gcc_cv_ld_eh_frame_ciev3=no - fi - fi - else - case "$target" in - *-*-solaris2*) - # Sun ld added support for CIE v3 in .eh_frame in Solaris 11.1. - if test "$ld_vers_major" -gt 1 || test "$ld_vers_minor" -ge 2324; then - gcc_cv_ld_eh_frame_ciev3=yes - fi - ;; - esac - fi -fi -AC_DEFINE_UNQUOTED(HAVE_LD_EH_FRAME_CIEV3, - [`if test x"$gcc_cv_ld_eh_frame_ciev3" = xyes; then echo 1; else echo 0; fi`], - [Define 0/1 if your linker supports CIE v3 in .eh_frame.]) -AC_MSG_RESULT($gcc_cv_ld_eh_frame_ciev3) - AC_MSG_CHECKING(linker position independent executable support) gcc_cv_ld_pie=no if test $in_tree_ld = yes ; then diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f35d991..8d0aac9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,41 @@ +2025-02-13 Jason Merrill <jason@redhat.com> + + * tree.cc (handle_init_priority_attribute): Use OPT_prio_ctor_dtor. + +2025-02-13 Jason Merrill <jason@redhat.com> + + * decl.cc (omp_declare_variant_finalize_one): Use forward_parm. + +2025-02-13 Jason Merrill <jason@redhat.com> + + PR c++/118856 + * call.cc (struct extend_temps_data): Add var_map. + (extend_all_temps): Adjust. + (set_up_extended_ref_temp): Make walk_data void*. + (extend_temps_r): Remap variables. Handle pset here. + Extend all TARGET_EXPRs. + +2025-02-13 Nathaniel Shead <nathanieloshead@gmail.com> + + PR c++/118849 + * decl2.cc (min_vis_expr_r): Constrain visibility according to + the type of decl_constant_var_p decls. + +2025-02-13 Jakub Jelinek <jakub@redhat.com> + + PR c++/118822 + PR c++/118833 + * semantics.cc (adjust_loop_decl_cond): Allow multiple trailing + CLEANUP_STMT levels in *BODY_P. Set *CLEANUP_P to the number + of levels rather than one particular cleanup, keep the cleanups + in *PREP_P. Set *BODY_P to the last stmt in the cur_stmt_list + or NULL if *CLEANUP_P and the innermost cur_stmt_list is empty. + (finish_loop_cond_prep): New function. + (finish_while_stmt, finish_for_stmt): Use it. Don't call + set_one_cleanup_loc. + * constexpr.cc (cxx_eval_loop_expr): Adjust handling of + {FOR,WHILE}_COND_{PREP,CLEANUP}. + 2025-02-11 Jason Merrill <jason@redhat.com> PR c++/118574 diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc index 2c77b4a..38a8f7f 100644 --- a/gcc/cp/call.cc +++ b/gcc/cp/call.cc @@ -14154,18 +14154,6 @@ make_temporary_var_for_ref_to_temp (tree decl, tree type) return pushdecl (var); } -/* Data for extend_temps_r, mostly matching the parameters of - extend_ref_init_temps. */ - -struct extend_temps_data -{ - tree decl; - tree init; - vec<tree, va_gc> **cleanups; - tree* cond_guard; - hash_set<tree> *pset; -}; - static tree extend_temps_r (tree *, int *, void *); /* EXPR is the initializer for a variable DECL of reference or @@ -14177,7 +14165,7 @@ static tree extend_temps_r (tree *, int *, void *); static tree set_up_extended_ref_temp (tree decl, tree expr, vec<tree, va_gc> **cleanups, tree *initp, tree *cond_guard, - extend_temps_data *walk_data) + void *walk_data) { tree init; tree type; @@ -14218,7 +14206,7 @@ set_up_extended_ref_temp (tree decl, tree expr, vec<tree, va_gc> **cleanups, maybe_constant_init because the extension might change its result. */ if (walk_data) cp_walk_tree (&TARGET_EXPR_INITIAL (expr), extend_temps_r, - walk_data, walk_data->pset); + walk_data, nullptr); else TARGET_EXPR_INITIAL (expr) = extend_ref_init_temps (decl, TARGET_EXPR_INITIAL (expr), cleanups, @@ -14833,6 +14821,19 @@ extend_ref_init_temps_1 (tree decl, tree init, vec<tree, va_gc> **cleanups, return init; } +/* Data for extend_temps_r, mostly matching the parameters of + extend_ref_init_temps. */ + +struct extend_temps_data +{ + tree decl; + tree init; + vec<tree, va_gc> **cleanups; + tree* cond_guard; + hash_set<tree> *pset; // For avoiding redundant walk_tree. + hash_map<tree, tree> *var_map; // For remapping extended temps. +}; + /* Tree walk function for extend_all_temps. Generally parallel to extend_ref_init_temps_1, but adapted for walk_tree. */ @@ -14841,7 +14842,15 @@ extend_temps_r (tree *tp, int *walk_subtrees, void *data) { extend_temps_data *d = (extend_temps_data *)data; - if (TYPE_P (*tp) || TREE_CODE (*tp) == CLEANUP_POINT_EXPR) + if (TREE_CODE (*tp) == VAR_DECL) + { + if (tree *r = d->var_map->get (*tp)) + *tp = *r; + return NULL_TREE; + } + + if (TYPE_P (*tp) || TREE_CODE (*tp) == CLEANUP_POINT_EXPR + || d->pset->add (*tp)) { *walk_subtrees = 0; return NULL_TREE; @@ -14849,13 +14858,13 @@ extend_temps_r (tree *tp, int *walk_subtrees, void *data) if (TREE_CODE (*tp) == COND_EXPR) { - cp_walk_tree (&TREE_OPERAND (*tp, 0), extend_temps_r, d, d->pset); + cp_walk_tree (&TREE_OPERAND (*tp, 0), extend_temps_r, d, nullptr); auto walk_arm = [d](tree &op) { tree cur_cond_guard = NULL_TREE; auto ov = make_temp_override (d->cond_guard, &cur_cond_guard); - cp_walk_tree (&op, extend_temps_r, d, d->pset); + cp_walk_tree (&op, extend_temps_r, d, nullptr); if (cur_cond_guard) { tree set = build2 (MODIFY_EXPR, boolean_type_node, @@ -14870,30 +14879,26 @@ extend_temps_r (tree *tp, int *walk_subtrees, void *data) return NULL_TREE; } - if (TREE_CODE (*tp) == ADDR_EXPR - /* A discarded-value temporary. */ - || (TREE_CODE (*tp) == CONVERT_EXPR - && VOID_TYPE_P (TREE_TYPE (*tp)))) + tree *p = tp; + + if (TREE_CODE (*tp) == ADDR_EXPR) + for (p = &TREE_OPERAND (*tp, 0); + TREE_CODE (*p) == COMPONENT_REF || TREE_CODE (*p) == ARRAY_REF; ) + p = &TREE_OPERAND (*p, 0); + + if (TREE_CODE (*p) == TARGET_EXPR) { - tree *p; - for (p = &TREE_OPERAND (*tp, 0); - TREE_CODE (*p) == COMPONENT_REF || TREE_CODE (*p) == ARRAY_REF; ) - p = &TREE_OPERAND (*p, 0); - if (TREE_CODE (*p) == TARGET_EXPR) - { - tree subinit = NULL_TREE; - *p = set_up_extended_ref_temp (d->decl, *p, d->cleanups, &subinit, - d->cond_guard, d); - if (TREE_CODE (*tp) == ADDR_EXPR) - recompute_tree_invariant_for_addr_expr (*tp); - if (subinit) - *tp = cp_build_compound_expr (subinit, *tp, tf_none); - } + tree subinit = NULL_TREE; + tree slot = TARGET_EXPR_SLOT (*p); + *p = set_up_extended_ref_temp (d->decl, *p, d->cleanups, &subinit, + d->cond_guard, d); + if (TREE_CODE (*tp) == ADDR_EXPR) + recompute_tree_invariant_for_addr_expr (*tp); + if (subinit) + *tp = cp_build_compound_expr (subinit, *tp, tf_none); + d->var_map->put (slot, *p); } - /* TARGET_EXPRs that aren't handled by the above are implementation details - that shouldn't be ref-extended, like the build_vec_init iterator. */ - return NULL_TREE; } @@ -14903,8 +14908,10 @@ static tree extend_all_temps (tree decl, tree init, vec<tree, va_gc> **cleanups) { hash_set<tree> pset; - extend_temps_data d = { decl, init, cleanups, nullptr, &pset }; - cp_walk_tree (&init, extend_temps_r, &d, &pset); + hash_map<tree, tree> map; + gcc_assert (!TREE_STATIC (decl)); + extend_temps_data d = { decl, init, cleanups, nullptr, &pset, &map }; + cp_walk_tree (&init, extend_temps_r, &d, nullptr); return init; } diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc index f142dd3..299b134 100644 --- a/gcc/cp/constexpr.cc +++ b/gcc/cp/constexpr.cc @@ -7153,6 +7153,7 @@ cxx_eval_loop_expr (const constexpr_ctx *ctx, tree t, tree body, cond = NULL_TREE, expr = NULL_TREE; tree cond_prep = NULL_TREE, cond_cleanup = NULL_TREE; + unsigned cond_cleanup_depth = 0; int count = 0; switch (TREE_CODE (t)) { @@ -7188,11 +7189,25 @@ cxx_eval_loop_expr (const constexpr_ctx *ctx, tree t, } if (cond_prep) gcc_assert (TREE_CODE (cond_prep) == BIND_EXPR); - auto cleanup_cond = [=] { + auto cleanup_cond = [&] { /* Clean up the condition variable after each iteration. */ - if (cond_cleanup && !*non_constant_p) - cxx_eval_constant_expression (ctx, cond_cleanup, vc_discard, - non_constant_p, overflow_p); + if (cond_cleanup_depth && !*non_constant_p) + { + auto_vec<tree, 4> cleanups (cond_cleanup_depth); + tree s = BIND_EXPR_BODY (cond_prep); + unsigned i; + for (i = cond_cleanup_depth; i; --i) + { + tree_stmt_iterator iter = tsi_last (s); + s = tsi_stmt (iter); + cleanups.quick_push (CLEANUP_EXPR (s)); + s = CLEANUP_BODY (s); + } + tree c; + FOR_EACH_VEC_ELT_REVERSE (cleanups, i, c) + cxx_eval_constant_expression (ctx, c, vc_discard, non_constant_p, + overflow_p); + } if (cond_prep) for (tree decl = BIND_EXPR_VARS (cond_prep); decl; decl = DECL_CHAIN (decl)) @@ -7227,9 +7242,77 @@ cxx_eval_loop_expr (const constexpr_ctx *ctx, tree t, for (tree decl = BIND_EXPR_VARS (cond_prep); decl; decl = DECL_CHAIN (decl)) ctx->global->clear_value (decl); - cxx_eval_constant_expression (ctx, BIND_EXPR_BODY (cond_prep), - vc_discard, non_constant_p, - overflow_p, jump_target); + if (cond_cleanup) + { + /* If COND_CLEANUP is non-NULL, we need to evaluate DEPTH + nested STATEMENT_LISTs from inside of BIND_EXPR_BODY, + but defer the evaluation of CLEANUP_EXPRs of CLEANUP_STMT + at the end of those STATEMENT_LISTs. */ + cond_cleanup_depth = 0; + tree s = BIND_EXPR_BODY (cond_prep); + for (unsigned depth = tree_to_uhwi (cond_cleanup); + depth; --depth) + { + for (tree_stmt_iterator i = tsi_start (s); + !tsi_end_p (i); ++i) + { + tree stmt = *i; + if (TREE_CODE (stmt) == DEBUG_BEGIN_STMT) + continue; + if (tsi_one_before_end_p (i)) + { + /* The last statement in the STATEMENT_LIST + has to be a CLEANUP_STMT (verified in + finish_loop_cond_prep). We want to + evaluate just its CLEANUP_BODY part but not + CLEANUP_EXPR part just yet. */ + gcc_assert (TREE_CODE (stmt) == CLEANUP_STMT); + /* If the CLEANUP_STMT is not actually to be + evaluated, don't increment cond_cleanup_depth + so that we don't evaluate the CLEANUP_EXPR + for it later either. */ + if (*jump_target) + { + depth = 1; + break; + } + ++cond_cleanup_depth; + /* If not in the innermost one, next iteration + will handle CLEANUP_BODY similarly. */ + if (depth > 1) + { + s = CLEANUP_BODY (stmt); + break; + } + /* The innermost one can be evaluated normally. */ + cxx_eval_constant_expression (ctx, + CLEANUP_BODY (stmt), + vc_discard, + non_constant_p, + overflow_p, + jump_target); + break; + } + /* And so should be evaluated statements which aren't + last in the STATEMENT_LIST. */ + cxx_eval_constant_expression (ctx, stmt, vc_discard, + non_constant_p, overflow_p, + jump_target); + if (*non_constant_p + || returns (jump_target) + || breaks (jump_target) + || continues (jump_target)) + { + depth = 1; + break; + } + } + } + } + else + cxx_eval_constant_expression (ctx, BIND_EXPR_BODY (cond_prep), + vc_discard, non_constant_p, + overflow_p, jump_target); } if (cond) diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc index 7f7f493..df4e667 100644 --- a/gcc/cp/decl.cc +++ b/gcc/cp/decl.cc @@ -8462,7 +8462,7 @@ omp_declare_variant_finalize_one (tree decl, tree attr) if (TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE) parm = DECL_CHAIN (parm); for (; parm; parm = DECL_CHAIN (parm)) - vec_safe_push (args, build_stub_object (TREE_TYPE (parm))); + vec_safe_push (args, forward_parm (parm)); unsigned nappend_args = 0; tree append_args_list = TREE_CHAIN (TREE_CHAIN (chain)); diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc index 593dcaa..aa9ebca 100644 --- a/gcc/cp/decl2.cc +++ b/gcc/cp/decl2.cc @@ -2814,7 +2814,9 @@ min_vis_expr_r (tree *tp, int */*walk_subtrees*/, void *data) /* The ODR allows definitions in different TUs to refer to distinct constant variables with internal or no linkage, so such a reference shouldn't affect visibility (PR110323). FIXME but only if the - lvalue-rvalue conversion is applied. */; + lvalue-rvalue conversion is applied. We still want to restrict + visibility according to the type of the declaration however. */ + tpvis = type_visibility (TREE_TYPE (t)); else if (! TREE_PUBLIC (t)) tpvis = VISIBILITY_ANON; else diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc index 8a2d865..7c7d3e3 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -790,8 +790,8 @@ finish_cond (tree *cond_p, tree expr) while (A x = 42) { } for (; A x = 42;) { } move the *BODY_P statements as a BIND_EXPR into {FOR,WHILE}_COND_PREP - and if there is any CLEANUP_STMT at the end, remove that and - put the cleanup into {FOR,WHILE}_COND_CLEANUP. + and if there are any CLEANUP_STMT at the end, remember their count in + {FOR,WHILE}_COND_CLEANUP. genericize_c_loop will then handle it appropriately. In particular, the {FOR,WHILE}_COND, {FOR,WHILE}_BODY, if used continue label and FOR_EXPR will be appended into the {FOR,WHILE}_COND_PREP BIND_EXPR, @@ -807,26 +807,88 @@ adjust_loop_decl_cond (tree *body_p, tree *prep_p, tree *cleanup_p) return; gcc_assert (!processing_template_decl); - if (*body_p != cur_stmt_list) - { - /* There can be either no cleanup at all, if the condition - declaration doesn't have non-trivial destructor, or a single - one if it does. In that case extract it into *CLEANUP_P. */ - gcc_assert (stmt_list_stack->length () > 1 - && (*stmt_list_stack)[stmt_list_stack->length () - - 2] == *body_p); - tree_stmt_iterator last = tsi_last (*body_p); - gcc_assert (tsi_one_before_end_p (last) - && TREE_CODE (tsi_stmt (last)) == CLEANUP_STMT - && CLEANUP_BODY (tsi_stmt (last)) == cur_stmt_list - && tsi_end_p (tsi_last (cur_stmt_list)) - && !CLEANUP_EH_ONLY (tsi_stmt (last))); - *cleanup_p = CLEANUP_EXPR (tsi_stmt (last)); - tsi_delink (&last); + *prep_p = *body_p; + if (*prep_p != cur_stmt_list) + { + /* There can be just one CLEANUP_STMT, or there could be multiple + nested CLEANUP_STMTs, e.g. for structured bindings used as + condition. */ + gcc_assert (stmt_list_stack->length () > 1); + for (unsigned i = stmt_list_stack->length () - 2; ; --i) + { + tree t = (*stmt_list_stack)[i]; + tree_stmt_iterator last = tsi_last (t); + gcc_assert (tsi_one_before_end_p (last) + && TREE_CODE (tsi_stmt (last)) == CLEANUP_STMT + && (CLEANUP_BODY (tsi_stmt (last)) + == (*stmt_list_stack)[i + 1]) + && !CLEANUP_EH_ONLY (tsi_stmt (last))); + if (t == *prep_p) + { + *cleanup_p = build_int_cst (long_unsigned_type_node, + stmt_list_stack->length () - 1 - i); + break; + } + gcc_assert (i >= 1); + } } current_binding_level->keep = true; - *prep_p = *body_p; - *body_p = push_stmt_list (); + tree_stmt_iterator iter = tsi_last (cur_stmt_list); + /* Temporarily store in {FOR,WHILE}_BODY the last statement of + the innnermost statement list or NULL if it has no statement. + This is used in finish_loop_cond_prep to find out the splitting + point and then {FOR,WHILE}_BODY will be changed to the actual + body. */ + if (tsi_end_p (iter)) + *body_p = NULL_TREE; + else + *body_p = tsi_stmt (iter); +} + +/* Finalize {FOR,WHILE}_{BODY,COND_PREP} after the loop body. + The above function initialized *BODY_P to the last statement + in *PREP_P at that point. + Call do_poplevel on *PREP_P and move everything after that + former last statement into *BODY_P. genericize_c_loop + will later put those parts back together. + CLEANUP is {FOR,WHILE}_COND_CLEANUP. */ + +static void +finish_loop_cond_prep (tree *body_p, tree *prep_p, tree cleanup) +{ + *prep_p = do_poplevel (*prep_p); + gcc_assert (TREE_CODE (*prep_p) == BIND_EXPR); + if (BIND_EXPR_BODY (*prep_p) == *body_p) + { + gcc_assert (cleanup == NULL_TREE); + *body_p = build_empty_stmt (input_location); + return; + } + tree stmt_list = BIND_EXPR_BODY (*prep_p); + gcc_assert (TREE_CODE (stmt_list) == STATEMENT_LIST); + if (cleanup) + { + tree_stmt_iterator iter = tsi_last (stmt_list); + gcc_assert (TREE_CODE (tsi_stmt (iter)) == CLEANUP_STMT); + for (unsigned depth = tree_to_uhwi (cleanup); depth > 1; --depth) + { + gcc_assert (TREE_CODE (CLEANUP_BODY (tsi_stmt (iter))) + == STATEMENT_LIST); + iter = tsi_last (CLEANUP_BODY (tsi_stmt (iter))); + gcc_assert (TREE_CODE (tsi_stmt (iter)) == CLEANUP_STMT); + } + if (*body_p == NULL_TREE) + { + *body_p = CLEANUP_BODY (tsi_stmt (iter)); + CLEANUP_BODY (tsi_stmt (iter)) = build_empty_stmt (input_location); + return; + } + stmt_list = CLEANUP_BODY (tsi_stmt (iter)); + } + tree_stmt_iterator iter = tsi_start (stmt_list); + while (tsi_stmt (iter) != *body_p) + tsi_next (&iter); + *body_p = tsi_split_stmt_list (input_location, iter); } /* Finish a goto-statement. */ @@ -1437,14 +1499,13 @@ void finish_while_stmt (tree while_stmt) { end_maybe_infinite_loop (boolean_true_node); - WHILE_BODY (while_stmt) - = (WHILE_COND_PREP (while_stmt) - ? pop_stmt_list (WHILE_BODY (while_stmt)) - : do_poplevel (WHILE_BODY (while_stmt))); - finish_loop_cond (&WHILE_COND (while_stmt), WHILE_BODY (while_stmt)); if (WHILE_COND_PREP (while_stmt)) - WHILE_COND_PREP (while_stmt) = do_poplevel (WHILE_COND_PREP (while_stmt)); - set_one_cleanup_loc (WHILE_COND_CLEANUP (while_stmt), input_location); + finish_loop_cond_prep (&WHILE_BODY (while_stmt), + &WHILE_COND_PREP (while_stmt), + WHILE_COND_CLEANUP (while_stmt)); + else + WHILE_BODY (while_stmt) = do_poplevel (WHILE_BODY (while_stmt)); + finish_loop_cond (&WHILE_COND (while_stmt), WHILE_BODY (while_stmt)); } /* Begin a do-statement. Returns a newly created DO_STMT if @@ -1709,17 +1770,16 @@ finish_for_stmt (tree for_stmt) RANGE_FOR_BODY (for_stmt) = do_poplevel (RANGE_FOR_BODY (for_stmt)); else { - FOR_BODY (for_stmt) - = (FOR_COND_PREP (for_stmt) - ? pop_stmt_list (FOR_BODY (for_stmt)) - : do_poplevel (FOR_BODY (for_stmt))); + if (FOR_COND_PREP (for_stmt)) + finish_loop_cond_prep (&FOR_BODY (for_stmt), + &FOR_COND_PREP (for_stmt), + FOR_COND_CLEANUP (for_stmt)); + else + FOR_BODY (for_stmt) = do_poplevel (FOR_BODY (for_stmt)); if (FOR_COND (for_stmt)) finish_loop_cond (&FOR_COND (for_stmt), FOR_EXPR (for_stmt) ? integer_one_node : FOR_BODY (for_stmt)); - if (FOR_COND_PREP (for_stmt)) - FOR_COND_PREP (for_stmt) = do_poplevel (FOR_COND_PREP (for_stmt)); - set_one_cleanup_loc (FOR_COND_CLEANUP (for_stmt), input_location); } /* Pop the scope for the body of the loop. */ diff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc index 79bc74f..bf84fb6 100644 --- a/gcc/cp/tree.cc +++ b/gcc/cp/tree.cc @@ -5335,7 +5335,8 @@ handle_init_priority_attribute (tree* node, && !in_system_header_at (input_location)) { warning - (0, "requested %<init_priority%> %i is reserved for internal use", + (OPT_Wprio_ctor_dtor, + "requested %<init_priority%> %i is reserved for internal use", pri); } diff --git a/gcc/doc/gty.texi b/gcc/doc/gty.texi index 84f8546..5f649fe 100644 --- a/gcc/doc/gty.texi +++ b/gcc/doc/gty.texi @@ -313,6 +313,11 @@ Note that caches should generally use @code{deletable} instead; @code{cache} is only preferable if the value is impractical to recompute from the key when needed. +The @code{cache} option can have an optional argument, name of the function +which should be called before @samp{gt_cleare_cache}. This can be useful +if the hash table needs to be traversed and mark some pointers before +@samp{gt_cleare_cache} could clear slots in it. + @findex deletable @item deletable diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index bd7a380..08892c6 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -4840,7 +4840,7 @@ Support for Solaris 10 has been removed in GCC 10. Support for Solaris 9 has been removed in GCC 5. Support for Solaris 8 has been removed in GCC 4.8. Support for Solaris 7 has been removed in GCC 4.6. -Solaris 11.4 provides one or more of GCC 5, 7, 9, 10, 11, 12, and 13. +Solaris 11.4 provides one or more of GCC 5, 7, 9, 10, 11, 12, 13, and 14. You need to install the @code{system/header}, @code{system/linker}, and @code{developer/assembler} packages. @@ -4862,7 +4862,7 @@ conjunction with the Solaris linker. The GNU @command{as} versions included in Solaris 11.4, from GNU binutils 2.30.1 or newer (in @file{/usr/bin/gas} and @file{/usr/gnu/bin/as}), are known to work. The version from GNU -binutils 2.42 is known to work as well. Recent versions of the Solaris +binutils 2.44 is known to work as well. Recent versions of the Solaris assembler in @file{/usr/bin/as} work almost as well, though. To use GNU @command{as}, configure with the options @option{--with-gnu-as --with-as=@//usr/@/gnu/@/bin/@/as}. @@ -4870,9 +4870,12 @@ assembler in @file{/usr/bin/as} work almost as well, though. To use GNU For linking, the Solaris linker is preferred. If you want to use the GNU linker instead, the version in Solaris 11.4, from GNU binutils 2.30.1 or newer (in @file{/usr/gnu/bin/ld} and @file{/usr/bin/gld}), -works, as does the version from GNU binutils 2.42. However, it +works. However, it generally lacks platform specific features, so better stay with Solaris -@command{ld}. To use the LTO linker plugin +@command{ld}. When using the version from GNU binutils 2.44, there's +an important caveat: binutils @emph{must} be configured with +@code{CONFIG_SHELL=/bin/bash}, otherwise the linker's built-in linker +scripts get corrupted on x86. To use the LTO linker plugin (@option{-fuse-linker-plugin}) with GNU @command{ld}, GNU binutils @emph{must} be configured with @option{--enable-largefile}. To use Solaris @command{ld}, we recommend to configure with @@ -4894,7 +4897,7 @@ will be disabled if no appropriate version is found. Solaris work. In order to build the GNU Ada compiler, GNAT, a working GNAT is needed. -Since Solaris 11.4 SRU 39, GNAT 11, 12 or 13 is bundled in the +Since Solaris 11.4 SRU 39, GNAT 11, 12, 13 or 14 is bundled in the @code{developer/gcc/gcc-gnat} package. In order to build the GNU D compiler, GDC, a working @samp{libphobos} is diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index bd42a8b..e78810a 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -908,7 +908,7 @@ Objective-C and Objective-C++ Dialects}. @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args -mcvt -mbranch-cost=@var{cost} -mfuse-add=@var{level} -mfuse-move=@var{level} -mcall-prologues -mgas-isr-prologues -mint8 -mflmap --mdouble=@var{bits} -mlong-double=@var{bits} +-mdouble=@var{bits} -mlong-double=@var{bits} -mno-call-main -mn_flash=@var{size} -mfract-convert-truncate -mno-interrupts -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack -mrodata-in-ram -msplit-bit-shift -msplit-ldst @@ -7072,8 +7072,8 @@ This warning is enabled by @option{-Wall}. Warn when @option{-fhardened} did not enable an option from its set (for which see @option{-fhardened}). For instance, using @option{-fhardened} and @option{-fstack-protector} at the same time on the command line causes -@option{-Whardened} to warn because @option{-fstack-protector-strong} is -not enabled by @option{-fhardened}. +@option{-Whardened} to warn because @option{-fstack-protector-strong} will +not be enabled by @option{-fhardened}. This warning is enabled by default and has effect only when @option{-fhardened} is enabled. @@ -24456,6 +24456,24 @@ Do not save registers in @code{main}. The effect is the same like attaching attribute @ref{AVR Function Attributes,,@code{OS_task}} to @code{main}. It is activated per default if optimization is on. +@opindex mno-call-main +@opindex mcall-main +@item -mno-call-main +Don't run @code{main} by means of +@example +XCALL main +XJMP exit +@end example +Instead, put @code{main} in section +@w{@uref{https://avrdudes.github.io/avr-libc/avr-libc-user-manual/mem_sections.html#sec_dot_init,@code{.init9}}} +so that no call is required. +By setting this options the user asserts that @code{main} will not return. + +This option can be used for devices with very limited resources in order +to save a few bytes of code and stack space. It will work as expected since +@w{@uref{https://github.com/avrdudes/avr-libc/issues/1012,AVR-LibC v2.3}}. +With older versions, there will be no performance gain. + @opindex mno-interrupts @item -mno-interrupts Generated code is not compatible with hardware interrupts. @@ -24534,7 +24552,19 @@ Allow to use truncation instead of rounding towards zero for fractional fixed-po @opindex nodevicelib @item -nodevicelib -Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}. +Don't link against AVR-LibC's device specific library @code{lib@var{mcu}.a}. + +Notice that since AVR-LibC v2.3, that library contains code that is +essential for the correct functioning of a program. In particular, +it contains parts of the startup code like: +@w{@uref{https://github.com/avrdudes/avr-libc/issues/1011,@code{__init_sp}}} +to initialize the stack pointer with symbol @code{__stack}, +@w{@uref{https://github.com/avrdudes/avr-libc/issues/1010,@code{__init_cvt}}} +to set up the hardware to use a compact vector table with @option{-mcvt}, +@w{@uref{https://github.com/avrdudes/avr-libc/issues/1012,@code{__call_main}}} +to call @code{main} and @code{exit}, and +@w{@uref{https://github.com/avrdudes/avr-libc/issues/931,@code{__do_flmap_init}}} +to set up FLMAP according to symbol @code{__flmap}. @opindex nodevicespecs @item -nodevicespecs diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index 43884f2..ed7d940 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -23195,7 +23195,7 @@ gen_formal_parameter_pack_die (tree parm_pack, && subr_die); parm_pack_die = new_die (DW_TAG_GNU_formal_parameter_pack, subr_die, parm_pack); - add_src_coords_attributes (parm_pack_die, parm_pack); + add_name_and_src_coords_attributes (parm_pack_die, parm_pack); for (arg = pack_arg; arg; arg = DECL_CHAIN (arg)) { diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 1f2e88f..934d70f 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,13 @@ +2025-02-13 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/118845 + * interface.cc (compare_parameter): If the formal attribute has been + generated from an actual argument list, also output an pointer to + there in case of an error. + (gfc_get_formal_from_actual_arglist): Set function and subroutine + attributes and (if it is a function) the typespec from the actual + argument. + 2025-02-11 Sandra Loosemore <sloosemore@baylibre.com> * trans-openmp.cc (gfc_trans_omp_declare_variant): Update call to diff --git a/gcc/fortran/interface.cc b/gcc/fortran/interface.cc index fdde84d..edec907 100644 --- a/gcc/fortran/interface.cc +++ b/gcc/fortran/interface.cc @@ -2474,8 +2474,16 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, sizeof(err),NULL, NULL)) { if (where) - gfc_error_opt (0, "Interface mismatch in dummy procedure %qs at %L:" - " %s", formal->name, &actual->where, err); + { + /* Artificially generated symbol names would only confuse. */ + if (formal->attr.artificial) + gfc_error_opt (0, "Interface mismatch in dummy procedure " + "at %L conflicts with %L: %s", &actual->where, + &formal->declared_at, err); + else + gfc_error_opt (0, "Interface mismatch in dummy procedure %qs " + "at %L: %s", formal->name, &actual->where, err); + } return false; } @@ -2483,8 +2491,16 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, sizeof(err), NULL, NULL)) { if (where) - gfc_error_opt (0, "Interface mismatch in dummy procedure %qs at %L:" - " %s", formal->name, &actual->where, err); + { + if (formal->attr.artificial) + gfc_error_opt (0, "Interface mismatch in dummy procedure " + "at %L conflichts with %L: %s", &actual->where, + &formal->declared_at, err); + else + gfc_error_opt (0, "Interface mismatch in dummy procedure %qs at " + "%L: %s", formal->name, &actual->where, err); + + } return false; } @@ -5822,7 +5838,14 @@ gfc_get_formal_from_actual_arglist (gfc_symbol *sym, gfc_get_symbol (name, gfc_current_ns, &s); if (a->expr->ts.type == BT_PROCEDURE) { + gfc_symbol *asym = a->expr->symtree->n.sym; s->attr.flavor = FL_PROCEDURE; + if (asym->attr.function) + { + s->attr.function = 1; + s->ts = asym->ts; + } + s->attr.subroutine = asym->attr.subroutine; } else { @@ -305,9 +305,10 @@ static size_t dumpdir_length = 0; driver added to dumpdir after dumpbase or linker output name. */ static bool dumpdir_trailing_dash_added = false; -/* True if -r, -shared, -pie, or -no-pie were specified on the command - line. */ -static bool any_link_options_p; +/* True if -r, -shared, -pie, -no-pie, -z lazy, or -z norelro were + specified on the command line, and therefore -fhardened should not + add -z now/relro. */ +static bool avoid_linker_hardening_p; /* True if -static was specified on the command line. */ static bool static_p; @@ -4434,10 +4435,17 @@ driver_handle_option (struct gcc_options *opts, } /* Record the part after the last comma. */ add_infile (arg + prev, "*"); + if (strcmp (arg, "-z,lazy") == 0 || strcmp (arg, "-z,norelro") == 0) + avoid_linker_hardening_p = true; } do_save = false; break; + case OPT_z: + if (strcmp (arg, "lazy") == 0 || strcmp (arg, "norelro") == 0) + avoid_linker_hardening_p = true; + break; + case OPT_Xlinker: add_infile (arg, "*"); do_save = false; @@ -4642,7 +4650,7 @@ driver_handle_option (struct gcc_options *opts, case OPT_r: case OPT_shared: case OPT_no_pie: - any_link_options_p = true; + avoid_linker_hardening_p = true; break; case OPT_static: @@ -5026,7 +5034,7 @@ process_command (unsigned int decoded_options_count, /* TODO: check if -static -pie works and maybe use it. */ if (flag_hardened) { - if (!any_link_options_p && !static_p) + if (!avoid_linker_hardening_p && !static_p) { #if defined HAVE_LD_PIE && defined LD_PIE_SPEC save_switch (LD_PIE_SPEC, 0, NULL, /*validated=*/true, /*known=*/false); @@ -5045,7 +5053,7 @@ process_command (unsigned int decoded_options_count, } } /* We can't use OPT_Whardened yet. Sigh. */ - else if (warn_hardened) + else warning_at (UNKNOWN_LOCATION, 0, "linker hardening options not enabled by %<-fhardened%> " "because other link options were specified on the command " diff --git a/gcc/gengtype.cc b/gcc/gengtype.cc index a793795..6a3621c 100644 --- a/gcc/gengtype.cc +++ b/gcc/gengtype.cc @@ -4656,13 +4656,12 @@ write_roots (pair_p variables, bool emit_pch) outf_p f = get_output_file_with_visibility (CONST_CAST (input_file*, v->line.file)); struct flist *fli; - bool cache = false; options_p o; for (o = v->opt; o; o = o->next) if (strcmp (o->name, "cache") == 0) - cache = true; - if (!cache) + break; + if (!o) continue; for (fli = flp; fli; fli = fli->next) @@ -4677,6 +4676,8 @@ write_roots (pair_p variables, bool emit_pch) oprintf (f, " ()\n{\n"); } + if (o->kind == OPTION_STRING && o->info.string && o->info.string[0]) + oprintf (f, " %s (%s);\n", o->info.string, v->name); oprintf (f, " gt_cleare_cache (%s);\n", v->name); } diff --git a/gcc/ifcvt.cc b/gcc/ifcvt.cc index cb5597b..6d67bef 100644 --- a/gcc/ifcvt.cc +++ b/gcc/ifcvt.cc @@ -166,6 +166,13 @@ cheap_bb_rtx_cost_p (const_basic_block bb, { if (NONJUMP_INSN_P (insn)) { + /* Inline-asm's cost is not very estimatable. + It could be a costly instruction but the + estimate would be the same as a non costly + instruction. */ + if (asm_noperands (PATTERN (insn)) >= 0) + return false; + int cost = insn_cost (insn, speed) * REG_BR_PROB_BASE; if (cost == 0) return false; diff --git a/gcc/jit/ChangeLog b/gcc/jit/ChangeLog index 063697d..dfff85d 100644 --- a/gcc/jit/ChangeLog +++ b/gcc/jit/ChangeLog @@ -1,3 +1,10 @@ +2025-02-13 David Malcolm <dmalcolm@redhat.com> + + PR other/116613 + * dummy-frontend.cc + (jit_diagnostic_listener::on_report_diagnostic): Add + "final override". + 2025-02-07 Richard Biener <rguenther@suse.de> PR jit/118780 diff --git a/gcc/jit/dummy-frontend.cc b/gcc/jit/dummy-frontend.cc index 1d0080d..88784ec 100644 --- a/gcc/jit/dummy-frontend.cc +++ b/gcc/jit/dummy-frontend.cc @@ -1017,7 +1017,7 @@ public: } void on_report_diagnostic (const diagnostic_info &info, - diagnostic_t orig_diag_kind) + diagnostic_t orig_diag_kind) final override { JIT_LOG_SCOPE (gcc::jit::active_playback_ctxt->get_logger ()); diff --git a/gcc/loop-invariant.cc b/gcc/loop-invariant.cc index bcb52bb..236d5ee 100644 --- a/gcc/loop-invariant.cc +++ b/gcc/loop-invariant.cc @@ -1123,6 +1123,11 @@ find_invariant_insn (rtx_insn *insn, bool always_reached, bool always_executed) if (may_trap_or_fault_p (PATTERN (insn)) && !always_reached) return; + /* inline-asm that is not always executed cannot be moved + as it might conditionally trap. */ + if (!always_reached && asm_noperands (PATTERN (insn)) >= 0) + return; + depends_on = BITMAP_ALLOC (NULL); if (!check_dependencies (insn, depends_on)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1d39726..612a9f3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,146 @@ +2025-02-13 Robin Dapp <rdapp.gcc@gmail.com> + + PR target/118832 + * gcc.target/riscv/rvv/autovec/pr118832.c: New test. + +2025-02-13 Marek Polacek <polacek@redhat.com> + + PR driver/117739 + * c-c++-common/fhardened-16.c: New test. + * c-c++-common/fhardened-17.c: New test. + * c-c++-common/fhardened-18.c: New test. + * c-c++-common/fhardened-19.c: New test. + * c-c++-common/fhardened-20.c: New test. + * c-c++-common/fhardened-21.c: New test. + +2025-02-13 Jason Merrill <jason@redhat.com> + + * g++.dg/cpp2a/nontype-class72.C: Disable -fimplicit-constexpr. + +2025-02-13 Ed Catmur <ed@catmur.uk> + Jason Merrill <jason@redhat.com> + + PR c++/70536 + * g++.dg/debug/dwarf2/template-func-params-7.C: Check for pack names. + +2025-02-13 Jason Merrill <jason@redhat.com> + + * g++.dg/special/initp1.C: Test disabling -Wprio-ctor-dtor. + +2025-02-13 Jason Merrill <jason@redhat.com> + + * g++.dg/gomp/declare-variant-3.C: Adjust diagnostic. + * g++.dg/gomp/declare-variant-5.C: Adjust diagnostic. + +2025-02-13 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/118845 + * gfortran.dg/recursive_check_4.f03: Adjust call so types matche. + * gfortran.dg/recursive_check_6.f03: Likewise. + * gfortran.dg/specifics_2.f90: Adjust calls so types match. + * gfortran.dg/interface_52.f90: New test. + * gfortran.dg/interface_53.f90: New test. + +2025-02-13 Jason Merrill <jason@redhat.com> + + PR c++/118856 + * g++.dg/cpp23/range-for9.C: New test. + +2025-02-13 Marek Polacek <polacek@redhat.com> + + PR c++/113800 + DR 2450 + * g++.dg/cpp26/pack-indexing15.C: New test. + * g++.dg/cpp2a/nontype-class68.C: New test. + * g++.dg/cpp2a/nontype-class69.C: New test. + * g++.dg/cpp2a/nontype-class70.C: New test. + * g++.dg/cpp2a/nontype-class71.C: New test. + * g++.dg/cpp2a/nontype-class72.C: New test. + +2025-02-13 Jakub Jelinek <jakub@redhat.com> + + PR debug/118790 + * gfortran.dg/gomp/pr118790.f90: New test. + +2025-02-13 Nathaniel Shead <nathanieloshead@gmail.com> + + PR c++/118849 + * g++.dg/template/linkage6.C: New test. + +2025-02-13 Jakub Jelinek <jakub@redhat.com> + + PR c++/118574 + * g++.dg/coroutines/range-for2.C: New test. + +2025-02-13 Jakub Jelinek <jakub@redhat.com> + + PR c++/118822 + PR c++/118833 + * g++.dg/expr/for9.C: New test. + * g++.dg/cpp26/decomp12.C: New test. + +2025-02-13 Stefan Schulze Frielinghaus <stefansf@gcc.gnu.org> + + * gcc.target/s390/pr118835.c: New test. + +2025-02-13 Richard Biener <rguenther@suse.de> + + PR tree-optimization/118817 + * gcc.dg/pr118817.c: New testcase. + +2025-02-12 Marek Polacek <polacek@redhat.com> + + PR c++/101740 + * g++.dg/template/dtor12.C: New test. + +2025-02-12 Vineet Gupta <vineetg@rivosinc.com> + + * gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv32-1.c: Change + expected pattern. + * 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_unary-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_unary-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_unary-3.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_unary-4.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_unary-5.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_unary-6.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_unary-7.c: Ditto. + * gcc.target/riscv/rvv/autovec/cond/cond_unary-8.c: Ditto. + * gcc.target/riscv/rvv/autovec/conversions/vncvt-rv32gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/conversions/vncvt-rv64gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u16.c: Ditto + * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u32.c: Ditto. + * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u8.c: Ditto. + * gcc.target/riscv/rvv/autovec/unop/abs-rv32gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/unop/abs-rv64gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/unop/vneg-rv32gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/unop/vneg-rv64gcv.c: Ditto. + * gcc.target/riscv/rvv/autovec/vls/abs-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/vls/cond_convert-11.c: Ditto. + * gcc.target/riscv/rvv/autovec/vls/cond_convert-12.c: Ditto. + * gcc.target/riscv/rvv/autovec/vls/cond_neg-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/vls/cond_trunc-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/vls/cond_trunc-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/vls/cond_trunc-3.c: Ditto. + * gcc.target/riscv/rvv/autovec/vls/convert-11.c: Ditto. + * gcc.target/riscv/rvv/autovec/vls/convert-12.c: Ditto. + * gcc.target/riscv/rvv/autovec/vls/neg-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/vls/trunc-1.c: Ditto. + * gcc.target/riscv/rvv/autovec/vls/trunc-2.c: Ditto. + * gcc.target/riscv/rvv/autovec/vls/trunc-3.c: Ditto. + * gcc.target/riscv/rvv/base/simplify-vdiv.c: Ditto. + * gcc.target/riscv/rvv/base/unop_v_constraint-1.c: Ditto. + +2025-02-12 Jin Ma <jinma@linux.alibaba.com> + + PR target/118601 + * gcc.target/riscv/rvv/xtheadvector/pr114194.c: Move to... + * gcc.target/riscv/rvv/xtheadvector/pr114194-rv64.c: ...here. + * gcc.target/riscv/rvv/xtheadvector/pr114194-rv32.c: New test. + * gcc.target/riscv/rvv/xtheadvector/pr118601.c: New test. + 2025-02-11 Jeff Law <jlaw@ventanamicro.com> PR target/115478 diff --git a/gcc/testsuite/c-c++-common/fhardened-16.c b/gcc/testsuite/c-c++-common/fhardened-16.c new file mode 100644 index 0000000..7a50ad0 --- /dev/null +++ b/gcc/testsuite/c-c++-common/fhardened-16.c @@ -0,0 +1,5 @@ +/* PR driver/117739 */ +/* { dg-do compile { target *-*-linux* *-*-gnu* } } */ +/* { dg-options "-fhardened -O -Wl,-z,lazy -Whardened" } */ + +/* { dg-warning "linker hardening options not enabled" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/c-c++-common/fhardened-17.c b/gcc/testsuite/c-c++-common/fhardened-17.c new file mode 100644 index 0000000..acef8c6 --- /dev/null +++ b/gcc/testsuite/c-c++-common/fhardened-17.c @@ -0,0 +1,5 @@ +/* PR driver/117739 */ +/* { dg-do compile { target *-*-linux* *-*-gnu* } } */ +/* { dg-options "-fhardened -O -z lazy -Whardened" } */ + +/* { dg-warning "linker hardening options not enabled" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/c-c++-common/fhardened-18.c b/gcc/testsuite/c-c++-common/fhardened-18.c new file mode 100644 index 0000000..1a9a34b --- /dev/null +++ b/gcc/testsuite/c-c++-common/fhardened-18.c @@ -0,0 +1,5 @@ +/* PR driver/117739 */ +/* { dg-do compile { target *-*-linux* *-*-gnu* } } */ +/* { dg-options "-Wl,-z,lazy -fhardened -O -Whardened" } */ + +/* { dg-warning "linker hardening options not enabled" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/c-c++-common/fhardened-19.c b/gcc/testsuite/c-c++-common/fhardened-19.c new file mode 100644 index 0000000..a871702 --- /dev/null +++ b/gcc/testsuite/c-c++-common/fhardened-19.c @@ -0,0 +1,5 @@ +/* PR driver/117739 */ +/* { dg-do compile { target *-*-linux* *-*-gnu* } } */ +/* { dg-options "-z lazy -fhardened -O -Whardened" } */ + +/* { dg-warning "linker hardening options not enabled" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/c-c++-common/fhardened-20.c b/gcc/testsuite/c-c++-common/fhardened-20.c new file mode 100644 index 0000000..c9f2d89 --- /dev/null +++ b/gcc/testsuite/c-c++-common/fhardened-20.c @@ -0,0 +1,5 @@ +/* PR driver/117739 */ +/* { dg-do compile { target *-*-linux* *-*-gnu* } } */ +/* { dg-options "-fhardened -O -Wl,-z,norelro -Whardened" } */ + +/* { dg-warning "linker hardening options not enabled" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/c-c++-common/fhardened-21.c b/gcc/testsuite/c-c++-common/fhardened-21.c new file mode 100644 index 0000000..07b7ee1 --- /dev/null +++ b/gcc/testsuite/c-c++-common/fhardened-21.c @@ -0,0 +1,5 @@ +/* PR driver/117739 */ +/* { dg-do compile { target *-*-linux* *-*-gnu* } } */ +/* { dg-options "-fhardened -O -z norelro -Whardened" } */ + +/* { dg-warning "linker hardening options not enabled" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/g++.dg/coroutines/range-for2.C b/gcc/testsuite/g++.dg/coroutines/range-for2.C new file mode 100644 index 0000000..14372f3 --- /dev/null +++ b/gcc/testsuite/g++.dg/coroutines/range-for2.C @@ -0,0 +1,92 @@ +// PR c++/118574 +// { dg-do run } +// { dg-additional-options "-std=c++23 -O2" } + +#include <coroutine> + +[[gnu::noipa]] void +baz (int *) +{ +} + +struct D { + D () : d (new int (42)) {} + ~D () { if (*d != 42) __builtin_abort (); *d = 0; baz (d); delete d; } + int *d; +}; + +struct E { + E (const D &x) : e (x) {} + void test () const { if (*e.d != 42) __builtin_abort (); } + ~E () { test (); } + const D &e; +}; + +struct A { + const char **a = nullptr; + int n = 0; + const E *e1 = nullptr; + const E *e2 = nullptr; + void test () const { if (e1) e1->test (); if (e2) e2->test (); } + void push_back (const char *x) { test (); if (!a) a = new const char *[2]; a[n++] = x; } + const char **begin () const { test (); return a; } + const char **end () const { test (); return a + n; } + ~A () { test (); delete[] a; } +}; + +struct B { + long ns; + bool await_ready () const noexcept { return false; } + void await_suspend (std::coroutine_handle<> h) const noexcept { + volatile int v = 0; + while (v < ns) + v = v + 1; + h.resume (); + } + void await_resume () const noexcept {} +}; + +struct C { + struct promise_type { + const char *value; + std::suspend_never initial_suspend () { return {}; } + std::suspend_always final_suspend () noexcept { return {}; } + void return_value (const char *v) { value = v; } + void unhandled_exception () { __builtin_abort (); } + C get_return_object () { return C{this}; } + }; + promise_type *p; + explicit C (promise_type *p) : p(p) {} + const char *get () { return p->value; } +}; + +A +foo (const E &e1, const E &e2) +{ + A a; + a.e1 = &e1; + a.e2 = &e2; + a.push_back ("foo"); + a.push_back ("bar"); + return a; +} + +C +bar () +{ + A ret; + for (const auto &item : foo (E{D {}}, E{D {}})) + { + co_await B{200000}; + ret.push_back (item); + } + co_return "foobar"; +} + +int +main () +{ + auto task = bar (); + if (__builtin_strcmp (task.get (), "foobar")) + __builtin_abort (); +} diff --git a/gcc/testsuite/g++.dg/cpp23/range-for9.C b/gcc/testsuite/g++.dg/cpp23/range-for9.C new file mode 100644 index 0000000..db9be03 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp23/range-for9.C @@ -0,0 +1,20 @@ +// PR c++/118856 +// { dg-do compile { target c++11 } } + +#include <initializer_list> + +template <typename _Tp> struct vector { + vector(std::initializer_list<_Tp>); + template <typename T> vector(T, T); + char * begin(); + char * end(); +}; + +struct f{ + f(const char*); +}; + +void h() { + for (auto &vec : vector<vector<f>>{{""}}) + ; +} diff --git a/gcc/testsuite/g++.dg/cpp26/decomp12.C b/gcc/testsuite/g++.dg/cpp26/decomp12.C new file mode 100644 index 0000000..c4f56aa --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp26/decomp12.C @@ -0,0 +1,46 @@ +// P0963R3 - Structured binding declaration as a condition +// { dg-do compile { target c++11 } } +// { dg-options "" } + +namespace std { + template<typename T> struct tuple_size; + template<int, typename> struct tuple_element; +} + +struct S { + S () : s (0) {} + S (int x) : s (x) {} + S (const S &x) : s (x.s) {} + ~S () {} + int s; +}; + +struct T { + S a, b, c; + ~T () {} + explicit operator bool () const noexcept { return a.s == b.s; } + template <int I> S get () { return I ? a : b; } +}; + +template<> struct std::tuple_size<T> { static const int value = 2; }; +template<int I> struct std::tuple_element<I,T> { using type = S; }; + +void +foo (T t, bool x) +{ + while (auto [ i, j ] = T { 1, 1, 3 }) // { dg-warning "structured bindings in conditions only available with" "" { target c++23_down } } + { + if (x) + break; + } +} + +void +bar (T t, bool x) +{ + for (int cnt = 0; auto [ i, j ] = T { 2, 2, 4 }; ++cnt) // { dg-warning "structured bindings in conditions only available with" "" { target c++23_down } } + { + if (x) + break; + } +} diff --git a/gcc/testsuite/g++.dg/cpp26/pack-indexing15.C b/gcc/testsuite/g++.dg/cpp26/pack-indexing15.C new file mode 100644 index 0000000..3f8382b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp26/pack-indexing15.C @@ -0,0 +1,20 @@ +// PR c++/113800 +// { dg-do compile { target c++26 } } +// From LLVM's temp_arg_nontype_cxx2c.cpp. + +template<class... T> +concept C = sizeof(T...[1]) == 1; + +struct A {}; + +template<class T, C<T> auto = A{}> struct Set {}; + +template<class T> +void +foo () +{ + Set<T> u; +} + +Set<bool> sb; +Set<float> sf; // { dg-error "placeholder constraints not satisfied" } diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class68.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class68.C new file mode 100644 index 0000000..ade646e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class68.C @@ -0,0 +1,24 @@ +// PR c++/113800 +// { dg-do compile { target c++20 } } +// From [temp.arg.nontype]. + +template<auto n> struct B { /* ... */ }; +B<5> b1; // OK, template parameter type is int +B<'a'> b2; // OK, template parameter type is char +B<2.5> b3; // OK, template parameter type is double +B<void(0)> b4; // { dg-error ".void. is not a valid type for a template non-type parameter" } + +template<int i> struct C { /* ... */ }; +C<{ 42 }> c1; // OK + +struct J1 { + J1 *self = this; +}; +B<J1{}> j1; // { dg-error "not a constant expression" } + +struct J2 { + J2 *self = this; + constexpr J2() {} + constexpr J2(const J2&) {} +}; +B<J2{}> j2; // { dg-error "not a constant expression" } diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class69.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class69.C new file mode 100644 index 0000000..08b0a5ef --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class69.C @@ -0,0 +1,27 @@ +// PR c++/113800 +// { dg-do compile { target c++20 } } + +// DR 2450 +struct S { int a; }; + +template<S s> +void +f () +{ +} + +void +test () +{ + f<{0}>(); + f<{.a= 0}>(); +} + +// DR 2459 +struct A { + constexpr A (float) {} +}; + +template<A> +struct X {}; +X<1> x; diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class70.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class70.C new file mode 100644 index 0000000..0e50847 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class70.C @@ -0,0 +1,47 @@ +// PR c++/113800 +// P2308R1 - Template parameter initialization +// { dg-do compile { target c++20 } } + +struct S { + int a = 0; + int b = 42; +}; + +template <S t> +struct A { + static constexpr auto a = t.a; + static constexpr auto b = t.b; +}; + +static_assert(A<{}>::a == 0); +static_assert(A<{}>::b == 42); +static_assert(A<{.a = 3}>::a == 3); +static_assert(A<{.b = 4}>::b == 4); + +template<S = {}> +struct D1 {}; + +template<S = {1, 2}> +struct D2 {}; + +template <S = {.b = 5}> +struct D3 {}; + +struct E {}; + +struct I { + constexpr I(E) {}; +}; + +template<typename T, T> +struct W {}; + +void +g () +{ + D1<> d1; + D2<> d2; + D3<> d3; + + W<I, {E{}}> w; +} diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class71.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class71.C new file mode 100644 index 0000000..36ce5b1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class71.C @@ -0,0 +1,19 @@ +// PR c++/113800 +// { dg-do compile { target c++20 } } +// From LLVM's temp_arg_nontype_cxx2c.cpp. + +template<class T, int I> +struct A { + T x[I]; +}; + +template<class T, class... U> +A(T, U...) -> A<T, 1 + sizeof...(U)>; + +template<A a> void foo() { } + +void +bar () +{ + foo<{1}>(); +} diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class72.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class72.C new file mode 100644 index 0000000..c36be7a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class72.C @@ -0,0 +1,42 @@ +// PR c++/113800 +// P2308R1 - Template parameter initialization +// { dg-do compile { target c++20 } } +// { dg-additional-options "-fno-implicit-constexpr" } +// Invalid cases. + +namespace std { +template <typename T> class initializer_list { + const T *_M_array; + decltype (sizeof 0) _M_len; +}; +} + +template<auto> +struct X {}; + +struct A { + int i; +}; + +template<A> +struct B { }; + +struct E {}; + +struct I { // { dg-message "not literal" } + I(E) {}; +}; + +template<typename T, T> +struct W {}; + +void +g () +{ + X<{0}> x; // { dg-error "unable to deduce" } + + int i = 42; // { dg-message "not const" } + B<{i}> b; // { dg-error "not usable" } + + W<I, {E{}}> w; // { dg-error "not a valid type for a template non-type parameter" } +} diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-7.C b/gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-7.C index 22b0e4f..4e95c23 100644 --- a/gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-7.C +++ b/gcc/testsuite/g++.dg/debug/dwarf2/template-func-params-7.C @@ -23,6 +23,9 @@ // These 3 function template instantiations has a total of 3 template // parameters named T. // { dg-final { scan-assembler-times "\.ascii \"T.0\"\[\t \]+\[^\n\]*DW_AT_name" 3 } } +// And the packs also have names. +// { dg-final { scan-assembler-times "\.ascii \"PTs.0\"\[\t \]+\[^\n\]*DW_AT_name" 3 } } +// { dg-final { scan-assembler-times "\.ascii \"args.0\"\[\t \]+\[^\n\]*DW_AT_name" 3 } } void @@ -35,11 +38,11 @@ printf(const char* s) */ } -template<typename T, typename... PackTypes> +template<typename T, typename... PTs> void printf(const char* s, T value, - PackTypes... args) + PTs... args) { while (*s) { diff --git a/gcc/testsuite/g++.dg/expr/for9.C b/gcc/testsuite/g++.dg/expr/for9.C new file mode 100644 index 0000000..5f90a5c --- /dev/null +++ b/gcc/testsuite/g++.dg/expr/for9.C @@ -0,0 +1,25 @@ +// PR c++/118822 +// { dg-do compile } + +struct A { A (); ~A (); }; +bool baz (); + +void +foo () +{ + while (bool x = baz ()) + { + lab:; + A a; + } +} + +void +bar () +{ + for (bool y = baz (); bool x = baz (); y |= x) + { + lab:; + A a; + } +} diff --git a/gcc/testsuite/g++.dg/gomp/declare-variant-3.C b/gcc/testsuite/g++.dg/gomp/declare-variant-3.C index 8c0cfd2..fdf030f 100644 --- a/gcc/testsuite/g++.dg/gomp/declare-variant-3.C +++ b/gcc/testsuite/g++.dg/gomp/declare-variant-3.C @@ -86,8 +86,8 @@ struct E { int e; }; void fn19 (E, int); -#pragma omp declare variant (fn19)match(user={condition(0)}) // { dg-error {could not convert 'std::declval<int>\(\)' from 'int' to 'E'} } -void fn20 (int, E); +#pragma omp declare variant (fn19)match(user={condition(0)}) // { dg-error {could not convert 'i' from 'int' to 'E'} } +void fn20 (int i, E e); struct F { operator int () const { return 42; } int f; }; void fn21 (int, F); @@ -95,8 +95,8 @@ void fn21 (int, F); #pragma omp declare variant ( fn21 ) match (user = { condition ( 1 - 1 ) } ) // { dg-error "variant 'void fn21\\\(int, F\\\)' and base 'void fn22\\\(F, F\\\)' have incompatible types" } void fn22 (F, F); -#pragma omp declare variant (fn19) match (user={condition(0)}) // { dg-error {could not convert 'std::declval<F>\(\)' from 'F' to 'E'} } -void fn23 (F, int); +#pragma omp declare variant (fn19) match (user={condition(0)}) // { dg-error {could not convert 'f' from 'F' to 'E'} } +void fn23 (F f, int i); void fn24 (int); struct U { int u; }; diff --git a/gcc/testsuite/g++.dg/gomp/declare-variant-5.C b/gcc/testsuite/g++.dg/gomp/declare-variant-5.C index a4747ac..f3697f6 100644 --- a/gcc/testsuite/g++.dg/gomp/declare-variant-5.C +++ b/gcc/testsuite/g++.dg/gomp/declare-variant-5.C @@ -74,8 +74,8 @@ struct E { int e; }; void fn19 (E, int) {} -#pragma omp declare variant (fn19)match(user={condition(0)}) // { dg-error {could not convert 'std::declval<int>\(\)' from 'int' to 'E'} } -void fn20 (int, E) {} +#pragma omp declare variant (fn19)match(user={condition(0)}) // { dg-error {could not convert 'i' from 'int' to 'E'} } +void fn20 (int i, E e) {} struct F { operator int () const { return 42; } int f; }; void fn21 (int, F) {} @@ -83,8 +83,8 @@ void fn21 (int, F) {} #pragma omp declare variant ( fn21 ) match (user = { condition ( 1 - 1 ) } ) // { dg-error "variant 'void fn21\\\(int, F\\\)' and base 'void fn22\\\(F, F\\\)' have incompatible types" } void fn22 (F, F) {} -#pragma omp declare variant (fn19) match (user={condition(0)}) // { dg-error {could not convert 'std::declval<F>\(\)' from 'F' to 'E'} } -void fn23 (F, int) {} +#pragma omp declare variant (fn19) match (user={condition(0)}) // { dg-error {could not convert 'f' from 'F' to 'E'} } +void fn23 (F f, int i) {} void fn24 (int); struct U { int u; }; diff --git a/gcc/testsuite/g++.dg/special/initp1.C b/gcc/testsuite/g++.dg/special/initp1.C index 4a539a5..ef88ca9 100644 --- a/gcc/testsuite/g++.dg/special/initp1.C +++ b/gcc/testsuite/g++.dg/special/initp1.C @@ -30,9 +30,9 @@ Two hoo[ 3 ] = { Two( 15, 16 ) }; -Two coo[ 3 ] __attribute__((init_priority(1000))); - -Two koo[ 3 ] __attribute__((init_priority(1000))) = { +Two coo[ 3 ] __attribute__((init_priority(10))); // { dg-warning "reserved" } +#pragma GCC diagnostic ignored "-Wprio-ctor-dtor" +Two koo[ 3 ] __attribute__((init_priority(10))) = { Two( 21, 22 ), Two( 23, 24 ), Two( 25, 26 ) diff --git a/gcc/testsuite/g++.dg/template/dtor12.C b/gcc/testsuite/g++.dg/template/dtor12.C new file mode 100644 index 0000000..2c75ee0 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/dtor12.C @@ -0,0 +1,19 @@ +// PR c++/101740 + +template<template<class> class T, class U> +struct Test{ + void fun(){ + T<U> d; + d.~GG<int>(); // #1 + } +}; + +template<class > +struct GG {}; + +int +main () +{ + Test<GG, int> b; + b.fun(); +} diff --git a/gcc/testsuite/g++.dg/template/linkage6.C b/gcc/testsuite/g++.dg/template/linkage6.C new file mode 100644 index 0000000..b86c986 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/linkage6.C @@ -0,0 +1,13 @@ +// PR c++/118849 +// { dg-do compile { target c++20 } } +// { dg-final { scan-assembler-not "(weak|glob)\[^\n\]*_Z" { xfail powerpc-*-aix* } } } + +namespace { + struct A {}; +} + +template <auto Q> void f() { } + +int main() { + f<A{}>(); +} diff --git a/gcc/testsuite/gcc.dg/pr118817.c b/gcc/testsuite/gcc.dg/pr118817.c new file mode 100644 index 0000000..6cfb424 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr118817.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +typedef int v4si __attribute__((vector_size (sizeof(int) * 4))); + +v4si x; + +void foo (int flag) +{ + v4si tem = (v4si) { 0, 0, 0, 0 }; + if (flag) + tem = (v4si) { flag }; + x = __builtin_shufflevector (tem, tem, 0, 0, 0, 0); +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv32-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv32-1.c index 5eb6030..50f2ac6 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv32-1.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv32-1.c @@ -10,8 +10,8 @@ /* { dg-final { scan-assembler-times {\tvzext\.vf8\tv[0-9]+,v[0-9]+,v0\.t} 1 } } */ /* { dg-final { scan-assembler-times {\tvsext\.vf8\tv[0-9]+,v[0-9]+,v0\.t} 1 } } */ -/* { dg-final { scan-assembler-times {\tvncvt\.x\.x\.w\tv[0-9]+,v[0-9]+,v0\.t} 12 } } */ -/* { dg-final { scan-assembler-times {\tvncvt\.x\.x\.w\tv[0-9]+,v[0-9]+\n} 8 } } */ +/* { dg-final { scan-assembler-times {\tvnsrl\.wi\tv[0-9]+,v[0-9]+,0,v0\.t} 12 } } */ +/* { dg-final { scan-assembler-times {\tvnsrl\.wi\tv[0-9]+,v[0-9]+,0\n} 8 } } */ /* { dg-final { scan-assembler {\tvsetvli\t[a-z0-9]+,[a-z0-9]+,e[0-9]+,m[f0-9]+,t[au],mu} } } */ /* { dg-final { scan-assembler-not {\tvf?merge\.v[vxi]m\t} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv32-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv32-2.c index aa6d6d4..dc84325a 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv32-2.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv32-2.c @@ -10,8 +10,8 @@ /* { dg-final { scan-assembler-times {\tvzext\.vf8\tv[0-9]+,v[0-9]+,v0\.t} 1 } } */ /* { dg-final { scan-assembler-times {\tvsext\.vf8\tv[0-9]+,v[0-9]+,v0\.t} 1 } } */ -/* { dg-final { scan-assembler-times {\tvncvt\.x\.x\.w\tv[0-9]+,v[0-9]+,v0\.t} 12 } } */ -/* { dg-final { scan-assembler-times {\tvncvt\.x\.x\.w\tv[0-9]+,v[0-9]+\n} 8 } } */ +/* { dg-final { scan-assembler-times {\tvnsrl\.wi\tv[0-9]+,v[0-9]+,0,v0\.t} 12 } } */ +/* { dg-final { scan-assembler-times {\tvnsrl\.wi\tv[0-9]+,v[0-9]+,0\n} 8 } } */ /* { dg-final { scan-assembler {\tvsetvli\t[a-z0-9]+,[a-z0-9]+,e[0-9]+,m[f0-9]+,t[au],mu} } } */ /* { dg-final { scan-assembler-not {\tvf?merge\.v[vxi]m\t} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv64-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv64-1.c index 33cb991..980868d 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv64-1.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv64-1.c @@ -10,8 +10,8 @@ /* { dg-final { scan-assembler-times {\tvzext\.vf8\tv[0-9]+,v[0-9]+,v0\.t} 1 } } */ /* { dg-final { scan-assembler-times {\tvsext\.vf8\tv[0-9]+,v[0-9]+,v0\.t} 1 } } */ -/* { dg-final { scan-assembler-times {\tvncvt\.x\.x\.w\tv[0-9]+,v[0-9]+,v0\.t} 12 } } */ -/* { dg-final { scan-assembler-times {\tvncvt\.x\.x\.w\tv[0-9]+,v[0-9]+\n} 8 } } */ +/* { dg-final { scan-assembler-times {\tvnsrl\.wi\tv[0-9]+,v[0-9]+,0,v0\.t} 12 } } */ +/* { dg-final { scan-assembler-times {\tvnsrl\.wi\tv[0-9]+,v[0-9]+,0\n} 8 } } */ /* { dg-final { scan-assembler {\tvsetvli\t[a-z0-9]+,[a-z0-9]+,e[0-9]+,m[f0-9]+,t[au],mu} } } */ /* { dg-final { scan-assembler-not {\tvf?merge\.v[vxi]m\t} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv64-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv64-2.c index 082d9e1..ecfeaab 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv64-2.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_convert_int2int-rv64-2.c @@ -10,8 +10,8 @@ /* { dg-final { scan-assembler-times {\tvzext\.vf8\tv[0-9]+,v[0-9]+,v0\.t} 1 } } */ /* { dg-final { scan-assembler-times {\tvsext\.vf8\tv[0-9]+,v[0-9]+,v0\.t} 1 } } */ -/* { dg-final { scan-assembler-times {\tvncvt\.x\.x\.w\tv[0-9]+,v[0-9]+,v0\.t} 12 } } */ -/* { dg-final { scan-assembler-times {\tvncvt\.x\.x\.w\tv[0-9]+,v[0-9]+\n} 8 } } */ +/* { dg-final { scan-assembler-times {\tvnsrl\.wi\tv[0-9]+,v[0-9]+,0,v0\.t} 12 } } */ +/* { dg-final { scan-assembler-times {\tvnsrl\.wi\tv[0-9]+,v[0-9]+,0\n} 8 } } */ /* { dg-final { scan-assembler {\tvsetvli\t[a-z0-9]+,[a-z0-9]+,e[0-9]+,m[f0-9]+,t[au],mu} } } */ /* { dg-final { scan-assembler-not {\tvf?merge\.v[vxi]m\t} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-1.c index 4866b22..e908eba 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-1.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-1.c @@ -36,10 +36,10 @@ TEST_ALL (DEF_LOOP) -/* NOTE: int abs operator is converted to vneg.v + vmax.vv */ -/* { dg-final { scan-assembler-times {\tvneg\.v\tv[0-9]+,v[0-9]+} 8 } } */ +/* NOTE: int abs operator is converted to vneg.v (or vsrub.vi) + vmax.vv */ +/* { dg-final { scan-assembler-times {\tvrsub\.vi\tv[0-9]+,v[0-9]+} 8 } } */ /* { dg-final { scan-assembler-times {\tvmax\.vv\tv[0-9]+,v[0-9]+,v[0-9]+} 4 } } */ -/* { dg-final { scan-assembler-times {\tvneg\.v\tv[0-9]+,v[0-9]+,v0\.t} 4 } } */ +/* { dg-final { scan-assembler-times {\tvrsub\.vi\tv[0-9]+,v[0-9]+,0,v0\.t} 4 } } */ /* { dg-final { scan-assembler-times {\tvnot\.v\tv[0-9]+,v[0-9]+,v0\.t} 4 } } */ /* { dg-final { scan-assembler-times {\tvfabs\.v\tv[0-9]+,v[0-9]+,v0\.t} 3 } } */ /* { dg-final { scan-assembler-times {\tvfneg\.v\tv[0-9]+,v[0-9]+,v0\.t} 3 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-2.c index 651df9f..8b8a3f4 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-2.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-2.c @@ -39,10 +39,10 @@ TEST_ALL (DEF_LOOP) -/* NOTE: int abs operator is converted to vneg.v + vmax.vv */ -/* { dg-final { scan-assembler-times {\tvneg\.v\tv[0-9]+,v[0-9]+} 8 } } */ +/* NOTE: int abs operator is converted to vneg.v (or vsrub.vi) + vmax.vv */ +/* { dg-final { scan-assembler-times {\tvrsub\.vi\tv[0-9]+,v[0-9]+} 8 } } */ /* { dg-final { scan-assembler-times {\tvmax\.vv\tv[0-9]+,v[0-9]+,v[0-9]+} 4 } } */ -/* { dg-final { scan-assembler-times {\tvneg\.v\tv[0-9]+,v[0-9]+,v0\.t} 4 } } */ +/* { dg-final { scan-assembler-times {\tvrsub\.vi\tv[0-9]+,v[0-9]+,0,v0\.t} 4 } } */ /* { dg-final { scan-assembler-times {\tvnot\.v\tv[0-9]+,v[0-9]+,v0\.t} 4 } } */ /* { dg-final { scan-assembler-times {\tvfabs\.v\tv[0-9]+,v[0-9]+,v0\.t} 3 } } */ /* { dg-final { scan-assembler-times {\tvfneg\.v\tv[0-9]+,v[0-9]+,v0\.t} 3 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-3.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-3.c index cc5f788..6c098a9 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-3.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-3.c @@ -36,10 +36,10 @@ TEST_ALL (DEF_LOOP) -/* NOTE: int abs operator is converted to vneg.v + vmax.vv */ -/* { dg-final { scan-assembler-times {\tvneg\.v\tv[0-9]+,v[0-9]+} 8 } } */ +/* NOTE: int abs operator is converted to vneg.v (or vsrub.vi) + vmax.vv */ +/* { dg-final { scan-assembler-times {\tvrsub\.vi\tv[0-9]+,v[0-9]+} 8 } } */ /* { dg-final { scan-assembler-times {\tvmax\.vv\tv[0-9]+,v[0-9]+,v[0-9]+} 4 } } */ -/* { dg-final { scan-assembler-times {\tvneg\.v\tv[0-9]+,v[0-9]+,v0\.t} 4 } } */ +/* { dg-final { scan-assembler-times {\tvrsub\.vi\tv[0-9]+,v[0-9]+,0,v0\.t} 4 } } */ /* { dg-final { scan-assembler-times {\tvnot\.v\tv[0-9]+,v[0-9]+,v0\.t} 4 } } */ /* { dg-final { scan-assembler-times {\tvfabs\.v\tv[0-9]+,v[0-9]+,v0\.t} 3 } } */ /* { dg-final { scan-assembler-times {\tvfneg\.v\tv[0-9]+,v[0-9]+,v0\.t} 3 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-4.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-4.c index b5f8344..6dd9ff6 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-4.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-4.c @@ -36,10 +36,10 @@ TEST_ALL (DEF_LOOP) -/* NOTE: int abs operator is converted to vneg.v + vmax.vv */ -/* { dg-final { scan-assembler-times {\tvneg\.v\tv[0-9]+,v[0-9]+} 8 } } */ +/* NOTE: int abs operator is converted to vneg.v (or vsrub.vi) + vmax.vv */ +/* { dg-final { scan-assembler-times {\tvrsub\.vi\tv[0-9]+,v[0-9]+} 8 } } */ /* { dg-final { scan-assembler-times {\tvmax\.vv\tv[0-9]+,v[0-9]+,v[0-9]+} 4 } } */ -/* { dg-final { scan-assembler-times {\tvneg\.v\tv[0-9]+,v[0-9]+,v0\.t} 4 } } */ +/* { dg-final { scan-assembler-times {\tvrsub\.vi\tv[0-9]+,v[0-9]+,0,v0\.t} 4 } } */ /* { dg-final { scan-assembler-times {\tvnot\.v\tv[0-9]+,v[0-9]+,v0\.t} 4 } } */ /* { dg-final { scan-assembler-times {\tvfabs\.v\tv[0-9]+,v[0-9]+,v0\.t} 3 } } */ /* { dg-final { scan-assembler-times {\tvfneg\.v\tv[0-9]+,v[0-9]+,v0\.t} 3 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-5.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-5.c index 7608954..613a299 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-5.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-5.c @@ -31,10 +31,10 @@ TEST_ALL (DEF_LOOP) -/* NOTE: int abs operator is converted to vneg.v + vmax.vv */ -/* { dg-final { scan-assembler-times {\tvneg\.v\tv[0-9]+,v[0-9]+} 12 } } */ +/* NOTE: int abs operator is converted to vneg.v (or vsrub.vi) + vmax.vv */ +/* { dg-final { scan-assembler-times {\tvrsub\.vi\tv[0-9]+,v[0-9]+} 12 } } */ /* { dg-final { scan-assembler-times {\tvmax\.vv\tv[0-9]+,v[0-9]+,v[0-9]+} 6 } } */ -/* { dg-final { scan-assembler-times {\tvneg\.v\tv[0-9]+,v[0-9]+,v0\.t} 6 } } */ +/* { dg-final { scan-assembler-times {\tvrsub\.vi\tv[0-9]+,v[0-9]+,0,v0\.t} 6 } } */ /* { dg-final { scan-assembler-times {\tvnot\.v\tv[0-9]+,v[0-9]+,v0\.t} 6 } } */ /* NOTE: int abs operator cannot combine the vmerge. */ /* { dg-final { scan-assembler-times {\tvf?merge\.v[vxi]m\t} 6 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-6.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-6.c index 6dfb57e..8008f5b 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-6.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-6.c @@ -34,10 +34,10 @@ TEST_ALL (DEF_LOOP) -/* NOTE: int abs operator is converted to vneg.v + vmax.vv */ -/* { dg-final { scan-assembler-times {\tvneg\.v\tv[0-9]+,v[0-9]+} 12 } } */ +/* NOTE: int abs operator is converted to vneg.v (or vsrub.vi) + vmax.vv */ +/* { dg-final { scan-assembler-times {\tvrsub\.vi\tv[0-9]+,v[0-9]+} 12 } } */ /* { dg-final { scan-assembler-times {\tvmax\.vv\tv[0-9]+,v[0-9]+,v[0-9]+} 6 } } */ -/* { dg-final { scan-assembler-times {\tvneg\.v\tv[0-9]+,v[0-9]+,v0\.t} 6 } } */ +/* { dg-final { scan-assembler-times {\tvrsub\.vi\tv[0-9]+,v[0-9]+,0,v0\.t} 6 } } */ /* { dg-final { scan-assembler-times {\tvnot\.v\tv[0-9]+,v[0-9]+,v0\.t} 6 } } */ /* NOTE: int abs operator cannot combine the vmerge. */ /* { dg-final { scan-assembler-times {\tvf?merge\.v[vxi]m\t} 6 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-7.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-7.c index ca24a33..e5456b7 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-7.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-7.c @@ -31,10 +31,10 @@ TEST_ALL (DEF_LOOP) -/* NOTE: int abs operator is converted to vneg.v + vmax.vv */ -/* { dg-final { scan-assembler-times {\tvneg\.v\tv[0-9]+,v[0-9]+} 12 } } */ +/* NOTE: int abs operator is converted to vneg.v (or vsrub.vi) + vmax.vv */ +/* { dg-final { scan-assembler-times {\tvrsub\.vi\tv[0-9]+,v[0-9]+} 12 } } */ /* { dg-final { scan-assembler-times {\tvmax\.vv\tv[0-9]+,v[0-9]+,v[0-9]+} 6 } } */ -/* { dg-final { scan-assembler-times {\tvneg\.v\tv[0-9]+,v[0-9]+,v0\.t} 6 } } */ +/* { dg-final { scan-assembler-times {\tvrsub\.vi\tv[0-9]+,v[0-9]+,0,v0\.t} 6 } } */ /* { dg-final { scan-assembler-times {\tvnot\.v\tv[0-9]+,v[0-9]+,v0\.t} 6 } } */ /* NOTE: int abs operator cannot combine the vmerge. */ /* { dg-final { scan-assembler-times {\tvf?merge\.v[vxi]m\t} 6 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-8.c index 7be4b37..c88f876 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_unary-8.c @@ -31,10 +31,10 @@ TEST_ALL (DEF_LOOP) -/* NOTE: int abs operator is converted to vneg.v + vmax.vv */ -/* { dg-final { scan-assembler-times {\tvneg\.v\tv[0-9]+,v[0-9]+} 12 } } */ +/* NOTE: int abs operator is converted to vneg.v (or vsrub.vi) + vmax.vv */ +/* { dg-final { scan-assembler-times {\tvrsub\.vi\tv[0-9]+,v[0-9]+} 12 } } */ /* { dg-final { scan-assembler-times {\tvmax\.vv\tv[0-9]+,v[0-9]+,v[0-9]+} 6 } } */ -/* { dg-final { scan-assembler-times {\tvneg\.v\tv[0-9]+,v[0-9]+,v0\.t} 6 } } */ +/* { dg-final { scan-assembler-times {\tvrsub\.vi\tv[0-9]+,v[0-9]+,0,v0\.t} 6 } } */ /* { dg-final { scan-assembler-times {\tvnot\.v\tv[0-9]+,v[0-9]+,v0\.t} 6 } } */ /* NOTE: int abs operator cannot combine the vmerge. */ /* { dg-final { scan-assembler-times {\tvf?merge\.v[vxi]m\t} 6 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vncvt-rv32gcv.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vncvt-rv32gcv.c index cc3d624..011248c 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vncvt-rv32gcv.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vncvt-rv32gcv.c @@ -3,4 +3,4 @@ #include "vncvt-template.h" -/* { dg-final { scan-assembler-times {\tvncvt.x.x.w} 10 } } */ +/* { dg-final { scan-assembler-times {\tvnsrl.wi} 10 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vncvt-rv64gcv.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vncvt-rv64gcv.c index 0b43787..9e58f5d 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vncvt-rv64gcv.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vncvt-rv64gcv.c @@ -3,4 +3,4 @@ #include "vncvt-template.h" -/* { dg-final { scan-assembler-times {\tvncvt.x.x.w} 10 } } */ +/* { dg-final { scan-assembler-times {\tvnsrl.wi} 10 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr118832.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr118832.c new file mode 100644 index 0000000..db0b12b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr118832.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zbb -mabi=lp64d -O3" } */ + +int *a; +void b(int *); +void c(int *g, short h) { + int d[8], e[8]; + for (int f = 0; f < h; f++) + d[f] = g[f] << 24 | (g[f] & 4278190080) >> 24; + b(d); + for (int f = 0; f < h; f++) + a[f] = e[f] << 24 | (e[f] & 4278190080) >> 24; +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u16.c index 2d00b9b..2261872 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u16.c @@ -7,4 +7,4 @@ DEF_VEC_SAT_U_SUB_TRUNC_FMT_1(uint16_t, uint32_t) /* { dg-final { scan-tree-dump-times ".SAT_SUB " 1 "optimized" } } */ /* { dg-final { scan-assembler-times {vssubu\.vx} 1 } } */ -/* { dg-final { scan-assembler-times {vncvt\.x\.x\.w} 1 } } */ +/* { dg-final { scan-assembler-times {vnsrl\.wi} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u32.c index 287adf0..4250567 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u32.c @@ -7,4 +7,4 @@ DEF_VEC_SAT_U_SUB_TRUNC_FMT_1(uint32_t, uint64_t) /* { dg-final { scan-tree-dump-times ".SAT_SUB " 1 "optimized" } } */ /* { dg-final { scan-assembler-times {vssubu\.vx} 1 } } */ -/* { dg-final { scan-assembler-times {vncvt\.x\.x\.w} 1 } } */ +/* { dg-final { scan-assembler-times {vnsrl\.wi} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u8.c index 946480c..656aad7 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_trunc-1-u8.c @@ -7,4 +7,4 @@ DEF_VEC_SAT_U_SUB_TRUNC_FMT_1(uint8_t, uint16_t) /* { dg-final { scan-tree-dump-times ".SAT_SUB " 1 "optimized" } } */ /* { dg-final { scan-assembler-times {vssubu\.vx} 1 } } */ -/* { dg-final { scan-assembler-times {vncvt\.x\.x\.w} 1 } } */ +/* { dg-final { scan-assembler-times {vnsrl\.wi} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/abs-rv32gcv.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/abs-rv32gcv.c index 3f62d0e..379df7f 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/abs-rv32gcv.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/abs-rv32gcv.c @@ -4,6 +4,6 @@ #include "abs-template.h" /* { dg-final { scan-assembler-times {\tvseti?vli\s+[a-z0-9,]+,ta,ma} 7 } } */ -/* { dg-final { scan-assembler-times {\tvneg\.v} 4 } } */ +/* { dg-final { scan-assembler-times {\tvrsub\.vi} 4 } } */ /* { dg-final { scan-assembler-times {\tvmax\.vv\sv[0-9]+,v[0-9]+,v[0-9]+} 4 } } */ /* { dg-final { scan-assembler-times {\tvfabs.v} 3 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/abs-rv64gcv.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/abs-rv64gcv.c index 6430219..e75ae2e 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/abs-rv64gcv.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/abs-rv64gcv.c @@ -4,6 +4,6 @@ #include "abs-template.h" /* { dg-final { scan-assembler-times {\tvseti?vli\s+[a-z0-9,]+,ta,ma} 7 } } */ -/* { dg-final { scan-assembler-times {\tvneg\.v} 4 } } */ +/* { dg-final { scan-assembler-times {\tvrsub\.vi} 4 } } */ /* { dg-final { scan-assembler-times {\tvmax\.vv\sv[0-9]+,v[0-9]+,v[0-9]+} 4 } } */ /* { dg-final { scan-assembler-times {\tvfabs.v} 3 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vneg-rv32gcv.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vneg-rv32gcv.c index 66b512e..3ea1dc3 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vneg-rv32gcv.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vneg-rv32gcv.c @@ -3,5 +3,5 @@ #include "vneg-template.h" -/* { dg-final { scan-assembler-times {\tvneg\.v} 4 } } */ +/* { dg-final { scan-assembler-times {\tvrsub\.vi} 4 } } */ /* { dg-final { scan-assembler-times {\tvfneg\.v} 3 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vneg-rv64gcv.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vneg-rv64gcv.c index d32c6a1..ed84820 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vneg-rv64gcv.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/unop/vneg-rv64gcv.c @@ -3,5 +3,5 @@ #include "vneg-template.h" -/* { dg-final { scan-assembler-times {\tvneg\.v} 4 } } */ +/* { dg-final { scan-assembler-times {\tvrsub\.vi} 4 } } */ /* { dg-final { scan-assembler-times {\tvfneg\.v} 3 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/abs-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/abs-2.c index 510939a..e0272dd 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/abs-2.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/abs-2.c @@ -45,7 +45,7 @@ DEF_OP_V (neg, 128, int64_t, __builtin_abs) DEF_OP_V (neg, 256, int64_t, __builtin_abs) DEF_OP_V (neg, 512, int64_t, __builtin_abs) -/* { dg-final { scan-assembler-times {vneg\.v} 38 } } */ +/* { dg-final { scan-assembler-times {vrsub\.vi} 38 } } */ /* { dg-final { scan-assembler-times {vmax\.vv} 38 } } */ /* { dg-final { scan-assembler-not {csrr} } } */ /* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_convert-11.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_convert-11.c index 2a9a9ad..07740f8 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_convert-11.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_convert-11.c @@ -37,7 +37,7 @@ DEF_COND_FP_CONVERT (fncvt, df, uhi, uint16_t, 128) DEF_COND_FP_CONVERT (fncvt, df, uhi, uint16_t, 256) DEF_COND_FP_CONVERT (fncvt, df, uhi, uint16_t, 512) -/* { dg-final { scan-assembler-times {vncvt\.x\.x\.w\s+v[0-9]+,\s*v[0-9]+,\s*v0.t} 30 } } */ +/* { dg-final { scan-assembler-times {vnsrl\.wi\s+v[0-9]+,\s*v[0-9]+,0,\s*v0.t} 30 } } */ /* { dg-final { scan-assembler-not {csrr} } } */ /* { dg-final { scan-assembler-not {vmerge} } } */ /* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_convert-12.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_convert-12.c index 4444ad8..cc5a7cd 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_convert-12.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_convert-12.c @@ -19,7 +19,7 @@ DEF_COND_FP_CONVERT (fncvt, df, uqi, uint8_t, 128) DEF_COND_FP_CONVERT (fncvt, df, uqi, uint8_t, 256) DEF_COND_FP_CONVERT (fncvt, df, uqi, uint8_t, 512) -/* { dg-final { scan-assembler-times {vncvt\.x\.x\.w\s+v[0-9]+,\s*v[0-9]+,\s*v0.t} 14 } } */ +/* { dg-final { scan-assembler-times {vnsrl\.wi\s+v[0-9]+,\s*v[0-9]+,0,\s*v0.t} 14 } } */ /* { dg-final { scan-assembler-not {csrr} } } */ /* { dg-final { scan-assembler-not {vmerge} } } */ /* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_neg-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_neg-1.c index 1da9312..f356887 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_neg-1.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_neg-1.c @@ -45,7 +45,7 @@ DEF_COND_UNOP (cond_neg, 128, v128di, -) DEF_COND_UNOP (cond_neg, 256, v256di, -) DEF_COND_UNOP (cond_neg, 512, v512di, -) -/* { dg-final { scan-assembler-times {vneg\.v\s+v[0-9]+,\s*v[0-9]+,\s*v0.t} 38 } } */ +/* { dg-final { scan-assembler-times {vrsub\.vi\s+v[0-9]+,\s*v[0-9]+,0,\s*v0.t} 38 } } */ /* { dg-final { scan-assembler-not {csrr} } } */ /* { dg-final { scan-assembler-not {vmerge} } } */ /* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_trunc-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_trunc-1.c index dce94c5..7b3bc5e 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_trunc-1.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_trunc-1.c @@ -55,7 +55,7 @@ DEF_COND_CONVERT (trunc, v128udi, v128usi, 128) DEF_COND_CONVERT (trunc, v256udi, v256usi, 256) DEF_COND_CONVERT (trunc, v512udi, v512usi, 512) -/* { dg-final { scan-assembler-times {vncvt\.x\.x\.w\s+v[0-9]+,\s*v[0-9]+,\s*v0.t} 46 } } */ +/* { dg-final { scan-assembler-times {vnsrl\.wi\s+v[0-9]+,\s*v[0-9]+,0,\s*v0.t} 46 } } */ /* { dg-final { scan-assembler-not {csrr} } } */ /* { dg-final { scan-assembler-not {vmerge} } } */ /* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_trunc-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_trunc-2.c index 2a0d8bd..fa7ef19 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_trunc-2.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_trunc-2.c @@ -37,7 +37,7 @@ DEF_COND_CONVERT (trunc, v128udi, v128uhi, 128) DEF_COND_CONVERT (trunc, v256udi, v256uhi, 256) DEF_COND_CONVERT (trunc, v512udi, v512uhi, 512) -/* { dg-final { scan-assembler-times {vncvt\.x\.x\.w\s+v[0-9]+,\s*v[0-9]+,\s*v0.t} 30 } } */ +/* { dg-final { scan-assembler-times {vnsrl\.wi\s+v[0-9]+,\s*v[0-9]+,0,\s*v0.t} 30 } } */ /* { dg-final { scan-assembler-not {csrr} } } */ /* { dg-final { scan-assembler-not {vmerge} } } */ /* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_trunc-3.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_trunc-3.c index 510c656..532c50b 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_trunc-3.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/cond_trunc-3.c @@ -19,7 +19,7 @@ DEF_COND_CONVERT (trunc, v128udi, v128uqi, 128) DEF_COND_CONVERT (trunc, v256udi, v256uqi, 256) DEF_COND_CONVERT (trunc, v512udi, v512uqi, 512) -/* { dg-final { scan-assembler-times {vncvt\.x\.x\.w\s+v[0-9]+,\s*v[0-9]+,\s*v0.t} 14 } } */ +/* { dg-final { scan-assembler-times {vnsrl\.wi\s+v[0-9]+,\s*v[0-9]+,0,\s*v0.t} 14 } } */ /* { dg-final { scan-assembler-not {csrr} } } */ /* { dg-final { scan-assembler-not {vmerge} } } */ /* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/convert-11.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/convert-11.c index 9f96da75..c3191fd 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/convert-11.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/convert-11.c @@ -38,7 +38,7 @@ DEF_CONVERT (fncvt, double, uint16_t, 256) DEF_CONVERT (fncvt, double, uint16_t, 512) /* { dg-final { scan-assembler-times {vfncvt\.rtz\.x\.f.w} 30 } } */ -/* { dg-final { scan-assembler-times {vncvt\.x\.x\.w} 30 } } */ +/* { dg-final { scan-assembler-times {vnsrl\.wi} 30 } } */ /* { dg-final { scan-assembler-not {csrr} } } */ /* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */ /* { dg-final { scan-tree-dump-not "2,2" "optimized" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/convert-12.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/convert-12.c index 858c915..730195c 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/convert-12.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/convert-12.c @@ -20,7 +20,7 @@ DEF_CONVERT (fncvt, double, uint8_t, 256) DEF_CONVERT (fncvt, double, uint8_t, 512) /* { dg-final { scan-assembler-times {vfncvt\.rtz\.x\.f.w} 14 } } */ -/* { dg-final { scan-assembler-times {vncvt\.x\.x\.w} 28 } } */ +/* { dg-final { scan-assembler-times {vnsrl\.wi} 28 } } */ /* { dg-final { scan-assembler-not {csrr} } } */ /* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */ /* { dg-final { scan-tree-dump-not "2,2" "optimized" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/neg-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/neg-1.c index fb58d2e..305a533 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/neg-1.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/neg-1.c @@ -53,5 +53,5 @@ DEF_OP_V (neg, 128, int64_t, -) DEF_OP_V (neg, 256, int64_t, -) DEF_OP_V (neg, 512, int64_t, -) -/* { dg-final { scan-assembler-times {vneg\.v\s+v[0-9]+,\s*v[0-9]+} 42 } } */ +/* { dg-final { scan-assembler-times {vrsub\.vi\s+v[0-9]+,\s*v[0-9]+,\s*0} 42 } } */ /* { dg-final { scan-assembler-not {csrr} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/trunc-1.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/trunc-1.c index c197db3..dbb671c 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/trunc-1.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/trunc-1.c @@ -55,7 +55,7 @@ DEF_CONVERT (trunc, uint64_t, uint32_t, 64) DEF_CONVERT (trunc, uint64_t, uint32_t, 128) DEF_CONVERT (trunc, uint64_t, uint32_t, 256) -/* { dg-final { scan-assembler-times {vncvt\.x\.x\.w} 46 } } */ +/* { dg-final { scan-assembler-times {vnsrl\.wi} 46 } } */ /* { dg-final { scan-assembler-not {csrr} } } */ /* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */ /* { dg-final { scan-tree-dump-not "2,2" "optimized" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/trunc-2.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/trunc-2.c index 25bb2a2..93374f4 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/trunc-2.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/trunc-2.c @@ -37,7 +37,7 @@ DEF_CONVERT (trunc, uint64_t, uint16_t, 128) DEF_CONVERT (trunc, uint64_t, uint16_t, 256) DEF_CONVERT (trunc, uint64_t, uint16_t, 512) -/* { dg-final { scan-assembler-times {vncvt\.x\.x\.w} 60 } } */ +/* { dg-final { scan-assembler-times {vnsrl\.wi} 60 } } */ /* { dg-final { scan-assembler-not {csrr} } } */ /* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */ /* { dg-final { scan-tree-dump-not "2,2" "optimized" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/trunc-3.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/trunc-3.c index 1993c63..2977036 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/trunc-3.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/trunc-3.c @@ -19,7 +19,7 @@ DEF_CONVERT (trunc, uint64_t, uint8_t, 128) DEF_CONVERT (trunc, uint64_t, uint8_t, 256) DEF_CONVERT (trunc, uint64_t, uint8_t, 512) -/* { dg-final { scan-assembler-times {vncvt\.x\.x\.w} 42 } } */ +/* { dg-final { scan-assembler-times {vnsrl\.wi} 42 } } */ /* { dg-final { scan-assembler-not {csrr} } } */ /* { dg-final { scan-tree-dump-not "1,1" "optimized" } } */ /* { dg-final { scan-tree-dump-not "2,2" "optimized" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/simplify-vdiv.c b/gcc/testsuite/gcc.target/riscv/rvv/base/simplify-vdiv.c index b9fcfe7..3c7b89a 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/simplify-vdiv.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/simplify-vdiv.c @@ -15,4 +15,4 @@ VDIV_WITH_LMUL (1, 16) VDIV_WITH_LMUL (1, 32) -/* { dg-final { scan-assembler-times {vneg\.v} 2 } } */ +/* { dg-final { scan-assembler-times {vrsub\.vi} 2 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/unop_v_constraint-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/unop_v_constraint-1.c index 64f4407..3db832b 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/base/unop_v_constraint-1.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/unop_v_constraint-1.c @@ -8,8 +8,8 @@ ** ... ** vle32\.v\tv[0-9]+,0\([a-x0-9]+\) ** vle32\.v\tv[0-9]+,0\([a-x0-9]+\) -** vneg\.v\tv[0-9]+,\s*v[0-9]+ -** vneg\.v\tv[0-9]+,\s*v[0-9]+ +** vrsub\.vi\tv[0-9]+,\s*v[0-9]+,\s*0 +** vrsub\.vi\tv[0-9]+,\s*v[0-9]+,\s*0 ** vse32\.v\tv[0-9]+,0\([a-x0-9]+\) ** ret */ @@ -28,8 +28,8 @@ void f1 (void * in, void *out) ** vlm.v\tv[0-9]+,0\([a-x0-9]+\) ** ... ** vle32.v\tv[0-9]+,0\([a-x0-9]+\),v0.t -** vneg\.v\tv[0-9]+,\s*v[0-9]+ -** vneg\.v\tv[1-9][0-9]?,\s*v[0-9]+,\s*v0.t +** vrsub\.vi\tv[0-9]+,\s*v[0-9]+,\s*0 +** vrsub\.vi\tv[0-9]+,\s*v[0-9]+,\s*0,\s*v0.t ** vse32.v\tv[0-9]+,0\([a-x0-9]+\) ** ret */ @@ -51,8 +51,8 @@ void f2 (void * in, void *out) ** ... ** vle32\.v\tv[0-9]+,0\([a-x0-9]+\) ** vle32.v\tv[0-9]+,0\([a-x0-9]+\),v0.t -** vneg\.v\tv[0-9]+,\s*v[0-9]+ -** vneg\.v\tv[1-9][0-9]?,\s*v[0-9]+,\s*v0.t +** vrsub\.vi\tv[0-9]+,\s*v[0-9]+,\s*0 +** vrsub\.vi\tv[0-9]+,\s*v[0-9]+,\s*0,\s*v0.t ** vse32.v\tv[0-9]+,0\([a-x0-9]+\) ** ret */ @@ -72,8 +72,8 @@ void f3 (void * in, void *out) ** ... ** vle8\.v\tv[0-9]+,0\([a-x0-9]+\) ** vle8\.v\tv[0-9]+,0\([a-x0-9]+\) -** vneg\.v\tv[0-9]+,\s*v[0-9]+ -** vneg\.v\tv[0-9]+,\s*v[0-9]+ +** vrsub\.vi\tv[0-9]+,\s*v[0-9]+,\s*0 +** vrsub\.vi\tv[0-9]+,\s*v[0-9]+,\s*0 ** vse8\.v\tv[0-9]+,0\([a-x0-9]+\) ** ret */ @@ -92,8 +92,8 @@ void f4 (void * in, void *out) ** vlm.v\tv[0-9]+,0\([a-x0-9]+\) ** ... ** vle8.v\tv[0-9]+,0\([a-x0-9]+\),v0.t -** vneg\.v\tv[0-9]+,\s*v[0-9]+ -** vneg\.v\tv[1-9][0-9]?,\s*v[0-9]+,\s*v0.t +** vrsub\.vi\tv[0-9]+,\s*v[0-9]+,\s*0 +** vrsub\.vi\tv[0-9]+,\s*v[0-9]+,\s*0,\s*v0.t ** vse8.v\tv[0-9]+,0\([a-x0-9]+\) ** ret */ @@ -115,8 +115,8 @@ void f5 (void * in, void *out) ** ... ** vle8\.v\tv[0-9]+,0\([a-x0-9]+\) ** vle8.v\tv[0-9]+,0\([a-x0-9]+\),v0.t -** vneg\.v\tv[0-9]+,\s*v[0-9]+ -** vneg\.v\tv[1-9][0-9]?,\s*v[0-9]+,\s*v0.t +** vrsub\.vi\tv[0-9]+,\s*v[0-9]+,\s*0 +** vrsub\.vi\tv[0-9]+,\s*v[0-9]+,\s*0,\s*v0.t ** vse8.v\tv[0-9]+,0\([a-x0-9]+\) ** ret */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr114194-rv32.c b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr114194-rv32.c new file mode 100644 index 0000000..f95e713 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr114194-rv32.c @@ -0,0 +1,51 @@ +/* { dg-do compile { target { { ! riscv_abi_e } && rv32 } } } */ +/* { dg-options "-march=rv32gc_xtheadvector -O2" } */ +/* { dg-final { check-function-bodies "**" "" } } */ + +/* +** foo0_1: +** sb\tzero,0\([a-x0-9]+\) +** ret +*/ +void foo0_1 (void *p) +{ + __builtin_memset (p, 0, 1); +} + +/* +** foo0_7: +** li\t[a-x0-9]+,7 +** th.vsetvli\tzero,[a-x0-9]+,e8,m1 +** th\.vmv\.v\.i\tv[0-9],0 +** th\.vse\.v\tv[0-9]+,0\([a-x0-9]+\) +** ret +*/ +void foo0_7 (void *p) +{ + __builtin_memset (p, 0, 7); +} + +/* +** foo1_1: +** li\t[a-x0-9]+,1 +** sb\t[a-x0-9]+,0\([a-x0-9]+\) +** ret +*/ +void foo1_1 (void *p) +{ + __builtin_memset (p, 1, 1); +} + +/* +** foo1_5: +** li\t[a-x0-9]+,5 +** th.vsetvli\tzero,[a-x0-9]+,e8,m1 +** th\.vmv\.v\.i\tv[0-9],1 +** th\.vse\.v\tv[0-9]+,0\([a-x0-9]+\) +** ret +*/ + +void foo1_5 (void *p) +{ + __builtin_memset (p, 1, 5); +} diff --git a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr114194.c b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr114194-rv64.c index 5c9777b..ee0b49f 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr114194.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr114194-rv64.c @@ -1,6 +1,5 @@ -/* { dg-do compile { target { ! riscv_abi_e } } } */ -/* { dg-options "-march=rv32gc_xtheadvector -O2" { target { rv32 } } } */ -/* { dg-options "-march=rv64gc_xtheadvector -O2" { target { rv64 } } } */ +/* { dg-do compile { target { { ! riscv_abi_e } && rv64 } } } */ +/* { dg-options "-march=rv64gc_xtheadvector -O2" } */ /* { dg-final { check-function-bodies "**" "" } } */ /* diff --git a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr118601.c b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr118601.c new file mode 100644 index 0000000..c4ef7a1 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr118601.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target { ! riscv_abi_e } } } */ +/* { dg-options "-march=rv32gc_xtheadvector -O2" { target { rv32 } } } */ +/* { dg-options "-march=rv64gc_xtheadvector -O2" { target { rv64 } } } */ +/* { dg-final { check-function-bodies "**" "" } } */ + +/* +** foo1_16: +** li\t[a-x0-9]+,16 +** th.vsetvli\tzero,[a-x0-9]+,e8,m1 +** th\.vmv\.v\.i\tv[0-9],1 +** th\.vse\.v\tv[0-9]+,0\([a-x0-9]+\) +** ret +*/ + +void foo1_16 (void *p) +{ + __builtin_memset (p, 1, 16); +} diff --git a/gcc/testsuite/gcc.target/s390/pr118835.c b/gcc/testsuite/gcc.target/s390/pr118835.c new file mode 100644 index 0000000..1ca6cd9 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pr118835.c @@ -0,0 +1,21 @@ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O2" } */ + +/* During combine we may end up with patterns of the form + + (set (reg:DI 66 [ _6 ]) + (ashift:DI (reg:DI 72 [ x ]) + (subreg:QI (and:TI (reg:TI 67 [ _1 ]) + (const_wide_int 0x0aaaaaaaaaaaaaabf)) + 15))) + + which should be rejected since the shift count does not trivially fit the + scheme of address operands. */ + +long +test (long x, int y) +{ + __int128 z = 0xAAAAAAAAAAAAAABF; + z &= y; + return x << z; +} diff --git a/gcc/testsuite/gfortran.dg/gomp/pr118790.f90 b/gcc/testsuite/gfortran.dg/gomp/pr118790.f90 new file mode 100644 index 0000000..0a2aa36 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/pr118790.f90 @@ -0,0 +1,182 @@ +! PR debug/118790 +! { dg-do compile } +! { dg-options "-O2 -g -fopenmp --param ggc-min-expand=0 --param ggc-min-heapsize=0" } + +module ec_args_mod + private + public :: ec_argc, ec_argv, ec_args + interface + function ec_argc() bind(c,name="ec_argc") result(argc) + end function + end interface +contains + function ec_argv(iarg) result(argv) + use, intrinsic :: iso_c_binding + character(len=:), allocatable :: argv + type(c_ptr), pointer :: argv_cptrs(:) + argv = to_string (argv_cptrs(iarg+1), 1024) + end function + subroutine ec_args() + use, intrinsic :: iso_c_binding + integer :: argc + type(c_ptr) :: argv(512) + if (ec_argc() == 0) then + call read_command_line(argc,argv) + end if + end subroutine + function to_string(cptr,maxlen) result(string) + use, intrinsic :: iso_c_binding + character(len=:), allocatable :: string + type(c_ptr) :: cptr + character(kind=c_char,len=1), pointer :: s(:) + call c_f_pointer (cptr, s, (/maxlen/)) + do + if (s(i) == c_null_char) exit + i = i + 1 + end do + nchars = i - 1 + allocate (character(len=(nchars)) :: string) + do i=1,nchars + string(i:i) = s(i) + end do + end function + subroutine read_command_line(argc,argv) + use, intrinsic :: iso_c_binding + integer, parameter :: cmd_max_len = 1024 * 512 + integer(c_int) :: argc + type(c_ptr) :: argv(:) + character(kind=c_char,len=1), save, target :: args(cmd_max_len) + character(kind=c_char,len=cmd_max_len), save, target :: cmd + character(kind=c_char,len=cmd_max_len) :: arg + integer(c_int) :: iarg, arglen, pos, ich, argpos + do ich=1,len(cmd) + if (cmd(ich:ich) == " ") then + cmd(ich:ich) = c_null_char + end if + end do + do iarg=1,argc + do ich=1,arglen + args(pos) = arg(ich:ich) + end do + args(pos) = c_null_char; pos = pos+1 + argv(iarg+1) = c_loc(args(argpos)) + end do + end subroutine +end module +module mpl_mpif + integer mpi_status_size +end module mpl_mpif +subroutine ec_meminfo(ku,cdstring,kcomm,kbarr,kiotask,kcall) + use mpl_mpif + interface + subroutine ec_pmon(energy,power) + end subroutine ec_pmon + end interface + character(len=*), intent(in) :: cdstring + integer :: ii,jj,i,j,k,myproc,nproc,len,error,nodenum,jid + integer :: tasksmall,nodehuge,memfree,cached,nfree + integer :: nnuma + integer,dimension(:),allocatable,save :: smallpage,hugepage + integer :: n18 + integer,dimension(:,:),allocatable,save :: node, bucket + character(len=256) :: clstr + character(len=20) :: nodename,lastnode,clmaxnode + character(len=160) ::line + character(len=5+1+len(cdstring)) :: id_string + integer :: irecv_status(mpi_status_size) + logical :: llnocomm, llnohdr + logical, save :: llfirst_time = .true. + type ranknode_t + integer :: nodenum + integer :: pid + integer :: rank_world + integer :: rank + integer :: iorank + integer :: nodemaster + integer, allocatable :: coreids(:) + character(len=len(clstr)) :: str + end type + type (ranknode_t), allocatable, save :: rn(:) + integer, allocatable :: coreids(:) + character(len=64) :: clpfx + if (llfirst_time .and. .not. llnocomm) then + allocate(coreids(0:maxth-1)) + coreids(:) = -1 +!$omp parallel num_threads(maxth) shared(coreids) private(i,myth,icoreid) + do i=1,maxth + icoreid = ec_coreid() + myth = omp_get_thread_num() + coreids(myth) = icoreid + end do +!$omp end parallel + if (myproc == 0) then + call slash_proc + allocate(rn(0:nproc-1)) + do i=0,nproc-1 + rn(i)%nodenum = -1 + if (i > 0) then + call mpi_recv(lastnode, len(lastnode), mpi_byte, i, itag, kcomm, irecv_status, error) + call check_error("from mpi_recv(lastnode)","/tmp/fiat/src/fiat/util/ec_meminfo.f90",258) + call mpi_comm_rank(mpi_comm_world,k,error) + rn(i)%rank = 0 + rn(i)%str = cdstring + rn(i)%pid = ec_getpid() + end if + rn(i)%rank_world = k + rn(i)%iorank = iorank + rn(i)%nodemaster = 0 + call check_error("from mpi_send(iam_nodemaster)","/tmp/fiat/src/fiat/util/ec_meminfo.f90",305) + end do + call mpi_send(clstr,len(clstr),mpi_byte,0,itag+5,kcomm,error) + call mpi_send(clstr,maxth,mpi_integer4,0,itag+6,kcomm,error) + call mpi_recv(lastnode,1,mpi_integer4,0,itag+7,kcomm,irecv_status,error) + end if + end if +contains + subroutine slash_proc + read(line(idx+iclkeylen-1:),*,err=99,end=98) node(:,0) +98 continue + do k=1,maxnuma-1 + read(line(idx+iclkeylen-1:),*,err=99) node(0:n18-1,k) + end do +99 continue + close(502) + smallpage(:) = 0 + do k=0,nnuma-1 + do j=0,n18-1 + end do + smallpage(k) = sum(bucket(0:8,k))/onemega + hugepage(k) = sum(bucket(9:n18-1,k))/onemega + end do + open(file="/proc/meminfo",unit=502,status="old",action="read",err=977) + do i=1,10 + read(502,'(a)',err=988,end=988) line + if(line(1:7) == "memfree") then + read(line(9:80),*) memfree + else if(line(1:6) == "cached") then + read(line(8:80),*) cached + end if + end do +988 continue + close(502) +977 continue + memfree=memfree/1024 + end subroutine slash_proc + subroutine prt_data(kun,knodenum,cdlastnode,kcall) + character(len=4096) :: clbuf + write(clbuf(ilen+1:),'(2x,2i8,3x,2f6.1,1x,i9,1x,i6,1x,a7,1x,a)') trim(id_string) + end subroutine prt_data + subroutine check_error(clwhat,srcfile,srcline) + character(len=*), intent(in) :: clwhat, srcfile + integer, intent(in) :: srcline + if (error /= 0) then + write(0,'(a,i0,1x,a,1x,"(",a,":",i0,")")') & + & clpfx(1:ipfxlen)//"## ec_meminfo error code =",error,clwhat,srcfile,srcline + call mpi_abort(kcomm,-1,error) + end if + end subroutine check_error + subroutine rnsort(kun) + do i=0,nproc-1 + end do + end subroutine rnsort +end subroutine ec_meminfo diff --git a/gcc/testsuite/gfortran.dg/interface_52.f90 b/gcc/testsuite/gfortran.dg/interface_52.f90 new file mode 100644 index 0000000..4d61924 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/interface_52.f90 @@ -0,0 +1,20 @@ + ! { dg-do compile } +MODULE m + IMPLICIT NONE + +CONTAINS + + SUBROUTINE test () + IMPLICIT NONE + + CALL bar (test2) ! { dg-error "Interface mismatch in dummy procedure" } + END SUBROUTINE test + + INTEGER FUNCTION test2 () RESULT (x) + IMPLICIT NONE + + CALL bar (test) ! { dg-error "Interface mismatch in dummy procedure" } + END FUNCTION test2 + +END MODULE m + diff --git a/gcc/testsuite/gfortran.dg/interface_53.f90 b/gcc/testsuite/gfortran.dg/interface_53.f90 new file mode 100644 index 0000000..99a2b95 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/interface_53.f90 @@ -0,0 +1,8 @@ +! { dg-do compile } +! PR 118845 - reduced from a segfault in Lapack. +SUBROUTINE SDRVES( RESULT ) + external SSLECT + CALL SGEES( SSLECT ) + CALL SGEES( SSLECT ) + RESULT = SSLECT( 1, 2 ) +END diff --git a/gcc/testsuite/gfortran.dg/recursive_check_4.f03 b/gcc/testsuite/gfortran.dg/recursive_check_4.f03 index ece42ca..da45762 100644 --- a/gcc/testsuite/gfortran.dg/recursive_check_4.f03 +++ b/gcc/testsuite/gfortran.dg/recursive_check_4.f03 @@ -20,7 +20,7 @@ CONTAINS IMPLICIT NONE PROCEDURE(test2), POINTER :: procptr - CALL bar (test2) ! { dg-warning "Non-RECURSIVE" } + CALL bar2 (test2) ! { dg-warning "Non-RECURSIVE" } procptr => test2 ! { dg-warning "Non-RECURSIVE" } x = 1812 diff --git a/gcc/testsuite/gfortran.dg/recursive_check_6.f03 b/gcc/testsuite/gfortran.dg/recursive_check_6.f03 index 9414f58..732d7bc 100644 --- a/gcc/testsuite/gfortran.dg/recursive_check_6.f03 +++ b/gcc/testsuite/gfortran.dg/recursive_check_6.f03 @@ -31,7 +31,7 @@ CONTAINS bar = test_func () ! { dg-error "not RECURSIVE" } procptr => test_func ! { dg-warning "Non-RECURSIVE" } - CALL foobar (test_func) ! { dg-warning "Non-RECURSIVE" } + CALL foobar2 (test_func) ! { dg-warning "Non-RECURSIVE" } END FUNCTION bar END FUNCTION test_func diff --git a/gcc/testsuite/gfortran.dg/specifics_2.f90 b/gcc/testsuite/gfortran.dg/specifics_2.f90 index 4de0925..923ab9e 100644 --- a/gcc/testsuite/gfortran.dg/specifics_2.f90 +++ b/gcc/testsuite/gfortran.dg/specifics_2.f90 @@ -1,5 +1,6 @@ ! { dg-do compile } -! This is the list of intrinsics allowed as actual arguments + ! This is the list of intrinsics allowed as actual arguments + implicit none intrinsic abs,acos,acosh,aimag,aint,alog,alog10,amod,anint,asin,asinh,atan,& atan2,atanh,cabs,ccos,cexp,clog,conjg,cos,cosh,csin,csqrt,dabs,dacos,& dacosh,dasin,dasinh,datan,datan2,datanh,dconjg,dcos,dcosh,ddim,dexp,dim,& @@ -7,75 +8,75 @@ exp,iabs,idim,idnint,index,isign,len,mod,nint,sign,sin,sinh,sqrt,tan,& tanh,zabs,zcos,zexp,zlog,zsin,zsqrt - call foo(abs) - call foo(acos) - call foo(acosh) - call foo(aimag) - call foo(aint) - call foo(alog) - call foo(alog10) - call foo(amod) - call foo(anint) - call foo(asin) - call foo(asinh) - call foo(atan) - call foo(atan2) - call foo(atanh) - call foo(cabs) - call foo(ccos) - call foo(cexp) - call foo(clog) - call foo(conjg) - call foo(cos) - call foo(cosh) - call foo(csin) - call foo(csqrt) - call foo(dabs) - call foo(dacos) - call foo(dacosh) - call foo(dasin) - call foo(dasinh) - call foo(datan) - call foo(datan2) - call foo(datanh) - call foo(dconjg) - call foo(dcos) - call foo(dcosh) - call foo(ddim) - call foo(dexp) - call foo(dim) - call foo(dimag) - call foo(dint) - call foo(dlog) - call foo(dlog10) - call foo(dmod) - call foo(dnint) - call foo(dprod) - call foo(dsign) - call foo(dsin) - call foo(dsinh) - call foo(dsqrt) - call foo(dtan) - call foo(dtanh) - call foo(exp) - call foo(iabs) - call foo(idim) - call foo(idnint) - call foo(index) - call foo(isign) - call foo(len) - call foo(mod) - call foo(nint) - call foo(sign) - call foo(sin) - call foo(sinh) - call foo(sqrt) - call foo(tan) - call foo(tanh) - call foo(zabs) - call foo(zcos) - call foo(zexp) - call foo(zlog) - call foo(zsin) - call foo(zsqrt) + call foo_r4(abs) + call foo_r4(acos) + call foo_r4(acosh) + call foo_r4(aimag) + call foo_r4(aint) + call foo_r4(alog) + call foo_r4(alog10) + call foo_r4(amod) + call foo_r4(anint) + call foo_r4(asin) + call foo_r4(asinh) + call foo_r4(atan) + call foo_r4(atan2) + call foo_r4(atanh) + call foo_r4(cabs) + call foo_c4(ccos) + call foo_c4(cexp) + call foo_c4(clog) + call foo_c4(conjg) + call foo_r4(cos) + call foo_r4(cosh) + call foo_c4(csin) + call foo_c4(csqrt) + call foo_r8(dabs) + call foo_r8(dacos) + call foo_r8(dacosh) + call foo_r8(dasin) + call foo_r8(dasinh) + call foo_r8(datan) + call foo_r8(datan2) + call foo_r8(datanh) + call foo_c8(dconjg) + call foo_r8(dcos) + call foo_r8(dcosh) + call foo_r8(ddim) + call foo_r8(dexp) + call foo_r8(ddim) + call foo_r8(dimag) + call foo_r8(dint) + call foo_r8(dlog) + call foo_r8(dlog10) + call foo_r8(dmod) + call foo_r8(dnint) + call foo_r8(dprod) + call foo_r8(dsign) + call foo_r8(dsin) + call foo_r8(dsinh) + call foo_r8(dsqrt) + call foo_r8(dtan) + call foo_r8(dtanh) + call foo_r5(exp) + call foo_i4(iabs) + call foo_i4(idim) + call foo_i4(idnint) + call foo_i4(index) + call foo_i4(isign) + call foo_i4(len) + call foo_i4(mod) + call foo_i4(nint) + call foo_r4(sign) + call foo_r4(sin) + call foo_r4(sinh) + call foo_r4(sqrt) + call foo_r4(tan) + call foo_r4(tanh) + call foo_r8(zabs) + call foo_c8(zcos) + call foo_c8(zexp) + call foo_c8(zlog) + call foo_c8(zsin) + call foo_c8(zsqrt) end diff --git a/gcc/tree-iterator.cc b/gcc/tree-iterator.cc index db2219c..b7e2b42 100644 --- a/gcc/tree-iterator.cc +++ b/gcc/tree-iterator.cc @@ -284,6 +284,28 @@ tsi_delink (tree_stmt_iterator *i) i->ptr = next; } +/* Split a STATEMENT_LIST in I.contrainer into two, all statements + from the start until I.ptr inclusive will remain in the original + one, all statements after I.ptr are removed from that STATEMENT_LIST + and returned as a new STATEMENT_LIST. If I is the last statement, + an empty statement with LOC location is returned. */ + +tree +tsi_split_stmt_list (location_t loc, tree_stmt_iterator i) +{ + if (tsi_one_before_end_p (i)) + return build_empty_stmt (loc); + tsi_next (&i); + tree ret = NULL_TREE; + while (!tsi_end_p (i)) + { + tree t = tsi_stmt (i); + tsi_delink (&i); + append_to_statement_list_force (t, &ret); + } + return ret; +} + /* Return the first expression in a sequence of COMPOUND_EXPRs, or in a STATEMENT_LIST, disregarding DEBUG_BEGIN_STMTs, recursing into a STATEMENT_LIST if that's the first non-DEBUG_BEGIN_STMT. */ diff --git a/gcc/tree-iterator.h b/gcc/tree-iterator.h index 27795e9..d1bc901 100644 --- a/gcc/tree-iterator.h +++ b/gcc/tree-iterator.h @@ -138,6 +138,7 @@ extern void tsi_link_after (tree_stmt_iterator *, tree, enum tsi_iterator_update); extern void tsi_delink (tree_stmt_iterator *); +extern tree tsi_split_stmt_list (location_t, tree_stmt_iterator); extern tree alloc_stmt_list (void); extern void free_stmt_list (tree); diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc index 06f6b0c..8bb4578 100644 --- a/gcc/tree-ssa-sccvn.cc +++ b/gcc/tree-ssa-sccvn.cc @@ -2604,13 +2604,18 @@ vn_nary_build_or_lookup (gimple_match_op *res_op) tree vn_nary_simplify (vn_nary_op_t nary) { - if (nary->length > gimple_match_op::MAX_NUM_OPS) + if (nary->length > gimple_match_op::MAX_NUM_OPS + /* For CONSTRUCTOR the vn_nary_op_t and gimple_match_op representation + does not match. */ + || nary->opcode == CONSTRUCTOR) return NULL_TREE; gimple_match_op op (gimple_match_cond::UNCOND, nary->opcode, nary->type, nary->length); memcpy (op.ops, nary->op, sizeof (tree) * nary->length); tree res = vn_nary_build_or_lookup_1 (&op, false, true); - if (op.code.is_tree_code () && op.num_ops <= nary->length) + if (op.code.is_tree_code () + && op.num_ops <= nary->length + && (tree_code) op.code != CONSTRUCTOR) { nary->opcode = (tree_code) op.code; nary->length = op.num_ops; diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc index 06ca99e..56a4e9a 100644 --- a/gcc/tree-vect-loop-manip.cc +++ b/gcc/tree-vect-loop-manip.cc @@ -1686,6 +1686,16 @@ slpeel_tree_duplicate_loop_to_edge_cfg (class loop *loop, edge loop_exit, set_immediate_dominator (CDI_DOMINATORS, new_preheader, loop->header); + + /* Fix up the profile counts of the new exit blocks. + main_loop_exit_block was created by duplicating the + preheader, so needs its count scaling according to the main + exit edge's probability. The remaining count from the + preheader goes to the alt_loop_exit_block, since all + alternative exits have been redirected there. */ + main_loop_exit_block->count = loop_exit->count (); + alt_loop_exit_block->count + = preheader->count - main_loop_exit_block->count; } /* Adjust the epilog loop PHI entry values to continue iteration. diff --git a/gcc/tree.cc b/gcc/tree.cc index 05f679e..4319f8d 100644 --- a/gcc/tree.cc +++ b/gcc/tree.cc @@ -211,13 +211,61 @@ struct cl_option_hasher : ggc_cache_ptr_hash<tree_node> static GTY ((cache)) hash_table<cl_option_hasher> *cl_option_hash_table; +/* Callback called through walk_tree_1 to discover DECL_HAS_VALUE_EXPR_P + VAR_DECLs which weren't marked yet, in that case marks them and + walks their DECL_VALUE_EXPR expressions. */ + +static tree +gt_value_expr_mark_2 (tree *tp, int *, void *data) +{ + tree t = *tp; + if (VAR_P (t) && DECL_HAS_VALUE_EXPR_P (t) && !ggc_set_mark (t)) + { + tree dve = DECL_VALUE_EXPR (t); + walk_tree_1 (&dve, gt_value_expr_mark_2, data, + (hash_set<tree> *) data, NULL); + } + return NULL_TREE; +} + +/* Callback called through traverse_noresize on the + value_expr_for_decl hash table. */ + +int +gt_value_expr_mark_1 (tree_decl_map **e, hash_set<tree> *pset) +{ + if (ggc_marked_p ((*e)->base.from)) + walk_tree_1 (&(*e)->to, gt_value_expr_mark_2, pset, pset, NULL); + return 1; +} + +/* The value_expr_for_decl hash table can have mappings for trees + which are only referenced from mappings of other trees in the + same table, see PR118790. Without this routine, gt_cleare_cache + could clear hash table slot of a tree which isn't marked but + will be marked when processing later hash table slot of another + tree which is marked. This function marks with the above + helpers marks all the not yet marked DECL_HAS_VALUE_EXPR_P + VAR_DECLs mentioned in DECL_VALUE_EXPR expressions of marked + trees and in that case also recurses on their DECL_VALUE_EXPR. */ + +void +gt_value_expr_mark (hash_table<tree_decl_map_cache_hasher> *h) +{ + if (!h) + return; + + hash_set<tree> pset; + h->traverse_noresize<hash_set<tree> *, gt_value_expr_mark_1> (&pset); +} + /* General tree->tree mapping structure for use in hash tables. */ static GTY ((cache)) hash_table<tree_decl_map_cache_hasher> *debug_expr_for_decl; -static GTY ((cache)) +static GTY ((cache ("gt_value_expr_mark"))) hash_table<tree_decl_map_cache_hasher> *value_expr_for_decl; static GTY ((cache)) diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 7a515f1..8990773 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,8 @@ +2025-02-12 Yangyu Chen <cyy@cyyself.name> + + * config/riscv/feature_bits.c (RISCV_VENDOR_FEATURE_BITS_LENGTH): Drop. + (__init_riscv_features_bits_linux): Drop. + 2025-02-08 Dimitry Andric <dimitry@andric.com> PR target/118685 |