diff options
Diffstat (limited to 'gcc')
68 files changed, 1816 insertions, 104 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 65a07a1..81c5f80 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,65 @@ +2025-10-01 Jeff Law <jlaw@ventanamicro.com> + + PR target/122106 + * config/riscv/bitmanip.md (crc expanders): Add predicate for + polynomial argument. Drop unnecessary constraints. + +2025-10-01 Andreas Schwab <schwab@linux-m68k.org> + + PR target/122066 + * config/m68k/m68k.md (adddi3, subdi3): Strip POST_INC and PRE_DEC + when generating high part of the destination operand. + +2025-10-01 Jan Hubicka <hubicka@ucw.cz> + + * auto-profile.cc (afdo_calculate_branch_prob): Improve dump file. + +2025-10-01 Jan Hubicka <hubicka@ucw.cz> + + * auto-profile.cc (determine_scale): Break out from ... + (afdo_adjust_guessed_profile): ... here. + (scale_bb_profile): New function. + (afdo_annotate_cfg): Use it. + * params.opt (auto-profile-bbs): New parmaeter. + * doc/invoke.texi (auto-profile-bbs): Document. + +2025-10-01 Jan Hubicka <hubicka@ucw.cz> + + * auto-profile.cc (afdo_unscaled_edge_count): New function based on + part of ... + (afdo_set_bb_count): ... this function; use it here. + (afdo_calculate_branch_prob): Try to determine edge counts using + phi args and goto locuses. + +2025-10-01 Jan Hubicka <hubicka@ucw.cz> + + * Makefile.in (ALL_FDAS): New variable. + (ALL_HOST_BACKEND_OBJ): Use all.fda instead of cc1plus.fda + (all.fda): New target + +2025-10-01 Jan Hubicka <hubicka@ucw.cz> + + * cfghooks.cc (merge_blocks): Choose more reliable or higher BB + count. + +2025-10-01 Jan Hubicka <hubicka@ucw.cz> + + * predict.cc (unlikely_executed_stmt_p): Remove redundant check. + (rebuild_frequencies): Also recompute unlikely bbs when profile is + present or consistent. + +2025-10-01 Andrew MacLeod <amacleod@redhat.com> + + PR tree-optimization/120560 + * vr-values.cc (range_from_loop_direction): Use wi::ge_p rather + than wi::gt_p. + +2025-10-01 Richard Biener <rguenther@suse.de> + + PR tree-optimization/122110 + * tree-vect-loop.cc (vectorizable_reduction): Relax restriction + to mode-precision operations. + 2025-09-30 David Malcolm <dmalcolm@redhat.com> * diagnostics/output-spec.cc (text_scheme_handler::make_sink): Use diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index ce6a0ae..924403e 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20251001 +20251002 diff --git a/gcc/aclocal.m4 b/gcc/aclocal.m4 index 762e949..e44fc5f 100644 --- a/gcc/aclocal.m4 +++ b/gcc/aclocal.m4 @@ -69,6 +69,7 @@ m4_include([../ltversion.m4]) m4_include([../lt~obsolete.m4]) m4_include([../config/acx.m4]) m4_include([../config/cet.m4]) +m4_include([../config/clang-plugin.m4]) m4_include([../config/codeset.m4]) m4_include([../config/depstand.m4]) m4_include([../config/dfp.m4]) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index bf15d94..9054428 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,7 @@ +2025-10-01 Alejandro Colomar <alx@kernel.org> + + * c.opt.urls: Regenerate + 2025-09-26 Alejandro Colomar <alx@kernel.org> * c.opt: Add -Wmultiple-parameter-fwd-decl-lists diff --git a/gcc/c-family/c-attribs.cc b/gcc/c-family/c-attribs.cc index df9ff99..5bc5183 100644 --- a/gcc/c-family/c-attribs.cc +++ b/gcc/c-family/c-attribs.cc @@ -249,6 +249,29 @@ static const struct attribute_spec::exclusions attr_target_clones_exclusions[] = ATTR_EXCL ("always_inline", true, true, true), ATTR_EXCL ("target", TARGET_HAS_FMV_TARGET_ATTRIBUTE, TARGET_HAS_FMV_TARGET_ATTRIBUTE, TARGET_HAS_FMV_TARGET_ATTRIBUTE), + ATTR_EXCL ("omp declare simd", true, true, true), + ATTR_EXCL ("simd", true, true, true), + ATTR_EXCL (NULL, false, false, false), +}; + +static const struct attribute_spec::exclusions attr_target_version_exclusions[] = +{ + ATTR_EXCL ("omp declare simd", true, true, true), + ATTR_EXCL ("simd", true, true, true), + ATTR_EXCL (NULL, false, false, false), +}; + +static const struct attribute_spec::exclusions attr_omp_declare_simd_exclusions[] = +{ + ATTR_EXCL ("target_version", true, true, true), + ATTR_EXCL ("target_clones", true, true, true), + ATTR_EXCL (NULL, false, false, false), +}; + +static const struct attribute_spec::exclusions attr_simd_exclusions[] = +{ + ATTR_EXCL ("target_version", true, true, true), + ATTR_EXCL ("target_clones", true, true, true), ATTR_EXCL (NULL, false, false, false), }; @@ -536,7 +559,7 @@ const struct attribute_spec c_common_gnu_attributes[] = attr_target_exclusions }, { "target_version", 1, 1, true, false, false, false, handle_target_version_attribute, - NULL }, + attr_target_version_exclusions}, { "target_clones", 1, -1, true, false, false, false, handle_target_clones_attribute, attr_target_clones_exclusions }, @@ -563,7 +586,8 @@ const struct attribute_spec c_common_gnu_attributes[] = { "returns_nonnull", 0, 0, false, true, true, false, handle_returns_nonnull_attribute, NULL }, { "omp declare simd", 0, -1, true, false, false, false, - handle_omp_declare_simd_attribute, NULL }, + handle_omp_declare_simd_attribute, + attr_omp_declare_simd_exclusions }, { "omp declare variant base", 0, -1, true, false, false, false, handle_omp_declare_variant_attribute, NULL }, { "omp declare variant variant", 0, -1, true, false, false, false, @@ -572,7 +596,7 @@ const struct attribute_spec c_common_gnu_attributes[] = false, false, handle_omp_declare_variant_attribute, NULL }, { "simd", 0, 1, true, false, false, false, - handle_simd_attribute, NULL }, + handle_simd_attribute, attr_simd_exclusions }, { "omp declare target", 0, -1, true, false, false, false, handle_omp_declare_target_attribute, NULL }, { "omp declare target link", 0, 0, true, false, false, false, diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index dea3113..72634fa 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2025-10-01 Jan Hubicka <hubicka@ucw.cz> + + * Make-lang.in: Add c_FDAS + (create_fdas_for_cc1): Be sure that build fails if create_gcov fails. + 2025-09-30 Martin Uecker <uecker@tugraz.at> PR target/121933 diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc index 7e4c7c2..632bbf0 100644 --- a/gcc/c/c-decl.cc +++ b/gcc/c/c-decl.cc @@ -2086,6 +2086,35 @@ previous_tag (tree type) return NULL_TREE; } +/* Subroutine to mark functions as versioned when using the attribute + 'target_version'. */ + +static void +maybe_mark_function_versioned (tree decl) +{ + if (!DECL_FUNCTION_VERSIONED (decl)) + { + /* Check if the name of the function has been overridden. */ + if (DECL_ASSEMBLER_NAME_SET_P (decl) + && IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl))[0] == '*') + error_at (DECL_SOURCE_LOCATION (decl), + "cannot use function multiversioning on a renamed function"); + + /* We need to insert function version now to make sure the correct + pre-mangled assembler name is recorded. */ + cgraph_node *node = cgraph_node::get_create (decl); + + if (!node->function_version ()) + node->insert_new_function_version (); + + DECL_FUNCTION_VERSIONED (decl) = 1; + + tree mangled_name + = targetm.mangle_decl_assembler_name (decl, DECL_NAME (decl)); + SET_DECL_ASSEMBLER_NAME (decl, mangled_name); + } +} + /* Subroutine of duplicate_decls. Compare NEWDECL to OLDDECL. Returns true if the caller should proceed to merge the two, false if OLDDECL should simply be discarded. As a side effect, issues @@ -2505,6 +2534,10 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl, "but not here"); } } + /* Check if these are unmergable overlapping FMV declarations. */ + if (!TARGET_HAS_FMV_TARGET_ATTRIBUTE + && diagnose_versioned_decls (olddecl, newdecl)) + return false; } else if (VAR_P (newdecl)) { @@ -2971,6 +3004,12 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) if (TREE_CODE (newdecl) == FUNCTION_DECL) { + if (DECL_FUNCTION_VERSIONED (olddecl) + || DECL_FUNCTION_VERSIONED (newdecl)) + { + maybe_mark_function_versioned (olddecl); + maybe_mark_function_versioned (newdecl); + } /* If we're redefining a function previously defined as extern inline, make sure we emit debug info for the inline before we throw it away, in case it was inlined into a function that @@ -3370,6 +3409,53 @@ pushdecl (tree x) TREE_TYPE (b_use->decl) = b_use->u.type; } } + + /* Check if x is part of a FMV set with b_use. */ + if (b_use && TREE_CODE (b_use->decl) == FUNCTION_DECL + && TREE_CODE (x) == FUNCTION_DECL && DECL_FILE_SCOPE_P (b_use->decl) + && DECL_FILE_SCOPE_P (x) + && disjoint_version_decls (x, b_use->decl) + && comptypes (vistype, type) != 0) + { + maybe_mark_function_versioned (b_use->decl); + maybe_mark_function_versioned (b->decl); + maybe_mark_function_versioned (x); + + cgraph_node *b_node = cgraph_node::get_create (b_use->decl); + cgraph_function_version_info *b_v = b_node->function_version (); + if (!b_v) + b_v = b_node->insert_new_function_version (); + + /* Check if this new node conflicts with any previous functions + in the set. */ + cgraph_function_version_info *version = b_v; + for (; version; version = version->next) + if (!disjoint_version_decls (version->this_node->decl, x)) + { + /* The decls define overlapping version, so attempt to merge + or diagnose the conflict. */ + if (duplicate_decls (x, version->this_node->decl)) + return version->this_node->decl; + else + return error_mark_node; + } + + /* This is a new version to be added to FMV structure. */ + cgraph_node::add_function_version (b_v, x); + + /* Get the first node from the structure. */ + cgraph_function_version_info *default_v = b_v; + while (default_v->prev) + default_v = default_v->prev; + /* Always use the default node for the bindings. */ + b_use->decl = default_v->this_node->decl; + b->decl = default_v->this_node->decl; + + /* Node is not a duplicate, so no need to do the rest of the + checks. */ + return x; + } + if (duplicate_decls (x, b_use->decl)) { if (b_use != b) @@ -4494,6 +4580,12 @@ tree lookup_name (tree name) { struct c_binding *b = I_SYMBOL_BINDING (name); + /* Do not resolve non-default function versions. */ + if (b + && TREE_CODE (b->decl) == FUNCTION_DECL + && DECL_FUNCTION_VERSIONED (b->decl) + && !is_function_default_version (b->decl)) + return NULL_TREE; if (b && !b->invisible) { maybe_record_typedef_use (b->decl); @@ -5776,6 +5868,17 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs, && VAR_OR_FUNCTION_DECL_P (decl)) objc_check_global_decl (decl); + /* To enable versions to be created across TU's we mark and mangle all + non-default versioned functions. */ + if (TREE_CODE (decl) == FUNCTION_DECL + && !TARGET_HAS_FMV_TARGET_ATTRIBUTE + && get_target_version (decl).is_valid ()) + { + maybe_mark_function_versioned (decl); + if (current_scope != file_scope) + error ("versioned declarations are only allowed at file scope"); + } + /* Add this decl to the current scope. TEM may equal DECL or it may be a previous decl of the same name. */ if (do_push) @@ -10754,6 +10857,17 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator, warn_parm_array_mismatch (origloc, old_decl, parms); } + /* To enable versions to be created across TU's we mark and mangle all + non-default versioned functions. */ + if (TREE_CODE (decl1) == FUNCTION_DECL + && !TARGET_HAS_FMV_TARGET_ATTRIBUTE + && get_target_version (decl1).is_valid ()) + { + maybe_mark_function_versioned (decl1); + if (current_scope != file_scope) + error ("versioned definitions are only allowed at file scope"); + } + /* Record the decl so that the function name is defined. If we already have a decl for this name, and it is a FUNCTION_DECL, use the old decl. */ @@ -13585,6 +13699,10 @@ c_parse_final_cleanups (void) c_write_global_declarations_1 (BLOCK_VARS (DECL_INITIAL (t))); c_write_global_declarations_1 (BLOCK_VARS (ext_block)); + /* Call this to set cpp_implicit_aliases_done on all nodes. This is + important for function multiversioning aliases to get resolved. */ + symtab->process_same_body_aliases (); + if (!in_lto_p) free_attr_access_data (); diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index df44a91..7c24526 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -27776,6 +27776,13 @@ c_finish_omp_declare_simd (c_parser *parser, tree fndecl, tree parms, clauses[0].type = CPP_EOF; return; } + if (DECL_FUNCTION_VERSIONED (fndecl)) + { + error_at (DECL_SOURCE_LOCATION (fndecl), + "%<#pragma omp declare %s%> cannot be used with function " + "multi-versioning", kind); + return; + } if (parms == NULL_TREE) parms = DECL_ARGUMENTS (fndecl); diff --git a/gcc/cfghooks.cc b/gcc/cfghooks.cc index 8b33468..25bc5d4 100644 --- a/gcc/cfghooks.cc +++ b/gcc/cfghooks.cc @@ -819,7 +819,7 @@ merge_blocks (basic_block a, basic_block b) /* Pick the more reliable count. If both qualities agrees, pick the larger one since turning mistakely hot code to cold is more harmful. */ - if (a->count.initialized_p ()) + if (!a->count.initialized_p ()) a->count = b->count; else if (a->count.quality () < b->count.quality ()) a->count = b->count; diff --git a/gcc/config/riscv/predicates.md b/gcc/config/riscv/predicates.md index 777e71b..056f9e2 100644 --- a/gcc/config/riscv/predicates.md +++ b/gcc/config/riscv/predicates.md @@ -607,13 +607,12 @@ (define_predicate "ge_operator" (match_code "ge,geu")) -;; pmode_reg_or_uimm5_operand can be used by vsll.vx/vsrl.vx/vsra.vx instructions. -;; Since it has the same predicate with vector_length_operand which allows register -;; or immediate (0 ~ 31), we define this predicate same as vector_length_operand here. -;; We don't use vector_length_operand directly to predicate vsll.vx/vsrl.vx/vsra.vx -;; since it may be confusing. +;; pmode_reg_or_uimm5_operand can be used by vsll.vx/vsrl.vx/vsra.vx instructions +;; It is *not* equivalent to vector_length_operand due to the vector_length_operand +;; needing to conditionalize some behavior on XTHEADVECTOR. (define_special_predicate "pmode_reg_or_uimm5_operand" - (match_operand 0 "vector_length_operand")) + (ior (match_operand 0 "pmode_register_operand") + (match_operand 0 "const_csr_operand"))) (define_special_predicate "pmode_reg_or_0_operand" (ior (match_operand 0 "const_0_operand") diff --git a/gcc/configure b/gcc/configure index d6cc7fc..38d8cd9 100755 --- a/gcc/configure +++ b/gcc/configure @@ -758,6 +758,7 @@ LIPO NMEDIT DSYMUTIL STRIP +LLVM_CONFIG OBJDUMP ac_ct_DUMPBIN DUMPBIN @@ -16455,8 +16456,266 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown -plugin_option= + +# Try CLANG_PLUGIN_FILE first since GCC_PLUGIN_OPTION may return the +# wrong plugin_option with clang. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clang" >&5 +$as_echo_n "checking for clang... " >&6; } +if ${clang_cv_is_clang+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef __clang__ + yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then : + clang_cv_is_clang=yes +else + clang_cv_is_clang=no +fi +rm -f conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $clang_cv_is_clang" >&5 +$as_echo "$clang_cv_is_clang" >&6; } + plugin_file= + if test $clang_cv_is_clang = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clang plugin file" >&5 +$as_echo_n "checking for clang plugin file... " >&6; } + plugin_names="LLVMgold.so" + for plugin in $plugin_names; do + plugin_file=`${CC} ${CFLAGS} --print-file-name $plugin` + if test x$plugin_file = x$plugin; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}llvm-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}llvm-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_LLVM_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LLVM_CONFIG"; then + ac_cv_prog_LLVM_CONFIG="$LLVM_CONFIG" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_LLVM_CONFIG="${ac_tool_prefix}llvm-config" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LLVM_CONFIG=$ac_cv_prog_LLVM_CONFIG +if test -n "$LLVM_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LLVM_CONFIG" >&5 +$as_echo "$LLVM_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LLVM_CONFIG"; then + ac_ct_LLVM_CONFIG=$LLVM_CONFIG + # Extract the first word of "llvm-config", so it can be a program name with args. +set dummy llvm-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_LLVM_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_LLVM_CONFIG"; then + ac_cv_prog_ac_ct_LLVM_CONFIG="$ac_ct_LLVM_CONFIG" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_LLVM_CONFIG="llvm-config" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_LLVM_CONFIG=$ac_cv_prog_ac_ct_LLVM_CONFIG +if test -n "$ac_ct_LLVM_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LLVM_CONFIG" >&5 +$as_echo "$ac_ct_LLVM_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_LLVM_CONFIG" = x; then + LLVM_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LLVM_CONFIG=$ac_ct_LLVM_CONFIG + fi +else + LLVM_CONFIG="$ac_cv_prog_LLVM_CONFIG" +fi + + if test "$?" != 0; then + as_fn_error $? "Required tool 'llvm-config' not found on PATH." "$LINENO" 5 + fi + clang_lib_dir=`$LLVM_CONFIG --libdir` + if test -f $clang_lib_dir/$plugin; then + plugin_file=$clang_lib_dir/$plugin + fi + if test x$plugin_file != x$plugin; then + break; + fi + fi + done + if test -z $plugin_file; then + as_fn_error $? "Couldn't find clang plugin file for $CC." "$LINENO" 5 + fi + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="ar" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_AR" = x; then + AR="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +else + AR="$ac_cv_prog_AR" +fi + + if test "${AR}" = "" ; then + as_fn_error $? "Required archive tool 'ar' not found on PATH." "$LINENO" 5 + fi + plugin_option="--plugin $plugin_file" + touch conftest.c + ${AR} $plugin_option rc conftest.a conftest.c + if test "$?" != 0; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5 +$as_echo "$as_me: WARNING: Failed: $AR $plugin_option rc" >&2;} + plugin_file= + fi + rm -f conftest.* + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $plugin_file" >&5 +$as_echo "$plugin_file" >&6; } + fi + plugin_file="$plugin_file" + +if test -n "$plugin_file"; then + plugin_option="--plugin $plugin_file" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -plugin option" >&5 +$as_echo_n "checking for -plugin option... " >&6; } + plugin_names="liblto_plugin.so liblto_plugin-0.dll cyglto_plugin-0.dll" +plugin_option= for plugin in $plugin_names; do plugin_so=`${CC} ${CFLAGS} --print-prog-name $plugin` if test x$plugin_so = x$plugin; then @@ -16467,7 +16726,119 @@ for plugin in $plugin_names; do break fi done +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="ar" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_AR" = x; then + AR="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +else + AR="$ac_cv_prog_AR" +fi + +if test "${AR}" = "" ; then + as_fn_error $? "Required archive tool 'ar' not found on PATH." "$LINENO" 5 +fi +touch conftest.c +${AR} $plugin_option rc conftest.a conftest.c +if test "$?" != 0; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5 +$as_echo "$as_me: WARNING: Failed: $AR $plugin_option rc" >&2;} + plugin_option= +fi +rm -f conftest.* +if test -n "$plugin_option"; then + plugin_option="$plugin_option" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $plugin_option" >&5 +$as_echo "$plugin_option" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + +fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 @@ -16562,17 +16933,15 @@ fi test -z "$AR" && AR=ar if test -n "$plugin_option"; then - if $AR --help 2>&1 | grep -q "\--plugin"; then - touch conftest.c - $AR $plugin_option rc conftest.a conftest.c - if test "$?" != 0; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5 -$as_echo "$as_me: WARNING: Failed: $AR $plugin_option rc" >&2;} - else + case "$AR" in + *"$plugin_option"*) + ;; + *) + if $AR --help 2>&1 | grep -q "\--plugin"; then AR="$AR $plugin_option" fi - rm -f conftest.* - fi + ;; + esac fi test -z "$AR_FLAGS" && AR_FLAGS=cru @@ -16779,9 +17148,15 @@ fi test -z "$RANLIB" && RANLIB=: if test -n "$plugin_option" && test "$RANLIB" != ":"; then - if $RANLIB --help 2>&1 | grep -q "\--plugin"; then - RANLIB="$RANLIB $plugin_option" - fi + case "$RANLIB" in + *"$plugin_option"*) + ;; + *) + if $RANLIB --help 2>&1 | grep -q "\--plugin"; then + RANLIB="$RANLIB $plugin_option" + fi + ;; + esac fi @@ -21484,7 +21859,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 21487 "configure" +#line 21862 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -21590,7 +21965,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 21593 "configure" +#line 21968 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 98b48ff..ab3878b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,15 @@ +2025-10-01 Iain Sandoe <iain@sandoe.co.uk> + + * constexpr.cc (cxx_eval_constant_expression): Use revised + interfaces to determine if contracts are ignored and, if not, + whether they are evaluated. + * contracts.h (contract_ignored_p, contract_evaluated_p): New. + +2025-10-01 Jan Hubicka <hubicka@ucw.cz> + + * Make-lang.in: Add c++_FDAS + (create_fdas_for_cc1plus): Be sure that build fails if create_gcov fails. + 2025-09-27 Jason Merrill <jason@redhat.com> PR c++/112632 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index ad537f7..1453a2a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,17 @@ +2025-10-01 Harald Anlauf <anlauf@gmx.de> + + PR fortran/122080 + * trans-array.cc (gfc_conv_array_parameter): Wrap the derivation of + bounds and strides for the descriptor of an optional dummy array + argument by a test on argument presence when it is supposed to be + passed to an optional argument. + +2025-10-01 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/122089 + * decl.cc (gfc_get_pdt_instance): If the pdt_template is use + associated, 'module' field should be copied to this instance. + 2025-09-30 Paul Thomas <pault@gcc.gnu.org> PR fortran/102241 diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 4da9ca3..55e0883 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,8 @@ +2025-10-01 Jan Hubicka <hubicka@ucw.cz> + + * Make-lang.in: Add lto_FDAS; enable FDA collection + (create_fdas_for_lto1): Be sure that build fails if create_gcov fails. + 2025-04-15 Kyrylo Tkachov <ktkachov@nvidia.com> * lto-partition.cc (add_node_references_to_partition): Define. diff --git a/gcc/m2/ChangeLog b/gcc/m2/ChangeLog index b9e2b4d..1e9f733 100644 --- a/gcc/m2/ChangeLog +++ b/gcc/m2/ChangeLog @@ -1,3 +1,9 @@ +2025-10-01 Gaius Mulley <gaiusmod2@gmail.com> + + PR modula2/122009 + * pge-boot/Gldtoa.cc (ldtoa_ldtoa): Change int to bool for + parameter sign. + 2025-09-21 Mark Wielaard <mark@klomp.org> * lang.opt.urls: Regenerate. diff --git a/gcc/m2/gm2-compiler/M2GCCDeclare.mod b/gcc/m2/gm2-compiler/M2GCCDeclare.mod index 710976e..24634fd 100644 --- a/gcc/m2/gm2-compiler/M2GCCDeclare.mod +++ b/gcc/m2/gm2-compiler/M2GCCDeclare.mod @@ -4447,19 +4447,6 @@ END PrintString ; (* - PrintKnown - -*) - -PROCEDURE PrintKnown (sym: CARDINAL) ; -BEGIN - IF GccKnowsAbout (sym) - THEN - printf0 ("[gcc]") - END -END PrintKnown ; - - -(* PrintVerboseFromList - prints the, i, th element in the list, l. *) diff --git a/gcc/m2/gm2-gcc/m2type.cc b/gcc/m2/gm2-gcc/m2type.cc index 535ab14..184b506 100644 --- a/gcc/m2/gm2-gcc/m2type.cc +++ b/gcc/m2/gm2-gcc/m2type.cc @@ -2213,7 +2213,7 @@ gm2_build_enumerator (location_t location, tree name, tree value) enumvalues, list. It returns a copy of the value. */ tree -m2type_BuildEnumerator (location_t location, char *name, tree value, +m2type_BuildEnumerator (location_t location, const char *name, tree value, tree *enumvalues) { tree id = get_identifier (name); diff --git a/gcc/m2/gm2-gcc/m2type.def b/gcc/m2/gm2-gcc/m2type.def index 8a72652..6f64c98 100644 --- a/gcc/m2/gm2-gcc/m2type.def +++ b/gcc/m2/gm2-gcc/m2type.def @@ -173,7 +173,7 @@ PROCEDURE BuildPointerType (totype: tree) : tree ; It returns a copy of the value. --fixme-- why do this? *) -PROCEDURE BuildEnumerator (location: location_t; name: CharStar; value: tree; +PROCEDURE BuildEnumerator (location: location_t; name: ConstCharStar; value: tree; VAR enumvalues: tree) : tree ; diff --git a/gcc/m2/gm2-gcc/m2type.h b/gcc/m2/gm2-gcc/m2type.h index afd97f7..68015a0 100644 --- a/gcc/m2/gm2-gcc/m2type.h +++ b/gcc/m2/gm2-gcc/m2type.h @@ -183,7 +183,7 @@ EXTERN tree m2type_BuildStartEnumeration (location_t location, char *name, bool ispacked); EXTERN tree m2type_BuildEndEnumeration (location_t location, tree enumtype, tree enumvalues); -EXTERN tree m2type_BuildEnumerator (location_t location, char *name, +EXTERN tree m2type_BuildEnumerator (location_t location, const char *name, tree value, tree *enumvalues); EXTERN tree m2type_BuildPointerType (tree totype); EXTERN tree m2type_BuildConstPointerType (tree totype); diff --git a/gcc/m2/gm2-libs/M2WIDESET.mod b/gcc/m2/gm2-libs/M2WIDESET.mod index f1b1bed..93df428 100644 --- a/gcc/m2/gm2-libs/M2WIDESET.mod +++ b/gcc/m2/gm2-libs/M2WIDESET.mod @@ -490,21 +490,21 @@ PROCEDURE ShiftLeftByteBit (VAR dest: ARRAY OF BYTE; src: ARRAY OF BYTE; highbit: CARDINAL; byteshift, bitshift: CARDINAL) ; VAR - top, bot, mid : BYTESET ; - i, h, from, to: CARDINAL ; + top, bot, mid : BYTESET ; + i, h, fromIdx, toIdx: CARDINAL ; BEGIN (* Copy the bytes into dest at the mostly correct position (modulo byte position). *) - to := 0 ; - from := 0 ; - WHILE to < byteshift DO - dest[to] := BYTE (0) ; - INC (to) + toIdx := 0 ; + fromIdx := 0 ; + WHILE toIdx < byteshift DO + dest[toIdx] := BYTE (0) ; + INC (toIdx) END ; - WHILE to <= HIGH (dest) DO - dest[to] := src[from] ; - INC (to) ; - INC (from) + WHILE toIdx <= HIGH (dest) DO + dest[toIdx] := src[fromIdx] ; + INC (toIdx) ; + INC (fromIdx) END ; (* And adjust by bit shifting. *) IF bitshift > 0 @@ -567,12 +567,12 @@ PROCEDURE ShiftRightByteBit (VAR dest: ARRAY OF BYTE; src: ARRAY OF BYTE; highbit: CARDINAL; byteshift, bitshift: CARDINAL) ; VAR - top, bot, mid : BYTESET ; - i, h, to, from: CARDINAL ; + top, bot, mid : BYTESET ; + i, h, toIdx, fromIdx: CARDINAL ; BEGIN (* Copy the bytes. *) - to := 0 ; - from := byteshift ; + toIdx := 0 ; + fromIdx := byteshift ; IF EnableDebugging THEN printf ("HIGH (dest) = %d\n", HIGH (dest)) @@ -580,15 +580,15 @@ BEGIN IF byteshift <= HIGH (dest) THEN h := HIGH (dest) - byteshift ; - WHILE to <= h DO - dest[to] := src[from] ; - INC (to) ; - INC (from) + WHILE toIdx <= h DO + dest[toIdx] := src[fromIdx] ; + INC (toIdx) ; + INC (fromIdx) END END ; - WHILE to <= HIGH (dest) DO - dest[to] := BYTE (0) ; - INC (to) + WHILE toIdx <= HIGH (dest) DO + dest[toIdx] := BYTE (0) ; + INC (toIdx) END ; (* And bit shift the remainder. *) IF EnableDebugging @@ -691,7 +691,7 @@ VAR next : BOOLEAN ; mask, unused, - set : BYTESET ; + setb : BYTESET ; BEGIN IF EnableDebugging THEN @@ -704,14 +704,14 @@ BEGIN bytes. *) i := 0 ; WHILE i < high DO - set := dest[i] ; - next := MSB IN set ; - set := SHIFT (set, 1) ; (* Shift left. *) + setb := dest[i] ; + next := MSB IN setb ; + setb := SHIFT (setb, 1) ; (* Shift left. *) IF carry THEN - INCL (set, 0) (* Set bit 0. *) + INCL (setb, 0) (* Set bit 0. *) END ; - dest[i] := set ; + dest[i] := setb ; carry := next ; IF EnableDebugging THEN @@ -722,27 +722,27 @@ BEGIN END ; (* Last byte special case as there may be some unused bits which must be preserved. *) - set := dest[high] ; + setb := dest[high] ; unused := BYTESET {} ; (* Will contain all top unused bits of dest[high]. *) mask := - BYTESET {} ; topbit := (highbit+1) MOD TBITSIZE (BYTE) ; WHILE topbit # 0 DO EXCL (mask, topbit) ; - IF topbit IN set + IF topbit IN setb THEN - EXCL (set, topbit) ; + EXCL (setb, topbit) ; INCL (unused, topbit) END ; topbit := (topbit+1) MOD TBITSIZE (BYTE) END ; - set := SHIFT (set, 1) ; (* Left shift. *) + setb := SHIFT (setb, 1) ; (* Left shift. *) IF carry THEN - INCL (set, 0) (* Set bit 0. *) + INCL (setb, 0) (* Set bit 0. *) END ; - set := set * mask ; (* Remove all unused bits. *) - set := set + unused ; (* Restore original unused bits. *) - dest[high] := set ; + setb := setb * mask ; (* Remove all unused bits. *) + setb := setb + unused ; (* Restore original unused bits. *) + dest[high] := setb ; IF EnableDebugging THEN printf ("ArithShiftLeft shifted byte dest[%d]\n", high); @@ -785,32 +785,32 @@ VAR next : BOOLEAN ; mask, unused, - set : BYTESET ; + setb : BYTESET ; BEGIN high := HIGH (dest) ; (* Clear any unused bits in the highest byte, but save them into unused. *) - set := dest[high] ; + setb := dest[high] ; unused := BYTESET {} ; topbit := (highbit+1) MOD TBITSIZE (BYTE) ; mask := - BYTESET {} ; WHILE topbit # 0 DO EXCL (mask, topbit) ; - IF topbit IN set + IF topbit IN setb THEN - EXCL (set, topbit) ; + EXCL (setb, topbit) ; INCL (unused, topbit) END ; topbit := (topbit+1) MOD TBITSIZE (BYTE) END ; (* Start at the top and work down to byte 0. *) - set := set * mask ; (* Ignore unused bits. *) - next := 0 IN set ; (* Next carry. *) - set := SHIFT (set, -1) ; (* Shift right by 1 bit. *) + setb := setb * mask ; (* Ignore unused bits. *) + next := 0 IN setb ; (* Next carry. *) + setb := SHIFT (setb, -1) ; (* Shift right by 1 bit. *) IF carry THEN - INCL (set, highbit MOD TBITSIZE (BYTE)) + INCL (setb, highbit MOD TBITSIZE (BYTE)) END ; - dest[high] := set + unused ; (* First byte is a special case as we + dest[high] := setb + unused ; (* First byte is a special case as we have to preserve the unused bits. *) (* Now we ripple through the remaining bytes, propagating local carry between bytes. *) @@ -818,14 +818,14 @@ BEGIN WHILE i > 0 DO prev := next ; DEC (i) ; - set := dest[i] ; - next := 0 IN set ; - set := SHIFT (set, -1) ; + setb := dest[i] ; + next := 0 IN setb ; + setb := SHIFT (setb, -1) ; IF prev THEN - INCL (set, MSB) + INCL (setb, MSB) END ; - dest[i] := set + dest[i] := setb END END ArithShiftRightBit ; @@ -914,7 +914,7 @@ VAR high, highplus1, highbitplus1, - from, to : CARDINAL ; + fromIdx, toIdx: CARDINAL ; BEGIN IF EnableDebugging THEN @@ -925,21 +925,21 @@ BEGIN (* Copy the contents rotating on byte granularity, then arithmetically shift the remaining number of bits. *) high := HIGH (dest) ; - from := 0 ; + fromIdx := 0 ; highplus1 := high + 1 ; highbitplus1 := highbit + 1 ; - to := RotateCount DIV TBITSIZE (BYTE) ; (* Byte level granularity. *) + toIdx := RotateCount DIV TBITSIZE (BYTE) ; (* Byte level granularity. *) REPEAT - dest[to] := src[from] ; + dest[toIdx] := src[fromIdx] ; IF EnableDebugging THEN printf ("RotateLeft after partial byte movement: dest[%d] := src[%d]\n", - to, from); + toIdx, fromIdx); DumpSet (dest, highbit) END ; - from := (from + 1) MOD highplus1 ; - to := (to + 1) MOD highplus1 ; - UNTIL from = 0 ; + fromIdx := (fromIdx + 1) MOD highplus1 ; + toIdx := (toIdx + 1) MOD highplus1 ; + UNTIL fromIdx = 0 ; IF EnableDebugging THEN diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a7d81ad..7562dc2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,28 @@ +2025-10-01 Jeff Law <jlaw@ventanamicro.com> + + PR target/122106 + * gcc.target/riscv/pr122106.c: New test. + +2025-10-01 Harald Anlauf <anlauf@gmx.de> + + PR fortran/122080 + * gfortran.dg/ubsan/missing_optional_dummy_9.f90: New test. + +2025-10-01 Andreas Schwab <schwab@linux-m68k.org> + + PR target/122066 + * gcc.c-torture/compile/pr122066.c: New test. + +2025-10-01 Andrew MacLeod <amacleod@redhat.com> + + PR tree-optimization/120560 + * gcc.dg/pr120560.c: New. + +2025-10-01 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/122089 + * gfortran.dg/pdt_51.f03: New test. + 2025-09-30 David Malcolm <dmalcolm@redhat.com> * lib/sarif.py: Remove import of ET. diff --git a/gcc/testsuite/gcc.dg/torture/pr122079-1.c b/gcc/testsuite/gcc.dg/torture/pr122079-1.c new file mode 100644 index 0000000..0af01a5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr122079-1.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fcode-hoisting" } */ + +int a, b, c; +void e(int *f) { + int d = 0; + if (f) + goto g; + goto h; +i: + d = 1 + f[0]; +j: + if (c) + goto h; +k: + if (b) + goto i; + if (a) + goto j; +g: + if (d + f[0]) + goto k; +h: + int l[] = {f[0]}; + if (a) + e(l); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr122079-2.c b/gcc/testsuite/gcc.dg/torture/pr122079-2.c new file mode 100644 index 0000000..40c36b0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr122079-2.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ + +int a, b, *c = &a, d, e, f; +void g(int *p) { a = p[0]; } +int main() { + int h = 0; +i: + d = c[0]; + c[0] = h; + if (a) + goto j; +k: + h = c[0] - 1; + while (1) { + if (b) + goto i; + if (f) + goto k; + j: + if (!e) { + int m[] = {c[0]}; + g(m); + break; + } + } + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr122079-3.c b/gcc/testsuite/gcc.dg/torture/pr122079-3.c new file mode 100644 index 0000000..df95c71 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr122079-3.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fno-tree-loop-im" } */ + +int a, b, c; +void d(int[]); +void e(int f[][2]) { +g: + b = f[0][1]; + if (c) + goto h; +i: + if (a) + goto g; + if (f[1][1]) + goto j; +h: + if (f[1][1]) + goto i; + goto k; +j: + b--; + if (b + f[0][1]) + goto i; +k: + int l[] = {f[0][1]}; + d(l); +} diff --git a/gcc/testsuite/gcc.target/aarch64/mv-1.c b/gcc/testsuite/gcc.target/aarch64/mv-1.c new file mode 100644 index 0000000..6f095ec --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-1.c @@ -0,0 +1,43 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("default"))) int +foo () +{ + return 1; +} + +__attribute__ ((target_version ("rng"))) int +foo () +{ + return 2; +} + +__attribute__ ((target_version ("flagm"))) int +foo () +{ + return 3; +} + +__attribute__ ((target_version ("rng+flagm"))) int +foo () +{ + return 4; +} + +int +bar () +{ + return foo (); +} + +/* Check usage of the first two FMV features, in case of off-by-one errors. */ +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mrng:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MrngMflagm:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mflagm:\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-and-mvc-error1.c b/gcc/testsuite/gcc.target/aarch64/mv-and-mvc-error1.c new file mode 100644 index 0000000..b08de29 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-and-mvc-error1.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("dotprod"))) int +foo () { return 3; } /* { dg-message "previous definition of .foo \\\[\\\[target_version\\(.dotprod.\\)\\\]\\\]. with type .int\\(void\\)." } */ + +__attribute__ ((target_clones ("dotprod", "sve"))) int +foo () { return 1; } /* { dg-error "redefinition of .foo \\\[\\\[target_clones\\(.dotprod., .sve.\\)\\\]\\\]." } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-and-mvc-error2.c b/gcc/testsuite/gcc.target/aarch64/mv-and-mvc-error2.c new file mode 100644 index 0000000..d34b246 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-and-mvc-error2.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("default"))) int +foo () { return 1; } /* { dg-message "previous definition of .foo \\\[\\\[target_version\\(.default.\\)\\\]\\\]. with type .int\\(void\\)." } */ + +__attribute__ ((target_clones ("dotprod", "sve"))) float +foo () { return 3; } /* { dg-error "conflicting types for .foo \\\[\\\[target_clones\\(.dotprod., .sve.\\)\\\]\\\].; have .float\\(void\\)." } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-and-mvc-error3.c b/gcc/testsuite/gcc.target/aarch64/mv-and-mvc-error3.c new file mode 100644 index 0000000..a6a45bd --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-and-mvc-error3.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +float foo () { return 1; } /* { dg-message "previous definition of .foo." } */ + +__attribute__ ((target_clones ("default", "dotprod", "sve"))) float +foo () { return 3; } /* { dg-error "redefinition of .foo \\\[\\\[target_clones\\(.default., .dotprod., .sve.\\)\\\]\\\]." } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-and-mvc1.c b/gcc/testsuite/gcc.target/aarch64/mv-and-mvc1.c new file mode 100644 index 0000000..39ed306 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-and-mvc1.c @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__((target_version("default"))) +int foo () +{ + return 0; +} + +__attribute__((target_clones("dotprod", "sve+sve2"))) +int foo () +{ + return 1; +} + +__attribute__((target_clones("sve", "sve2"))) +int foo () +{ + return 2; +} + +int bar() +{ + return foo (); +} + + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Msve:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Msve2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-and-mvc2.c b/gcc/testsuite/gcc.target/aarch64/mv-and-mvc2.c new file mode 100644 index 0000000..17c7cbd --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-and-mvc2.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__((target_version("default"))) +int foo (); + +__attribute__((target_clones("dotprod", "sve+sve2"))) +int foo () +{ + return 1; +} + +__attribute__((target_clones("sve", "sve2"))) +int foo () +{ + return 2; +} + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Msve:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Msve2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 0 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-and-mvc3.c b/gcc/testsuite/gcc.target/aarch64/mv-and-mvc3.c new file mode 100644 index 0000000..8325c8e --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-and-mvc3.c @@ -0,0 +1,40 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__((target_clones("dotprod", "sve+sve2"))) +int foo (); + +__attribute__((target_version("default"))) +int foo () +{ + return 0; +} + +__attribute__((target_clones("sve", "sve2"))) +int foo () +{ + return 2; +} + +int bar() +{ + return foo (); +} + + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Msve:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Msve2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ +// { dg-final { scan-assembler-times "\n\tadrp\tx\[0-9\]+, foo\.default\n" 1 } } +/* { dg-final { scan-assembler-times "\n\tadrp\tx\[0-9\]+, foo\._Mdotprod\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx\[0-9\]+, foo\._MsveMsve2\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx\[0-9\]+, foo\._Msve\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx\[0-9\]+, foo\._Msve2\n" 1 } } */ + diff --git a/gcc/testsuite/gcc.target/aarch64/mv-and-mvc4.c b/gcc/testsuite/gcc.target/aarch64/mv-and-mvc4.c new file mode 100644 index 0000000..951c950 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-and-mvc4.c @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__((target_version("dotprod"))) +int foo () +{ + return 0; +} + +__attribute__((target_clones("default", "sve+sve2"))) +int foo () +{ + return 1; +} + +__attribute__((target_clones("sve", "sve2"))) +int foo () +{ + return 2; +} + +int bar() +{ + return foo (); +} + + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Msve:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Msve2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-error1.c b/gcc/testsuite/gcc.target/aarch64/mv-error1.c new file mode 100644 index 0000000..61c9af2 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-error1.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("default"))) int +foo (); + +__attribute__ ((target_version ("default"))) int +foo () { return 1; } /* { dg-message "previous definition of .foo \\\[\\\[target_version\\(.default.\\)\\\]\\\]. with type .int\\(void\\)." } */ + +__attribute__ ((target_version ("dotprod"))) float +foo () { return 3; } /* { dg-error "conflicting types for .foo \\\[\\\[target_version\\(.dotprod.\\)\\\]\\\].; have .float\\(void\\)." } */ + +__attribute__ ((target_version ("sve"))) int +foo2 () { return 1; } /* { dg-message "previous definition of .foo2 \\\[\\\[target_version\\(.sve.\\)\\\]\\\]. with type .int\\(void\\)." } */ + +__attribute__ ((target_version ("dotprod"))) float +foo2 () { return 3; } /* { dg-error "conflicting types for .foo2 \\\[\\\[target_version\\(.dotprod.\\)\\\]\\\].; have .float\\(void\\)." } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-error10.c b/gcc/testsuite/gcc.target/aarch64/mv-error10.c new file mode 100644 index 0000000..218f103 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-error10.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +void +bar () +{ + __attribute__ ((target_version ("dotprod"))) int + foo1 (); /* { dg-message "versioned declarations are only allowed at file scope" } */ + + __attribute__ ((target_version ("simd"))) int + foo2 () { return 1; } /* { dg-message "versioned definitions are only allowed at file scope" } */ +} diff --git a/gcc/testsuite/gcc.target/aarch64/mv-error11.c b/gcc/testsuite/gcc.target/aarch64/mv-error11.c new file mode 100644 index 0000000..0fdd660 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-error11.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +int fn () asm("name"); +int fn () { return 1; } /* { dg-error "cannot use function multiversioning on a renamed function" } */ +int fn [[gnu::target_version("sve")]] () { return 1; } + +int fn2 [[gnu::target_version("sve")]] () asm("name"); /* { dg-warning ".asm. declaration ignored due to conflict with previous rename" } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-error12.c b/gcc/testsuite/gcc.target/aarch64/mv-error12.c new file mode 100644 index 0000000..45da85a --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-error12.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ +/* { dg-require-ifunc "" } */ + +#pragma omp declare simd +int fn [[gnu::target_version("sve")]] () { return 1; } /* { dg-error ".#pragma omp declare simd. cannot be used with function multi-versioning" } */ + +#pragma omp declare simd +int fn2 () { return 1; } + +int fn2 [[gnu::target_version("sve")]] (); /* { dg-warning "ignoring attribute .target_version. because it conflicts with attribute .omp declare simd." } */ + +int fn3 [[gnu::target_version("sve")]] [[gnu::simd]] () { return 1; } /* { dg-warning "ignoring attribute .simd. because it conflicts with attribute .target_version." } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-error2.c b/gcc/testsuite/gcc.target/aarch64/mv-error2.c new file mode 100644 index 0000000..19d961d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-error2.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("dotprod"))) float +foo () { return 3; } /* { dg-message "previous definition of .foo \\\[\\\[target_version\\(.dotprod.\\)\\\]\\\]. with type .float\\(void\\)." } */ + +__attribute__ ((target_version ("dotprod"))) float +foo () { return 3; } /* { dg-error "redefinition of .foo \\\[\\\[target_version\\(.dotprod.\\)\\\]\\\]." } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-error3.c b/gcc/testsuite/gcc.target/aarch64/mv-error3.c new file mode 100644 index 0000000..451ce02 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-error3.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("dotprod"))) float +foo () { return 3; } + +__attribute__ ((target_version ("default"))) float +foo () { return 3; } /* { dg-message "previous definition of .foo \\\[\\\[target_version\\(.default.\\)\\\]\\\]. with type .float\\(void\\)." } */ + +__attribute__ ((target_version ("default"))) float +foo () { return 3; } /* { dg-error "redefinition of .foo \\\[\\\[target_version\\(.default.\\)\\\]\\\]." } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-error4.c b/gcc/testsuite/gcc.target/aarch64/mv-error4.c new file mode 100644 index 0000000..44d3195 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-error4.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("test"))) float +foo () { return 3; } /* { dg-error "invalid feature modifier .test. of value .test. in .target_version. attribute" } */ + +__attribute__ ((target_version ("sve+test"))) float +foo2 () { return 3; } /* { dg-error "invalid feature modifier .test. of value .sve.test. in .target_version. attribute" } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-error5.c b/gcc/testsuite/gcc.target/aarch64/mv-error5.c new file mode 100644 index 0000000..776b80a --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-error5.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("sve+sve2"))) int +foo(); /* { dg-message "previous declaration of .foo \\\[\\\[target_version\\(.sve\\\+sve2.\\)\\\]\\\]. with type .int\\(void\\)." } */ + +int bar () { return foo (); } /* { dg-error "implicit declaration of function .foo." } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-error6.c b/gcc/testsuite/gcc.target/aarch64/mv-error6.c new file mode 100644 index 0000000..afc71a4 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-error6.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("sve+sve2"))) int +foo () { + return 1; +} + +__attribute__ ((target_version ("sve"))) int +foo () { /* { dg-message "previous definition of .foo \\\[\\\[target_version\\(.sve.\\)\\\]\\\]. with type .int\\(void\\)." } */ + return 1; +} + +int bar () { return foo (); } /* { dg-error "implicit declaration of function .foo." } */ + +__attribute__ ((target_version ("sve+sve2"))) int +foo2(); /* { dg-message "previous declaration of .foo2 \\\[\\\[target_version\\(.sve\\\+sve2.\\)\\\]\\\]. with type .int\\(void\\)." } */ + +int bar2 () { return foo2 (); } /* { dg-error "implicit declaration of function .foo2." } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-error7.c b/gcc/testsuite/gcc.target/aarch64/mv-error7.c new file mode 100644 index 0000000..68db978 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-error7.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("dotprod"))) int +foo (); /* { dg-message "previous declaration of .foo \\\[\\\[target_version\\(.dotprod.\\)\\\]\\\]. with type .int\\(void\\)." } */ + +__attribute__ ((target_version ("sve+sve2"))) int +foo (); + +int bar () { return foo (); } /* { dg-error "implicit declaration of function .foo." } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-error8.c b/gcc/testsuite/gcc.target/aarch64/mv-error8.c new file mode 100644 index 0000000..7599df1 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-error8.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("default"))) int +foo (int a, int (*b)[4]) { return 1; } + +int bar(void) { + __attribute__ ((target_version ("dotprod"))) int + foo (int a, int (*b)[5]) { return 3; } /* { dg-error "versioned definitions are only allowed at file scope" } */ + + return 1; +} diff --git a/gcc/testsuite/gcc.target/aarch64/mv-error9.c b/gcc/testsuite/gcc.target/aarch64/mv-error9.c new file mode 100644 index 0000000..dc982e9 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-error9.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("dotprod"))) int +foo (); /* { dg-message "previous declaration of .foo \\\[\\\[target_version\\(.dotprod.\\)\\\]\\\]. with type .int\\(void\\)." } */ + +int +bar () +{ + return foo (); /* { dg-error "implicit declaration of function .foo." } */ +} diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols1.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols1.c new file mode 100644 index 0000000..7982278 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols1.c @@ -0,0 +1,38 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +// Basic case of fmv correctness with all functions and use in one TU. + +__attribute__ ((target_version ("default"))) int +foo () +{ + return 1; +} + +__attribute__ ((target_version ("dotprod"))) int +foo () +{ + return 3; +} +__attribute__ ((target_version ("sve+sve2"))) int +foo () +{ + return 5; +} + +int +bar () +{ + return foo (); +} + +/* When updating any of the symbol names in these tests, make sure to also + update any tests for their absence in mv-symbolsN.C */ + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols10.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols10.c new file mode 100644 index 0000000..d525638 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols10.c @@ -0,0 +1,42 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +int +foo (); + +int +foo () +{ + return 1; +} + +__attribute__ ((target_version ("dotprod"))) int +foo () +{ + return 3; +} +__attribute__ ((target_version ("sve+sve2"))) int +foo () +{ + return 5; +} + +int +bar () +{ + return foo (); +} + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\._MsveMsve2\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\._Mdotprod\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\.default\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols11.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols11.c new file mode 100644 index 0000000..fd3dc34 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols11.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +// Check that types can be combined + +__attribute__ ((target_version ("default"))) int +foo (int a, int (*b)[4]) { return 1; } + +__attribute__ ((target_version ("dotprod"))) int +foo (int a, int (*b)[]) { return 3; } + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols12.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols12.c new file mode 100644 index 0000000..1a0b667 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols12.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("default"))) int +foo () { return 1; } + +__attribute__ ((target_version ("dotprod"))) int +foo () { return 3; } + +int bar () +{ + int (*test)() = foo; + + test(); +} + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx\[0-9\], foo\._Mdotprod\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx\[0-9\], foo\.default\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n\tadrp\tx\[0-9\]+, foo\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols13.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols13.c new file mode 100644 index 0000000..308dace --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols13.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("default"))) int +foo (); + +int bar () +{ + int (*test)() = foo; + + test(); +} + +__attribute__ ((target_version ("dotprod"))) int +foo () { return 3; } + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx\[0-9\], foo\._Mdotprod\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx\[0-9\], foo\.default\n" 0 } } */ + +/* { dg-final { scan-assembler-times "\n\tadrp\tx\[0-9\]+, foo\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 0 } } */ + diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols14.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols14.c new file mode 100644 index 0000000..d1af69f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols14.c @@ -0,0 +1,34 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +int foo (); + +__attribute__ ((target_version ("default"))) int +foo () +{ + return 1; +} + +__attribute__ ((target_version ("dotprod"))) int +foo () +{ + return 3; +} + +int +bar () +{ + return foo (); +} + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\._Mdotprod\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\.default\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols2.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols2.c new file mode 100644 index 0000000..a8732ca --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols2.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +// FMV correctness with definitions but no call + +__attribute__ ((target_version ("default"))) int +foo () +{ + return 1; +} + +__attribute__ ((target_version ("dotprod"))) int +foo () +{ + return 3; +} +__attribute__ ((target_version ("sve+sve2"))) int +foo () +{ + return 5; +} + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols3.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols3.c new file mode 100644 index 0000000..962bae9 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols3.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +// FMV correctness with declarations but no implementation + +__attribute__ ((target_version ("default"))) int +foo (); + +__attribute__ ((target_version ("dotprod"))) int +foo (); + +__attribute__ ((target_version ("sve+sve2"))) int +foo (); + +int +bar () +{ + return foo (); +} + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 0 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols4.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols4.c new file mode 100644 index 0000000..a476800 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols4.c @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +// FMV correctness with a default implementation and declarations of other +// versions + +__attribute__ ((target_version ("default"))) int +foo () +{ + return 1; +} + +__attribute__ ((target_version ("dotprod"))) int +foo (); + +__attribute__ ((target_version ("sve+sve2"))) int +foo (); + +int +bar () +{ + return foo (); +} + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols5.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols5.c new file mode 100644 index 0000000..4df2000 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols5.c @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +// FMV correctness with default declaration, and implementations of other +// versions. + +__attribute__ ((target_version ("default"))) int +foo (); + +__attribute__ ((target_version ("dotprod"))) int +foo () +{ + return 3; +} +__attribute__ ((target_version ("sve+sve2"))) int +foo () +{ + return 5; +} + +int +bar () +{ + return foo (); +} + +/* When updating any of the symbol names in these tests, make sure to also + update any tests for their absence in mvc-symbolsN.C */ + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 0 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols6.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols6.c new file mode 100644 index 0000000..cbf8bca --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols6.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("default"))) int +foo () +{ + return 1; +} + +int bar() +{ + return foo(); +} + +/* { dg-final { scan-assembler-times "\nfoo:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 0 } } */ +/* { dg-final { scan-assembler-times "bl\tfoo.default\n" 1 } } */ +/* { dg-final { scan-assembler-times ".global\tfoo\n" 1 } } */ +/* { dg-final { scan-assembler-times ".set\tfoo,foo.default\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols7.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols7.c new file mode 100644 index 0000000..2ea4d2e --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols7.c @@ -0,0 +1,47 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("dotprod"))) int +foo (); + +__attribute__ ((target_version ("sve+sve2"))) int +foo (); + +__attribute__ ((target_version ("default"))) int +foo (); + +int +bar () +{ + return foo (); +} + +__attribute__ ((target_version ("sve+sve2"))) int +foo () +{ + return 5; +} +__attribute__ ((target_version ("dotprod"))) int +foo () +{ + return 3; +} +__attribute__ ((target_version ("default"))) int +foo () +{ + return 1; +} + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\._MsveMsve2\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\._Mdotprod\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\.default\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols8.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols8.c new file mode 100644 index 0000000..3e3eaf2 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols8.c @@ -0,0 +1,47 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("dotprod"))) int +foo (); + +__attribute__ ((target_version ("sve+sve2"))) int +foo (); + +__attribute__ ((target_version ("default"))) int +foo (); + +__attribute__ ((target_version ("sve+sve2"))) int +foo () +{ + return 5; +} +__attribute__ ((target_version ("dotprod"))) int +foo () +{ + return 3; +} +__attribute__ ((target_version ("default"))) int +foo () +{ + return 1; +} + +int +bar () +{ + return foo (); +} + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\._MsveMsve2\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\._Mdotprod\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\.default\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mv-symbols9.c b/gcc/testsuite/gcc.target/aarch64/mv-symbols9.c new file mode 100644 index 0000000..8e0864f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mv-symbols9.c @@ -0,0 +1,44 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_version ("dotprod"))) int +foo (); +__attribute__ ((target_version ("sve+sve2"))) int +foo (); + +int +foo () +{ + return 1; +} + +__attribute__ ((target_version ("dotprod"))) int +foo () +{ + return 3; +} +__attribute__ ((target_version ("sve+sve2"))) int +foo () +{ + return 5; +} + +int +bar () +{ + return foo (); +} + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\._MsveMsve2\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\._Mdotprod\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tadrp\tx., foo\.default\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ + +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mvc-error1.c b/gcc/testsuite/gcc.target/aarch64/mvc-error1.c new file mode 100644 index 0000000..482d0a7 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mvc-error1.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_clones ("default, dotprod"))) float +foo (); /* { dg-message "previous declaration of .foo \\\[\\\[target_clones\\(.default., .dotprod.\\)\\\]\\\]." } */ + +__attribute__ ((target_clones ("dotprod", "sve"))) float +foo () { return 3; } /* { dg-error ".foo \\\[\\\[target_clones\\(.dotprod., .sve.\\)\\\]\\\]. conflicts with overlapping .target_clone. declaration" } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mvc-error2.c b/gcc/testsuite/gcc.target/aarch64/mvc-error2.c new file mode 100644 index 0000000..482d0a7 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mvc-error2.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_clones ("default, dotprod"))) float +foo (); /* { dg-message "previous declaration of .foo \\\[\\\[target_clones\\(.default., .dotprod.\\)\\\]\\\]." } */ + +__attribute__ ((target_clones ("dotprod", "sve"))) float +foo () { return 3; } /* { dg-error ".foo \\\[\\\[target_clones\\(.dotprod., .sve.\\)\\\]\\\]. conflicts with overlapping .target_clone. declaration" } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mvc-symbols1.c b/gcc/testsuite/gcc.target/aarch64/mvc-symbols1.c new file mode 100644 index 0000000..3ad15e5 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mvc-symbols1.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_clones ("default", "dotprod", "sve+sve2"))) int +foo () +{ + return 1; +} + +int +bar () +{ + return foo (); +} + +/* When updating any of the symbol names in these tests, make sure to also + update any tests for their absence in mvc-symbolsN.C */ + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mvc-symbols2.c b/gcc/testsuite/gcc.target/aarch64/mvc-symbols2.c new file mode 100644 index 0000000..78385ed --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mvc-symbols2.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_clones ("default", "dotprod", "sve+sve2"))) int +foo () +{ + return 1; +} + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mvc-symbols3.c b/gcc/testsuite/gcc.target/aarch64/mvc-symbols3.c new file mode 100644 index 0000000..1cbe3fd --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mvc-symbols3.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_clones ("default", "dotprod", "sve+sve2"))) int +foo (); + +int +bar () +{ + return foo (); +} + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\tbl\tfoo\n" 1 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 0 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mvc-symbols4.c b/gcc/testsuite/gcc.target/aarch64/mvc-symbols4.c new file mode 100644 index 0000000..abaf60f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mvc-symbols4.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +__attribute__ ((target_clones ("default", "dotprod", "sve+sve2"))) int +foo (); + +/* { dg-final { scan-assembler-times "\nfoo\.default:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._Mdotprod:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\._MsveMsve2:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\nfoo\.resolver:\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.type\tfoo, %gnu_indirect_function\n" 0 } } */ +/* { dg-final { scan-assembler-times "\n\t\.set\tfoo,foo\.resolver\n" 0 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mvc-warning1.c b/gcc/testsuite/gcc.target/aarch64/mvc-warning1.c new file mode 100644 index 0000000..1bae38c --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mvc-warning1.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O0" } */ + +__attribute__((target_clones("default", "dotprod", "sve+sve2"))) +int foo () { + return 1; +} + +__attribute__((target_clones("invalid1"))) +int foo () { /* { dg-warning "invalid feature modifier .invalid1. in version .invalid1. for .target_clones. attribute" } */ + return 2; +} diff --git a/gcc/testsuite/gcc.target/riscv/pr122051.c b/gcc/testsuite/gcc.target/riscv/pr122051.c new file mode 100644 index 0000000..c2f4b87 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/pr122051.c @@ -0,0 +1,24 @@ +/* { dg-do compile { target int128 } } */ +/* { dg-additional-options "-mrvv-vector-bits=zvl -mcpu=xt-c920 -w" } */ + +typedef __attribute__((__vector_size__(4))) char B; +typedef __attribute__((__vector_size__(16))) long V; +typedef __attribute__((__vector_size__(32))) double W; +typedef __attribute__((__vector_size__(32))) char U; +unsigned u; +B o; +char *p; +int q; +V v; +W w; + +void +foo(__int128, __int128, __int128, __int128, B a, B b, B c, B d, B e, B f, B g, B h) { + do { + w -= q; + v ^= u; + } while (__builtin_memcmp(p, 1 + p, 7)); + o = ((U)w)[0] + c + d + e + f + g + h + a + b; +} + + diff --git a/gcc/tree-ssa-pre.cc b/gcc/tree-ssa-pre.cc index 64ffaca..2a7dcbe 100644 --- a/gcc/tree-ssa-pre.cc +++ b/gcc/tree-ssa-pre.cc @@ -2049,8 +2049,12 @@ prune_clobbered_mems (bitmap_set_t set, basic_block block, bool clean_traps) the bitmap_find_leader way to see if there's still an expression for it. For some ratio of to be removed values and number of values/expressions in the set this might be faster than rebuilding - the value-set. */ - if (any_removed) + the value-set. + Note when there's a MAX solution on one edge (clean_traps) do not + prune values as we need to consider the resulting expression set MAX + as well. This avoids a later growing ANTIC_IN value-set during + iteration, when the explicitly represented expression set grows. */ + if (any_removed && !clean_traps) { bitmap_clear (&set->values); FOR_EACH_EXPR_ID_IN_SET (set, i, bi) @@ -2080,6 +2084,7 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge) edge e; edge_iterator ei; + bool was_visited = BB_VISITED (block); bool changed = ! BB_VISITED (block); bool any_max_on_edge = false; @@ -2215,6 +2220,32 @@ compute_antic_aux (basic_block block, bool block_has_abnormal_pred_edge) /* clean (ANTIC_IN (block)) is defered to after the iteration converged because it can cause non-convergence, see for example PR81181. */ + if (was_visited + && bitmap_and_into (&ANTIC_IN (block)->values, &old->values)) + { + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, "warning: intersecting with old ANTIC_IN " + "shrinks the set\n"); + /* Prune expressions not in the value set. */ + bitmap_iterator bi; + unsigned int i; + unsigned int to_clear = -1U; + FOR_EACH_EXPR_ID_IN_SET (ANTIC_IN (block), i, bi) + { + if (to_clear != -1U) + { + bitmap_clear_bit (&ANTIC_IN (block)->expressions, to_clear); + to_clear = -1U; + } + pre_expr expr = expression_for_id (i); + unsigned int value_id = get_expr_value_id (expr); + if (!bitmap_bit_p (&ANTIC_IN (block)->values, value_id)) + to_clear = i; + } + if (to_clear != -1U) + bitmap_clear_bit (&ANTIC_IN (block)->expressions, to_clear); + } + if (!bitmap_set_equal (old, ANTIC_IN (block))) changed = true; diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 1d549e4..df45adb 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -7177,6 +7177,15 @@ vectorizable_reduction (loop_vec_info loop_vinfo, tree vectype_out = SLP_TREE_VECTYPE (slp_for_stmt_info); VECT_REDUC_INFO_VECTYPE (reduc_info) = vectype_out; + /* We do not handle mask reductions correctly in the epilogue. */ + if (VECTOR_BOOLEAN_TYPE_P (vectype_out)) + { + if (dump_enabled_p ()) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "mask reduction not supported.\n"); + return false; + } + gimple_match_op op; if (!gimple_extract_op (stmt_info->stmt, &op)) gcc_unreachable (); @@ -7187,8 +7196,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo, return false; /* Do not try to vectorize bit-precision reductions. */ - if (!VECTOR_BOOLEAN_TYPE_P (vectype_out) - && !type_has_mode_precision_p (op.type) + if (!type_has_mode_precision_p (op.type) && op.code != BIT_AND_EXPR && op.code != BIT_IOR_EXPR && op.code != BIT_XOR_EXPR) |