diff --git README.md README.md new file mode 100644 index 000000000..20509d6c5 --- /dev/null +++ README.md @@ -0,0 +1,26 @@ +# This is a branch of GCC-16.1 supporting AArch64(Arm64) on Darwin. + +The branch is suitable for i686, x86_64 and aarch64 Darwin from Darwin9 (MacOSX 10.5) through Darwin23 (macOS 14 / Sonoma) on architectures relevant to each version. It should also be applicable to powerpc but has not been tested there. + +Please see README for general information on the GCC sources + +The GCC 16.1 upstream release has many changes and improvements, please see the general GCC release documentation for details. + +Please see gcc/config/aarch64/darwinpcs.md for a description of the AArch64 ABI +support. + +**_The current release is GCC-16.1-darwin-r0. (May 2026)_** + +In addition to the AArch64 support, this release: + + * Contains a number of fixes for compatibility with newer Xcode tools + * Contains a number of fixes for compatibility with newer SDKs. + * Adds support for a number of clang extensions that have been used in various SDK versions. + +Extras thanks to: + * 'FX' (https://github.com/fxcoudert) for the main part of the ```__float128``` support, progressing upstream commits and test fixes. + +Iain Sandoe, June 2026. + +Please report issues for this branch to: +https://github.com/iains/gcc-16-branch/issues diff --git configure configure index 083e8823d..314fa3f48 100755 --- configure +++ configure @@ -3677,6 +3677,8 @@ esac # Disable libffi for some systems. case "${target}" in + aarch64*-*-darwin2*) + ;; powerpc-*-darwin*) ;; i[3456789]86-*-darwin*) diff --git configure.ac configure.ac index c5de225b0..122eb9487 100644 --- configure.ac +++ configure.ac @@ -834,6 +834,8 @@ esac # Disable libffi for some systems. case "${target}" in + aarch64*-*-darwin2*) + ;; powerpc-*-darwin*) ;; i[[3456789]]86-*-darwin*) diff --git fixincludes/fixincl.x fixincludes/fixincl.x index 9db4d376a..626d24d58 100644 --- fixincludes/fixincl.x +++ fixincludes/fixincl.x @@ -2,11 +2,11 @@ * * DO NOT EDIT THIS FILE (fixincl.x) * - * It has been AutoGen-ed February 15, 2026 at 11:11:08 PM by AutoGen 5.18.12 + * It has been AutoGen-ed February 16, 2026 at 09:10:33 AM by AutoGen 5.18.16 * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT MERGE THIS FILE, EITHER Sun Feb 15 23:11:08 CET 2026 +/* DO NOT MERGE THIS FILE, EITHER Mon Feb 16 09:10:33 GMT 2026 * * You must regenerate it. Use the ./genfixes script. * @@ -15,7 +15,7 @@ * certain ANSI-incompatible system header files which are fixed to work * correctly with ANSI C and placed in a directory that GNU C will search. * - * This file contains 251 fixup descriptions. + * This file contains 249 fixup descriptions. * * See README for more information. * @@ -267,56 +267,6 @@ static const char* apzAab_Darwin7_9_Long_Double_FuncsPatch[] = { #endif /* __MATH__ */", (char*)NULL }; -/* * * * * * * * * * * * * * * * * * * * * * * * * * - * - * Description of Darwin_Api_Availability fix - */ -tSCC zDarwin_Api_AvailabilityName[] = - "darwin_api_availability"; - -/* - * File name selection pattern - */ -tSCC zDarwin_Api_AvailabilityList[] = - "os/availability.h\0"; -/* - * Machine/OS name selection pattern - */ -tSCC* apzDarwin_Api_AvailabilityMachs[] = { - "*-*-darwin*", - (const char*)NULL }; - -/* - * content selection pattern - do fix if pattern found - */ -tSCC zDarwin_Api_AvailabilitySelect0[] = - " *#define __API_AVAILABLE.*\n\ - *#define __API_DEPRECATED.*\n\ - *#define __API_DEPRECATED_WITH_REPLACEMENT.*\n\ - *#define __API_UNAVAILABLE.*\n"; - -/* - * content bypass pattern - skip fix if pattern found - */ -tSCC zDarwin_Api_AvailabilityBypass0[] = - "__IPHONE_OS_VERSION_MIN_REQUIRED"; - -#define DARWIN_API_AVAILABILITY_TEST_CT 2 -static tTestDesc aDarwin_Api_AvailabilityTests[] = { - { TT_NEGREP, zDarwin_Api_AvailabilityBypass0, (regex_t*)NULL }, - { TT_EGREP, zDarwin_Api_AvailabilitySelect0, (regex_t*)NULL }, }; - -/* - * Fix Command Arguments for Darwin_Api_Availability - */ -static const char* apzDarwin_Api_AvailabilityPatch[] = { - "format", - " #define API_AVAILABLE(...)\n\ - #define API_DEPRECATED(...)\n\ - #define API_DEPRECATED_WITH_REPLACEMENT(...)\n\ - #define API_UNAVAILABLE(...)\n", - (char*)NULL }; - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Aab_Fd_Zero_Asm_Posix_Types_H fix @@ -2731,51 +2681,6 @@ extern \"C\" {\n\ #endif\n", (char*)NULL }; -/* * * * * * * * * * * * * * * * * * * * * * * * * * - * - * Description of Darwin_Availabilityinternal fix - */ -tSCC zDarwin_AvailabilityinternalName[] = - "darwin_availabilityinternal"; - -/* - * File name selection pattern - */ -tSCC zDarwin_AvailabilityinternalList[] = - "AvailabilityInternal.h\0"; -/* - * Machine/OS name selection pattern - */ -tSCC* apzDarwin_AvailabilityinternalMachs[] = { - "*-*-darwin*", - (const char*)NULL }; - -/* - * content selection pattern - do fix if pattern found - */ -tSCC zDarwin_AvailabilityinternalSelect0[] = - "#define[ \t]+(__API_[ADU]\\([^)]*\\)).*"; - -#define DARWIN_AVAILABILITYINTERNAL_TEST_CT 1 -static tTestDesc aDarwin_AvailabilityinternalTests[] = { - { TT_EGREP, zDarwin_AvailabilityinternalSelect0, (regex_t*)NULL }, }; - -/* - * Fix Command Arguments for Darwin_Availabilityinternal - */ -static const char* apzDarwin_AvailabilityinternalPatch[] = { - "format", - "#if defined(__has_attribute)\n\ - #if __has_attribute(availability)\n\ -%0\n\ - #else\n\ - #define %1\n\ - #endif\n\ -#else\n\ - #define %1\n\ -#endif", - (char*)NULL }; - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Darwin_9_Long_Double_Funcs_2 fix @@ -10283,9 +10188,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 291 +#define REGEX_COUNT 288 #define MACH_LIST_SIZE_LIMIT 187 -#define FIX_COUNT 251 +#define FIX_COUNT 249 /* * Enumerate the fixes @@ -10294,7 +10199,6 @@ typedef enum { AAB_AIX_STDIO_FIXIDX, AAB_AIX_FCNTL_FIXIDX, AAB_DARWIN7_9_LONG_DOUBLE_FUNCS_FIXIDX, - DARWIN_API_AVAILABILITY_FIXIDX, AAB_FD_ZERO_ASM_POSIX_TYPES_H_FIXIDX, AAB_FD_ZERO_GNU_TYPES_H_FIXIDX, AAB_FD_ZERO_SELECTBITS_H_FIXIDX, @@ -10355,7 +10259,6 @@ typedef enum { CTRL_QUOTES_DEF_FIXIDX, CTRL_QUOTES_USE_FIXIDX, CXX_UNREADY_FIXIDX, - DARWIN_AVAILABILITYINTERNAL_FIXIDX, DARWIN_9_LONG_DOUBLE_FUNCS_2_FIXIDX, DARWIN_EXTERNC_FIXIDX, DARWIN_GCC4_BREAKAGE_FIXIDX, @@ -10560,11 +10463,6 @@ tFixDesc fixDescList[ FIX_COUNT ] = { AAB_DARWIN7_9_LONG_DOUBLE_FUNCS_TEST_CT, FD_MACH_ONLY | FD_REPLACEMENT, aAab_Darwin7_9_Long_Double_FuncsTests, apzAab_Darwin7_9_Long_Double_FuncsPatch, 0 }, - { zDarwin_Api_AvailabilityName, zDarwin_Api_AvailabilityList, - apzDarwin_Api_AvailabilityMachs, - DARWIN_API_AVAILABILITY_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, - aDarwin_Api_AvailabilityTests, apzDarwin_Api_AvailabilityPatch, 0 }, - { zAab_Fd_Zero_Asm_Posix_Types_HName, zAab_Fd_Zero_Asm_Posix_Types_HList, apzAab_Fd_Zero_Asm_Posix_Types_HMachs, AAB_FD_ZERO_ASM_POSIX_TYPES_H_TEST_CT, FD_MACH_ONLY | FD_REPLACEMENT, @@ -10865,11 +10763,6 @@ tFixDesc fixDescList[ FIX_COUNT ] = { CXX_UNREADY_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aCxx_UnreadyTests, apzCxx_UnreadyPatch, 0 }, - { zDarwin_AvailabilityinternalName, zDarwin_AvailabilityinternalList, - apzDarwin_AvailabilityinternalMachs, - DARWIN_AVAILABILITYINTERNAL_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, - aDarwin_AvailabilityinternalTests, apzDarwin_AvailabilityinternalPatch, 0 }, - { zDarwin_9_Long_Double_Funcs_2Name, zDarwin_9_Long_Double_Funcs_2List, apzDarwin_9_Long_Double_Funcs_2Machs, DARWIN_9_LONG_DOUBLE_FUNCS_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff --git fixincludes/inclhack.def fixincludes/inclhack.def index 91f29a2ca..ed4619a23 100644 --- fixincludes/inclhack.def +++ fixincludes/inclhack.def @@ -194,33 +194,6 @@ fix = { _EndOfHeader_; }; -/* - * SDKs for 10.13 and 10.14 omit the definitions for API_AVAILABLE where - * __attribute__((availability)) is not supported. - */ -fix = { - hackname = darwin_api_availability; - mach = "*-*-darwin*"; - files = os/availability.h; - bypass = "__IPHONE_OS_VERSION_MIN_REQUIRED"; - select = - " *#define __API_AVAILABLE.*\n" - " *#define __API_DEPRECATED.*\n" - " *#define __API_DEPRECATED_WITH_REPLACEMENT.*\n" - " *#define __API_UNAVAILABLE.*\n"; - c_fix = format; - c_fix_arg = - " #define API_AVAILABLE(...)\n" - " #define API_DEPRECATED(...)\n" - " #define API_DEPRECATED_WITH_REPLACEMENT(...)\n" - " #define API_UNAVAILABLE(...)\n"; - test_text = - "#define __API_AVAILABLE(...)\n" - "#define __API_DEPRECATED(...)\n" - "#define __API_DEPRECATED_WITH_REPLACEMENT(...)\n" - "#define __API_UNAVAILABLE(...)\n"; -}; - /* * This fixes __FD_ZERO bug for linux 2.x.y (x <= 2 && y <= some n) */ @@ -1333,32 +1306,6 @@ fix = { test_text = "extern void* malloc( size_t );"; }; -/* - * macOS 10.12 uses __attribute__((availability)) - * unconditionally. - */ -fix = { - hackname = darwin_availabilityinternal; - mach = "*-*-darwin*"; - files = AvailabilityInternal.h; - select = "#define[ \t]+(__API_[ADU]\\([^)]*\\)).*"; - c_fix = format; - c_fix_arg = <<- _EOFix_ - #if defined(__has_attribute) - #if __has_attribute(availability) - %0 - #else - #define %1 - #endif - #else - #define %1 - #endif - _EOFix_; - - test_text = "#define __API_A(x) __attribute__((availability(__API_AVAILABLE_PLATFORM_##x)))\n" - "#define __API_D(msg,x) __attribute__((availability(__API_DEPRECATED_PLATFORM_##x,message=msg)))"; -}; - /* * For the AAB_darwin7_9_long_double_funcs fix (and later fixes for long long) * to be useful, the main math.h must use <> and not "" includes. diff --git gcc/ada/init.c gcc/ada/init.c index 7aced7fe8..0ba1e8a97 100644 --- gcc/ada/init.c +++ gcc/ada/init.c @@ -2566,7 +2566,10 @@ __gnat_map_signal (int sig, siginfo_t *si, void *mcontext ATTRIBUTE_UNUSED) /* Reset the use of alt stack, so that the alt stack will be used for the next signal delivery. The stack can't be used in case of stack checking. */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" syscall (SYS_sigreturn, NULL, UC_RESET_ALT_STACK); +#pragma GCC diagnostic pop break; case SIGFPE: diff --git gcc/c-family/c-attribs.cc gcc/c-family/c-attribs.cc index d437c5528..c9d7b57b8 100644 --- gcc/c-family/c-attribs.cc +++ gcc/c-family/c-attribs.cc @@ -754,6 +754,18 @@ set_musttail_on_return (tree retval, location_t loc, bool musttail_p) error_at (loc, "cannot tail-call: return value must be a call"); } +/* Returns TRUE iff the attribute indicated by ATTR_ID needs its + arguments converted to string constants. */ + +bool +attribute_clang_form_p (const_tree attr_id) +{ + const struct attribute_spec *spec = lookup_attribute_spec (attr_id); + if (spec && !strcmp ("availability", spec->name)) + return true; + return false; +} + /* Verify that argument value POS at position ARGNO to attribute NAME applied to function FN (which is either a function declaration or function type) refers to a function parameter at position POS and the expected type diff --git gcc/c-family/c-common.cc gcc/c-family/c-common.cc index 5acb221d3..a22c3b831 100644 --- gcc/c-family/c-common.cc +++ gcc/c-family/c-common.cc @@ -355,7 +355,11 @@ static constexpr hf_feature_info has_feature_table[] = { "enumerator_attributes", HF_FLAG_NONE, 0 }, { "tls", HF_FLAG_NONE, 0 }, { "gnu_asm_goto_with_outputs", HF_FLAG_EXT, 0 }, - { "gnu_asm_goto_with_outputs_full", HF_FLAG_EXT, 0 } + { "gnu_asm_goto_with_outputs_full", HF_FLAG_EXT, 0 }, + { "attribute_availability", HF_FLAG_NONE, 0 }, + { "attribute_availability_with_message", HF_FLAG_NONE, 0 }, + { "attribute_availability_with_replacement", HF_FLAG_NONE, 0 }, + { "attribute_availability_with_version_underscores", HF_FLAG_NONE, 0 } }; /* Global visibility options. */ @@ -394,8 +398,8 @@ static bool nonnull_check_p (tree, unsigned HOST_WIDE_INT); */ const struct c_common_resword c_common_reswords[] = { - { "_Alignas", RID_ALIGNAS, D_CONLY }, - { "_Alignof", RID_ALIGNOF, D_CONLY }, + { "_Alignas", RID_ALIGNAS, D_EXT_C_IN_CXX }, + { "_Alignof", RID_ALIGNOF, D_EXT_C_IN_CXX }, { "_Countof", RID_COUNTOF, D_CONLY }, { "_Maxof", RID_MAXOF, D_CONLY }, { "_Minof", RID_MINOF, D_CONLY }, @@ -418,7 +422,7 @@ const struct c_common_resword c_common_reswords[] = { "_Fract", RID_FRACT, D_CONLY | D_EXT }, { "_Accum", RID_ACCUM, D_CONLY | D_EXT }, { "_Sat", RID_SAT, D_CONLY | D_EXT }, - { "_Static_assert", RID_STATIC_ASSERT, D_CONLY }, + { "_Static_assert", RID_STATIC_ASSERT, D_EXT_C_IN_CXX }, { "_Noreturn", RID_NORETURN, D_CONLY }, { "_Generic", RID_GENERIC, D_CONLY }, { "_Thread_local", RID_THREAD, D_CONLY }, diff --git gcc/c-family/c-common.h gcc/c-family/c-common.h index 89517e2a8..fb05c36d5 100644 --- gcc/c-family/c-common.h +++ gcc/c-family/c-common.h @@ -454,6 +454,8 @@ extern machine_mode c_default_pointer_mode; #define D_CXX_COROUTINES 0x10000 /* In C++, only with coroutines. */ #define D_CXX_MODULES 0x20000 /* In C++, only with modules. */ #define D_CXX26 0x40000 /* In C++, C++26 only. */ +#define D_EXT_C_IN_CXX 0x80000 /* In C++, allow additional C keywords. */ +#define D_EXT_CXX_IN_C 0x100000 /* In C, allow additional C++ keywords. */ #define D_CXX_CONCEPTS_FLAGS D_CXXONLY | D_CXX_CONCEPTS #define D_CXX_CHAR8_T_FLAGS D_CXXONLY | D_CXX_CHAR8_T @@ -1686,6 +1688,7 @@ extern void check_for_xor_used_as_pow (location_t lhs_loc, tree lhs_val, /* In c-attribs.cc. */ extern bool attribute_takes_identifier_p (const_tree); extern tree handle_deprecated_attribute (tree *, tree, tree, int, bool *); +extern bool attribute_clang_form_p (const_tree); extern tree handle_unused_attribute (tree *, tree, tree, int, bool *); extern tree handle_fallthrough_attribute (tree *, tree, tree, int, bool *); extern int parse_tm_stmt_attr (tree, int); diff --git gcc/c-family/c-lex.cc gcc/c-family/c-lex.cc index 1750fbc3d..8fb9cbb47 100644 --- gcc/c-family/c-lex.cc +++ gcc/c-family/c-lex.cc @@ -591,6 +591,21 @@ c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags, case CPP_NUMBER: { + /* If the user wants number-like entities to be returned as a raw + string, then don't try to classify them, which emits unwanted + diagnostics. */ + if (lex_flags & C_LEX_NUMBER_AS_STRING) + { + /* build_string adds a trailing NUL at [len]. */ + tree num_string = build_string (tok->val.str.len + 1, + (const char *) tok->val.str.text); + TREE_TYPE (num_string) = char_array_type_node; + *value = num_string; + /* We will effectively note this as CPP_N_INVALID, because we + made no checks here. */ + break; + } + const char *suffix = NULL; unsigned int flags = cpp_classify_number (parse_in, tok, &suffix, *loc); diff --git gcc/c-family/c-opts.cc gcc/c-family/c-opts.cc index c818a0802..45cf63de1 100644 --- gcc/c-family/c-opts.cc +++ gcc/c-family/c-opts.cc @@ -1218,7 +1218,7 @@ c_common_post_options (const char **pfilename) if (flag_extern_tls_init) { - if (!TARGET_SUPPORTS_ALIASES || !SUPPORTS_WEAK) + if (!SUPPORTS_WEAK) { /* Lazy TLS initialization for a variable in another TU requires alias and weak reference support. */ diff --git gcc/c-family/c-pragma.h gcc/c-family/c-pragma.h index ff299f4e1..5e0c7d632 100644 --- gcc/c-family/c-pragma.h +++ gcc/c-family/c-pragma.h @@ -292,6 +292,9 @@ extern void pragma_lex_discard_to_eol (); #define C_LEX_STRING_NO_JOIN 2 /* Do not concatenate strings nor translate them into execution character set. */ +#define C_LEX_NUMBER_AS_STRING 4 /* Do not classify a number, but + instead return it as a raw + string. */ /* This is not actually available to pragma parsers. It's merely a convenient location to declare this function for c-lex, after diff --git gcc/c-family/c.opt gcc/c-family/c.opt index 3d96a73ec..025488283 100644 --- gcc/c-family/c.opt +++ gcc/c-family/c.opt @@ -1852,6 +1852,18 @@ static-libmpxwrappers Driver WarnRemoved Removed in GCC 9. This switch has no effect. +fallow-const-var-array-size +C ObjC C++ ObjC++ LTO Var(flag_allow_const_var_array_size) Init(0) +Allow arrays sizes to be const-qualified vars in C and Objective-C. + +fallow-extended-attribute-placement +C ObjC C++ ObjC++ LTO Var(flag_allow_ext_attr_placement) Init(0) +Allow placement of attributes on function definitions. + +fallow-extra-keywords +C ObjC C++ ObjC++ LTO Var(flag_allow_extra_keywords) Init(0) +Allow additional C keywords in C++ and vice versa. + fcilkplus C ObjC C++ ObjC++ LTO Undocumented Ignore Removed in GCC 8. This switch has no effect. diff --git gcc/c/c-decl.cc gcc/c/c-decl.cc index 8a894de3a..68f7d1089 100644 --- gcc/c/c-decl.cc +++ gcc/c/c-decl.cc @@ -7390,6 +7390,25 @@ grokdeclarator (const struct c_declarator *declarator, } size = c_fully_fold (size, false, &size_maybe_const); + bool size_const_var = false; + if (flag_allow_const_var_array_size) + { + tree maybe_const_size = TREE_CODE (size) == NOP_EXPR + ? TREE_OPERAND (size, 0) : size; + size_const_var + = (TREE_CODE (maybe_const_size) == VAR_DECL + && TREE_READONLY (maybe_const_size) + && !TREE_THIS_VOLATILE (maybe_const_size)); + if (size_const_var + && size_maybe_const + && DECL_INITIAL (maybe_const_size)) + { + size = DECL_INITIAL (maybe_const_size); + size = c_fully_fold (size, false, &size_maybe_const); + size_int_const = (TREE_CODE (size) == INTEGER_CST + && !TREE_OVERFLOW (size)); + } + } if (pedantic && size_maybe_const && integer_zerop (size)) { @@ -7432,6 +7451,9 @@ grokdeclarator (const struct c_declarator *declarator, this_size_varies = size_varies = true; warn_variable_length_array (name, size); } + if (flag_allow_const_var_array_size && size_const_var) + pedwarn (input_location, OPT_Wpedantic, + "variably modified %qE at file scope", name); } else if ((decl_context == NORMAL || decl_context == FIELD) && current_scope == file_scope) diff --git gcc/c/c-parser.cc gcc/c/c-parser.cc index 0b8b23871..7b5fb52dd 100644 --- gcc/c/c-parser.cc +++ gcc/c/c-parser.cc @@ -220,6 +220,9 @@ struct GTY(()) c_parser { should translate them to the execution character set (false inside attributes). */ BOOL_BITFIELD translate_strings_p : 1; + /* True if we want to lex arbitrary number-like sequences as their + string representation. */ + BOOL_BITFIELD lex_number_as_string : 1; /* Objective-C specific parser/lexer information. */ @@ -339,10 +342,10 @@ c_lex_one_token (c_parser *parser, c_token *token, bool raw = false) if (raw || vec_safe_length (parser->raw_tokens) == 0) { + int lex_flags = parser->lex_joined_string ? 0 : C_LEX_STRING_NO_JOIN; + lex_flags |= parser->lex_number_as_string ? C_LEX_NUMBER_AS_STRING : 0; token->type = c_lex_with_flags (&token->value, &token->location, - &token->flags, - (parser->lex_joined_string - ? 0 : C_LEX_STRING_NO_JOIN)); + &token->flags, lex_flags); token->id_kind = C_ID_NONE; token->keyword = RID_MAX; token->pragma_kind = PRAGMA_NONE; @@ -2872,15 +2875,28 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, d = d->declarator; underspec_name = d->u.id.id; } + tree postfix_attrs = NULL_TREE; + if (flag_allow_ext_attr_placement + && c_parser_next_token_is_keyword (parser, RID_ATTRIBUTE)) + { + postfix_attrs = c_parser_gnu_attributes (parser); + /* IF we have a function definition, and we're allowing it then + treat these attributes as if they had been prepended. */ + if (c_parser_next_token_is (parser, CPP_OPEN_BRACE)) + { + all_prefix_attrs = chainon (all_prefix_attrs, postfix_attrs); + postfix_attrs = NULL_TREE; + } + } if (c_parser_next_token_is (parser, CPP_EQ) || c_parser_next_token_is (parser, CPP_COMMA) || c_parser_next_token_is (parser, CPP_SEMICOLON) || c_parser_next_token_is_keyword (parser, RID_ASM) || c_parser_next_token_is_keyword (parser, RID_ATTRIBUTE) + || postfix_attrs || c_parser_next_token_is_keyword (parser, RID_IN)) { tree asm_name = NULL_TREE; - tree postfix_attrs = NULL_TREE; if (!diagnosed_no_specs && !specs->declspecs_seen_p) { diagnosed_no_specs = true; @@ -2892,8 +2908,9 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok, if (c_parser_next_token_is_keyword (parser, RID_ASM)) asm_name = c_parser_simple_asm_expr (parser); if (c_parser_next_token_is_keyword (parser, RID_ATTRIBUTE)) + postfix_attrs = c_parser_gnu_attributes (parser); + if (postfix_attrs) { - postfix_attrs = c_parser_gnu_attributes (parser); if (c_parser_next_token_is (parser, CPP_OPEN_BRACE)) { /* This means there is an attribute specifier after @@ -5668,6 +5685,88 @@ c_parser_gnu_attribute_any_word (c_parser *parser) return attr_name; } +/* Handle parsing clang-form attribute arguments, where we need to adjust + the parsing rules to relate to a specific attribute. */ + +static tree +c_parser_clang_attribute_arguments (c_parser *parser, tree /*attr_id*/) +{ + /* We can, if required, alter the parsing on the basis of the attribute. + At present, we handle the availability attr, where ach entry can be : + identifier + identifier=N.MM.Z + identifier="string" + followed by ',' or ) for the last entry*/ + + tree attr_args = NULL_TREE; + do + { + tree name = NULL_TREE; + tree value = NULL_TREE; + + if (c_parser_next_token_is (parser, CPP_NAME) + && c_parser_peek_token (parser)->id_kind == C_ID_ID) + { + name = c_parser_peek_token (parser)->value; + c_parser_consume_token (parser); + } + else if (c_parser_next_token_is (parser, CPP_COMMA)) + name = error_mark_node; /* Comma handled below. */ + else + { + bool saved_join_state = parser->lex_joined_string; + parser->lex_number_as_string = 1; + parser->lex_joined_string = 1; + c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, + "expected an attribute keyword"); + parser->lex_number_as_string = 0; + parser->lex_joined_string = saved_join_state; + return error_mark_node; + } + if (c_parser_next_token_is (parser, CPP_EQ)) + { + c_parser_consume_token (parser); /* eat the '=' */ + /* We need to bludgeon the lexer into not trying to interpret the + xx.yy.zz form, since that just looks like a malformed float. + Also, as a result of macro processing, we can have strig literals + that are in multiple pieces so, for this specific part of the + parse, we need to join strings. */ + bool saved_join_state = parser->lex_joined_string; + parser->lex_number_as_string = 1; + parser->lex_joined_string = 1; + /* So look at the next token, expecting a string, or something that + looks initially like a number, but might be a version number. */ + c_parser_peek_token (parser); + /* Done with the funky number parsing. */ + parser->lex_number_as_string = 0; + parser->lex_joined_string = saved_join_state; + if (c_parser_next_token_is_not (parser, CPP_CLOSE_PAREN) + && c_parser_next_token_is_not (parser, CPP_COMMA)) + { + value = c_parser_peek_token (parser)->value; + /* ???: check for error mark and early-return? */ + c_parser_consume_token (parser); + } + /* else value is absent. */ + } + else if (c_parser_next_token_is_not (parser, CPP_CLOSE_PAREN) + && c_parser_next_token_is_not (parser, CPP_COMMA)) + { + c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, + "expected %<,%> or %<=%>"); + return error_mark_node; + } + if (c_parser_next_token_is (parser, CPP_COMMA)) + c_parser_consume_token (parser); /* Just skip the comma. */ + tree t = tree_cons (value, name, NULL); + if (!attr_args) + attr_args = t; + else + chainon (attr_args, t); + } while (c_parser_next_token_is_not (parser, CPP_CLOSE_PAREN)); + return attr_args; +} + /* Parse attribute arguments. This is a common form of syntax covering all currently valid GNU and standard attributes. @@ -5833,9 +5932,13 @@ c_parser_gnu_attribute (c_parser *parser, tree attrs, attrs = chainon (attrs, attr); return attrs; } - c_parser_consume_token (parser); + c_parser_consume_token (parser); /* The '('. */ - tree attr_args + tree attr_args; + if (attribute_clang_form_p (attr_name)) + attr_args = c_parser_clang_attribute_arguments (parser, attr_name); + else + attr_args = c_parser_attribute_arguments (parser, attribute_takes_identifier_p (attr_name), false, diff --git gcc/calls.cc gcc/calls.cc index 4cdc2361a..1f89d7e73 100644 --- gcc/calls.cc +++ gcc/calls.cc @@ -1418,7 +1418,8 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED, with those made by function.cc. */ /* See if this argument should be passed by invisible reference. */ - function_arg_info arg (type, argpos < n_named_args); + function_arg_info arg (type, argpos < n_named_args, + argpos == n_named_args - 1); if (pass_by_reference (args_so_far_pnt, arg)) { const bool callee_copies @@ -1543,10 +1544,13 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED, type = integer_type_node; arg.type = type; - arg.mode - = promote_function_mode (type, TYPE_MODE (type), &unsignedp, - fndecl ? TREE_TYPE (fndecl) : fntype, 0); - + arg.mode = TYPE_MODE (type); +// arg.mode +// = promote_function_mode (type, TYPE_MODE (type), &unsignedp, +// fndecl ? TREE_TYPE (fndecl) : fntype, 0); + arg.mode = promote_function_mode (args_so_far, arg, + fndecl ? TREE_TYPE (fndecl) : fntype, + &unsignedp, 0); args[i].unsignedp = unsignedp; args[i].mode = arg.mode; @@ -1596,6 +1600,7 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED, #endif reg_parm_stack_space, args[i].pass_on_stack ? 0 : args[i].partial, + args_so_far, fndecl, args_size, &args[i].locate); #ifdef BLOCK_REG_PADDING else @@ -4174,6 +4179,7 @@ split_complex_types (tree types) return types; } +extern void debug_tree (tree); /* Output a library call to function ORGFUN (a SYMBOL_REF rtx) for a value of mode OUTMODE, with NARGS different arguments, passed as ARGS. @@ -4359,6 +4365,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, argvec[count].reg != 0, #endif reg_parm_stack_space, 0, + args_so_far, NULL_TREE, &args_size, &argvec[count].locate); if (argvec[count].reg == 0 || argvec[count].partial != 0 @@ -4429,8 +4436,16 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, val = force_operand (XEXP (slot, 0), NULL_RTX); } - arg.mode = promote_function_mode (NULL_TREE, arg.mode, &unsigned_p, - NULL_TREE, 0); +// arg.mode = promote_function_mode (NULL_TREE, arg.mode, &unsigned_p, +// NULL_TREE, 0); + tree t = arg.type; +if (t) + debug_tree (t); +gcc_assert (!t); + arg.type = NULL_TREE; + arg.mode = promote_function_mode (args_so_far, arg, NULL_TREE, + &unsigned_p, 0); + arg.type = t; argvec[count].mode = arg.mode; argvec[count].value = convert_modes (arg.mode, GET_MODE (val), val, unsigned_p); @@ -4450,6 +4465,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, argvec[count].reg != 0, #endif reg_parm_stack_space, argvec[count].partial, + args_so_far, NULL_TREE, &args_size, &argvec[count].locate); args_size.constant += argvec[count].locate.size.constant; gcc_assert (!argvec[count].locate.size.var); diff --git gcc/calls.h gcc/calls.h index 8d1e9af80..6e38916f6 100644 --- gcc/calls.h +++ gcc/calls.h @@ -35,24 +35,43 @@ class function_arg_info { public: function_arg_info () - : type (NULL_TREE), mode (VOIDmode), named (false), + : type (NULL_TREE), mode (VOIDmode), named (false), last_named (false), pass_by_reference (false) {} /* Initialize an argument of mode MODE, either before or after promotion. */ function_arg_info (machine_mode mode, bool named) - : type (NULL_TREE), mode (mode), named (named), pass_by_reference (false) + : type (NULL_TREE), mode (mode), named (named), last_named (false), + pass_by_reference (false) + {} + + function_arg_info (machine_mode mode, bool named, bool last_named) + : type (NULL_TREE), mode (mode), named (named), last_named (last_named), + pass_by_reference (false) {} /* Initialize an unpromoted argument of type TYPE. */ function_arg_info (tree type, bool named) - : type (type), mode (TYPE_MODE (type)), named (named), + : type (type), mode (TYPE_MODE (type)), named (named), last_named (false), pass_by_reference (false) {} + /* Initialize an unpromoted argument of type TYPE. */ + function_arg_info (tree type, bool named, bool last_named) + : type (type), mode (TYPE_MODE (type)), named (named), + last_named (last_named), pass_by_reference (false) + {} + /* Initialize an argument with explicit properties. */ function_arg_info (tree type, machine_mode mode, bool named) - : type (type), mode (mode), named (named), pass_by_reference (false) + : type (type), mode (mode), named (named), last_named (false), + pass_by_reference (false) + {} + + /* Initialize an argument with explicit properties. */ + function_arg_info (tree type, machine_mode mode, bool named, bool last_named) + : type (type), mode (mode), named (named), last_named (last_named), + pass_by_reference (false) {} /* Return true if the gimple-level type is an aggregate. */ @@ -105,6 +124,9 @@ public: "..."). See also TARGET_STRICT_ARGUMENT_NAMING. */ unsigned int named : 1; + /* True if this is the last named argument. */ + unsigned int last_named : 1; + /* True if we have decided to pass the argument by reference, in which case the function_arg_info describes a pointer to the original argument. */ unsigned int pass_by_reference : 1; diff --git gcc/collect2.cc gcc/collect2.cc index 4353be6e3..c47f8be92 100644 --- gcc/collect2.cc +++ gcc/collect2.cc @@ -73,7 +73,7 @@ along with GCC; see the file COPYING3. If not see In a cross-compiler, this means you need a cross nm, but that is not quite as unpleasant as special headers. */ -#if !defined (OBJECT_FORMAT_COFF) +#if !defined (OBJECT_FORMAT_COFF) && !defined (OBJECT_FORMAT_MACHO) #define OBJECT_FORMAT_NONE #endif @@ -107,7 +107,7 @@ along with GCC; see the file COPYING3. If not see #endif /* OBJECT_FORMAT_COFF */ -#ifdef OBJECT_FORMAT_NONE +#if defined (OBJECT_FORMAT_NONE) || defined (OBJECT_FORMAT_MACHO) /* Default flags to pass to nm. */ #ifndef NM_FLAGS @@ -525,7 +525,7 @@ static const char *const target_machine = TARGET_MACHINE; Return 0 if not found, otherwise return its name, allocated with malloc. */ -#ifdef OBJECT_FORMAT_NONE +#if defined (OBJECT_FORMAT_NONE) || defined (OBJECT_FORMAT_MACHO) /* Add an entry for the object file NAME to object file list LIST. New entries are added at the end of the list. The original pointer @@ -764,6 +764,12 @@ do_link (char **ld_argv, const char *atsuffix) } } +#if defined (OBJECT_FORMAT_MACHO) +# define LLD_NAME "ld64.lld" +#else +# define LLD_NAME "ld.lld" +#endif + /* Main program. */ int @@ -778,17 +784,20 @@ main (int argc, char **argv) USE_LLD_LD, USE_MOLD_LD, USE_WILD_LD, + USE_CLASSIC_LD, USE_LD_MAX } selected_linker = USE_DEFAULT_LD; + static const char *const ld_suffixes[USE_LD_MAX] = { "ld", PLUGIN_LD_SUFFIX, "ld.gold", "ld.bfd", - "ld.lld", + LLD_NAME, "ld.mold", - "wild" + "wild", + "ld-classic" }; static const char *const real_ld_suffix = "real-ld"; static const char *const collect_ld_suffix = "collect-ld"; @@ -870,7 +879,8 @@ main (int argc, char **argv) #ifdef CROSS_DIRECTORY_STRUCTURE /* lld and mold are platform-agnostic and not prefixed with target triple. */ - if (!(i == USE_LLD_LD || i == USE_MOLD_LD || i == USE_WILD_LD)) + if (!(i == USE_LLD_LD || i == USE_MOLD_LD + || i == USE_WILD_LD || i == USE_CLASSIC_LD)) full_ld_suffixes[i] = concat (target_machine, "-", ld_suffixes[i], NULL); else @@ -958,16 +968,24 @@ main (int argc, char **argv) if (selected_linker == USE_DEFAULT_LD) selected_linker = USE_PLUGIN_LD; } +#if !defined (OBJECT_FORMAT_MACHO) else if (strcmp (argv[i], "-fuse-ld=bfd") == 0) selected_linker = USE_BFD_LD; else if (strcmp (argv[i], "-fuse-ld=gold") == 0) selected_linker = USE_GOLD_LD; +#endif else if (strcmp (argv[i], "-fuse-ld=lld") == 0) selected_linker = USE_LLD_LD; else if (strcmp (argv[i], "-fuse-ld=mold") == 0) selected_linker = USE_MOLD_LD; else if (strcmp (argv[i], "-fuse-ld=wild") == 0) selected_linker = USE_WILD_LD; +#if defined (OBJECT_FORMAT_MACHO) + else if (strcmp (argv[i], "-fuse-ld=classic") == 0) + selected_linker = USE_CLASSIC_LD; +#endif + else if (startswith (argv[i], "-fuse-ld=")) + selected_linker = USE_DEFAULT_LD; else if (startswith (argv[i], "-o")) { /* Parse the output filename if it's given so that we can make @@ -1061,7 +1079,7 @@ main (int argc, char **argv) #ifdef DEFAULT_LINKER if (selected_linker == USE_BFD_LD || selected_linker == USE_GOLD_LD || selected_linker == USE_LLD_LD || selected_linker == USE_MOLD_LD || - selected_linker == USE_WILD_LD) + selected_linker == USE_WILD_LD ||selected_linker == USE_CLASSIC_LD) { char *linker_name; # ifdef HOST_EXECUTABLE_SUFFIX @@ -2275,7 +2293,7 @@ write_aix_file (FILE *stream, struct id *list) } #endif -#ifdef OBJECT_FORMAT_NONE +#if defined (OBJECT_FORMAT_NONE) || defined (OBJECT_FORMAT_MACHO) /* Check to make sure the file is an LTO object file. */ diff --git gcc/common.opt gcc/common.opt index 5d0e255a4..e3daeacd7 100644 --- gcc/common.opt +++ gcc/common.opt @@ -3091,6 +3091,10 @@ fstack-usage Common RejectNegative Var(flag_stack_usage) Output stack usage information on a per-function basis. +fstack-use-cumulative-args +Common RejectNegative Var(flag_stack_use_cumulative_args) Init(STACK_USE_CUMULATIVE_ARGS_INIT) +Use cumulative args-based stack layout hooks. + fstrength-reduce Common Ignore Does nothing. Preserved for backward compatibility. @@ -3472,6 +3476,10 @@ fuse-ld=wild Common Driver Negative(fuse-ld=wild) Use the Wild linker instead of the default linker. +fuse-ld=classic +Common Driver Negative(fuse-ld=classic) +Use the ld-classic linker instead of the default linker. + fuse-linker-plugin Common Undocumented Var(flag_use_linker_plugin) diff --git gcc/common/config/aarch64/aarch64-common.cc gcc/common/config/aarch64/aarch64-common.cc index ae467f140..634cf6ece 100644 --- gcc/common/config/aarch64/aarch64-common.cc +++ gcc/common/config/aarch64/aarch64-common.cc @@ -653,8 +653,12 @@ aarch64_get_extension_string_for_isa_flags However, assemblers with Armv8-R AArch64 support should not have this issue, so we don't need this fix when targeting Armv8-R. */ - auto explicit_flags = (!(current_flags & AARCH64_FL_V8R) - ? AARCH64_FL_CRC : 0); + aarch64_feature_flags explicit_flags = +#ifndef DISABLE_AARCH64_AS_CRC_BUGFIX + (!(current_flags & AARCH64_FL_V8R) ? AARCH64_FL_CRC : 0); +#else + 0; +#endif /* Add the features in isa_flags & ~current_flags using the smallest possible number of extensions. We can do this by iterating over the diff --git gcc/config.gcc gcc/config.gcc index 8fe99616f..c8c98d2ea 100644 --- gcc/config.gcc +++ gcc/config.gcc @@ -1224,13 +1224,22 @@ case ${target} in ;; esac -# Figure out if we need to enable heap trampolines by default +# Figure out if we need to enable heap trampolines +# and variadic functions handling. case ${target} in +aarch64*-*-darwin2*) + # This applies to arm64 Darwin variadic funtions. + tm_defines="$tm_defines STACK_USE_CUMULATIVE_ARGS_INIT=1" + # Executable stack is forbidden. + tm_defines="$tm_defines HEAP_TRAMPOLINES_INIT=1" + ;; *-*-darwin2*) + tm_defines="$tm_defines STACK_USE_CUMULATIVE_ARGS_INIT=0" # Currently, we do this for macOS 11 and above. tm_defines="$tm_defines HEAP_TRAMPOLINES_INIT=1" ;; *) + tm_defines="$tm_defines STACK_USE_CUMULATIVE_ARGS_INIT=0" tm_defines="$tm_defines HEAP_TRAMPOLINES_INIT=0" ;; esac @@ -1274,6 +1283,14 @@ aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*) done TM_MULTILIB_CONFIG=`echo $TM_MULTILIB_CONFIG | sed 's/^,//'` ;; +aarch64-*-darwin* ) + tm_file="${tm_file} aarch64/aarch64-errata.h" + tmake_file="${tmake_file} aarch64/t-aarch64 aarch64/t-aarch64-darwin" + tm_defines="${tm_defines} TARGET_DEFAULT_ASYNC_UNWIND_TABLES=1" + tm_defines="${tm_defines} DISABLE_AARCH64_AS_CRC_BUGFIX=1" + # Choose a default CPU version that will work for all current releases. + with_cpu=${with_cpu:-apple-m1} + ;; aarch64*-*-freebsd*) tm_file="${tm_file} elfos.h ${fbsd_tm_file}" tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-freebsd.h" diff --git gcc/config/aarch64/aarch64-builtins.cc gcc/config/aarch64/aarch64-builtins.cc index 611f6dc45..dde45e2ff 100644 --- gcc/config/aarch64/aarch64-builtins.cc +++ gcc/config/aarch64/aarch64-builtins.cc @@ -911,6 +911,8 @@ enum aarch64_builtins AARCH64_BUILTIN_STSHH_SF, AARCH64_BUILTIN_STSHH_DF, AARCH64_BUILTIN_STSHH_PTR, + /* OS-specific */ + AARCH64_BUILTIN_CFSTRING, AARCH64_BUILTIN_MAX }; @@ -1044,6 +1046,9 @@ tree aarch64_fp16_ptr_type_node = NULL_TREE; /* Back-end node type for brain float (bfloat) types. */ tree aarch64_bf16_ptr_type_node = NULL_TREE; +/* Pointer to __float128 on Mach-O, where the 128b float is not long double. */ +tree aarch64_float128_ptr_type_node = NULL_TREE; + /* Wrapper around add_builtin_function. NAME is the name of the built-in function, TYPE is the function type, CODE is the function subcode (relative to AARCH64_BUILTIN_GENERAL), and ATTRS is the function @@ -2073,6 +2078,29 @@ aarch64_init_bf16_types (void) aarch64_bf16_ptr_type_node = build_pointer_type (bfloat16_type_node); } +/* Initialize the backend REAL_TYPE type supporting __float128 on Mach-O, + as well as the related built-ins. */ +static void +aarch64_init_float128_types (void) +{ + /* The __float128 type. The node has already been created as + _Float128, so for C we only need to register the __float128 name for + it. For C++, we create a distinct type which will mangle differently + (g) vs. _Float128 (DF128_) and behave backwards compatibly. */ + if (float128t_type_node == NULL_TREE) + { + float128t_type_node = make_node (REAL_TYPE); + TYPE_PRECISION (float128t_type_node) + = TYPE_PRECISION (float128_type_node); + SET_TYPE_MODE (float128t_type_node, TYPE_MODE (float128_type_node)); + layout_type (float128t_type_node); + } + lang_hooks.types.register_builtin_type (float128t_type_node, "__float128"); + + aarch64_float128_ptr_type_node = build_pointer_type (float128t_type_node); +} + + /* Pointer authentication builtins that will become NOP on legacy platform. Currently, these builtins are for internal use only (libgcc EH unwinder). */ @@ -2566,8 +2594,9 @@ aarch64_general_init_builtins (void) aarch64_init_fp8_types (); aarch64_init_fp16_types (); - aarch64_init_bf16_types (); + if (TARGET_MACHO) + aarch64_init_float128_types (); { aarch64_target_switcher switcher (AARCH64_FL_SIMD); @@ -2652,6 +2681,15 @@ aarch64_general_builtin_decl (unsigned code, bool) return aarch64_builtin_decls[code]; } +void +aarch64_init_subtarget_builtins (void) +{ +#ifdef SUBTARGET_INIT_BUILTINS + SUBTARGET_INIT_BUILTINS; +#endif +} + + /* True if we've already complained about attempts to use functions when the required extension is disabled. */ static bool reported_missing_extension_p; diff --git gcc/config/aarch64/aarch64-c.cc gcc/config/aarch64/aarch64-c.cc index b2cc3e67f..d92f96325 100644 --- gcc/config/aarch64/aarch64-c.cc +++ gcc/config/aarch64/aarch64-c.cc @@ -342,6 +342,16 @@ aarch64_cpu_cpp_builtins (cpp_reader *pfile) { aarch64_define_unconditional_macros (pfile); aarch64_update_cpp_builtins (pfile); + + if (TARGET_MACHO) + { + builtin_define ("__builtin_copysignq=__builtin_copysignf128"); + builtin_define ("__builtin_fabsq=__builtin_fabsf128"); + builtin_define ("__builtin_huge_valq=__builtin_huge_valf128"); + builtin_define ("__builtin_infq=__builtin_inff128"); + builtin_define ("__builtin_nanq=__builtin_nanf128"); + builtin_define ("__builtin_nansq=__builtin_nansf128"); + } } /* Hook to validate the current #pragma GCC target and set the state, and @@ -481,4 +491,8 @@ aarch64_register_pragmas (void) targetm.check_builtin_call = aarch64_check_builtin_call; c_register_pragma ("GCC", "aarch64", aarch64_pragma_aarch64); + +#ifdef REGISTER_SUBTARGET_PRAGMAS + REGISTER_SUBTARGET_PRAGMAS (); +#endif } diff --git gcc/config/aarch64/aarch64-option-extensions.def gcc/config/aarch64/aarch64-option-extensions.def index b23e44efe..14f7b41ca 100644 --- gcc/config/aarch64/aarch64-option-extensions.def +++ gcc/config/aarch64/aarch64-option-extensions.def @@ -137,6 +137,8 @@ AARCH64_OPT_FMV_EXTENSION("rdma", RDMA, (), (SIMD), (), "asimdrdm") /* rdm is an alias for rdma. */ AARCH64_FMV_FEATURE("rdm", RDM, (RDMA)) +AARCH64_OPT_EXTENSION_ALIAS("rdm", RDM, (RDMA), (RDMA), (RDMA), (RDMA), "") + AARCH64_OPT_FMV_EXTENSION("crc", CRC, (), (), (), "crc32") AARCH64_OPT_FMV_EXTENSION("sha2", SHA2, (SIMD), (), (), "sha1 sha2") diff --git gcc/config/aarch64/aarch64-protos.h gcc/config/aarch64/aarch64-protos.h index afacc004c..67a5c4141 100644 --- gcc/config/aarch64/aarch64-protos.h +++ gcc/config/aarch64/aarch64-protos.h @@ -109,6 +109,14 @@ enum aarch64_symbol_type SYMBOL_TLSLE24, SYMBOL_TLSLE32, SYMBOL_TLSLE48, + SYMBOL_MO_SMALL_ABS, + SYMBOL_MO_SMALL_PCR, + SYMBOL_MO_SMALL_GOT, + SYMBOL_MO_SMALL_TLS, + SYMBOL_MO_LARGE_ABS, + SYMBOL_MO_LARGE_PCR, + SYMBOL_MO_LARGE_GOT, + SYMBOL_MO_LARGE_TLS, SYMBOL_FORCE_TO_MEM }; @@ -865,6 +873,7 @@ void aarch64_post_cfi_startproc (void); poly_int64 aarch64_initial_elimination_offset (unsigned, unsigned); int aarch64_get_condition_code (rtx); bool aarch64_address_valid_for_prefetch_p (rtx, bool); +bool aarch64_address_valid_for_unscaled_prefetch_p (rtx, bool); bool aarch64_bitmask_imm (unsigned HOST_WIDE_INT val, machine_mode); unsigned HOST_WIDE_INT aarch64_and_split_imm1 (HOST_WIDE_INT val_in); unsigned HOST_WIDE_INT aarch64_and_split_imm2 (HOST_WIDE_INT val_in); @@ -902,7 +911,11 @@ bool aarch64_is_extend_from_extract (scalar_int_mode, rtx, rtx); bool aarch64_is_long_call_p (rtx); bool aarch64_is_noplt_call_p (rtx); bool aarch64_label_mentioned_p (rtx); +#if TARGET_MACHO +void aarch64_darwin_declare_function_name (FILE *, const char*, tree ); +#else void aarch64_declare_function_name (FILE *, const char*, tree); +#endif void aarch64_asm_output_alias (FILE *, const tree, const tree); void aarch64_asm_output_external (FILE *, tree, const char*); bool aarch64_legitimate_pic_operand_p (rtx); @@ -1144,6 +1157,7 @@ void aarch64_override_options_internal (struct gcc_options *); const char *aarch64_general_mangle_builtin_type (const_tree); void aarch64_general_init_builtins (void); +void aarch64_init_subtarget_builtins (void); tree aarch64_general_fold_builtin (unsigned int, tree, unsigned int, tree *); gimple *aarch64_general_gimple_fold_builtin (unsigned int, gcall *, gimple_stmt_iterator *); diff --git gcc/config/aarch64/aarch64.cc gcc/config/aarch64/aarch64.cc index 62194b964..dac71f0eb 100644 --- gcc/config/aarch64/aarch64.cc +++ gcc/config/aarch64/aarch64.cc @@ -358,8 +358,10 @@ static bool aarch64_vfp_is_call_or_return_candidate (machine_mode, const_tree, machine_mode *, int *, bool *, bool); +#if !TARGET_MACHO static void aarch64_elf_asm_constructor (rtx, int) ATTRIBUTE_UNUSED; static void aarch64_elf_asm_destructor (rtx, int) ATTRIBUTE_UNUSED; +#endif static void aarch64_override_options_after_change (void); static bool aarch64_vector_mode_supported_p (machine_mode); static int aarch64_address_cost (rtx, machine_mode, addr_space_t, bool); @@ -916,6 +918,9 @@ static const attribute_spec aarch64_gnu_attributes[] = { /* { name, min_len, max_len, decl_req, type_req, fn_type_req, affects_type_identity, handler, exclude } */ +#ifdef SUBTARGET_ATTRIBUTE_TABLE + SUBTARGET_ATTRIBUTE_TABLE, +#endif { "aarch64_vector_pcs", 0, 0, false, true, true, true, handle_aarch64_vector_pcs_attribute, aarch64_pcs_exclusions }, @@ -932,9 +937,6 @@ static const attribute_spec aarch64_gnu_attributes[] = { "dllimport", 0, 0, false, false, false, false, handle_dll_attribute, NULL }, { "dllexport", 0, 0, false, false, false, false, handle_dll_attribute, NULL }, #endif -#ifdef SUBTARGET_ATTRIBUTE_TABLE - SUBTARGET_ATTRIBUTE_TABLE -#endif }; static const scoped_attribute_specs aarch64_gnu_attribute_table = @@ -2471,7 +2473,7 @@ aarch64_hard_regno_mode_ok (unsigned regno, machine_mode mode) if (known_le (GET_MODE_SIZE (mode), 8)) return true; if (known_le (GET_MODE_SIZE (mode), 16)) - return (regno & 1) == 0; + return (regno & 1) == 0 || TARGET_MACHO; /* darwinpcs D.4 */ } else if (FP_REGNUM_P (regno)) { @@ -2517,8 +2519,10 @@ static bool aarch64_takes_arguments_in_sve_regs_p (const_tree fntype) { CUMULATIVE_ARGS args_so_far_v; + /* This does not apply to variadic functions, so all the (currently + uncounted) arguments must be named. */ aarch64_init_cumulative_args (&args_so_far_v, NULL_TREE, NULL_RTX, - NULL_TREE, 0, true); + NULL_TREE, -1, true); cumulative_args_t args_so_far = pack_cumulative_args (&args_so_far_v); for (tree chain = TYPE_ARG_TYPES (fntype); @@ -3003,7 +3007,11 @@ aarch64_constant_alignment (const_tree exp, HOST_WIDE_INT align) unsigned aarch64_data_alignment (const_tree type, unsigned align) { - if (optimize_size) + /* For now, on Darwin we do not give global entities any extra + alignment TODO: determine if we should for some optimisation + level. */ + + if (optimize_size || TARGET_MACHO) return align; if (AGGREGATE_TYPE_P (type)) @@ -3426,6 +3434,7 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm, switch (type) { case SYMBOL_SMALL_ABSOLUTE: + case SYMBOL_MO_SMALL_PCR: { /* In ILP32, the mode of dest can be either SImode or DImode. */ rtx tmp_reg = dest; @@ -3449,6 +3458,22 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm, } imm = plus_constant (mode, imm, -mid_const); + if (TARGET_MACHO) + { + rtx sym, off; + split_const (imm, &sym, &off); + /* Negative offsets are not used, and we need to fit the result + into 21 bits. */ + if (INTVAL (off) < 0 || INTVAL (off) >= 4 * 1024 * 1024) + { + emit_move_insn (tmp_reg, gen_rtx_HIGH (mode, sym)); + emit_insn (gen_add_losym (dest, tmp_reg, sym)); + /* FIXME: add the SI option if/when we support ilp32. */ + emit_insn (gen_adddi3 (dest, dest, off)); + return; + } + /* else small enough positive offset is OK. */ + } emit_move_insn (tmp_reg, gen_rtx_HIGH (mode, copy_rtx (imm))); if (mid_const) emit_set_insn (tmp_reg, plus_constant (mode, tmp_reg, mid_const)); @@ -3534,6 +3559,7 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm, return; } + case SYMBOL_MO_SMALL_GOT: case SYMBOL_SMALL_GOT_4G: emit_insn (gen_rtx_SET (dest, imm)); return; @@ -6767,6 +6793,7 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm) case SYMBOL_SMALL_TLSIE: case SYMBOL_SMALL_GOT_28K: case SYMBOL_SMALL_GOT_4G: + case SYMBOL_MO_SMALL_GOT: case SYMBOL_TINY_GOT: case SYMBOL_TINY_TLSIE: if (const_offset != 0) @@ -6780,6 +6807,7 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm) /* FALLTHRU */ case SYMBOL_SMALL_ABSOLUTE: + case SYMBOL_MO_SMALL_PCR: case SYMBOL_TINY_ABSOLUTE: case SYMBOL_TLSLE12: case SYMBOL_TLSLE24: @@ -7443,6 +7471,7 @@ aarch64_return_in_memory (const_tree type, const_tree fndecl ATTRIBUTE_UNUSED) gcc_unreachable (); } +#if !TARGET_MACHO static bool aarch64_vfp_is_call_candidate (cumulative_args_t pcum_v, machine_mode mode, const_tree type, int *nregs) @@ -7452,6 +7481,7 @@ aarch64_vfp_is_call_candidate (cumulative_args_t pcum_v, machine_mode mode, &pcum->aapcs_vfp_rmode, nregs, NULL, pcum->silent_p); } +#endif /* Given MODE and TYPE of a function argument, return the alignment in bits. The idea is to suppress any stronger alignment requested by @@ -7480,7 +7510,7 @@ aarch64_function_arg_alignment (machine_mode mode, const_tree type, if (integer_zerop (TYPE_SIZE (type))) return 0; - gcc_assert (TYPE_MODE (type) == mode); + gcc_assert (TARGET_MACHO || TYPE_MODE (type) == mode); if (!AGGREGATE_TYPE_P (type)) { @@ -7637,7 +7667,7 @@ get_pcs_arg_reg (enum arm_pcs pcs, int num) } static int -aarch64_arg_size (const function_arg_info &arg) +aarch64_arg_size (const function_arg_info &arg, int *unrounded_size = nullptr) { HOST_WIDE_INT size; @@ -7649,6 +7679,9 @@ aarch64_arg_size (const function_arg_info &arg) shouldn't be asked to pass or return them. */ size = GET_MODE_SIZE (arg.mode).to_constant (); + if (unrounded_size) + *unrounded_size = size; + return ROUND_UP (size, UNITS_PER_WORD); } @@ -7800,6 +7833,14 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) Both behaviors were wrong, but in different cases. */ pcum->aapcs_arg_processed = true; + if (TARGET_MACHO) + { + /* Set suitable defaults for queries. */ + pcum->darwinpcs_arg_boundary + = aarch64_function_arg_alignment (mode, type, &abi_break_gcc_9, + &abi_break_gcc_13, &abi_break_gcc_14); + pcum->darwinpcs_arg_padding = BITS_PER_UNIT; + } pure_scalable_type_info pst_info; if (type && pst_info.analyze_registers (type)) @@ -7853,12 +7894,28 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) && (aarch64_some_values_include_pst_objects_p (type) || (vec_flags & VEC_PARTIAL))); - size = aarch64_arg_size (arg); + if (TARGET_MACHO) + /* Since we can pack things on the stack, we need the unrounded size. */ + size = aarch64_arg_size (arg, &pcum->darwinpcs_stack_bytes); + else + size = aarch64_arg_size (arg); + allocate_ncrn = (type) ? !(FLOAT_TYPE_P (type)) : !FLOAT_MODE_P (mode); + bool is_ha = false; +#if !TARGET_MACHO allocate_nvrn = aarch64_vfp_is_call_candidate (pcum_v, mode, type, &nregs); +#else + /* We care if the value is a homogenous aggregate when laying out the stack, + so use this call directly. */ + allocate_nvrn + = aarch64_vfp_is_call_or_return_candidate (mode, type, + &pcum->aapcs_vfp_rmode, + &nregs, &is_ha, + pcum->silent_p); +#endif gcc_assert (!sve_p || !allocate_nvrn); unsigned int alignment @@ -7887,7 +7944,13 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) if (!pcum->silent_p && !TARGET_FLOAT) aarch64_err_no_fpadvsimd (mode); - if (nvrn + nregs <= NUM_FP_ARG_REGS) + if (TARGET_MACHO + && !arg.named) + { + pcum->aapcs_nextnvrn = NUM_FP_ARG_REGS; + goto on_stack; + } + else if (nvrn + nregs <= NUM_FP_ARG_REGS) { pcum->aapcs_nextnvrn = nvrn + nregs; if (!aarch64_composite_type_p (type, mode)) @@ -7917,6 +7980,7 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) } pcum->aapcs_reg = par; } + pcum->darwinpcs_stack_bytes = 0; return; } else @@ -7937,10 +8001,19 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) { gcc_assert (nregs == 0 || nregs == 1 || nregs == 2); + if (TARGET_MACHO + && !arg.named) + { + pcum->aapcs_nextncrn = num_pcs_arg_regs (pcum->pcs_variant); + goto on_stack; + } + /* C.8 if the argument has an alignment of 16 then the NGRN is rounded up to the next even number. */ if (nregs == 2 - && ncrn % 2) + && ncrn % 2 + /* Darwin PCS deletes rule C.8. */ + && !TARGET_MACHO) { /* Emit a warning if the alignment changed when taking the 'packed' attribute into account. */ @@ -8012,8 +8085,8 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) } pcum->aapcs_reg = par; } - pcum->aapcs_nextncrn = ncrn + nregs; + pcum->darwinpcs_stack_bytes = 0; return; } @@ -8023,7 +8096,81 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) /* The argument is passed on stack; record the needed number of words for this argument and align the total size if necessary. */ on_stack: - pcum->aapcs_stack_words = size / UNITS_PER_WORD; + + if (TARGET_MACHO) + { + /* Darwin does not round up the allocation for smaller entities to 8 + bytes. It only requires the natural alignment for these. + + but we don't do this for: + * unnamed parms in variadic functions + * complex types + * unions + * aggregates (except for homogeneous ones which are handles as the + enclosed type). + each entry starts a new slot. + + 16 byte entities are naturally aligned on the stack. + There was no darwinpcs for GCC 9, so neither the implementation + change nor the warning should fire here (i.e. we do not need to check + if 16byte entities alter the stack size). */ + + gcc_checking_assert (arg.named == pcum->named_p); + pcum->darwinpcs_arg_padding = BITS_PER_UNIT; + if (!pcum->named_p + || TREE_CODE (type) == COMPLEX_TYPE + || (TREE_CODE (type) == RECORD_TYPE + && !is_ha && !SCALAR_FLOAT_MODE_P (pcum->aapcs_vfp_rmode)) + || TREE_CODE (type) == UNION_TYPE) + { + pcum->aapcs_stack_words = size / UNITS_PER_WORD; + pcum->darwinpcs_sub_word_offset = 0; + pcum->darwinpcs_sub_word_pos = 0; + pcum->darwinpcs_arg_boundary = MAX (alignment, PARM_BOUNDARY); + if (!pcum->named_p) + pcum->darwinpcs_arg_padding = PARM_BOUNDARY; + return; + } + + /* Updated sub-word offset aligned for the new object. + We are looking for the case that the new object will fit after some + existing object(s) in the same stack slot. In that case, we do not + need to add any more stack space for it. */ + int new_off + = ROUND_UP (pcum->darwinpcs_sub_word_pos, alignment / BITS_PER_UNIT); + + if (new_off >= UNITS_PER_WORD) + { + /* That exceeds a stack slot, start a new one. */ + pcum->darwinpcs_sub_word_offset = 0; + pcum->darwinpcs_sub_word_pos = 0; + new_off = 0; + } + /* This is the end of the new object. */ + int new_pos = new_off + pcum->darwinpcs_stack_bytes; + + if (pcum->darwinpcs_sub_word_pos == 0) + /* New stack slot, just allocate one or more words, and note where + the next arg will start. */ + pcum->aapcs_stack_words = size / UNITS_PER_WORD; + else if (new_pos <= UNITS_PER_WORD) + /* Old stack slot, object starts at new_off and goes to new_pos, we do + not add any stack space. */ + pcum->darwinpcs_sub_word_offset = new_off; + pcum->darwinpcs_sub_word_pos = new_pos; + pcum->darwinpcs_arg_boundary = alignment ; + if (pcum->last_named_p && new_pos > 0) + { + /* Round the last named arg to the start of the next stack slot. */ + if (new_pos <= 4) + pcum->darwinpcs_arg_padding = PARM_BOUNDARY; + else if (new_pos <= 6) + pcum->darwinpcs_arg_padding = 4 * BITS_PER_UNIT; + else if (pcum->darwinpcs_sub_word_pos <= 7) + pcum->darwinpcs_arg_padding = 2 * BITS_PER_UNIT; + } + return; + } if (warn_pcs_change_le_gcc14 && abi_break_gcc_13 @@ -8039,6 +8186,8 @@ on_stack: inform (input_location, "parameter passing for argument of type " "%qT changed in GCC 14.1", type); + /* size was already rounded up to PARM_BOUNDARY. */ + pcum->aapcs_stack_words = size / UNITS_PER_WORD; if (alignment == 16 * BITS_PER_UNIT) { int new_size = ROUND_UP (pcum->aapcs_stack_size, 16 / UNITS_PER_WORD); @@ -8148,12 +8297,33 @@ aarch64_init_cumulative_args (CUMULATIVE_ARGS *pcum, pcum->aapcs_arg_processed = false; pcum->aapcs_stack_words = 0; pcum->aapcs_stack_size = 0; + pcum->darwinpcs_stack_bytes = 0; + pcum->darwinpcs_sub_word_offset = 0; + pcum->darwinpcs_sub_word_pos = 0; + pcum->darwinpcs_arg_boundary = BITS_PER_UNIT; + pcum->darwinpcs_arg_padding = BITS_PER_UNIT; + /* If we have been invoked for incoming args, then n_named will have been + set to -1, but we should have a function decl - so pick up the named + count from that. If that fails, and we end up with -1, this effectively + corresponds to assuming that there is an arbitrary number of named + args. */ + pcum->darwinpcs_n_named = n_named; + if (n_named == (unsigned)-1 && fndecl) + { + tree fnt = TREE_TYPE (fndecl); + if (fnt && TYPE_ARG_TYPES (fnt)) + pcum->darwinpcs_n_named = list_length (TYPE_ARG_TYPES (fnt)); + } + pcum->darwinpcs_n_args_processed = 0; + pcum->named_p = pcum->darwinpcs_n_named != 0; + pcum->last_named_p = pcum->darwinpcs_n_named == 1; pcum->silent_p = silent_p; pcum->shared_za_flags = (fntype ? aarch64_fntype_shared_flags (fntype, "za") : 0U); pcum->shared_zt0_flags = (fntype ? aarch64_fntype_shared_flags (fntype, "zt0") : 0U); pcum->num_sme_mode_switch_args = 0; + pcum->aapcs_vfp_rmode = VOIDmode; if (!silent_p && !TARGET_FLOAT @@ -8194,6 +8364,7 @@ aarch64_function_arg_advance (cumulative_args_t pcum_v, || pcum->pcs_variant == ARM_PCS_MS_VARIADIC) { aarch64_layout_arg (pcum_v, arg); + pcum->darwinpcs_n_args_processed++; if (pcum->aapcs_reg && aarch64_call_switches_pstate_sm (pcum->isa_mode)) aarch64_record_sme_mode_switch_args (pcum); @@ -8204,6 +8375,12 @@ aarch64_function_arg_advance (cumulative_args_t pcum_v, pcum->aapcs_stack_size += pcum->aapcs_stack_words; pcum->aapcs_stack_words = 0; pcum->aapcs_reg = NULL_RTX; + pcum->darwinpcs_arg_boundary = BITS_PER_UNIT; + pcum->darwinpcs_arg_padding = BITS_PER_UNIT; + pcum->named_p + = pcum->darwinpcs_n_args_processed < pcum->darwinpcs_n_named; + pcum->last_named_p + = pcum->darwinpcs_n_args_processed + 1 == pcum->darwinpcs_n_named; } } @@ -8243,12 +8420,15 @@ aarch64_function_arg_regno_p (unsigned regno) gcc_unreachable (); } -/* Implement FUNCTION_ARG_BOUNDARY. Every parameter gets at least - PARM_BOUNDARY bits of alignment, but will be given anything up - to STACK_BOUNDARY bits if the type requires it. This makes sure - that both before and after the layout of each argument, the Next - Stacked Argument Address (NSAA) will have a minimum alignment of - 8 bytes. */ +/* Implement FUNCTION_ARG_BOUNDARY. + For AAPCS64, Every parameter gets at least PARM_BOUNDARY bits of + alignment, but will be given anything up to STACK_BOUNDARY bits + if the type requires it. This makes sure that both before and after + the layout of each argument, the Next Stacked Argument Address (NSAA) + will have a minimum alignment of 8 bytes. + + For darwinpcs, this is only called to lower va_arg entries which are + always aligned as for AAPCS64. */ static unsigned int aarch64_function_arg_boundary (machine_mode mode, const_tree type) @@ -8262,8 +8442,113 @@ aarch64_function_arg_boundary (machine_mode mode, const_tree type) &abi_break_gcc_14); /* We rely on aarch64_layout_arg and aarch64_gimplify_va_arg_expr to emit warnings about ABI incompatibility. */ +#if TARGET_MACHO + /* This can only work for unnamed args. */ + machine_mode comp_mode = VOIDmode; + int nregs = 0; + bool is_ha; + aarch64_vfp_is_call_or_return_candidate (mode, type, &comp_mode, &nregs, + &is_ha, /*silent*/true); + if (TREE_CODE (type) == COMPLEX_TYPE + || (TREE_CODE (type) == RECORD_TYPE + && !is_ha && !SCALAR_FLOAT_MODE_P (comp_mode)) + || TREE_CODE (type) == UNION_TYPE) + return MIN (MAX (alignment, PARM_BOUNDARY), STACK_BOUNDARY); + return MIN (alignment, STACK_BOUNDARY); +#else alignment = MIN (MAX (alignment, PARM_BOUNDARY), STACK_BOUNDARY); return alignment; +#endif +} + +/* For Darwin, we want to use the arg boundary computed when laying out the + function arg, to cope with items packed on the stack and the different + rules applied to unnamed parms. */ + +static unsigned int +aarch64_function_arg_boundary_ca (machine_mode mode ATTRIBUTE_UNUSED, + const_tree type ATTRIBUTE_UNUSED, + cumulative_args_t ca ATTRIBUTE_UNUSED) +{ + unsigned int abi_break_gcc_9; + unsigned int abi_break_gcc_13; + unsigned int abi_break_gcc_14; + unsigned int alignment + = aarch64_function_arg_alignment (mode, type, &abi_break_gcc_9, + &abi_break_gcc_13, &abi_break_gcc_14); + /* We rely on aarch64_layout_arg and aarch64_gimplify_va_arg_expr + to emit warnings about ABI incompatibility. */ +#if TARGET_MACHO + CUMULATIVE_ARGS *pcum = get_cumulative_args (ca); +gcc_checking_assert (pcum->aapcs_arg_processed); + + bool named_p = pcum->darwinpcs_n_args_processed < pcum->darwinpcs_n_named; +gcc_checking_assert (named_p == pcum->named_p); + machine_mode comp_mode = VOIDmode; + int nregs = 0; + bool is_ha; + aarch64_vfp_is_call_or_return_candidate (mode, type, &comp_mode, &nregs, + &is_ha, /*silent*/true); + bool no_pack = (TREE_CODE (type) == COMPLEX_TYPE + || (TREE_CODE (type) == RECORD_TYPE + && !is_ha && !SCALAR_FLOAT_MODE_P (comp_mode)) + || TREE_CODE (type) == UNION_TYPE); + + bool in_reg = pcum->aapcs_reg != NULL_RTX; +// || pcum->aapcs_nextncrn < num_pcs_arg_regs (pcum->pcs_variant); + + /* See aarch64_layout_arg for comment about mode sizes. */ + int size = (type) ? int_size_in_bytes (type) + : GET_MODE_SIZE (mode).to_constant (); + + if ((named_p && (!no_pack || size == 0)) || in_reg) + ; /* Leave the alignment as natural. */ + else + alignment = MAX (alignment, PARM_BOUNDARY); + gcc_checking_assert (alignment == pcum->darwinpcs_arg_boundary); + return MIN (alignment, STACK_BOUNDARY); + +#else + alignment = MIN (MAX (alignment, PARM_BOUNDARY), STACK_BOUNDARY); + return alignment; +#endif +} + +/* Implement TARGET_FUNCTION_ARG_ROUND_BOUNDARY_CA for darwinpcs which allows + non-standard passing of byte-aligned items [D.2]. This is done by pulling + the values out of the cumulative args struct. */ + +static unsigned int +aarch64_function_arg_round_boundary_ca (machine_mode mode ATTRIBUTE_UNUSED, + const_tree type ATTRIBUTE_UNUSED, + cumulative_args_t ca) +{ + CUMULATIVE_ARGS *pcum = get_cumulative_args (ca); +gcc_checking_assert (pcum->aapcs_arg_processed); + bool named_p = pcum->darwinpcs_n_args_processed < pcum->darwinpcs_n_named; +gcc_checking_assert (named_p == pcum->named_p); + bool last_named_p = pcum->darwinpcs_n_args_processed + 1 == pcum->darwinpcs_n_named; +gcc_checking_assert (last_named_p == pcum->last_named_p); + + unsigned boundary = BITS_PER_UNIT; + if (last_named_p && pcum->darwinpcs_sub_word_pos > 0) + { + /* Round the last named arg to the start of the next stack slot. */ + if (pcum->darwinpcs_sub_word_pos <= 4) + boundary = PARM_BOUNDARY; + else if (pcum->darwinpcs_sub_word_pos <= 6) + boundary = 4 * BITS_PER_UNIT; + else if (pcum->darwinpcs_sub_word_pos <= 7) + boundary = 2 * BITS_PER_UNIT; + } + else if (named_p) + /* Named args are naturally aligned, but with no rounding. */ + ; + else + /* un-named args are rounded to fill slots. */ + boundary = PARM_BOUNDARY; +gcc_checking_assert (boundary == pcum->darwinpcs_arg_padding); + return boundary; } /* Implement TARGET_GET_RAW_RESULT_MODE and TARGET_GET_RAW_ARG_MODE. */ @@ -11711,6 +11996,7 @@ aarch64_classify_address (struct aarch64_address_info *info, /* load literal: pc-relative constant pool entry. Only supported for SI mode or larger. */ info->type = ADDRESS_SYMBOLIC; + info->offset = NULL_RTX; if (!load_store_pair_p && GET_MODE_SIZE (mode).is_constant (&const_size) @@ -11718,6 +12004,7 @@ aarch64_classify_address (struct aarch64_address_info *info, { poly_int64 offset; rtx sym = strip_offset_and_salt (x, &offset); + return ((LABEL_REF_P (sym) || (SYMBOL_REF_P (sym) && CONSTANT_POOL_ADDRESS_P (sym) @@ -11735,10 +12022,13 @@ aarch64_classify_address (struct aarch64_address_info *info, poly_int64 offset; HOST_WIDE_INT const_offset; rtx sym = strip_offset_and_salt (info->offset, &offset); + if (SYMBOL_REF_P (sym) && offset.is_constant (&const_offset) && (aarch64_classify_symbol (sym, const_offset) - == SYMBOL_SMALL_ABSOLUTE)) + == SYMBOL_SMALL_ABSOLUTE + || aarch64_classify_symbol (sym, const_offset) + == SYMBOL_MO_SMALL_PCR)) { /* The symbol and offset must be aligned to the access size. */ unsigned int align; @@ -11788,6 +12078,55 @@ aarch64_address_valid_for_prefetch_p (rtx x, bool strict_p) if (!res) return false; + /* For ELF targets using GAS, we emit prfm unconditionally; GAS will alter + the instruction to pick the prfum form where possible (i.e. when the + offset is in the range -256..255) and fall back to prfm otherwise. + We can reject cases where the offset exceeds the range usable by both + insns [-256..32760], or for offsets > 255 when the value is not divisible + by 8. + For Mach-O (Darwin) where the assembler uses the LLVM back end, that does + not yet do the substitution, so we must reject all prfum cases. */ + if (addr.offset) + { + HOST_WIDE_INT offs = INTVAL (addr.offset); + if (offs < -256) /* Out of range for both prfum and prfm. */ + return false; + if (offs > 32760) /* Out of range for prfm. */ + return false; + if (offs & 0x07) /* We cannot use prfm. */ + { + if (offs > 255) /* Out of range for prfum. */ + return false; + if (TARGET_MACHO) + return false; + } + if (TARGET_MACHO && offs < 0) + return false; + } + + /* ... except writeback forms. */ + return addr.type != ADDRESS_REG_WB; +} + +/* Return true if the address X is valid for a PRFUM instruction. + STRICT_P is true if we should do strict checking with + aarch64_classify_address. */ + +bool +aarch64_address_valid_for_unscaled_prefetch_p (rtx x, bool strict_p) +{ + struct aarch64_address_info addr; + + /* PRFUM accepts the same addresses as DImode, but constrained to a range + -256..255. */ + bool res = aarch64_classify_address (&addr, x, DImode, strict_p); + if (!res) + return false; + + if (addr.offset && ((INTVAL (addr.offset) > 255) + || (INTVAL (addr.offset) < -256))) + return false; + /* ... except writeback forms. */ return addr.type != ADDRESS_REG_WB; } @@ -12955,6 +13294,144 @@ sizetochar (int size) } } +static void +output_macho_postfix_expr (FILE *file, rtx x, const char *postfix) +{ + char buf[256]; + + restart: + switch (GET_CODE (x)) + { + case PC: + putc ('.', file); + break; + + case SYMBOL_REF: + if (SYMBOL_REF_DECL (x)) + assemble_external (SYMBOL_REF_DECL (x)); + assemble_name (file, XSTR (x, 0)); + fprintf (file, "@%s", postfix); + break; + + case LABEL_REF: + x = label_ref_label (x); + /* Fall through. */ + case CODE_LABEL: + ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (x)); + assemble_name (file, buf); + fprintf (file, "@%s", postfix); + break; + + case CONST_INT: + fprintf (file, HOST_WIDE_INT_PRINT_DEC, INTVAL (x)); + break; + + case CONST: + /* This used to output parentheses around the expression, + but that does not work on the 386 (either ATT or BSD assembler). */ + output_macho_postfix_expr (file, XEXP (x, 0), postfix); + break; + + case CONST_WIDE_INT: + /* We do not know the mode here so we have to use a round about + way to build a wide-int to get it printed properly. */ + { + wide_int w = wide_int::from_array (&CONST_WIDE_INT_ELT (x, 0), + CONST_WIDE_INT_NUNITS (x), + CONST_WIDE_INT_NUNITS (x) + * HOST_BITS_PER_WIDE_INT, + false); + print_decs (w, file); + } + break; + + case CONST_DOUBLE: + if (CONST_DOUBLE_AS_INT_P (x)) + { + /* We can use %d if the number is one word and positive. */ + if (CONST_DOUBLE_HIGH (x)) + fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX, + (unsigned HOST_WIDE_INT) CONST_DOUBLE_HIGH (x), + (unsigned HOST_WIDE_INT) CONST_DOUBLE_LOW (x)); + else if (CONST_DOUBLE_LOW (x) < 0) + fprintf (file, HOST_WIDE_INT_PRINT_HEX, + (unsigned HOST_WIDE_INT) CONST_DOUBLE_LOW (x)); + else + fprintf (file, HOST_WIDE_INT_PRINT_DEC, CONST_DOUBLE_LOW (x)); + } + else + /* We can't handle floating point constants; + PRINT_OPERAND must handle them. */ + output_operand_lossage ("floating constant misused"); + break; + + case CONST_FIXED: + fprintf (file, HOST_WIDE_INT_PRINT_DEC, CONST_FIXED_VALUE_LOW (x)); + break; + + case PLUS: + /* Some assemblers need integer constants to appear last (eg masm). */ + if (CONST_INT_P (XEXP (x, 0))) + { + output_macho_postfix_expr (file, XEXP (x, 1), postfix); + if (INTVAL (XEXP (x, 0)) >= 0) + fprintf (file, "+"); + output_addr_const (file, XEXP (x, 0)); + } + else + { + output_macho_postfix_expr (file, XEXP (x, 0), postfix); + if (!CONST_INT_P (XEXP (x, 1)) + || INTVAL (XEXP (x, 1)) >= 0) + fprintf (file, "+"); + output_addr_const (file, XEXP (x, 1)); + } + break; + + case MINUS: + /* Avoid outputting things like x-x or x+5-x, + since some assemblers can't handle that. */ + x = simplify_subtraction (x); + if (GET_CODE (x) != MINUS) + goto restart; + + output_macho_postfix_expr (file, XEXP (x, 0), postfix); + fprintf (file, "-"); + if ((CONST_INT_P (XEXP (x, 1)) && INTVAL (XEXP (x, 1)) >= 0) + || GET_CODE (XEXP (x, 1)) == PC + || GET_CODE (XEXP (x, 1)) == SYMBOL_REF) + output_addr_const (file, XEXP (x, 1)); + else + { + fputs (targetm.asm_out.open_paren, file); + output_addr_const (file, XEXP (x, 1)); + fputs (targetm.asm_out.close_paren, file); + } + break; + + case ZERO_EXTEND: + case SIGN_EXTEND: + case SUBREG: + case TRUNCATE: + output_addr_const (file, XEXP (x, 0)); + break; + + case UNSPEC: + if (XINT (x, 1) == UNSPEC_SALT_ADDR) + { + output_macho_postfix_expr (file, XVECEXP (x, 0, 0), postfix); + break; + } + /* FALLTHROUGH */ + default: + if (targetm.asm_out.output_addr_const_extra (file, x)) + break; + + output_operand_lossage ("invalid expression as operand"); + } + +} + /* Print operand X to file F in a target specific manner according to CODE. The acceptable formatting commands given by CODE are: 'c': An integer or symbol address without a preceding # @@ -13028,6 +13505,12 @@ aarch64_print_operand (FILE *f, rtx x, int code) } break; + case 'J': + output_macho_postfix_expr (f, x, "PAGEOFF"); + break; + case 'O': + output_macho_postfix_expr (f, x, "GOTPAGEOFF"); + break; case 'e': { x = unwrap_const_vec_duplicate (x); @@ -13360,7 +13843,7 @@ aarch64_print_operand (FILE *f, rtx x, int code) case 'A': if (GET_CODE (x) == HIGH) x = XEXP (x, 0); - +#if !TARGET_MACHO switch (aarch64_classify_symbolic_expression (x)) { case SYMBOL_SMALL_GOT_4G: @@ -13391,9 +13874,26 @@ aarch64_print_operand (FILE *f, rtx x, int code) break; } output_addr_const (asm_out_file, x); +#endif +#if TARGET_MACHO + switch (aarch64_classify_symbolic_expression (x)) + { + case SYMBOL_MO_SMALL_PCR: + output_macho_postfix_expr (asm_out_file, x, "PAGE"); + break; + case SYMBOL_MO_SMALL_GOT: + output_macho_postfix_expr (asm_out_file, x, "GOTPAGE"); + break; + default: + /* large code model unimplemented. */ + gcc_unreachable (); + break; + } +#endif break; case 'L': +#if !TARGET_MACHO switch (aarch64_classify_symbolic_expression (x)) { case SYMBOL_SMALL_GOT_4G: @@ -13431,10 +13931,12 @@ aarch64_print_operand (FILE *f, rtx x, int code) default: break; } +#endif output_addr_const (asm_out_file, x); break; case 'G': +#if !TARGET_MACHO switch (aarch64_classify_symbolic_expression (x)) { case SYMBOL_TLSLE24: @@ -13443,6 +13945,7 @@ aarch64_print_operand (FILE *f, rtx x, int code) default: break; } +#endif output_addr_const (asm_out_file, x); break; @@ -13608,8 +14111,13 @@ aarch64_print_address_internal (FILE *f, machine_mode mode, rtx x, break; case ADDRESS_LO_SUM: +#if TARGET_MACHO + asm_fprintf (f, "[%s, #", reg_names [REGNO (addr.base)]); + output_macho_postfix_expr (f, addr.offset, "PAGEOFF"); +#else asm_fprintf (f, "[%s, #:lo12:", reg_names [REGNO (addr.base)]); output_addr_const (f, addr.offset); +#endif asm_fprintf (f, "]"); return true; @@ -13926,7 +14434,23 @@ aarch64_frame_pointer_required () { /* If the function needs to record the incoming value of PSTATE.SM, make sure that the slot is accessible from the frame pointer. */ - return aarch64_need_old_pstate_sm (); + if (!TARGET_MACHO) + return aarch64_need_old_pstate_sm (); + + /* We could do with some more general test. + gcc_checking_assert (!aarch64_need_old_pstate_sm ());*/ + + if (crtl->calls_eh_return || aarch64_need_old_pstate_sm ()) + return true; + + /* Not used in leaf functions (unless forced). */ + if (flag_omit_leaf_frame_pointer && leaf_function_p ()) + return false; + + /* NOTE: We are allowing the user to force omission of the frame + pointer, (despite that it is not ABI-compliant). */ + + return flag_omit_frame_pointer != 1; } static bool @@ -14155,6 +14679,8 @@ aarch64_asm_output_labelref (FILE* f, const char *name) asm_fprintf (f, "%U%s", name); } +#if !TARGET_MACHO + static void aarch64_elf_asm_constructor (rtx symbol, int priority) { @@ -14194,6 +14720,7 @@ aarch64_elf_asm_destructor (rtx symbol, int priority) assemble_aligned_integer (POINTER_BYTES, symbol); } } +#endif const char* aarch64_output_casesi (rtx *operands) @@ -14348,12 +14875,16 @@ aarch64_select_rtx_section (machine_mode mode, if (aarch64_can_use_per_function_literal_pools_p ()) return function_section (current_function_decl); +#if TARGET_MACHO + return machopic_select_rtx_section (mode, x, align); +#else /* When using anchors for constants use the readonly section. */ if ((CONST_INT_P (x) || CONST_DOUBLE_P (x) || CONST_VECTOR_P (x)) && known_le (GET_MODE_SIZE (mode), 16)) return readonly_data_section; return default_elf_select_rtx_section (mode, x, align); +#endif } /* Implement ASM_OUTPUT_POOL_EPILOGUE. */ @@ -16815,15 +17346,17 @@ aarch64_init_builtins () { aarch64_ms_variadic_abi_init_builtins (); } -#ifdef SUBTARGET_INIT_BUILTINS - SUBTARGET_INIT_BUILTINS; -#endif + aarch64_init_subtarget_builtins (); } /* Implement TARGET_FOLD_BUILTIN. */ static tree aarch64_fold_builtin (tree fndecl, int nargs, tree *args, bool) { +#ifdef SUBTARGET_FOLD_BUILTIN + if (tree res = SUBTARGET_FOLD_BUILTIN (fndecl, nargs, args, false)) + return res; +#endif unsigned int code = DECL_MD_FUNCTION_CODE (fndecl); unsigned int subcode = code >> AARCH64_BUILTIN_SHIFT; tree type = TREE_TYPE (TREE_TYPE (fndecl)); @@ -20230,10 +20763,14 @@ initialize_aarch64_code_model (struct gcc_options *opts) } break; case AARCH64_CMODEL_LARGE: - if (opts->x_flag_pic) + if (TARGET_MACHO) + /* We need to implement fPIC here (arm64_32 also accepts the large + model). */ + sorry ("code model %qs not supported yet", "large"); + else if (opts->x_flag_pic) sorry ("code model %qs with %<-f%s%>", "large", opts->x_flag_pic > 1 ? "PIC" : "pic"); - if (opts->x_aarch64_abi == AARCH64_ABI_ILP32) + else if (opts->x_aarch64_abi == AARCH64_ABI_ILP32) sorry ("code model %qs not supported in ilp32 mode", "large"); break; case AARCH64_CMODEL_TINY_PIC: @@ -22185,7 +22722,9 @@ aarch64_classify_symbol (rtx x, HOST_WIDE_INT offset) case AARCH64_CMODEL_SMALL_SPIC: case AARCH64_CMODEL_SMALL_PIC: case AARCH64_CMODEL_SMALL: - return SYMBOL_SMALL_ABSOLUTE; + return TARGET_MACHO + ? SYMBOL_MO_SMALL_PCR + : SYMBOL_SMALL_ABSOLUTE; default: gcc_unreachable (); @@ -22222,12 +22761,23 @@ aarch64_classify_symbol (rtx x, HOST_WIDE_INT offset) return SYMBOL_TINY_ABSOLUTE; - case AARCH64_CMODEL_SMALL_SPIC: case AARCH64_CMODEL_SMALL_PIC: case AARCH64_CMODEL_SMALL: - if (!TARGET_PECOFF - && (flag_pic || SYMBOL_REF_WEAK (x)) +#if TARGET_MACHO + if (TARGET_MACHO) + { + /* Constant pool addresses are always TU-local and PC- + relative. We indirect common, external and weak + symbols (but weak only if not hidden). */ + if (!CONSTANT_POOL_ADDRESS_P (x) + && (MACHO_SYMBOL_MUST_INDIRECT_P (x) + || !aarch64_symbol_binds_local_p (x))) + return SYMBOL_MO_SMALL_GOT; + } + else +#endif + if (!TARGET_PECOFF && (flag_pic || SYMBOL_REF_WEAK (x)) && !aarch64_symbol_binds_local_p (x)) return aarch64_cmodel == AARCH64_CMODEL_SMALL_SPIC ? SYMBOL_SMALL_GOT_28K : SYMBOL_SMALL_GOT_4G; @@ -22238,7 +22788,8 @@ aarch64_classify_symbol (rtx x, HOST_WIDE_INT offset) || offset_within_block_p (x, offset))) return SYMBOL_FORCE_TO_MEM; - return SYMBOL_SMALL_ABSOLUTE; + return TARGET_MACHO ? SYMBOL_MO_SMALL_PCR + : SYMBOL_SMALL_ABSOLUTE; case AARCH64_CMODEL_LARGE: /* This is alright even in PIC code as the constant @@ -22389,7 +22940,9 @@ static GTY(()) tree va_list_type; }; Windows ABI is handled using - aarch64_ms_variadic_abi_build_builtin_va_list (void). */ + aarch64_ms_variadic_abi_build_builtin_va_list (void). + darwinpcs uses 'char *' for the va_list (in common with other platform + ports). */ static tree aarch64_build_builtin_va_list (void) @@ -22397,6 +22950,13 @@ aarch64_build_builtin_va_list (void) if (TARGET_AARCH64_MS_ABI) return aarch64_ms_variadic_abi_build_builtin_va_list (); + if (TARGET_MACHO) + { + /* darwinpcs uses a simple char * for this. */ + va_list_type = build_pointer_type (char_type_node); + return va_list_type; + } + tree va_list_name; tree f_stack, f_grtop, f_vrtop, f_groff, f_vroff; @@ -22491,6 +23051,13 @@ aarch64_expand_builtin_va_start (tree valist, rtx nextarg) int vr_save_area_size = cfun->va_list_fpr_size; int vr_offset; + /* darwinpcs uses the default, char * va_list impl. */ + if (TARGET_MACHO) + { + std_expand_builtin_va_start (valist, nextarg); + return; + } + cum = &crtl->args.info; if (cfun->va_list_gpr_size) gr_save_area_size = MIN ((num_pcs_arg_regs (cum->pcs_variant) @@ -22583,6 +23150,9 @@ aarch64_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, HOST_WIDE_INT size, rsize, adjust, align; tree t, u, cond1, cond2; + if (TARGET_MACHO) + return std_gimplify_va_arg_expr (valist, type, pre_p, post_p); + indirect_p = pass_va_arg_by_reference (type); if (indirect_p) type = build_pointer_type (type); @@ -22787,8 +23357,18 @@ aarch64_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, field_ptr_t = double_ptr_type_node; break; case E_TFmode: - field_t = long_double_type_node; - field_ptr_t = long_double_ptr_type_node; + if (TARGET_MACHO) + { + /* Darwin has __float128, and long double is the same as + double. */ + field_t = float128_type_node; + field_ptr_t = aarch64_float128_ptr_type_node; + } + else + { + field_t = long_double_type_node; + field_ptr_t = long_double_ptr_type_node; + } break; case E_SDmode: field_t = dfloat32_type_node; @@ -22872,6 +23452,9 @@ aarch64_setup_incoming_varargs (cumulative_args_t cum_v, int gr_saved = cfun->va_list_gpr_size; int vr_saved = cfun->va_list_fpr_size; + if (TARGET_MACHO) + return default_setup_incoming_varargs (cum_v, arg, pretend_size, no_rtl); + /* The caller has advanced CUM up to, but not beyond, the last named argument. Advance a local copy of CUM past the last "real" named argument, to find out how many registers are left over. */ @@ -23426,6 +24009,7 @@ aarch64_vfp_is_call_or_return_candidate (machine_mode mode, unsigned int warn_psabi_flags = 0; int ag_count = aapcs_vfp_sub_candidate (type, &new_mode, &warn_psabi_flags); + *count = ag_count; if (ag_count > 0 && ag_count <= HA_MAX_NUM_FLDS) { static unsigned last_reported_type_uid; @@ -23461,9 +24045,7 @@ aarch64_vfp_is_call_or_return_candidate (machine_mode mode, "type %qT changed %{in GCC 12.1%}", TYPE_MAIN_VARIANT (type), url12); } - if (is_ha != NULL) *is_ha = true; - *count = ag_count; } else return false; @@ -23767,6 +24349,12 @@ aarch64_convert_to_type (tree type, tree expr) static const char * aarch64_mangle_type (const_tree type) { + /* The darwinpcs ABI documents say that "__va_list" has to be + mangled as char *. */ + if (TARGET_MACHO + && lang_hooks.types_compatible_p (const_cast (type), va_list_type)) + return "Pc"; + /* The AArch64 ABI documents say that "__va_list" has to be mangled as if it is in the "std" namespace. The Windows Arm64 ABI uses just an address of the first variadic @@ -23790,6 +24378,12 @@ aarch64_mangle_type (const_tree type) if (TYPE_MAIN_VARIANT (type) == aarch64_mfp8_type_node) return "u6__mfp8"; + /* __float128 is mangled as "g" on darwin. _Float128 is not mangled here, + but handled in common code (as "DF128_"). */ + if (TARGET_MACHO && TYPE_MODE (type) == TFmode + && TYPE_MAIN_VARIANT (type) == float128t_type_node) + return "g"; + /* Mangle AArch64-specific internal types. TYPE_NAME is non-NULL_TREE for builtin types. */ if (TYPE_NAME (type) != NULL) @@ -24781,7 +25375,8 @@ aarch64_mov_operand_p (rtx x, machine_mode mode) /* GOT accesses are valid moves. */ if (SYMBOL_REF_P (x) - && aarch64_classify_symbolic_expression (x) == SYMBOL_SMALL_GOT_4G) + && (aarch64_classify_symbolic_expression (x) == SYMBOL_SMALL_GOT_4G + || aarch64_classify_symbolic_expression (x) == SYMBOL_MO_SMALL_GOT)) return true; if (SYMBOL_REF_P (x) && mode == DImode && CONSTANT_ADDRESS_P (x)) @@ -26286,12 +26881,8 @@ aarch64_asm_output_variant_pcs (FILE *stream, const tree decl, const char* name) static std::string aarch64_last_printed_arch_string; static std::string aarch64_last_printed_tune_string; -/* Implement ASM_DECLARE_FUNCTION_NAME. Output the ISA features used - by the function fndecl. */ - -void -aarch64_declare_function_name (FILE *stream, const char* name, - tree fndecl) +static void +aarch64_function_options_preamble (tree fndecl) { tree target_parts = DECL_FUNCTION_SPECIFIC_TARGET (fndecl); @@ -26326,15 +26917,60 @@ aarch64_declare_function_name (FILE *stream, const char* name, this_tune->name); aarch64_last_printed_tune_string = this_tune->name; } +} + +/* Implement ASM_DECLARE_FUNCTION_NAME. Output the ISA features used + by the function fndecl. */ + +#if TARGET_MACHO +void +aarch64_darwin_declare_function_name (FILE *stream, const char* name, + tree fndecl) +{ + gcc_checking_assert (TREE_CODE (fndecl) == FUNCTION_DECL); + gcc_checking_assert (!DECL_COMMON (fndecl)); + + /* Update .arch and .tune as needed. */ + aarch64_function_options_preamble (fndecl); + + /* Darwin does not emit pcs variant info. */ + + rtx decl_rtx = XEXP (DECL_RTL (fndecl), 0); + if (GET_CODE (decl_rtx) != SYMBOL_REF) + name = IDENTIFIER_POINTER (DECL_NAME (fndecl)); + if (! DECL_WEAK (fndecl) + && ((TREE_STATIC (fndecl) && !TREE_PUBLIC (fndecl)) + || DECL_INITIAL (fndecl))) + machopic_define_symbol (DECL_RTL (fndecl)); + if ((TREE_STATIC (fndecl) && !TREE_PUBLIC (fndecl)) + || DECL_INITIAL (fndecl)) + (* targetm.encode_section_info) (fndecl, DECL_RTL (fndecl), false); + ASM_OUTPUT_FUNCTION_LABEL (stream, name, fndecl); + + cfun->machine->label_is_assembled = true; +} + +#else + +void +aarch64_declare_function_name (FILE *stream, const char* name, + tree fndecl) +{ + /* Update .arch and .tune as needed. */ + aarch64_function_options_preamble (fndecl); + /* Emit any necessary pcs information. */ aarch64_asm_output_variant_pcs (stream, fndecl, name); /* Don't forget the type directive for ELF. */ +#ifdef ASM_OUTPUT_TYPE_DIRECTIVE ASM_OUTPUT_TYPE_DIRECTIVE (stream, name, "function"); +#endif ASM_OUTPUT_FUNCTION_LABEL (stream, name, fndecl); cfun->machine->label_is_assembled = true; } +#endif /* Implement PRINT_PATCHABLE_FUNCTION_ENTRY. */ @@ -26391,12 +27027,17 @@ aarch64_output_patchable_area (unsigned int patch_area_size, bool record_p) /* Implement ASM_OUTPUT_DEF_FROM_DECLS. Output .variant_pcs for aliases. */ void -aarch64_asm_output_alias (FILE *stream, const tree decl, const tree target) +aarch64_asm_output_alias (FILE *stream, const tree decl, + const tree target ATTRIBUTE_UNUSED) { const char *name = XSTR (XEXP (DECL_RTL (decl), 0), 0); +#ifdef ASM_OUTPUT_DEF const char *value = IDENTIFIER_POINTER (target); +#endif aarch64_asm_output_variant_pcs (stream, decl, name); +#ifdef ASM_OUTPUT_DEF ASM_OUTPUT_DEF (stream, name, value); +#endif } /* Implement ASM_OUTPUT_EXTERNAL. Output .variant_pcs for undefined @@ -26478,7 +27119,10 @@ aarch64_start_file (void) asm_fprintf (asm_out_file, "\t.arch %s\n", arch_string.c_str ()); - default_file_start (); + default_file_start (); +#if TARGET_MACHO + darwin_file_start (); +#endif } /* Emit load exclusive. */ @@ -26999,6 +27643,16 @@ aarch64_output_simd_imm (rtx const_vector, unsigned width, } gcc_assert (CONST_INT_P (info.u.mov.value)); + unsigned HOST_WIDE_INT value = UINTVAL (info.u.mov.value); + + /* We have signed chars which can result in a sign-extended 8bit value + which is then emitted as an unsigned hex value, and the LLVM back end + assembler rejects that as being too big. */ + if (TARGET_MACHO && (known_eq (GET_MODE_BITSIZE (info.elt_mode), 8))) + { + unsigned HOST_WIDE_INT mask = (1U << GET_MODE_BITSIZE (info.elt_mode))-1; + value &= mask; + } if (which == AARCH64_CHECK_MOV) { @@ -27025,16 +27679,16 @@ aarch64_output_simd_imm (rtx const_vector, unsigned width, ? "msl" : "lsl"); if (lane_count == 1) snprintf (templ, sizeof (templ), "%s\t%%d0, " HOST_WIDE_INT_PRINT_HEX, - mnemonic, UINTVAL (info.u.mov.value)); + mnemonic, value); else if (info.u.mov.shift) snprintf (templ, sizeof (templ), "%s\t%%0.%d%c, " HOST_WIDE_INT_PRINT_HEX ", %s %d", mnemonic, lane_count, - element_char, UINTVAL (info.u.mov.value), shift_op, + element_char, value, shift_op, info.u.mov.shift); else snprintf (templ, sizeof (templ), "%s\t%%0.%d%c, " HOST_WIDE_INT_PRINT_HEX, mnemonic, lane_count, - element_char, UINTVAL (info.u.mov.value)); + element_char, value); } else { @@ -27055,12 +27709,12 @@ aarch64_output_simd_imm (rtx const_vector, unsigned width, else if (info.u.mov.shift) snprintf (templ, sizeof (templ), "%s\t%%0.%d%c, #" HOST_WIDE_INT_PRINT_DEC ", %s #%d", mnemonic, lane_count, - element_char, UINTVAL (info.u.mov.value), "lsl", + element_char, value, "lsl", info.u.mov.shift); else snprintf (templ, sizeof (templ), "%s\t%%0.%d%c, #" HOST_WIDE_INT_PRINT_DEC, mnemonic, lane_count, - element_char, UINTVAL (info.u.mov.value)); + element_char, value); } return templ; } @@ -29012,6 +29666,8 @@ aarch64_expand_subvti (rtx op0, rtx low_dest, rtx low_in1, static unsigned HOST_WIDE_INT aarch64_asan_shadow_offset (void) { + if (TARGET_MACHO) + return 0; /* macOS uses a dynamic allocation. */ if (TARGET_ILP32) return (HOST_WIDE_INT_1 << 29); else @@ -30407,7 +31063,8 @@ aarch64_libgcc_floating_mode_supported_p (scalar_float_mode mode) } /* Implement TARGET_SCALAR_MODE_SUPPORTED_P - return TRUE - if MODE is [BH]Fmode, and punt to the generic implementation otherwise. */ + if MODE is [BH]Fmode, or TFmode on Mach-O, and punt to the generic + implementation otherwise. */ static bool aarch64_scalar_mode_supported_p (scalar_mode mode) @@ -30508,8 +31165,13 @@ aarch64_bitint_type_info (int n, struct bitint_info *info) static machine_mode aarch64_c_mode_for_floating_type (enum tree_index ti) { + if (TARGET_MACHO && ti == TI_LONG_DOUBLE_TYPE) + /* darwinpcs amends AAPCS S7 to use double as the type for long double. */ + return DFmode; + if (TARGET_LONG_DOUBLE_128 && ti == TI_LONG_DOUBLE_TYPE) return TFmode; + return default_mode_for_floating_type (ti); } @@ -31721,19 +32383,37 @@ aarch64_sls_emit_shared_blr_thunks (FILE *out_file) continue; const char *name = indirect_symbol_names[regnum]; - switch_to_section (get_named_section (decl, NULL, 0)); + /* If the target uses a unique section for this switch to it. */ + if (DECL_SECTION_NAME (decl)) + switch_to_section (get_named_section (decl, NULL, 0)); + else + switch_to_section (text_section); ASM_OUTPUT_ALIGN (out_file, 2); - targetm.asm_out.globalize_label (out_file, name); + if (!TARGET_MACHO) + targetm.asm_out.globalize_label (out_file, name); +#ifdef ASM_OUTPUT_TYPE_DIRECTIVE + ASM_OUTPUT_TYPE_DIRECTIVE (out_file, name, "function"); +#endif + if (TARGET_MACHO) + { +#ifdef ASM_WEAKEN_DECL + if (DECL_WEAK (decl)) + ASM_WEAKEN_DECL (out_file, decl, name, 0); + else +#endif + targetm.asm_out.globalize_decl_name (out_file, decl); + } /* Only emits if the compiler is configured for an assembler that can handle visibility directives. */ targetm.asm_out.assemble_visibility (decl, VISIBILITY_HIDDEN); - ASM_OUTPUT_TYPE_DIRECTIVE (out_file, name, "function"); ASM_OUTPUT_LABEL (out_file, name); aarch64_sls_emit_function_stub (out_file, regnum); /* Use the most conservative target to ensure it can always be used by any function in the translation unit. */ asm_fprintf (out_file, "\tdsb\tsy\n\tisb\n"); +#ifdef ASM_DECLARE_FUNCTION_SIZE ASM_DECLARE_FUNCTION_SIZE (out_file, name, decl); +#endif } } @@ -33150,6 +33830,59 @@ aarch64_check_target_clone_version (string_slice str, location_t *loc) gcc_unreachable (); } +#if TARGET_MACHO +/* This handles the promotion of function return values. + It also handles function args under two specific curcumstances: + - called from combine with a register argument + - caller for a libcall with type == NULL. + The remaining cases for argument promotion are handled with access to + cumulative args data, below. */ +machine_mode +aarch64_darwin_promote_fn_mode (const_tree type, machine_mode mode, + int *punsignedp, + const_tree funtype ATTRIBUTE_UNUSED, + int for_return ATTRIBUTE_UNUSED) +{ + /* With the amended use of promote using cargs, the only cases that arrive + here with for_return == 0 are from combine (where the value is definitely + in a register) and for libcalls, where type == NULL. We want to promote + function return values in the callee, so this becomes pretty much + unconditional now. */ + if (type != NULL_TREE) + return promote_mode (type, mode, punsignedp); + return mode; +} + +/* Ensure that we only promote the mode of named parms when they are passed in + a register. Named values passed on the stack retain their original mode and + alignment. */ +machine_mode +aarch64_darwin_promote_function_mode_ca (cumulative_args_t ca, + function_arg_info arg, + const_tree funtype ATTRIBUTE_UNUSED, + int *punsignedp, + int for_return ATTRIBUTE_UNUSED) +{ + tree type = arg.type; + machine_mode mode = arg.mode; + machine_mode new_mode = promote_mode (type, mode, punsignedp); + if (new_mode == mode || arg.named == false + || GET_MODE_CLASS (new_mode) != MODE_INT + || known_gt (GET_MODE_SIZE (new_mode), 4)) + return new_mode; + + CUMULATIVE_ARGS *pcum = get_cumulative_args (ca); + /* Make sure that changes in assumption do not get missed. */ + gcc_checking_assert (for_return == 0 && new_mode == SImode + && !pcum->aapcs_arg_processed); + /* We have a named integer value that fits in a reg; if there's one available + then promote the value. */ + if (pcum->aapcs_ncrn < num_pcs_arg_regs (pcum->pcs_variant)) + return new_mode; + return mode; +} +#endif + /* Target-specific selftests. */ #if CHECKING_P @@ -33412,6 +34145,15 @@ aarch64_run_selftests (void) #define TARGET_ASM_UNALIGNED_DI_OP TARGET_ASM_ALIGNED_DI_OP #endif +#if TARGET_MACHO +#undef TARGET_ASM_UNALIGNED_HI_OP +#define TARGET_ASM_UNALIGNED_HI_OP "\t.short\t" +#undef TARGET_ASM_UNALIGNED_SI_OP +#define TARGET_ASM_UNALIGNED_SI_OP "\t.long\t" +#undef TARGET_ASM_UNALIGNED_DI_OP +#define TARGET_ASM_UNALIGNED_DI_OP "\t.quad\t" +#endif + #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK #define TARGET_ASM_CAN_OUTPUT_MI_THUNK \ hook_bool_const_tree_hwi_hwi_const_tree_true @@ -33532,6 +34274,12 @@ aarch64_run_selftests (void) #undef TARGET_FUNCTION_ARG_BOUNDARY #define TARGET_FUNCTION_ARG_BOUNDARY aarch64_function_arg_boundary +#undef TARGET_FUNCTION_ARG_BOUNDARY_CA +#define TARGET_FUNCTION_ARG_BOUNDARY_CA aarch64_function_arg_boundary_ca + +#undef TARGET_FUNCTION_ARG_ROUND_BOUNDARY_CA +#define TARGET_FUNCTION_ARG_ROUND_BOUNDARY_CA aarch64_function_arg_round_boundary_ca + #undef TARGET_FUNCTION_ARG_PADDING #define TARGET_FUNCTION_ARG_PADDING aarch64_function_arg_padding @@ -33808,8 +34556,16 @@ aarch64_libgcc_floating_mode_supported_p /* Section anchor support. */ +#if !TARGET_MACHO #undef TARGET_MIN_ANCHOR_OFFSET #define TARGET_MIN_ANCHOR_OFFSET -256 +#else +/* The static linker is allowed to split objects at visible symbol boundaries, + so we must ensure that anchors are at the beginning of a block. */ +#undef TARGET_MIN_ANCHOR_OFFSET +#define TARGET_MIN_ANCHOR_OFFSET 0 +#endif + /* Limit the maximum anchor offset to 4k-1, since that's the limit for a byte offset; we can do much more for larger data types, but have no way @@ -33869,6 +34625,11 @@ aarch64_libgcc_floating_mode_supported_p #undef TARGET_ASAN_SHADOW_OFFSET #define TARGET_ASAN_SHADOW_OFFSET aarch64_asan_shadow_offset +#if TARGET_MACHO +#undef TARGET_ASAN_DYNAMIC_SHADOW_OFFSET_P +#define TARGET_ASAN_DYNAMIC_SHADOW_OFFSET_P hook_bool_void_true +#endif + #undef TARGET_LEGITIMIZE_ADDRESS #define TARGET_LEGITIMIZE_ADDRESS aarch64_legitimize_address @@ -33917,7 +34678,7 @@ aarch64_libgcc_floating_mode_supported_p /* The architecture reserves bits 0 and 1 so use bit 2 for descriptors. */ #undef TARGET_CUSTOM_FUNCTION_DESCRIPTORS -#define TARGET_CUSTOM_FUNCTION_DESCRIPTORS 4 +#define TARGET_CUSTOM_FUNCTION_DESCRIPTORS AARCH64_CUSTOM_FUNCTION_TEST #undef TARGET_HARD_REGNO_NREGS #define TARGET_HARD_REGNO_NREGS aarch64_hard_regno_nregs diff --git gcc/config/aarch64/aarch64.h gcc/config/aarch64/aarch64.h index d61705d78..c48261b85 100644 --- gcc/config/aarch64/aarch64.h +++ gcc/config/aarch64/aarch64.h @@ -72,6 +72,10 @@ #define BYTES_BIG_ENDIAN (TARGET_BIG_END != 0) #define WORDS_BIG_ENDIAN (BYTES_BIG_ENDIAN) +/* If this is non-zero then generated code of the object format, ABI and + assembler syntax used by Darwin (Mach-O) platforms. */ +#define TARGET_MACHO 0 + #define UNITS_PER_WORD 8 #define UNITS_PER_VREG 16 @@ -132,6 +136,12 @@ /* Heap alignment (same as BIGGEST_ALIGNMENT and STACK_BOUNDARY). */ #define MALLOC_ABI_ALIGNMENT 128 +/* We will and with this value to test if a custom function descriptor needs + a static chain. The function boundary must the adjusted so that the bit + this represents is no longer part of the address. 0 Disables the custom + function descriptors. */ +#define AARCH64_CUSTOM_FUNCTION_TEST 4 + /* Defined by the ABI */ #define WCHAR_TYPE "unsigned int" #define WCHAR_TYPE_SIZE 32 @@ -1260,6 +1270,24 @@ typedef struct aapcs_reg == NULL_RTX. */ int aapcs_stack_size; /* The total size (in words, per 8 byte) of the stack arg area so far. */ + + /* In the darwinpcs, items smaller than one word are packed onto the stack + naturally aligned. Unnamed parameters passed in a variadic call are, + however, aligned the same way as the AAPCS64. This means that we need to + pad the last named arg to the next parm boundary (and hence notice when + we are processing that arg). */ + int darwinpcs_stack_bytes; /* If the argument is passed on the stack, this + the byte-size. */ + int darwinpcs_sub_word_offset;/* This is the offset of this arg within a word + when placing smaller items for darwinpcs. */ + int darwinpcs_sub_word_pos; /* The next byte available within the word for + darwinpcs. */ + unsigned darwinpcs_arg_boundary; /* The computed argument boundary. */ + unsigned darwinpcs_arg_padding; /* The computed argument padding. */ + unsigned darwinpcs_n_named; /* Number of named arguments. */ + unsigned darwinpcs_n_args_processed; /* Processed so far. */ + bool named_p; /* Is this arg named? */ + bool last_named_p; /* Is this the last named arg? */ bool silent_p; /* True if we should act silently, rather than raise an error for invalid calls. */ @@ -1584,8 +1612,13 @@ extern const char *is_host_cpu_not_armv8_base (int argc, const char **argv); #define ASM_CPU_SPEC \ MARCH_REWRITE_SPEC +#ifndef SUBTARGET_EXTRA_SPECS +#define SUBTARGET_EXTRA_SPECS +#endif + #define EXTRA_SPECS \ - { "asm_cpu_spec", ASM_CPU_SPEC } + { "asm_cpu_spec", ASM_CPU_SPEC }, \ + SUBTARGET_EXTRA_SPECS #define ASM_OUTPUT_POOL_EPILOGUE aarch64_asm_output_pool_epilogue @@ -1606,6 +1639,10 @@ extern GTY(()) tree aarch64_bf16_ptr_type_node; /* Windows Arm64 variadic function call ABI specific va_list type node. */ extern GTY(()) tree ms_va_list_type_node; +/* A pointer to the user-visible __float128 (on Mach-O). Defined in + aarch64-builtins.c. */ +extern GTY(()) tree aarch64_float128_ptr_type_node; + /* The generic unwind code in libgcc does not initialize the frame pointer. So in order to unwind a function using a frame pointer, the very first function that is unwound must save the frame pointer. That way the frame diff --git gcc/config/aarch64/aarch64.md gcc/config/aarch64/aarch64.md index 0ef01e889..5ac191bf9 100644 --- gcc/config/aarch64/aarch64.md +++ gcc/config/aarch64/aarch64.md @@ -414,6 +414,7 @@ ;; Wraps a constant integer that should be multiplied by the number ;; of quadwords in an SME vector. UNSPEC_SME_VQ + UNSPEC_MACHOPIC_OFFSET ; Common to Mach-O ports. ]) (define_c_enum "unspecv" [ @@ -1381,6 +1382,37 @@ [(set_attr "type" "load_4")] ) +(define_insn "prefetch_unscaled" + [(prefetch (match_operand:DI 0 "aarch64_unscaled_prefetch_operand" "Du") + (match_operand:QI 1 "const_int_operand" "") + (match_operand:QI 2 "const_int_operand" ""))] + "" + { + const char * pftype[2][4] = + { + {"prfum\\tPLDL1STRM, %0", + "prfum\\tPLDL3KEEP, %0", + "prfum\\tPLDL2KEEP, %0", + "prfum\\tPLDL1KEEP, %0"}, + {"prfum\\tPSTL1STRM, %0", + "prfum\\tPSTL3KEEP, %0", + "prfum\\tPSTL2KEEP, %0", + "prfum\\tPSTL1KEEP, %0"}, + }; + + int locality = INTVAL (operands[2]); + + gcc_assert (IN_RANGE (locality, 0, 3)); + + /* PRFUM accepts the same addresses as a 64-bit LDR so wrap + the address into a DImode MEM so that aarch64_print_operand knows + how to print it. */ + operands[0] = gen_rtx_MEM (DImode, operands[0]); + return pftype[INTVAL(operands[1])][locality]; + } + [(set_attr "type" "load_4")] +) + (define_insn "trap" [(trap_if (const_int 1) (const_int 8))] "" @@ -1790,7 +1822,7 @@ [w , m ; load_4 , fp , 4] ldr\t%s0, %1 [m , r Z; store_4 , * , 4] str\t%w1, %0 [m , w ; store_4 , fp , 4] str\t%s1, %0 - [r , Usw; load_4 , * , 8] adrp\t%x0, %A1\;ldr\t%w0, [%x0, %L1] + [r , Usw; load_4 , * , 8] << TARGET_MACHO ? \"adrp\\t%x0, %A1\;ldr\\t%w0, [%x0, %O1]\" : \"adrp\\t%x0, %A1\;ldr\\t%w0, [%x0, %L1]\"; [r , Usa; adr , * , 4] adr\t%x0, %c1 [r , Ush; adr , * , 4] adrp\t%x0, %A1 [w , r Z; f_mcr , fp , 4] fmov\t%s0, %w1 @@ -1829,7 +1861,7 @@ [w, m ; load_8 , fp , 4] ldr\t%d0, %1 [m, r Z ; store_8 , * , 4] str\t%x1, %0 [m, w ; store_8 , fp , 4] str\t%d1, %0 - [r, Usw ; load_8 , * , 8] << TARGET_ILP32 ? "adrp\t%0, %A1\;ldr\t%w0, [%0, %L1]" : "adrp\t%0, %A1\;ldr\t%0, [%0, %L1]"; + [r, Usw ; load_8 , * , 8] << TARGET_ILP32 ? (TARGET_MACHO ? \"adrp\\t%0, %A1\;ldr\\t%w0, [%0, %O1]\" : \"adrp\\t%0, %A1\;ldr\\t%w0, [%0, %L1]\") : (TARGET_MACHO ? \"adrp\\t%0, %A1\;ldr\\t%0, [%0, %O1]\" : \"adrp\\t%0, %A1\;ldr\\t%0, [%0, %L1]\"); [r, Usa ; adr , * , 4] adr\t%x0, %c1 [r, Ush ; adr , * , 4] adrp\t%x0, %A1 [w, r Z ; f_mcr , fp , 4] fmov\t%d0, %x1 @@ -7946,7 +7978,10 @@ (lo_sum:P (match_operand:P 1 "register_operand" "r") (match_operand 2 "aarch64_valid_symref" "S")))] "" - "add\\t%0, %1, :lo12:%c2" + { return TARGET_MACHO + ? "add\\t%0, %1, %J2;" + : "add\\t%0, %1, :lo12:%c2"; + } [(set_attr "type" "alu_imm")] ) diff --git gcc/config/aarch64/aarch64.opt gcc/config/aarch64/aarch64.opt index 64004f213..afcb6995e 100644 --- gcc/config/aarch64/aarch64.opt +++ gcc/config/aarch64/aarch64.opt @@ -220,6 +220,13 @@ Enum(aarch64_abi) String(ilp32) Value(AARCH64_ABI_ILP32) EnumValue Enum(aarch64_abi) String(lp64) Value(AARCH64_ABI_LP64) +EnumValue +Enum(aarch64_abi) String(darwinpcs) Value(AARCH64_ABI_LP64) + +m64 +Target RejectNegative Alias(mabi=, darwinpcs) +On Darwin for compatibility with other platform variants. + mpc-relative-literal-loads Target Save Var(pcrelative_literal_loads) Init(2) Save PC relative literal loads. diff --git gcc/config/aarch64/constraints.md gcc/config/aarch64/constraints.md index 3d166fe3a..be053fdb1 100644 --- gcc/config/aarch64/constraints.md +++ gcc/config/aarch64/constraints.md @@ -206,7 +206,9 @@ A constraint that matches a small GOT access." (and (match_code "const,symbol_ref") (match_test "aarch64_classify_symbolic_expression (op) - == SYMBOL_SMALL_GOT_4G"))) + == SYMBOL_SMALL_GOT_4G + || aarch64_classify_symbolic_expression (op) + == SYMBOL_MO_SMALL_GOT"))) (define_constraint "Uss" "@internal @@ -621,6 +623,11 @@ (match_test "IN_RANGE (ival, -1008, -1) && !(ival & 0xf)"))) +(define_address_constraint "Du" + "@internal + An address valid for a prefetch instruction with an unscaled offset." + (match_test "aarch64_address_valid_for_unscaled_prefetch_p (op, true)")) + (define_constraint "vgb" "@internal A constraint that matches an immediate offset valid for SVE LD1B diff --git gcc/config/aarch64/darwin.h gcc/config/aarch64/darwin.h new file mode 100644 index 000000000..b8f577d49 --- /dev/null +++ gcc/config/aarch64/darwin.h @@ -0,0 +1,268 @@ +/* Target definitions for Arm64/Aarch64 running on macOS/iOS. + +Copyright The GNU Toolchain Authors. +Contributed by Iain Sandoe. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +/* Enable Mach-O bits in generic Aarch64 code. */ +#undef TARGET_MACHO +#define TARGET_MACHO 1 + +#undef DARWIN_ARM64 +#define DARWIN_ARM64 1 + +/* This is used in generic code in darwin.cc (at present, we have no support + for the arm64_32 target). */ +#undef TARGET_64BIT +#define TARGET_64BIT 1 + +#undef PTRDIFF_TYPE +#define PTRDIFF_TYPE "long int" + +#undef TARGET_PROMOTE_FUNCTION_MODE +#define TARGET_PROMOTE_FUNCTION_MODE aarch64_darwin_promote_fn_mode + +#undef TARGET_PROMOTE_FUNCTION_MODE_CA +#define TARGET_PROMOTE_FUNCTION_MODE_CA aarch64_darwin_promote_function_mode_ca + +/* NOTE that arm64_32 is a valid thing and corresponds to darwinpcs + and TARGET_ILP32, but we are not implementing that for now. */ +#define TARGET_OS_CPP_BUILTINS() \ + do { \ + builtin_define ("__LITTLE_ENDIAN__"); \ + builtin_define ("__arm64"); \ + builtin_define ("__arm64__"); \ + darwin_cpp_builtins (pfile); \ + } while (0) + +/* In Darwin's Arm64 ABI, chars are signed. */ + +#undef DEFAULT_SIGNED_CHAR +#define DEFAULT_SIGNED_CHAR 1 + +/* Disable custom function descriptors on Darwin (we use heap-based + trampolines). */ +#undef AARCH64_CUSTOM_FUNCTION_TEST +#define AARCH64_CUSTOM_FUNCTION_TEST 0 + +/* Non-PIE executables are forbidden by the Arm64-darwin security model; + remove the option from link-lines since they just produce a warning from + ld64 and are then ignored anyway. */ +#undef DARWIN_NOPIE_SPEC +#define DARWIN_NOPIE_SPEC \ +" % 10years). Any symbol that is not 'global' and does not begin + with 'L' (the local symbol designation) is counted as 'linker visible'. + * does _not_ support 'static' code in the user space + + Everything needs to be invoked using the dynamic linker (`dyld`). There is + neither crt0.o nor a static edition of libc. + +FIXME: CHECK the kernel model here. + +### Darwin Relocations and Assembler syntax + +* `Mach-O` for `Arm64` uses a reduced set of relocations c.f. the ELF set. + + There are only 11 entries but the relocation format allows for multiple sizes +(1, 2, 4, 8) where that's appropriate, and for ancillary data (e.g. a scale), +so the actual number of permutations is larger. + +* Generally, Darwin supports relocations of the form A - B + signed const + + A must be known (i.e. defined in the current TU). + +* `Mach-O` for `Arm64` has postfix assembler syntax. + + Where there's an assembly language representation for the relocation type + it appears after the name (e.g. `foo@PAGE` in contrast to the ELF + `:got:foo`). + +#### Relocs list + +For pointers (no source representation). + +`ARM64_RELOC_UNSIGNED = 0` + +Must be followed by an `ARM64_RELOC_UNSIGNED` + +`ARM64_RELOC_SUBTRACTOR = 1` + +A B/BL instruction with 26-bit displacement. +(no source representation) + +`ARM64_RELOC_BRANCH26 = 2` + +PC-rel distance to page of target [adrp]. + +`foo@PAGE` + +`ARM64_RELOC_PAGE21 = 3` + +Offset within page, scaled by r_length [add imm, ld/st]. + +`foo@PAGEOFF` + +`ARM64_RELOC_PAGEOFF12 = 4` + +PC-rel distance to page of GOT slot [adrp]. + +`foo@GOTPAGE` +`ARM64_RELOC_GOT_LOAD_PAGE21 = 5` + +Offset within page of GOT slot, scaled by r_length [add imm, ld/st]. + +`foo@GOTPAGEOFF` + +`ARM64_RELOC_GOT_LOAD_PAGEOFF12 = 6` + + +For pointers to GOT slots. +(4 and 8 byte versions) + +`foo@GOT` + +`ARM64_RELOC_POINTER_TO_GOT = 7` + + +PC-rel distance to page of TLVP slot [adrp]. + +`foo@TVLPPAGE` + +`ARM64_RELOC_TLVP_LOAD_PAGE21 = 8` + +Offset within page of TLVP slot, scaled by r_length [add imm, ld/st]. + +`foo@TVLPPAGEOFF` + +`ARM64_RELOC_TLVP_LOAD_PAGEOFF12 = 9` + +Must be followed by `ARM64_RELOC_PAGE21` or `ARM64_RELOC_PAGEOFF12`. +(no source representation) + +The addend is a signed 24bit quantity (+/- 8M range). + +`ARM64_RELOC_ADDEND = 10` + +## PART 2 - GCC-12 deviations from the PCS and supporting information. + +### D.3 is not yet supported (github issue #74) + + GCC promotes in the callee not the caller. + +### Support for nested functions + + GCC provides nested functions which are used overtly from C but also to + implement some parts of Ada and Fortran. + + This requires assigning a register to act as the STATIC CHAIN. + For GCC-12 this is X16 + + Support for nested function trampolines is provided by a heap-based table. + +### Support for __float128 + + The darwinpcs has no provision for a 128bit float type. + GCC-12 supports IEEE741 128bit float values by sof-float. + The ABI used for __float128 matches that for AAPCS64 + +## End. diff --git gcc/config/aarch64/driver-aarch64.cc gcc/config/aarch64/driver-aarch64.cc index a8888640e..02c3d6f96 100644 --- gcc/config/aarch64/driver-aarch64.cc +++ gcc/config/aarch64/driver-aarch64.cc @@ -28,6 +28,76 @@ #include "aarch64-protos.h" #include "aarch64-feature-deps.h" + +/* Default architecture to use if -mcpu=native did not detect a known CPU. */ +#if TARGET_MACHO +#define DEFAULT_ARCH "apple-m1" +#else +#define DEFAULT_ARCH "8A" +#define DEFAULT_CPU "generic-armv8-a" +#endif + + +#if defined(__APPLE__) +/* macOS does not have /proc/cpuinfo and needs a different approach, + based on sysctl. It is much simpler. */ +#include +#include + +const char * +host_detect_local_cpu (ATTRIBUTE_UNUSED int argc, ATTRIBUTE_UNUSED const char **argv) +{ + bool arch = false; + bool tune = false; + bool cpu = false; + const char *res = NULL; + uint32_t family; + size_t len = sizeof(family); + + gcc_assert (argc); + if (!argv[0]) + return NULL; + + /* Are we processing -march, mtune or mcpu? */ + arch = strcmp (argv[0], "arch") == 0; + if (!arch) + tune = strcmp (argv[0], "tune") == 0; + if (!arch && !tune) + cpu = strcmp (argv[0], "cpu") == 0; + if (!arch && !tune && !cpu) + return NULL; + + sysctlbyname("hw.cpufamily", &family, &len, NULL, 0); + + switch (family) + { + case 0x07d34b9f: // Vortex, Tempest + res = "apple-a12"; + break; + case 0x573b5eec: + case 0x1b588bb3: // Firestorm, Icestorm + res = "apple-m1"; + break; + case 0xda33d83d: // Blizzard, Avalanche + res = "apple-m2"; + break; + case 0xfa33415e: // Ibiza (M3) + case 0x5f4dea93: // Lobos (M3 Pro) + case 0x72015832: // Palma (M3 Max) + res = "apple-m3"; + break; + default: + res = DEFAULT_ARCH; + } + + if (res) + return concat ("-m", argv[0], "=", res, NULL); + else + return NULL; +} + +#else + struct aarch64_arch_extension { const char *ext; @@ -58,9 +128,6 @@ struct aarch64_core_data #define INVALID_IMP ((unsigned char) -1) #define INVALID_CORE ((unsigned)-1) #define ALL_VARIANTS ((unsigned)-1) -/* Default architecture to use if -mcpu=native did not detect a known CPU. */ -#define DEFAULT_ARCH "8A" -#define DEFAULT_CPU "generic-armv8-a" #define AARCH64_CORE(CORE_NAME, CORE_IDENT, SCHED, ARCH, FLAGS, COSTS, IMP, PART, VARIANT) \ { CORE_NAME, #ARCH, IMP, PART, unsigned(VARIANT), feature_deps::cpu_##CORE_IDENT }, @@ -516,3 +583,4 @@ not_found: return NULL; } } +#endif diff --git gcc/config/aarch64/predicates.md gcc/config/aarch64/predicates.md index 40b0e8b9f..b89d3a138 100644 --- gcc/config/aarch64/predicates.md +++ gcc/config/aarch64/predicates.md @@ -365,9 +365,24 @@ (define_predicate "aarch64_prefetch_operand" (match_test "aarch64_address_valid_for_prefetch_p (op, false)")) +(define_predicate "aarch64_unscaled_prefetch_operand" + (match_test "aarch64_address_valid_for_unscaled_prefetch_p (op, false)")) + (define_predicate "aarch64_valid_symref" (match_code "const, symbol_ref, label_ref") { + if (TARGET_MACHO) + { + rtx x = op; + rtx offset; + split_const (x, &x, &offset); + if (GET_CODE (x) == CONST) + x = XEXP (x, 0); + if (GET_CODE (x) == UNSPEC && XINT (x, 1) == UNSPEC_SALT_ADDR) + x = XVECEXP (x, 0, 0); + if (SYMBOL_REF_P (x) && INTVAL (offset) < 0) + return false; + } return (aarch64_classify_symbolic_expression (op) != SYMBOL_FORCE_TO_MEM); }) diff --git gcc/config/aarch64/t-aarch64-darwin gcc/config/aarch64/t-aarch64-darwin new file mode 100644 index 000000000..e2b8ad923 --- /dev/null +++ gcc/config/aarch64/t-aarch64-darwin @@ -0,0 +1,25 @@ +# Machine description for AArch64 architecture. +# Copyright (C) 2020 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +LIB1ASMSRC = aarch64/lib1funcs.asm +LIB1ASMFUNCS = _aarch64_sync_cache_range + +# TODO - figure out what multilib provisions we should make for +# a) arm64e +# b) arm64_32 diff --git gcc/config/darwin-driver.cc gcc/config/darwin-driver.cc index 038b3b329..8178ee478 100644 --- gcc/config/darwin-driver.cc +++ gcc/config/darwin-driver.cc @@ -270,10 +270,13 @@ darwin_driver_init (unsigned int *decoded_options_count, bool seenX86_64 = false; bool seenPPC = false; bool seenPPC64 = false; +#if !DARWIN_ARM64 + bool seenArm64 = false; bool seenM32 = false; bool seenM64 = false; bool appendM32 = false; bool appendM64 = false; +#endif const char *vers_string = NULL; bool seen_version_min = false; bool seen_sysroot_p = false; @@ -298,6 +301,12 @@ darwin_driver_init (unsigned int *decoded_options_count, seenPPC = true; else if (!strcmp ((*decoded_options)[i].arg, "ppc64")) seenPPC64 = true; + else if (!strcmp ((*decoded_options)[i].arg, "arm64")) +#if !DARWIN_ARM64 + seenArm64 = true; +#else + ; /* We accept the option, but don't need to act on it. */ +#endif else error ("this compiler does not support %qs", (*decoded_options)[i].arg); @@ -311,7 +320,7 @@ darwin_driver_init (unsigned int *decoded_options_count, --i; --*decoded_options_count; break; - +#if !DARWIN_ARM64 case OPT_m32: seenM32 = true; break; @@ -319,6 +328,7 @@ darwin_driver_init (unsigned int *decoded_options_count, case OPT_m64: seenM64 = true; break; +#endif case OPT_mmacosx_version_min_: seen_version_min = true; @@ -378,6 +388,9 @@ darwin_driver_init (unsigned int *decoded_options_count, if (seenPPC || seenPPC64) warning (0, "this compiler does not support PowerPC" " (%<-arch%> option ignored)"); + else if (seenArm64) + warning (0, "this compiler does not support Arm64" + " (%<-arch%> option ignored)"); if (seenX86) { if (seenX86_64 || seenM64) @@ -401,6 +414,9 @@ darwin_driver_init (unsigned int *decoded_options_count, if (seenX86 || seenX86_64) warning (0, "this compiler does not support x86" " (%<-arch%> option ignored)"); + else if (seenArm64) + warning (0, "this compiler does not support Arm64" + " (%<-arch%> option ignored)"); if (seenPPC) { if (seenPPC64 || seenM64) @@ -420,12 +436,20 @@ darwin_driver_init (unsigned int *decoded_options_count, if (! seenM64) /* Add -m64 if the User didn't. */ appendM64 = true; } +#elif DARWIN_ARM64 + if (seenPPC || seenPPC64) + warning (0, "this compiler does not support PowerPC" + " (%<-arch%> option ignored)"); + if (seenX86 || seenX86_64) + warning (0, "this compiler does not support x86" + " (%<-arch%> option ignored)"); #endif /* If there is nothing else on the command line, do not add sysroot etc. */ if (*decoded_options_count <= 1) return; +#if !DARWIN_ARM64 if (appendM32 || appendM64) { ++*decoded_options_count; @@ -435,6 +459,7 @@ darwin_driver_init (unsigned int *decoded_options_count, generate_option (appendM32 ? OPT_m32 : OPT_m64, NULL, 1, CL_DRIVER, &(*decoded_options)[*decoded_options_count - 1]); } +#endif if (!seen_sysroot_p) { diff --git gcc/config/darwin-protos.h gcc/config/darwin-protos.h index 59f402033..04926295a 100644 --- gcc/config/darwin-protos.h +++ gcc/config/darwin-protos.h @@ -86,9 +86,12 @@ extern void darwin_asm_lto_end (void); extern void darwin_mark_decl_preserved (const char *); extern tree darwin_handle_kext_attribute (tree *, tree, tree, int, bool *); -extern tree darwin_handle_weak_import_attribute (tree *node, tree name, - tree args, int flags, - bool * no_add_attrs); +extern tree darwin_handle_weak_import_attribute (tree *, tree, tree, int, + bool *); +extern tree darwin_handle_availability_attribute (tree *, tree, tree, + int, bool *); +extern bool darwin_attribute_takes_identifier_p (const_tree); + extern void machopic_output_stub (FILE *, const char *, const char *); extern void darwin_globalize_label (FILE *, const char *); extern void darwin_assemble_visibility (tree, int); diff --git gcc/config/darwin.cc gcc/config/darwin.cc index 6008ee730..7b4342fed 100644 --- gcc/config/darwin.cc +++ gcc/config/darwin.cc @@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see #include "cfghooks.h" #include "df.h" #include "memmodel.h" +#include "c-family/c-common.h" /* enum rid. */ #include "tm_p.h" #include "stringpool.h" #include "attribs.h" @@ -50,6 +51,7 @@ along with GCC; see the file COPYING3. If not see #include "flags.h" #include "opts.h" #include "asan.h" +#include "c-family/c-objc.h" /* for objc_method_decl(). */ /* Fix and Continue. @@ -103,6 +105,7 @@ int darwin_running_cxx; /* Some code-gen now depends on OS major version numbers (at least). */ int generating_for_darwin_version ; +unsigned long current_os_version = 0; /* For older linkers we need to emit special sections (marked 'coalesced') for for weak or single-definition items. */ @@ -132,7 +135,7 @@ struct { section * darwin_sections[NUM_DARWIN_SECTIONS]; /* While we transition to using in-tests instead of ifdef'd code. */ -#if !HAVE_lo_sum +#if !HAVE_lo_sum || DARWIN_ARM64 #define gen_macho_high(m,a,b) (a) #define gen_macho_low(m,a,b,c) (a) #endif @@ -1105,6 +1108,7 @@ machopic_legitimize_pic_address (rtx orig, machine_mode mode, rtx reg) return pic_ref; } +#if !DARWIN_ARM64 /* Callbacks to output the stub or non-lazy pointers. Each works on the item in *SLOT,if it has been used. DATA is the FILE* for assembly output. @@ -1260,6 +1264,7 @@ machopic_finish (FILE *out_file) machopic_indirections->traverse_noresize (out_file); } +#endif int machopic_operand_p (rtx op) @@ -2244,6 +2249,122 @@ darwin_handle_kext_attribute (tree *node, tree name, return NULL_TREE; } +enum version_components { MAJOR, MINOR, TINY }; + +/* Parse a version number in x.y.z form and validate it as a macOS + version. Ideally, we'd put this in a common place usable by the + Darwin backend. */ + +static bool +parse_version (unsigned version_array[3], const char *version_str) +{ + size_t version_len; + char *end, last = '\0', delimiter = '.', alt_delim = '_'; + + if (!version_str) + return false; + + /* Handle the odd situation in which we get STRING_CST which contain the + starting and ending quotes. */ + if (version_str[0] == '"') + { + version_str++; + version_len = strrchr (&version_str[1], '"') - version_str; + last = '"'; + } + else + version_len = strlen (version_str); + + if (version_len < 1) + return false; + + /* Version string must consist of digits and periods only. */ + if (strspn (version_str, "0123456789._") != version_len) + return false; + + if (!ISDIGIT (version_str[0]) || !ISDIGIT (version_str[version_len - 1])) + return false; + + version_array[MAJOR] = strtoul (version_str, &end, 10); + if (*end == '_') + { + delimiter = '_'; + alt_delim = '.'; + } + version_str = end + ((*end == delimiter) ? 1 : 0); + if (version_array[MAJOR] == 100000) + return true; + if (version_array[MAJOR] > 99) + return false; + + /* Version string must not contain adjacent delimiters. */ + if (*version_str == delimiter || *version_str == alt_delim) + return false; + + version_array[MINOR] = strtoul (version_str, &end, 10); + if (*end == alt_delim) + return false; + version_str = end + ((*end == delimiter) ? 1 : 0); + if (version_array[MINOR] > 99) + return false; + + version_array[TINY] = strtoul (version_str, &end, 10); + if (version_array[TINY] > 99) + return false; + + /* Version string must contain no more than three tokens. */ + if (*end != last) + return false; + + return true; +} + +/* Turn a version expressed as maj.min.tiny into an unsigned long + integer representing the value used in macOS availability macros. */ + +static unsigned long +version_from_version_array (unsigned vers[3]) +{ + unsigned long res = 0; + /* There seems to be a special "unknown" value. */ + if (vers[0] == 100000) + return 999999; + + /* Here, we follow the 'modern' / 'legacy' numbering scheme for versions. */ + if (vers[0] > 10 || vers[1] >= 10) + res = vers[0] * 10000 + vers[1] * 100 + vers[2]; + else + { + res = vers[0] * 100; + if (vers[1] > 9) + res += 90; + else + res += vers[1] * 10; + if (vers[2] > 9) + res += 9; + else + res += vers[1]; + } + return res; +} + +/* Extract a macOS version from an availability attribute argument. */ + +static unsigned long +os_version_from_avail_value (tree value) +{ + unsigned long res = 0; + unsigned vers[3] = {0,0,0}; + if (TREE_CODE (value) == STRING_CST) + { + if (parse_version (&vers[0], TREE_STRING_POINTER (value))) + res = version_from_version_array (&vers[0]); + } + else + gcc_unreachable (); + return res; +} + /* Handle a "weak_import" attribute; arguments as in struct attribute_spec.handler. */ @@ -2265,6 +2386,231 @@ darwin_handle_weak_import_attribute (tree *node, tree name, return NULL_TREE; } +#define NUM_AV_OSES 13 +const char *availability_os[NUM_AV_OSES] + = { "macos", "macosx", "ios", "tvos", "watchos", "driverkit", "swift", + "maccatalyst", "macCatalyst", "xros", "visionos", "android", "zos" }; + +#define NUM_AV_CLAUSES 6 +const char *availability_clause[NUM_AV_CLAUSES] + = { "unavailable", "introduced", "deprecated", "obsoleted", "message", + "replacement" }; + +/* Validate and act upon the arguments to an 'availability' attribute. */ + +tree +darwin_handle_availability_attribute (tree *node, tree name, tree args, + int flags, bool * no_add_attrs) +{ + tree decl = *node; + *no_add_attrs = true; + + if (!decl || (!TYPE_P (decl) && !DECL_P (decl))) + { + warning (OPT_Wattributes, "%qE attribute ignored", name); + return NULL_TREE; + } + else if (decl == error_mark_node) + return NULL_TREE; + + location_t loc = DECL_SOURCE_LOCATION (decl); + if (args == NULL_TREE) + { + error_at (loc, "%qE attribute requires at least one argument", + name); + return NULL_TREE; + } + else if (args == error_mark_node) + return NULL_TREE; + + /* The first argument must name a supported OS - although we could choose + to ignore any OS we don't recognise. */ + gcc_checking_assert (TREE_CODE (args) == TREE_LIST); + tree platform = TREE_VALUE (args); + if (platform == error_mark_node) + return NULL_TREE; + + gcc_checking_assert (TREE_CODE (platform) == IDENTIFIER_NODE); + bool platform_ok = false; + unsigned plat_num = 0; + for (; plat_num < (unsigned) NUM_AV_OSES; plat_num++) + if (strcmp (availability_os[plat_num], IDENTIFIER_POINTER (platform)) == 0) + { + platform_ok = true; + break; + } + if (!platform_ok) + { + error_at (input_location, + "platform %qE is not recognised for the % " + "attribute", platform); + return NULL_TREE; + } + else if (plat_num > 1) /* We only compile for macos so far. */ + return NULL_TREE; + + /* We might be dealing with an object or type. */ + tree target_decl = NULL_TREE; + tree type = NULL_TREE; + bool warn = false; + if (DECL_P (*node)) + { + type = TREE_TYPE (decl); + + if (TREE_CODE (decl) == TYPE_DECL + || TREE_CODE (decl) == PARM_DECL + || VAR_OR_FUNCTION_DECL_P (decl) + || TREE_CODE (decl) == FIELD_DECL + || TREE_CODE (decl) == CONST_DECL + /*|| objc_method_decl (TREE_CODE (decl))*/) + target_decl = decl; + else + warn = true; + } + else if (TYPE_P (*node)) + type = target_decl = *node; + else + warn = true; + + tree what = NULL_TREE; + if (warn) + { + if (type && TYPE_NAME (type)) + { + if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE) + what = TYPE_NAME (*node); + else if (TREE_CODE (TYPE_NAME (type)) == TYPE_DECL + && DECL_NAME (TYPE_NAME (type))) + what = DECL_NAME (TYPE_NAME (type)); + } + if (what) + warning (OPT_Wattributes, "%qE attribute ignored for %qE", name, what); + else + warning (OPT_Wattributes, "%qE attribute ignored", name); + return NULL_TREE; + } + + /* Now we have to parse the availability clauses. */ + tree msg = NULL_TREE; + tree replacement = NULL_TREE; + bool unavailable = false; + unsigned introduced = 1000; + unsigned deprecated = current_os_version + 1; + unsigned obsoleted = current_os_version + 1; + for (tree arg = TREE_CHAIN (args); arg; arg = TREE_CHAIN (arg)) + { + tree clause_name = TREE_VALUE (arg); + tree clause_value = TREE_PURPOSE (arg); + if (clause_name == error_mark_node + || clause_value == error_mark_node) + continue; + unsigned clause_num = 0; + for (; clause_num < (unsigned) NUM_AV_CLAUSES; clause_num++) + if (strcmp (availability_clause[clause_num], + IDENTIFIER_POINTER (clause_name)) == 0) + break; + switch (clause_num) + { + default: + error_at (input_location, + "clause %qE is not recognised for the % " + "attribute", clause_name); + break; + case 0: + unavailable = true; + break; + case 1: + case 2: + case 3: + if (!clause_value) + error_at (input_location, "%<%E=%> requires a value", clause_name); + else + { + unsigned version = os_version_from_avail_value (clause_value); + if (version == 0) + error_at (input_location, "the value %qE provided to %qE is " + "not a valid OS version", clause_value, clause_name); + else if (clause_num == 1) + introduced = version; + else if (clause_num == 2) + deprecated = version; + else if (clause_num == 3) + obsoleted = version; + } + break; + case 4: + case 5: + if (!clause_value || TREE_CODE (clause_value) != STRING_CST) + error_at (input_location, "%<%E=%> requires a string", clause_name); + else if (clause_num == 4) + msg = clause_value; + else + replacement = clause_value; + break; + } + } + /* Now figure out what to do. */ + tree maybe_text = NULL_TREE; + if (replacement) + maybe_text = tree_cons (NULL_TREE, replacement, NULL_TREE); + else if (msg) + maybe_text = tree_cons (NULL_TREE, msg, NULL_TREE); + + if (unavailable || current_os_version >= obsoleted) + { + TREE_UNAVAILABLE (*node) = true; + /* We do not handle the availability attribute at diagnostics-time, so + if we want the informational messages, then attach them to additional + attributes for the deprecation or unavailability. TODO; maybe we can + fabricate the composite here. */ + if (maybe_text) + { + *no_add_attrs = false; + tree new_attr = tree_cons (get_identifier ("unavailable"), + maybe_text, NULL_TREE); + /* This is the actual consequence of the evaluation. */ + if (TYPE_P (target_decl) && !(flags & (int) ATTR_FLAG_TYPE_IN_PLACE)) + { + *node = build_variant_type_copy (*node); + TYPE_ATTRIBUTES (*node) = chainon (TYPE_ATTRIBUTES (*node), + new_attr); + } + else + DECL_ATTRIBUTES (*node) = chainon (DECL_ATTRIBUTES (*node), + new_attr); + } + } + else if (current_os_version > deprecated) + { + TREE_DEPRECATED (*node) = true; + if (maybe_text) + { + *no_add_attrs = false; + tree new_attr = tree_cons (get_identifier ("deprecated"), + maybe_text, NULL_TREE); + /* This is the actual consequence of the evaluation. */ + if (TYPE_P (target_decl) && !(flags & (int) ATTR_FLAG_TYPE_IN_PLACE)) + { + *node = build_variant_type_copy (*node); + TYPE_ATTRIBUTES (*node) = chainon (TYPE_ATTRIBUTES (*node), + new_attr); + } + else + DECL_ATTRIBUTES (*node) = chainon (DECL_ATTRIBUTES (*node), + new_attr); + } + } + else if (current_os_version < introduced) + *no_add_attrs = false; + return NULL_TREE; +} + +bool +darwin_attribute_takes_identifier_p (const_tree attr_id) +{ + return is_attribute_p ("availability", attr_id); +} + /* Emit a label for an FDE, making it global and/or weak if appropriate. The third parameter is nonzero if this is for exception handling. The fourth parameter is nonzero if this is just a placeholder for an @@ -2356,6 +2702,8 @@ darwin_emit_except_table_label (FILE *file) rtx darwin_make_eh_symbol_indirect (rtx orig, bool ARG_UNUSED (pubvis)) { + if (DARWIN_ARM64) + return orig; if (DARWIN_PPC == 0 && TARGET_64BIT) return orig; @@ -3204,7 +3552,12 @@ darwin_file_end (void) fprintf (asm_out_file, "\t.long\t0\n\t.long\t%u\n", flags); } +#if !DARWIN_ARM64 machopic_finish (asm_out_file); +#else + gcc_checking_assert (!machopic_indirections); +#endif + if (flag_apple_kext) { /* These sections are only used for kernel code. */ @@ -3405,7 +3758,14 @@ darwin_override_options (void) generating_for_darwin_version = 8; /* Earlier versions are not specifically accounted, until required. */ + unsigned vers[3] = {0,0,0}; + if (!parse_version (vers, darwin_macosx_version_min)) + error_at (UNKNOWN_LOCATION, "how did we get a bad OS version? (%s)", + darwin_macosx_version_min); + current_os_version = version_from_version_array (vers); } + else + current_os_version = 1058; /* Some codegen needs to account for the capabilities of the target linker. */ @@ -3647,6 +4007,19 @@ darwin_override_options (void) /* The c_dialect...() macros are not available to us here. */ darwin_running_cxx = (strstr (lang_hooks.name, "C++") != 0); + + /* Allow the clang extension to permit const vars used in array sizes. */ + if (!OPTION_SET_P (flag_allow_const_var_array_size)) + flag_allow_const_var_array_size = true; + + /* We need to consume attributes on function definitions from the the SDK + headers. */ + if (!OPTION_SET_P (flag_allow_ext_attr_placement)) + flag_allow_ext_attr_placement = true; + + /* We need to consume some C keywords in C++. */ + if (!OPTION_SET_P (flag_allow_extra_keywords)) + flag_allow_extra_keywords = true; } #if DARWIN_PPC diff --git gcc/config/darwin.h gcc/config/darwin.h index 53a7b5980..126dbb3ea 100644 --- gcc/config/darwin.h +++ gcc/config/darwin.h @@ -42,6 +42,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define DARWIN_X86 0 #define DARWIN_PPC 0 +#define DARWIN_ARM64 0 #define OBJECT_FORMAT_MACHO 1 @@ -394,7 +395,8 @@ extern GTY(()) int darwin_ms_struct; */ #define DARWIN_NOCOMPACT_UNWIND \ -" %:version-compare(>= 10.6 mmacosx-version-min= -no_compact_unwind) " +"%{!fuse-ld=lld: \ + %:version-compare(>= 10.6 mmacosx-version-min= -no_compact_unwind)}" /* In Darwin linker specs we can put -lcrt0.o and ld will search the library path for crt0.o or -lcrtx.a and it will search for libcrtx.a. As for @@ -423,7 +425,8 @@ extern GTY(()) int darwin_ms_struct; %{force_cpusubtype_ALL:-arch %(darwin_arch)} \ %{!force_cpusubtype_ALL:-arch %(darwin_subarch)} "\ DARWIN_PLATFORM_ID \ - " %l " \ + " %l \ + %{fuse-ld=*:-fuse-ld=%*} " \ LINK_COMPRESS_DEBUG_SPEC \ "%X %{s} %{t} %{Z} %{u*} \ %{e*} %{r} \ @@ -1003,7 +1006,12 @@ extern GTY(()) section * darwin_sections[NUM_DARWIN_SECTIONS]; { "apple_kext_compatibility", 0, 0, false, true, false, false, \ darwin_handle_kext_attribute, NULL }, \ { "weak_import", 0, 0, true, false, false, false, \ - darwin_handle_weak_import_attribute, NULL } + darwin_handle_weak_import_attribute, NULL }, \ + { "availability", 0, -1, true, false, false, false, \ + darwin_handle_availability_attribute, NULL } + +#undef TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P +#define TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P darwin_attribute_takes_identifier_p /* Make local constant labels linker-visible, so that if one follows a weak_global constant, ld64 will be able to separate the atoms. */ diff --git gcc/configure gcc/configure index ef780a23c..128ee8d5b 100755 --- gcc/configure +++ gcc/configure @@ -747,6 +747,8 @@ ORIGINAL_NM_FOR_TARGET gcc_cv_nm ORIGINAL_LD_GOLD_FOR_TARGET ORIGINAL_LD_BFD_FOR_TARGET +ORIGINAL_CLASSIC_LD_FOR_TARGET +ORIGINAL_LLD_FOR_TARGET ORIGINAL_LD_FOR_TARGET ORIGINAL_PLUGIN_LD_FOR_TARGET gcc_cv_ld @@ -3823,20 +3825,19 @@ gcc_gxx_libcxx_include_dir= # Check whether --with-gxx-libcxx-include-dir was given. if test "${with_gxx_libcxx_include_dir+set}" = set; then : - withval=$with_gxx_libcxx_include_dir; case "${withval}" in -yes) as_fn_error $? "bad value ${withval} given for libc++ include directory" "$LINENO" 5 ;; -*) gcc_gxx_libcxx_include_dir=$with_gxx_libcxx_include_dir ;; -esac + withval=$with_gxx_libcxx_include_dir; gcc_gxx_libcxx_include_dir=$with_gxx_libcxx_include_dir fi # --with-gxx-libcxx-include-dir controls the enabling of the -stdlib option. # if --with-gxx-libcxx-include-dir is 'no' we disable the stdlib option. +# if --with-gxx-libcxx-include-dir is 'yes' we enable the stdlib option and use +# the default path within the installation. # if --with-gxx-libcxx-include-dir is unset we enable the stdlib option -# based on the platform (to be available on platform versions where it is the +# based on the platform (to be available on platform versions where it is the # default for the system tools). We also use a default path within the compiler -# install tree. -# Otherwise, we use the path provided and enable the stdlib option. +# install tree. +# Otherwise, we use the path provided and enable the stdlib option. # If both --with-sysroot and --with-gxx-libcxx-include-dir are passed, we # check to see if the latter starts with the former and, upon success, compute # gcc_gxx_libcxx_include_dir as relative to the sysroot. @@ -3844,16 +3845,20 @@ gcc_gxx_libcxx_include_dir_add_sysroot=0 gcc_enable_stdlib_opt=0 if test x${gcc_gxx_libcxx_include_dir} != x; then if test x${gcc_gxx_libcxx_include_dir} = xno; then - # set defaults for the dir, but the option is disabled anyway. + # set defaults for the dir, but the option is disabled anyway. + gcc_gxx_libcxx_include_dir= + elif test x${gcc_gxx_libcxx_include_dir} = xyes; then + # set defaults for the dir, and enable. gcc_gxx_libcxx_include_dir= + gcc_enable_stdlib_opt=1 else gcc_enable_stdlib_opt=1 fi else case $target in *-darwin1[1-9]* | *-darwin2*) - # Default this on for Darwin versions which default to libcxx, - # and embed the path in the compiler install so that we get a + # Default this on for Darwin versions which default to libcxx, + # and embed the path in the compiler install so that we get a # self-contained toolchain. gcc_enable_stdlib_opt=1 ;; @@ -21975,7 +21980,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 21978 "configure" +#line 21980 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -22081,7 +22086,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 22084 "configure" +#line 22086 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -25803,6 +25808,14 @@ fi $as_echo "$gold_non_default" >&6; } ORIGINAL_LD_FOR_TARGET=$gcc_cv_ld +if test x"$ld64_flag" = x"yes"; then +ORIGINAL_LLD_FOR_TARGET=${gcc_cv_ld}64.lld +else +ORIGINAL_LLD_FOR_TARGET=$gcc_cv_lld +fi +ORIGINAL_CLASSIC_LD_FOR_TARGET=$gcc_cv_ld-classic + + case "$ORIGINAL_LD_FOR_TARGET" in ./collect-ld | ./collect-ld$build_exeext) ;; diff --git gcc/configure.ac gcc/configure.ac index cdf2997cb..f79339e55 100644 --- gcc/configure.ac +++ gcc/configure.ac @@ -235,18 +235,17 @@ gcc_gxx_libcxx_include_dir= AC_ARG_WITH(gxx-libcxx-include-dir, [AS_HELP_STRING([--with-gxx-libcxx-include-dir=DIR], [specifies directory to find libc++ header files])], -[case "${withval}" in -yes) AC_MSG_ERROR(bad value ${withval} given for libc++ include directory) ;; -*) gcc_gxx_libcxx_include_dir=$with_gxx_libcxx_include_dir ;; -esac]) +[gcc_gxx_libcxx_include_dir=$with_gxx_libcxx_include_dir]) # --with-gxx-libcxx-include-dir controls the enabling of the -stdlib option. # if --with-gxx-libcxx-include-dir is 'no' we disable the stdlib option. +# if --with-gxx-libcxx-include-dir is 'yes' we enable the stdlib option and use +# the default path within the installation. # if --with-gxx-libcxx-include-dir is unset we enable the stdlib option -# based on the platform (to be available on platform versions where it is the +# based on the platform (to be available on platform versions where it is the # default for the system tools). We also use a default path within the compiler -# install tree. -# Otherwise, we use the path provided and enable the stdlib option. +# install tree. +# Otherwise, we use the path provided and enable the stdlib option. # If both --with-sysroot and --with-gxx-libcxx-include-dir are passed, we # check to see if the latter starts with the former and, upon success, compute # gcc_gxx_libcxx_include_dir as relative to the sysroot. @@ -254,16 +253,20 @@ gcc_gxx_libcxx_include_dir_add_sysroot=0 gcc_enable_stdlib_opt=0 if test x${gcc_gxx_libcxx_include_dir} != x; then if test x${gcc_gxx_libcxx_include_dir} = xno; then - # set defaults for the dir, but the option is disabled anyway. + # set defaults for the dir, but the option is disabled anyway. gcc_gxx_libcxx_include_dir= + elif test x${gcc_gxx_libcxx_include_dir} = xyes; then + # set defaults for the dir, and enable. + gcc_gxx_libcxx_include_dir= + gcc_enable_stdlib_opt=1 else gcc_enable_stdlib_opt=1 fi else case $target in *-darwin1[[1-9]]* | *-darwin2*) - # Default this on for Darwin versions which default to libcxx, - # and embed the path in the compiler install so that we get a + # Default this on for Darwin versions which default to libcxx, + # and embed the path in the compiler install so that we get a # self-contained toolchain. gcc_enable_stdlib_opt=1 ;; @@ -2969,7 +2972,15 @@ fi AC_MSG_RESULT($gold_non_default) ORIGINAL_LD_FOR_TARGET=$gcc_cv_ld +if test x"$ld64_flag" = x"yes"; then +ORIGINAL_LLD_FOR_TARGET=${gcc_cv_ld}64.lld +else +ORIGINAL_LLD_FOR_TARGET=$gcc_cv_lld +fi +ORIGINAL_CLASSIC_LD_FOR_TARGET=$gcc_cv_ld-classic AC_SUBST(ORIGINAL_LD_FOR_TARGET) +AC_SUBST(ORIGINAL_LLD_FOR_TARGET) +AC_SUBST(ORIGINAL_CLASSIC_LD_FOR_TARGET) case "$ORIGINAL_LD_FOR_TARGET" in ./collect-ld | ./collect-ld$build_exeext) ;; *) AC_CONFIG_FILES(collect-ld:exec-tool.in, [chmod +x collect-ld]) ;; diff --git gcc/cp/decl2.cc gcc/cp/decl2.cc index 351e1c376..3b593f570 100644 --- gcc/cp/decl2.cc +++ gcc/cp/decl2.cc @@ -4308,9 +4308,8 @@ get_tls_init_fn (tree var) if (!flag_extern_tls_init && DECL_EXTERNAL (var)) return NULL_TREE; - /* If the variable is internal, or if we can't generate aliases, - call the local init function directly. */ - if (!TREE_PUBLIC (var) || !TARGET_SUPPORTS_ALIASES) + /* If the variable is internal call the local init function directly. */ + if (!TREE_PUBLIC (var)) return get_local_tls_init_fn (DECL_SOURCE_LOCATION (var)); tree sname = mangle_tls_init_fn (var); @@ -4475,6 +4474,25 @@ generate_tls_wrapper (tree fn) expand_or_defer_fn (finish_function (/*inline_p=*/false)); } +/* A dummy init function to act as a weak placeholder for a (possibly non- + existent) dynamic init. */ +static void +generate_tls_dummy_init (tree fn) +{ + tree var = DECL_BEFRIENDING_CLASSES (fn); + tree init_fn = get_tls_init_fn (var); + /* If have no init fn, or it is non-weak, then we do not need to make a + dummy. */ + if (!init_fn || !lookup_attribute ("weak", DECL_ATTRIBUTES (init_fn))) + return; + start_preparsed_function (init_fn, NULL_TREE, SF_DEFAULT | SF_PRE_PARSED); + tree body = begin_function_body (); + declare_weak (init_fn); + finish_return_stmt (NULL_TREE); + finish_function_body (body); + expand_or_defer_fn (finish_function (/*inline_p=*/false)); +} + /* Start a global constructor or destructor function. */ static tree @@ -5545,6 +5563,7 @@ handle_tls_init (void) tree sl = NULL_TREE; int save_stmts_are_full_exprs_p = stmts_are_full_exprs_p (); bool saw_nonbase = false; + auto_vec direct_calls; for (; vars; vars = TREE_CHAIN (vars)) { tree var = TREE_VALUE (vars); @@ -5554,16 +5573,17 @@ handle_tls_init (void) one_static_initialization_or_destruction (/*initp=*/true, var, init, false); - /* Output init aliases even with -fno-extern-tls-init. */ - if (TARGET_SUPPORTS_ALIASES && TREE_PUBLIC (var)) + /* Output inits even with -fno-extern-tls-init. + We save the list here and output either an alias or a stub function + below. */ + if (TREE_PUBLIC (var)) { - tree single_init_fn = get_tls_init_fn (var); + tree single_init_fn = get_tls_init_fn (var); if (single_init_fn == NULL_TREE) continue; - cgraph_node *alias - = cgraph_node::get_create (fn)->create_same_body_alias - (single_init_fn, fn); - gcc_assert (alias != NULL); + if (single_init_fn == fn) + continue; + direct_calls.safe_push (single_init_fn); } } decomp_finalize_var_list (sl, save_stmts_are_full_exprs_p); @@ -5572,6 +5592,30 @@ handle_tls_init (void) finish_if_stmt (if_stmt); finish_function_body (body); expand_or_defer_fn (finish_function (/*inline_p=*/false)); + + /* For each TLS var that we have an init function, we either emit an alias + between that and the tls_init, or a stub function that just calls the + tls_init. */ + while (!direct_calls.is_empty()) + { + tree single_init_fn = direct_calls.pop (); + if (TARGET_SUPPORTS_ALIASES) + { + cgraph_node *alias + = cgraph_node::get_create (fn)->create_same_body_alias + (single_init_fn, fn); + gcc_assert (alias != NULL); + } + else + { + start_preparsed_function (single_init_fn, NULL_TREE, SF_PRE_PARSED); + tree body = begin_function_body (); + tree r = build_call_expr (fn, 0); + finish_expr_stmt (r); + finish_function_body (body); + expand_or_defer_fn (finish_function (/*inline_p=*/false)); + } + } } /* We're at the end of compilation, so generate any mangling aliases that @@ -6021,7 +6065,14 @@ c_parse_final_cleanups (void) } if (!DECL_INITIAL (decl) && decl_tls_wrapper_p (decl)) - generate_tls_wrapper (decl); + { + generate_tls_wrapper (decl); + /* The wrapper might have a weak reference to an init, we provide + a dummy function to satisfy that here. The linker/dynamic + loader will override this with the actual init, if one is + required. */ + generate_tls_dummy_init (decl); + } if (!DECL_SAVED_TREE (decl)) continue; diff --git gcc/cp/lex.cc gcc/cp/lex.cc index da40be0a5..da5deb3a8 100644 --- gcc/cp/lex.cc +++ gcc/cp/lex.cc @@ -268,6 +268,9 @@ init_reswords (void) { if (c_common_reswords[i].disable & D_CONLY) continue; + if (!flag_allow_extra_keywords + && c_common_reswords[i].disable & D_EXT_C_IN_CXX) + continue; id = get_identifier (c_common_reswords[i].word); C_SET_RID_CODE (id, c_common_reswords[i].rid); ridpointers [(int) c_common_reswords[i].rid] = id; diff --git gcc/cp/parser.cc gcc/cp/parser.cc index 449ed491d..641a66480 100644 --- gcc/cp/parser.cc +++ gcc/cp/parser.cc @@ -754,6 +754,91 @@ cp_lexer_handle_early_pragma (cp_lexer *lexer) static cp_parser *cp_parser_new (cp_lexer *); static GTY (()) cp_parser *the_parser; +/* Context-sensitive parse-checking for clang-style attributes. */ + +enum clang_attr_state { + CA_NONE = 0, + CA_ATTR, + CA_BR1, CA_BR2, + CA_LIST, + CA_LIST_ARGS, + CA_IS_CA, + CA_CA_ARGS, + CA_LIST_CONT +}; + +/* State machine tracking context of attribute lexing. */ + +static enum clang_attr_state +cp_lexer_attribute_state (cp_token& token, enum clang_attr_state attr_state) +{ + /* Implement a context-sensitive parser for clang attributes. + We detect __attribute__((clang_style_attribute (ARGS))) and lex the + args ARGS with the following differences from GNU attributes: + (a) number-like values are lexed as strings [this allows lexing XX.YY.ZZ + version numbers]. + (b) we concatenate strings, since clang attributes allow this too. */ + switch (attr_state) + { + case CA_NONE: + if (token.type == CPP_KEYWORD + && token.keyword == RID_ATTRIBUTE) + attr_state = CA_ATTR; + break; + case CA_ATTR: + if (token.type == CPP_OPEN_PAREN) + attr_state = CA_BR1; + else + attr_state = CA_NONE; + break; + case CA_BR1: + if (token.type == CPP_OPEN_PAREN) + attr_state = CA_BR2; + else + attr_state = CA_NONE; + break; + case CA_BR2: + if (token.type == CPP_NAME) + { + tree identifier = (token.type == CPP_KEYWORD) + /* For keywords, use the canonical spelling, not the + parsed identifier. */ + ? ridpointers[(int) token.keyword] + : token.u.value; + identifier = canonicalize_attr_name (identifier); + if (attribute_clang_form_p (identifier)) + attr_state = CA_IS_CA; + else + attr_state = CA_LIST; + } + else + attr_state = CA_NONE; + break; + case CA_IS_CA: + case CA_LIST: + if (token.type == CPP_COMMA) + attr_state = CA_BR2; /* Back to the list outer. */ + else if (token.type == CPP_OPEN_PAREN) + attr_state = attr_state == CA_IS_CA ? CA_CA_ARGS + : CA_LIST_ARGS; + else + attr_state = CA_NONE; + break; + case CA_CA_ARGS: /* We will special-case args in this state. */ + case CA_LIST_ARGS: + if (token.type == CPP_CLOSE_PAREN) + attr_state = CA_LIST_CONT; + break; + case CA_LIST_CONT: + if (token.type == CPP_COMMA) + attr_state = CA_BR2; /* Back to the list outer. */ + else + attr_state = CA_NONE; + break; + } + return attr_state; +} + /* Create a new main C++ lexer, the lexer that gets tokens from the preprocessor, and also create the main parser. */ @@ -770,6 +855,8 @@ cp_lexer_new_main (void) c_common_no_more_pch (); cp_lexer *lexer = cp_lexer_alloc (); + enum clang_attr_state attr_state = CA_NONE; + /* Put the first token in the buffer. */ cp_token *tok = lexer->buffer->quick_push (token); @@ -892,8 +979,14 @@ cp_lexer_new_main (void) if (tok->type == CPP_PRAGMA_EOL) cp_lexer_handle_early_pragma (lexer); + attr_state = cp_lexer_attribute_state (*tok, attr_state); tok = vec_safe_push (lexer->buffer, cp_token ()); - cp_lexer_get_preprocessor_token (C_LEX_STRING_NO_JOIN, tok); + unsigned int flags = C_LEX_STRING_NO_JOIN; + /* If we are processing clang-style attribute args, lex numbers as + potential version strings; NN .. NN.MM .. NN.MM.OO */ + if (attr_state == CA_CA_ARGS) + flags |= C_LEX_NUMBER_AS_STRING; + cp_lexer_get_preprocessor_token (flags, tok); } XDELETEVEC (raw_data_buf); @@ -1124,7 +1217,7 @@ cp_lexer_get_preprocessor_token (unsigned flags, cp_token *token) { static int is_extern_c = 0; - /* Get a new token from the preprocessor. */ + /* Get a new token from the preprocessor. */ token->type = c_lex_with_flags (&token->u.value, &token->location, &token->flags, flags); @@ -25906,7 +25999,7 @@ cp_parser_init_declarator (cp_parser* parser, cp_declarator *declarator; tree prefix_attributes; tree attributes = NULL; - tree asm_specification; + tree asm_specification = NULL_TREE; tree initializer; tree decl = NULL_TREE; tree scope; @@ -25988,8 +26081,6 @@ cp_parser_init_declarator (cp_parser* parser, asm_spec_start_token = cp_lexer_peek_token (parser->lexer); asm_specification = cp_parser_asm_specification_opt (parser); } - else - asm_specification = NULL_TREE; /* Gather the attributes that were provided with the decl-specifiers. */ @@ -25999,6 +26090,14 @@ cp_parser_init_declarator (cp_parser* parser, attributes_start_token = cp_lexer_peek_token (parser->lexer); attributes = cp_parser_attributes_opt (parser); + if (cp_parser_allow_gnu_extensions_p (parser) + && !asm_specification) + { + /* Look for an asm-specification. */ + asm_spec_start_token = cp_lexer_peek_token (parser->lexer); + asm_specification = cp_parser_asm_specification_opt (parser); + } + /* Peek at the next token. */ token = cp_lexer_peek_token (parser->lexer); @@ -26040,9 +26139,16 @@ cp_parser_init_declarator (cp_parser* parser, "an % specification is not allowed " "on a function-definition"); if (attributes) - error_at (attributes_start_token->location, - "attributes are not allowed " - "on a function-definition"); + { + /* When we are allowing attributes in this position, then add + them to the prefix ones. */ + if (flag_allow_ext_attr_placement) + prefix_attributes = chainon (prefix_attributes, attributes); + else + error_at (attributes_start_token->location, + "attributes are not allowed " + "on a function-definition"); + } /* This is a function-definition. */ *function_definition_p = true; @@ -32952,6 +33058,91 @@ cp_parser_gnu_attributes_opt (cp_parser* parser) return attributes; } +/* Parse the arguments list for a clang attribute. */ +static tree +cp_parser_clang_attribute (cp_parser *parser, tree/*attr_id*/) +{ + /* Each entry can be : + identifier + identifier=N.MM.Z + identifier="string" + followed by ',' or ) for the last entry*/ + + matching_parens parens; + if (!parens.require_open (parser)) + return NULL; + + bool save_translate_strings_p = parser->translate_strings_p; + parser->translate_strings_p = false; + tree attr_args = NULL_TREE; + cp_token *token; + do + { + tree name = NULL_TREE; + tree value = NULL_TREE; + + token = cp_lexer_peek_token (parser->lexer); + if (token->type == CPP_NAME) + name = token->u.value; + else if (token->type == CPP_KEYWORD) + name = ridpointers[(int) token->keyword]; + else if (token->flags & NAMED_OP) + name = get_identifier (cpp_type2name (token->type, token->flags)); + else + { + /* FIXME: context-sensitive for that attrib. */ + error_at (token->location, "expected an attribute keyword"); + cp_parser_skip_to_closing_parenthesis (parser, + /*recovering=*/true, + /*or_comma=*/false, + /*consume_paren=*/false); + attr_args = error_mark_node; + break; + } + cp_lexer_consume_token (parser->lexer); + + if (cp_lexer_next_token_is (parser->lexer, CPP_EQ)) + { + cp_lexer_consume_token (parser->lexer); /* eat the '=' */ + if (cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_PAREN) + && cp_lexer_next_token_is_not (parser->lexer, CPP_COMMA)) + { + token = cp_lexer_peek_token (parser->lexer); + if (token->type == CPP_STRING) + value = cp_parser_string_literal (parser, /*translate=*/false, + /*wide_ok=*/false); + else + { + value = token->u.value; + cp_lexer_consume_token (parser->lexer); + } + } + /* else value is missing. */ + } + else if (cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_PAREN) + && cp_lexer_next_token_is_not (parser->lexer, CPP_COMMA)) + { + error_at (token->location, "expected %<,%>, %<=%> or %<)%>"); + cp_parser_skip_to_closing_parenthesis (parser, + /*recovering=*/true, + /*or_comma=*/false, + /*consume_paren=*/false); + attr_args = error_mark_node; + break; + } + if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA)) + cp_lexer_consume_token (parser->lexer); + tree t = tree_cons (value, name, NULL_TREE); + attr_args = chainon (attr_args, t); + } while (cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_PAREN)); + + parser->translate_strings_p = save_translate_strings_p; + if (!parens.require_close (parser)) + return error_mark_node; + + return attr_args; +} + /* Parse a GNU attribute-list. attribute-list: @@ -33011,9 +33202,12 @@ cp_parser_gnu_attribute_list (cp_parser* parser, bool exactly_one /* = false */) /* Peek at the next token. */ token = cp_lexer_peek_token (parser->lexer); - /* If it's an `(', then parse the attribute arguments. */ - if (token->type == CPP_OPEN_PAREN) + if (token->type == CPP_OPEN_PAREN + && attribute_clang_form_p (identifier)) + arguments = cp_parser_clang_attribute (parser, identifier); + else if (token->type == CPP_OPEN_PAREN) { + /* If it's an `(', then parse the attribute arguments. */ vec *vec; int attr_flag = (attribute_takes_identifier_p (identifier) ? id_attr : normal_attr); @@ -33030,12 +33224,12 @@ cp_parser_gnu_attribute_list (cp_parser* parser, bool exactly_one /* = false */) arguments = build_tree_list_vec (vec); release_tree_vector (vec); } - /* Save the arguments away. */ - TREE_VALUE (attribute) = arguments; } if (arguments != error_mark_node) { + /* Save the arguments away. */ + TREE_VALUE (attribute) = arguments; /* Add this attribute to the list. */ TREE_CHAIN (attribute) = attribute_list; attribute_list = attribute; diff --git gcc/cumulative-args.h gcc/cumulative-args.h new file mode 100644 index 000000000..b60928e37 --- /dev/null +++ gcc/cumulative-args.h @@ -0,0 +1,20 @@ +#ifndef GCC_CUMULATIVE_ARGS_H +#define GCC_CUMULATIVE_ARGS_H + +#if CHECKING_P + +struct cumulative_args_t { void *magic; void *p; }; + +#else /* !CHECKING_P */ + +/* When using a GCC build compiler, we could use + __attribute__((transparent_union)) to get cumulative_args_t function + arguments passed like scalars where the ABI would mandate a less + efficient way of argument passing otherwise. However, that would come + at the cost of less type-safe !CHECKING_P compilation. */ + +union cumulative_args_t { void *p; }; + +#endif /* !CHECKING_P */ + +#endif /* GCC_CUMULATIVE_ARGS_H */ diff --git gcc/doc/invoke.texi gcc/doc/invoke.texi index 9207a021e..42f5acfbd 100644 --- gcc/doc/invoke.texi +++ gcc/doc/invoke.texi @@ -812,7 +812,7 @@ Objective-C and Objective-C++ Dialects}. -freg-struct-return -fshort-enums -fshort-wchar -fverbose-asm -fpack-struct[=@var{n}] -fleading-underscore -ftls-model=@var{model} --fstack-reuse=@var{reuse_level} +-fstack-reuse=@var{reuse_level} -fstack-use-cumulative-args -ftrampolines -ftrampoline-impl=@r{[}stack@r{|}heap@r{]} -ftrapv -fwrapv -fwrapv-pointer -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @@ -3375,7 +3375,7 @@ the checking and the remainder of the function body. @opindex fno-contract-disable-optimized-checks @item -fcontract-disable-optimized-checks When @code{pre} and @code{post} condition checks are outlined (using -@option{-fcontract-checks-outlined}), this option disables the optimisation +@option{-fcontract-checks-outlined}), this option disables the optimisation steps for those functions which can avoid unwanted elision of checking steps. @opindex fcontracts-client-check @@ -19032,6 +19032,17 @@ the behavior of older compilers in which temporaries' stack space is not reused, the aggressive stack reuse can lead to runtime errors. This option is used to control the temporary stack reuse optimization. +@opindex fstack_use_cumulative_args +@item -fstack-use-cumulative-args +This option instructs the compiler to use the +@code{cumulative_args_t}-based stack layout target hooks, +@code{TARGET_FUNCTION_ARG_BOUNDARY_CA} and +@code{TARGET_FUNCTION_ARG_ROUND_BOUNDARY_CA}. If a given target does +not define these hooks, the default behaviour is to fallback to using +the standard non-@code{_CA} variants instead. Certain targets (such as +AArch64 Darwin) require using the more advanced @code{_CA}-based +hooks: For these targets this option should be enabled by default. + @opindex ftrapv @opindex fno-trapv @item -ftrapv diff --git gcc/doc/tm.texi gcc/doc/tm.texi index 5edddd7f3..bbf81caef 100644 --- gcc/doc/tm.texi +++ gcc/doc/tm.texi @@ -1101,6 +1101,10 @@ also define the hook to @code{default_promote_function_mode_always_promote} if you would like to apply the same rules given by @code{PROMOTE_MODE}. @end deftypefn +@deftypefn {Target Hook} machine_mode TARGET_PROMOTE_FUNCTION_MODE_CA (cumulative_args_t, @var{function_arg_info}, @var{const_tree}, int *@var{}, @var{int}) +Like @code{promote_function_mode}, but takes a cumulative_args pointer and a current arg to supply the input. +@end deftypefn + @defmac PARM_BOUNDARY Normal alignment required for function parameters on the stack, in bits. All stack parameters receive at least this much alignment @@ -4500,6 +4504,16 @@ with the specified mode and type. The default hook returns @code{PARM_BOUNDARY} for all arguments. @end deftypefn +@deftypefn {Target Hook} {unsigned int} TARGET_FUNCTION_ARG_BOUNDARY_CA (machine_mode @var{mode}, const_tree @var{type}, cumulative_args_t @var{ca}) +This is the @code{cumulative_args_t}-based version of +@code{TARGET_FUNCTION_ARG_BOUNDARY}. Define this hook if you need more +fine-grained control over argument alignment, e.g. depending on whether +it is a named argument or not, or any other criteria that you choose to +place in the @var{ca} structure. + +The default hook will call @code{TARGET_FUNCTION_ARG_BOUNDARY}. +@end deftypefn + @deftypefn {Target Hook} {unsigned int} TARGET_FUNCTION_ARG_ROUND_BOUNDARY (machine_mode @var{mode}, const_tree @var{type}) Normally, the size of an argument is rounded up to @code{PARM_BOUNDARY}, which is the default value for this hook. You can define this hook to @@ -4507,6 +4521,16 @@ return a different value if an argument size must be rounded to a larger value. @end deftypefn +@deftypefn {Target Hook} {unsigned int} TARGET_FUNCTION_ARG_ROUND_BOUNDARY_CA (machine_mode @var{mode}, const_tree @var{type}, cumulative_args_t @var{ca}) +This is the @code{cumulative_args_t}-based version of +@code{TARGET_FUNCTION_ARG_ROUND_BOUNDARY}. Define this hook if you need more +fine-grained control over argument size rounding, e.g. depending on whether +it is a named argument or not, or any other criteria that you choose to +place in the @var{ca} structure. + +The default hook will call @code{TARGET_FUNCTION_ARG_ROUND_BOUNDARY}. +@end deftypefn + @defmac FUNCTION_ARG_REGNO_P (@var{regno}) A C expression that is nonzero if @var{regno} is the number of a hard register in which function arguments are sometimes passed. This does diff --git gcc/doc/tm.texi.in gcc/doc/tm.texi.in index 274bb899d..c71249cf5 100644 --- gcc/doc/tm.texi.in +++ gcc/doc/tm.texi.in @@ -978,6 +978,8 @@ applied. @hook TARGET_PROMOTE_FUNCTION_MODE +@hook TARGET_PROMOTE_FUNCTION_MODE_CA + @defmac PARM_BOUNDARY Normal alignment required for function parameters on the stack, in bits. All stack parameters receive at least this much alignment @@ -3463,8 +3465,12 @@ required. @hook TARGET_FUNCTION_ARG_BOUNDARY +@hook TARGET_FUNCTION_ARG_BOUNDARY_CA + @hook TARGET_FUNCTION_ARG_ROUND_BOUNDARY +@hook TARGET_FUNCTION_ARG_ROUND_BOUNDARY_CA + @defmac FUNCTION_ARG_REGNO_P (@var{regno}) A C expression that is nonzero if @var{regno} is the number of a hard register in which function arguments are sometimes passed. This does diff --git gcc/exec-tool.in gcc/exec-tool.in index 4aee9a6c2..793cc90a5 100644 --- gcc/exec-tool.in +++ gcc/exec-tool.in @@ -23,6 +23,8 @@ ORIGINAL_AS_FOR_TARGET="@ORIGINAL_AS_FOR_TARGET@" ORIGINAL_LD_FOR_TARGET="@ORIGINAL_LD_FOR_TARGET@" ORIGINAL_LD_BFD_FOR_TARGET="@ORIGINAL_LD_BFD_FOR_TARGET@" ORIGINAL_LD_GOLD_FOR_TARGET="@ORIGINAL_LD_GOLD_FOR_TARGET@" +ORIGINAL_LLD_FOR_TARGET="@ORIGINAL_LLD_FOR_TARGET@" +ORIGINAL_CLASSIC_LD_FOR_TARGET="@ORIGINAL_CLASSIC_LD_FOR_TARGET@" ORIGINAL_PLUGIN_LD_FOR_TARGET="@ORIGINAL_PLUGIN_LD_FOR_TARGET@" ORIGINAL_NM_FOR_TARGET="@ORIGINAL_NM_FOR_TARGET@" ORIGINAL_DSYMUTIL_FOR_TARGET="@ORIGINAL_DSYMUTIL_FOR_TARGET@" @@ -39,24 +41,41 @@ case "$invoked" in dir=gas ;; collect-ld) - # Check -fuse-ld=bfd and -fuse-ld=gold - case " $* " in - *\ -fuse-ld=bfd\ *) - original=$ORIGINAL_LD_BFD_FOR_TARGET - ;; - *\ -fuse-ld=gold\ *) - original=$ORIGINAL_LD_GOLD_FOR_TARGET - ;; - *) - # when using a linker plugin, gcc will always pass '-plugin' as the - # first or second option to the linker. - if test x"$1" = "x-plugin" || test x"$2" = "x-plugin"; then - original=$ORIGINAL_PLUGIN_LD_FOR_TARGET - else - original=$ORIGINAL_LD_FOR_TARGET - fi - ;; - esac + # when using a linker plugin, gcc will always pass '-plugin' as the + # first or second option to the linker. + if test x"$1" = "x-plugin" || test x"$2" = "x-plugin"; then + original=$ORIGINAL_PLUGIN_LD_FOR_TARGET + else + original=$ORIGINAL_LD_FOR_TARGET + fi + # Check -fuse-ld=bfd, -fuse-ld=gold and -fuse-ld=classic + # Remove -fuse-ld=classic from the command line + for arg do + # temporarily, remove the arg. + shift + case $arg in + -fuse-ld=bfd) + original=$ORIGINAL_LD_BFD_FOR_TARGET + ;; + -fuse-ld=gold) + original=$ORIGINAL_LD_GOLD_FOR_TARGET + ;; + -fuse-ld=lld) + original=$ORIGINAL_LLD_FOR_TARGET + # We want to remove this from the command line; by the slightly + # obtuse mechanism of not putting it back. + continue + ;; + -fuse-ld=classic) + original=$ORIGINAL_CLASSIC_LD_FOR_TARGET + # As for lld. + continue + ;; + *) ;; + esac + # if we want to keep the arg, put it back. + set -- "$@" "$arg" + done prog=ld-new$exeext if test "$original" = ../gold/ld-new$exeext; then dir=gold diff --git gcc/explow.cc gcc/explow.cc index 2d228d199..74f463acf 100644 --- gcc/explow.cc +++ gcc/explow.cc @@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see #include "langhooks.h" #include "except.h" #include "dojump.h" +#include "calls.h" #include "explow.h" #include "expr.h" #include "stringpool.h" @@ -876,6 +877,16 @@ promote_function_mode (const_tree type, machine_mode mode, int *punsignedp, return mode; } } + +machine_mode +promote_function_mode (cumulative_args_t args_so_far, function_arg_info arg, + const_tree funtype, int *punsignedp , int for_return) +{ + return targetm.calls.promote_function_mode_ca (args_so_far, arg, funtype, + punsignedp, for_return); +// return promote_function_mode (arg.type, arg.mode, punsignedp, funtype, for_return); +} + /* Return the mode to use to store a scalar of TYPE and MODE. PUNSIGNEDP points to the signedness of the type and may be adjusted to show what signedness to use on extension operations. */ diff --git gcc/explow.h gcc/explow.h index 75672f11d..15e732dd7 100644 --- gcc/explow.h +++ gcc/explow.h @@ -20,6 +20,8 @@ along with GCC; see the file COPYING3. If not see #ifndef GCC_EXPLOW_H #define GCC_EXPLOW_H +#include "calls.h" /* for cummulative args stuff. */ + /* Return a memory reference like MEMREF, but which is known to have a valid address. */ extern rtx validize_mem (rtx); @@ -51,8 +53,13 @@ extern rtx force_not_mem (rtx); /* Return mode and signedness to use when an argument or result in the given mode is promoted. */ -extern machine_mode promote_function_mode (const_tree, machine_mode, int *, - const_tree, int); +machine_mode promote_function_mode (const_tree, machine_mode, int *, + const_tree, int); + +/* Return mode and signedness to use when an argument or result in the + given mode is promoted. */ +machine_mode promote_function_mode (cumulative_args_t, function_arg_info, + const_tree, int *, int); /* Return mode and signedness to use when an object in the given mode is promoted. */ diff --git gcc/function.cc gcc/function.cc index 109821c16..33536a62f 100644 --- gcc/function.cc +++ gcc/function.cc @@ -58,8 +58,8 @@ along with GCC; see the file COPYING3. If not see #include "varasm.h" #include "except.h" #include "dojump.h" -#include "explow.h" #include "calls.h" +#include "explow.h" #include "expr.h" #include "optabs-tree.h" #include "output.h" @@ -2442,7 +2442,10 @@ assign_parm_find_data_types (struct assign_parm_data_all *all, tree parm, else if (DECL_CHAIN (parm)) data->arg.named = 1; /* Not the last non-variadic parm. */ else if (targetm.calls.strict_argument_naming (all->args_so_far)) - data->arg.named = 1; /* Only variadic ones are unnamed. */ + { + data->arg.named = 1; /* Only variadic ones are unnamed. */ + data->arg.last_named = 1; + } else data->arg.named = 0; /* Treat as variadic. */ @@ -2484,9 +2487,12 @@ assign_parm_find_data_types (struct assign_parm_data_all *all, tree parm, /* Find mode as it is passed by the ABI. */ unsignedp = TYPE_UNSIGNED (data->arg.type); - data->arg.mode - = promote_function_mode (data->arg.type, data->arg.mode, &unsignedp, - TREE_TYPE (current_function_decl), 0); +// data->arg.mode +// = promote_function_mode (data->arg.type, data->arg.mode, &unsignedp, +// TREE_TYPE (current_function_decl), 0); + data->arg.mode = promote_function_mode (all->args_so_far, data->arg, + TREE_TYPE (current_function_decl), + &unsignedp, 0); } /* A subroutine of assign_parms. Invoke setup_incoming_varargs. */ @@ -2499,6 +2505,7 @@ assign_parms_setup_varargs (struct assign_parm_data_all *all, function_arg_info last_named_arg = data->arg; last_named_arg.named = true; + last_named_arg.last_named = true; targetm.calls.setup_incoming_varargs (all->args_so_far, last_named_arg, &varargs_pretend_bytes, no_rtl); @@ -2607,7 +2614,9 @@ assign_parm_find_entry_rtl (struct assign_parm_data_all *all, locate_and_pad_parm (data->arg.mode, data->arg.type, in_regs, all->reg_parm_stack_space, - entry_parm ? data->partial : 0, current_function_decl, + entry_parm ? data->partial : 0, + all->args_so_far, + current_function_decl, &all->stack_args_size, &data->locate); /* Update parm_stack_boundary if this parameter is passed in the @@ -3923,7 +3932,8 @@ gimplify_parameters (gimple_seq *cleanup) if (data.arg.pass_by_reference) { tree type = TREE_TYPE (data.arg.type); - function_arg_info orig_arg (type, data.arg.named); + function_arg_info orig_arg (type, data.arg.named, + data.arg.last_named); if (reference_callee_copied (&all.args_so_far_v, orig_arg)) { tree local, t; @@ -4026,6 +4036,7 @@ gimplify_parameters (gimple_seq *cleanup) void locate_and_pad_parm (machine_mode passed_mode, tree type, int in_regs, int reg_parm_stack_space, int partial, + cumulative_args_t ca, tree fndecl ATTRIBUTE_UNUSED, struct args_size *initial_offset_ptr, struct locate_and_pad_arg_data *locate) @@ -4063,9 +4074,23 @@ locate_and_pad_parm (machine_mode passed_mode, tree type, int in_regs, ? arg_size_in_bytes (type) : size_int (GET_MODE_SIZE (passed_mode))); where_pad = targetm.calls.function_arg_padding (passed_mode, type); - boundary = targetm.calls.function_arg_boundary (passed_mode, type); - round_boundary = targetm.calls.function_arg_round_boundary (passed_mode, - type); + + if (flag_stack_use_cumulative_args) + { + boundary = targetm.calls.function_arg_boundary_ca (passed_mode, + type, + ca); + round_boundary = targetm.calls.function_arg_round_boundary_ca + (passed_mode, type, ca); + } + else + { + boundary = targetm.calls.function_arg_boundary (passed_mode, + type); + round_boundary = targetm.calls.function_arg_round_boundary + (passed_mode, type); + } + locate->where_pad = where_pad; /* Alignment can't exceed MAX_SUPPORTED_STACK_ALIGNMENT. */ diff --git gcc/function.h gcc/function.h index 765c71309..f271e8efe 100644 --- gcc/function.h +++ gcc/function.h @@ -20,6 +20,7 @@ along with GCC; see the file COPYING3. If not see #ifndef GCC_FUNCTION_H #define GCC_FUNCTION_H +#include "cumulative-args.h" /* Stack of pending (incomplete) sequences saved by `start_sequence'. Each element describes one pending sequence. @@ -690,6 +691,7 @@ extern bool aggregate_value_p (const_tree, const_tree); extern bool use_register_for_decl (const_tree); extern gimple_seq gimplify_parameters (gimple_seq *); extern void locate_and_pad_parm (machine_mode, tree, int, int, int, + cumulative_args_t, tree, struct args_size *, struct locate_and_pad_arg_data *); extern void generate_setjmp_warnings (void); diff --git gcc/ginclude/stddef.h gcc/ginclude/stddef.h index 454e5e9fc..280824363 100644 --- gcc/ginclude/stddef.h +++ gcc/ginclude/stddef.h @@ -443,9 +443,8 @@ typedef struct { /* _Float128 is defined as a basic type, so max_align_t must be sufficiently aligned for it. This code must work in C++, so we use __float128 here; that is only available on some - architectures, but only on i386 is extra alignment needed for - __float128. */ -#ifdef __i386__ + architectures. */ +#if defined(__i386__) || (__APPLE__ && __aarch64__) __float128 __max_align_f128 __attribute__((__aligned__(__alignof(__float128)))); #endif } max_align_t; diff --git gcc/opts.cc gcc/opts.cc index 6658b6acd..819e4c0dd 100644 --- gcc/opts.cc +++ gcc/opts.cc @@ -3425,6 +3425,7 @@ common_handle_option (struct gcc_options *opts, break; case OPT_fuse_ld_bfd: + case OPT_fuse_ld_classic: case OPT_fuse_ld_gold: case OPT_fuse_ld_lld: case OPT_fuse_ld_mold: diff --git gcc/target.def gcc/target.def index a9fcce785..a1fd2c568 100644 --- gcc/target.def +++ gcc/target.def @@ -4906,6 +4906,13 @@ if you would like to apply the same rules given by @code{PROMOTE_MODE}.", const_tree funtype, int for_return), default_promote_function_mode) +DEFHOOK +(promote_function_mode_ca, + "Like @code{promote_function_mode}, but takes a cumulative_args pointer \ + and a current arg to supply the input.", + machine_mode, (cumulative_args_t, function_arg_info, const_tree, int *, int), + default_promote_function_mode_ca) + DEFHOOK (promote_prototypes, "This target hook returns @code{true} if an argument declared in a\n\ @@ -5369,6 +5376,18 @@ with the specified mode and type. The default hook returns\n\ unsigned int, (machine_mode mode, const_tree type), default_function_arg_boundary) +DEFHOOK +(function_arg_boundary_ca, + "This is the @code{cumulative_args_t}-based version of\n\ +@code{TARGET_FUNCTION_ARG_BOUNDARY}. Define this hook if you need more\n\ +fine-grained control over argument alignment, e.g. depending on whether\n\ +it is a named argument or not, or any other criteria that you choose to\n\ +place in the @var{ca} structure.\n\ +\n\ +The default hook will call @code{TARGET_FUNCTION_ARG_BOUNDARY}.", + unsigned int, (machine_mode mode, const_tree type, cumulative_args_t ca), + default_function_arg_boundary_ca) + DEFHOOK (function_arg_round_boundary, "Normally, the size of an argument is rounded up to @code{PARM_BOUNDARY},\n\ @@ -5378,6 +5397,18 @@ value.", unsigned int, (machine_mode mode, const_tree type), default_function_arg_round_boundary) +DEFHOOK +(function_arg_round_boundary_ca, + "This is the @code{cumulative_args_t}-based version of\n\ +@code{TARGET_FUNCTION_ARG_ROUND_BOUNDARY}. Define this hook if you need more\n\ +fine-grained control over argument size rounding, e.g. depending on whether\n\ +it is a named argument or not, or any other criteria that you choose to\n\ +place in the @var{ca} structure.\n\ +\n\ +The default hook will call @code{TARGET_FUNCTION_ARG_ROUND_BOUNDARY}.", + unsigned int, (machine_mode mode, const_tree type, cumulative_args_t ca), + default_function_arg_round_boundary_ca) + /* Return the diagnostic message string if function without a prototype is not allowed for this 'val' argument; NULL otherwise. */ DEFHOOK diff --git gcc/target.h gcc/target.h index 68ba626da..a19b6b226 100644 --- gcc/target.h +++ gcc/target.h @@ -51,22 +51,8 @@ #include "insn-codes.h" #include "tm.h" #include "hard-reg-set.h" - -#if CHECKING_P - -struct cumulative_args_t { void *magic; void *p; }; - -#else /* !CHECKING_P */ - -/* When using a GCC build compiler, we could use - __attribute__((transparent_union)) to get cumulative_args_t function - arguments passed like scalars where the ABI would mandate a less - efficient way of argument passing otherwise. However, that would come - at the cost of less type-safe !CHECKING_P compilation. */ - -union cumulative_args_t { void *p; }; - -#endif /* !CHECKING_P */ +#include "tree-core.h" +#include "cumulative-args.h" /* Values for bitint_info::extended below. */ diff --git gcc/targhooks.cc gcc/targhooks.cc index 5f1eac751..9a9e263f0 100644 --- gcc/targhooks.cc +++ gcc/targhooks.cc @@ -179,6 +179,15 @@ default_promote_function_mode_sign_extend (const_tree type, return promote_mode (type, mode, punsignedp); } +machine_mode +default_promote_function_mode_ca (cumulative_args_t, function_arg_info arg, + const_tree funtype, int *punsignedp, + int for_return) +{ + return promote_function_mode (arg.type, arg.mode, punsignedp, + funtype, for_return); +} + machine_mode default_cc_modes_compatible (machine_mode m1, machine_mode m2) { @@ -906,6 +915,14 @@ default_function_arg_boundary (machine_mode mode ATTRIBUTE_UNUSED, return PARM_BOUNDARY; } +unsigned int +default_function_arg_boundary_ca (machine_mode mode ATTRIBUTE_UNUSED, + const_tree type ATTRIBUTE_UNUSED, + cumulative_args_t ca ATTRIBUTE_UNUSED) +{ + return default_function_arg_boundary (mode, type); +} + unsigned int default_function_arg_round_boundary (machine_mode mode ATTRIBUTE_UNUSED, const_tree type ATTRIBUTE_UNUSED) @@ -913,6 +930,14 @@ default_function_arg_round_boundary (machine_mode mode ATTRIBUTE_UNUSED, return PARM_BOUNDARY; } +unsigned int +default_function_arg_round_boundary_ca (machine_mode mode ATTRIBUTE_UNUSED, + const_tree type ATTRIBUTE_UNUSED, + cumulative_args_t ca ATTRIBUTE_UNUSED) +{ + return default_function_arg_round_boundary (mode, type); +} + void hook_void_bitmap (bitmap regs ATTRIBUTE_UNUSED) { diff --git gcc/targhooks.h gcc/targhooks.h index 9582233e6..967ef5d1e 100644 --- gcc/targhooks.h +++ gcc/targhooks.h @@ -36,6 +36,9 @@ extern machine_mode default_promote_function_mode_always_promote extern machine_mode default_promote_function_mode_sign_extend (const_tree, machine_mode, int *, const_tree, int); +extern machine_mode default_promote_function_mode_ca + (cumulative_args_t, function_arg_info, const_tree, int *, int); + extern machine_mode default_cc_modes_compatible (machine_mode, machine_mode); @@ -162,6 +165,12 @@ extern unsigned int default_function_arg_boundary (machine_mode, const_tree); extern unsigned int default_function_arg_round_boundary (machine_mode, const_tree); +extern unsigned int default_function_arg_boundary_ca (machine_mode, + const_tree, + cumulative_args_t ca); +extern unsigned int default_function_arg_round_boundary_ca (machine_mode, + const_tree, + cumulative_args_t ca); extern bool hook_bool_const_rtx_commutative_p (const_rtx, int); extern rtx default_function_value (const_tree, const_tree, bool); extern HARD_REG_SET default_zero_call_used_regs (HARD_REG_SET); diff --git gcc/testsuite/c-c++-common/pr58346-3.c gcc/testsuite/c-c++-common/pr58346-3.c index 41627ed95..b3d35ce0d 100644 --- gcc/testsuite/c-c++-common/pr58346-3.c +++ gcc/testsuite/c-c++-common/pr58346-3.c @@ -1,5 +1,6 @@ /* PR c/58346 */ /* { dg-do compile } */ +/* { dg-additional-options "-fno-allow-const-var-array-size" { target *-*-darwin* } } */ void foo (void) diff --git gcc/testsuite/g++.dg/abi/aarch64_guard1.C gcc/testsuite/g++.dg/abi/aarch64_guard1.C index e2669a89f..52be32dec 100644 --- gcc/testsuite/g++.dg/abi/aarch64_guard1.C +++ gcc/testsuite/g++.dg/abi/aarch64_guard1.C @@ -12,5 +12,6 @@ int *foo () return &x; } -// { dg-final { scan-assembler _ZGVZ3foovE1x,8,8 } } +// { dg-final { scan-assembler _ZGVZ3foovE1x,8,8 { target { ! *-*-darwin* } } } } +// { dg-final { scan-assembler __DATA,__bss,__ZGVZ3foovE1x,8,3 { target *-*-darwin* } } } // { dg-final { scan-tree-dump "& 1" "original" } } diff --git gcc/testsuite/g++.dg/abi/arm_va_list.C gcc/testsuite/g++.dg/abi/arm_va_list.C index 4f6f3a46d..ff9fd8bcf 100644 --- gcc/testsuite/g++.dg/abi/arm_va_list.C +++ gcc/testsuite/g++.dg/abi/arm_va_list.C @@ -8,8 +8,10 @@ // #include typedef __builtin_va_list va_list; -// { dg-final { scan-assembler "\n_Z1fPSt9__va_list:" } } +// { dg-final { scan-assembler "\n_Z1fPSt9__va_list:" { target { ! *-*-darwin* } } } } +// { dg-final { scan-assembler "\n__Z1fPPc:" { target *-*-darwin* } } } void f(va_list*) {} -// { dg-final { scan-assembler "\n_Z1gSt9__va_listS_:" } } +// { dg-final { scan-assembler "\n_Z1gSt9__va_listS_:" { target { ! *-*-darwin* } } } } +// { dg-final { scan-assembler "\n__Z1gPcS_:" { target *-*-darwin* } } } void g(va_list, va_list) {} diff --git gcc/testsuite/g++.dg/cpp0x/pr106435-b.cc gcc/testsuite/g++.dg/cpp0x/pr106435-b.cc new file mode 100644 index 000000000..4f5816941 --- /dev/null +++ gcc/testsuite/g++.dg/cpp0x/pr106435-b.cc @@ -0,0 +1,17 @@ +// PR c++/106435 +#include "pr106435.h" + +//#include + +Foo::Foo() { + ++num_calls; +// std::cout << "Foo::Foo(this=" << this << ")\n"; +} + +int Foo::func() { +// std::cout << "Foo::func(this=" << this << ")\n"; + return num_calls; +} + +thread_local Foo Bar::foo; +thread_local Foo Bar::baz; diff --git gcc/testsuite/g++.dg/cpp0x/pr106435.C gcc/testsuite/g++.dg/cpp0x/pr106435.C new file mode 100644 index 000000000..d600976f9 --- /dev/null +++ gcc/testsuite/g++.dg/cpp0x/pr106435.C @@ -0,0 +1,20 @@ +// PR c++/106435 +// { dg-do run { target c++11 } } +// { dg-additional-sources "pr106435-b.cc" } + +#include "pr106435.h" + +int num_calls = 0; + +extern "C" __attribute__((__noreturn__)) void abort(); + +thread_local Foo Bar::bat; + +int main() { + int v = Bar::foo.func(); + if (v != 2) + abort(); + v = Bar::bat.func(); + if (v != 3) + abort(); +} diff --git gcc/testsuite/g++.dg/cpp0x/pr106435.h gcc/testsuite/g++.dg/cpp0x/pr106435.h new file mode 100644 index 000000000..240de1ee9 --- /dev/null +++ gcc/testsuite/g++.dg/cpp0x/pr106435.h @@ -0,0 +1,14 @@ +// PR c++/106435 +#pragma once + +extern int num_calls; +struct Foo { + Foo(); + int func(); +}; + +struct Bar { + thread_local static Foo foo; + thread_local static Foo baz; + thread_local static Foo bat; +}; diff --git gcc/testsuite/g++.dg/ext/arm-bf16/bf16-mangle-aarch64-1.C gcc/testsuite/g++.dg/ext/arm-bf16/bf16-mangle-aarch64-1.C index 5426a1814..a017ce8ce 100644 --- gcc/testsuite/g++.dg/ext/arm-bf16/bf16-mangle-aarch64-1.C +++ gcc/testsuite/g++.dg/ext/arm-bf16/bf16-mangle-aarch64-1.C @@ -2,12 +2,12 @@ /* Test mangling */ -/* { dg-final { scan-assembler "\t.global\t_Z1fPu6__bf16" } } */ +/* { dg-final { scan-assembler {\t.globa?l[ \t]_?_Z1fPu6__bf16} } } */ void f (__bf16 *x) { } -/* { dg-final { scan-assembler "\t.global\t_Z1gPu6__bf16S_" } } */ +/* { dg-final { scan-assembler {\t.globa?l[ \t]_?_Z1gPu6__bf16S_} } } */ void g (__bf16 *x, __bf16 *y) { } -/* { dg-final { scan-assembler "\t.global\t_ZN1SIu6__bf16u6__bf16E1iE" } } */ +/* { dg-final { scan-assembler {\t.globa?l[ \t]_?_ZN1SIu6__bf16u6__bf16E1iE} } } */ template struct S { static int i; }; template <> int S<__bf16, __bf16>::i = 3; diff --git gcc/testsuite/g++.dg/opt/icf1.C gcc/testsuite/g++.dg/opt/icf1.C index fbb275e63..e13020b9c 100644 --- gcc/testsuite/g++.dg/opt/icf1.C +++ gcc/testsuite/g++.dg/opt/icf1.C @@ -1,6 +1,7 @@ // Test that -fipa-icf combines i and j. // { dg-do run { target c++11 } } // { dg-options -fipa-icf } +// { dg-xfail-run-if "PR111067" { *-*-darwin* } } [[no_unique_address]] extern const int i[] = { 1,2,3 }; [[no_unique_address]] extern const int j[] = { 1,2,3 }; diff --git gcc/testsuite/g++.dg/opt/icf2.C gcc/testsuite/g++.dg/opt/icf2.C index 1ad48f617..b5cb8c81f 100644 --- gcc/testsuite/g++.dg/opt/icf2.C +++ gcc/testsuite/g++.dg/opt/icf2.C @@ -1,6 +1,7 @@ // Test that -fipa-icf combines the backing arrays for a and b. // { dg-do run { target c++11 } } // { dg-options -fipa-icf } +// { dg-xfail-run-if "PR111067" { *-*-darwin* } } #include diff --git gcc/testsuite/g++.dg/opt/icf3.C gcc/testsuite/g++.dg/opt/icf3.C index 8b86982b5..514926bae 100644 --- gcc/testsuite/g++.dg/opt/icf3.C +++ gcc/testsuite/g++.dg/opt/icf3.C @@ -1,6 +1,7 @@ // Test that -fipa-icf combines the backing arrays for a and b. // { dg-do run { target c++11 } } // { dg-options -fipa-icf } +// { dg-xfail-run-if "PR111067" { *-*-darwin* } } #include diff --git gcc/testsuite/g++.dg/pch/pch.exp gcc/testsuite/g++.dg/pch/pch.exp index 0b98042f8..968d1c1ee 100644 --- gcc/testsuite/g++.dg/pch/pch.exp +++ gcc/testsuite/g++.dg/pch/pch.exp @@ -31,7 +31,7 @@ set old_dg_do_what_default "${dg-do-what-default}" foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.C]] { # We don't try to use the loop-optimizing options, since they are highly # unlikely to make any difference to PCH. - dg-flags-pch $subdir $test "-fno-modules" [list "-g" "-O2 -g" "-O2"] ".H" + dg-flags-pch $subdir $test "-fno-modules" [list "-g -Winvalid-pch" "-O2 -g -Winvalid-pch" "-O2 -Winvalid-pch"] ".H" } set dg-do-what-default "$old_dg_do_what_default" diff --git gcc/testsuite/g++.dg/torture/darwin-cfstring-3.C gcc/testsuite/g++.dg/torture/darwin-cfstring-3.C index 4be3a2526..95eec7d74 100644 --- gcc/testsuite/g++.dg/torture/darwin-cfstring-3.C +++ gcc/testsuite/g++.dg/torture/darwin-cfstring-3.C @@ -26,5 +26,5 @@ void foo(void) { /* { dg-final { scan-assembler "\\.long\[ \\t\]+___CFConstantStringClassReference\n\[ \\t\]*\\.long\[ \\t\]+1992\n\[ \\t\]*\\.long\[ \\t\]+L\.str\..*\n\[ \\t\]*\\.long\[ \\t\]+4\n" { target { *-*-darwin* && { ! lp64 } } } } } */ /* { dg-final { scan-assembler "\\.long\[ \\t\]+___CFConstantStringClassReference\n\[ \\t\]*\\.long\[ \\t\]+1992\n\[ \\t\]*\\.long\[ \\t\]+L\.str\..*\n\[ \\t\]*\\.long\[ \\t\]+10\n" { target { *-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t___CFConstantStringClassReference\n\t.long\t1992\n\t.space 4\n\t.quad\tL\.str\..*\n\t.quad\t4\n" { target { *-*-darwin* && { lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t___CFConstantStringClassReference\n\t.long\t1992\n\t.space 4\n\t.quad\tL\.str\..*\n\t.quad\t10\n" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t___CFConstantStringClassReference\n\t.(long|word)\t1992\n\t.space 4\n\t.(quad|xword)\tL\.str\..*\n\t.(quad|xword)\t4\n} { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t___CFConstantStringClassReference\n\t.(long|word)\t1992\n\t.space 4\n\t.(quad|xword)\tL\.str\..*\n\t.(quad|xword)\t10\n} { target { *-*-darwin* && { lp64 } } } } } */ diff --git gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2-extra.C gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2-extra.C index 52f9cdd1e..acc95ba82 100644 --- gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2-extra.C +++ gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2-extra.C @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "Darwin ABI is different, test separately" { *-*-darwin* } } */ /* { dg-options "-O2 -fno-stack-protector -save-temps -Wno-narrowing" } */ #define ALIGN 16 diff --git gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2.C gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2.C index 9ff4e4664..41e40b351 100644 --- gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2.C +++ gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2.C @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "Darwin ABI is different, test separately" { *-*-darwin* } } */ /* { dg-options "-O2 -fno-stack-protector -save-temps -Wno-narrowing" } */ #define ALIGN 16 diff --git gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2-extra.C gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2-extra.C index 55dcbfe4b..1460a04bb 100644 --- gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2-extra.C +++ gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2-extra.C @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "Darwin ABI is different, test separately" { *-*-darwin* } } */ /* { dg-options "-O2 -fno-stack-protector -save-temps -Wno-narrowing" } */ #define ALIGN 32 diff --git gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2.C gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2.C index 6bb8778ee..769b15acd 100644 --- gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2.C +++ gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2.C @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "Darwin ABI is different, test separately" { *-*-darwin* } } */ /* { dg-options "-O2 -fno-stack-protector -save-temps -Wno-narrowing" } */ #define ALIGN 32 diff --git gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align8-O2.C gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align8-O2.C index 41bcc894a..31273c3f1 100644 --- gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align8-O2.C +++ gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align8-O2.C @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "Darwin ABI is different, test separately" { *-*-darwin* } } */ /* { dg-options "-O2 -fno-stack-protector -save-temps -Wno-narrowing" } */ #define ALIGN 8 diff --git gcc/testsuite/g++.target/aarch64/float128-darwin-1.C gcc/testsuite/g++.target/aarch64/float128-darwin-1.C new file mode 100644 index 000000000..0dbed063a --- /dev/null +++ gcc/testsuite/g++.target/aarch64/float128-darwin-1.C @@ -0,0 +1,41 @@ +/* { dg-do run { target { aarch64*-*-darwin* } } } */ +/* { dg-options "-std=c++11 -std=gnu++98" } */ + +#include +#include +#include + +void foo () +{ + float x1 = 1.0q; + double x2 = 1.0q; + long double x3 = 1.0q; + + _Float128 w1 = 0; + __float128 w2 = 0; + + float y1 = w1; // { dg-warning "with greater conversion rank" } + double y2 = w1; // { dg-warning "with greater conversion rank" } + long double y3 = w1; // { dg-warning "with greater conversion rank" } + + float z1 = w2; + double z2 = w2; + long double z3 = w2; +} + +int main () +{ + // Check the correct mangling of floating-point types + if (typeid(float).name() != std::string("f")) + __builtin_abort(); + if (typeid(double).name() != std::string("d")) + __builtin_abort(); + if (typeid(long double).name() != std::string("e")) + __builtin_abort(); + if (typeid(__float128).name() != std::string("g")) + __builtin_abort(); + if (typeid(_Float128).name() != std::string("DF128_")) + __builtin_abort(); + if (typeid(1.0q).name() != std::string("g")) + __builtin_abort(); +} diff --git gcc/testsuite/g++.target/aarch64/mv-symbols10.C gcc/testsuite/g++.target/aarch64/mv-symbols10.C index b83e00be9..d68082c9c 100644 --- gcc/testsuite/g++.target/aarch64/mv-symbols10.C +++ gcc/testsuite/g++.target/aarch64/mv-symbols10.C @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-ifunc "" } */ /* { dg-options "-O0" } */ __attribute__ ((target_version ("default"))) void diff --git gcc/testsuite/g++.target/aarch64/mv-symbols11.C gcc/testsuite/g++.target/aarch64/mv-symbols11.C index 19ab82de7..dfe0d92e9 100644 --- gcc/testsuite/g++.target/aarch64/mv-symbols11.C +++ gcc/testsuite/g++.target/aarch64/mv-symbols11.C @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-ifunc "" } */ /* { dg-options "-O0" } */ __attribute__ ((target_version ("default"))) int diff --git gcc/testsuite/g++.target/aarch64/mv-symbols12.C gcc/testsuite/g++.target/aarch64/mv-symbols12.C index a5e54bbf0..121899f45 100644 --- gcc/testsuite/g++.target/aarch64/mv-symbols12.C +++ gcc/testsuite/g++.target/aarch64/mv-symbols12.C @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-ifunc "" } */ /* { dg-options "-O0" } */ int foo () { diff --git gcc/testsuite/g++.target/aarch64/mv-symbols13.C gcc/testsuite/g++.target/aarch64/mv-symbols13.C index 01b8b6c76..9de4d4005 100644 --- gcc/testsuite/g++.target/aarch64/mv-symbols13.C +++ gcc/testsuite/g++.target/aarch64/mv-symbols13.C @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-ifunc "" } */ /* { dg-options "-O0" } */ int foo () { diff --git gcc/testsuite/g++.target/aarch64/mv-symbols6.C gcc/testsuite/g++.target/aarch64/mv-symbols6.C index 7e54158f1..d33291b0f 100644 --- gcc/testsuite/g++.target/aarch64/mv-symbols6.C +++ gcc/testsuite/g++.target/aarch64/mv-symbols6.C @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-ifunc "" } */ /* { dg-options "-O0" } */ __attribute__ ((target_version ("default"))) int diff --git gcc/testsuite/g++.target/aarch64/mv-symbols7.C gcc/testsuite/g++.target/aarch64/mv-symbols7.C index a312caf65..e60cdbf73 100644 --- gcc/testsuite/g++.target/aarch64/mv-symbols7.C +++ gcc/testsuite/g++.target/aarch64/mv-symbols7.C @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-ifunc "" } */ /* { dg-options "-O0" } */ __attribute__ ((target_version ("dotprod"))) int diff --git gcc/testsuite/g++.target/aarch64/mv-symbols9.C gcc/testsuite/g++.target/aarch64/mv-symbols9.C index e46d9db26..19181b8e6 100644 --- gcc/testsuite/g++.target/aarch64/mv-symbols9.C +++ gcc/testsuite/g++.target/aarch64/mv-symbols9.C @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-ifunc "" } */ /* { dg-options "-O0" } */ int diff --git gcc/testsuite/g++.target/aarch64/no_unique_address_1.C gcc/testsuite/g++.target/aarch64/no_unique_address_1.C index 5fc68ea5d..5faf915fa 100644 --- gcc/testsuite/g++.target/aarch64/no_unique_address_1.C +++ gcc/testsuite/g++.target/aarch64/no_unique_address_1.C @@ -1,5 +1,5 @@ /* { dg-options "-std=c++11 -O -foptimize-sibling-calls -fpeephole2" } */ -/* { dg-final { check-function-bodies "**" "" "" { target lp64 } } } */ +/* { dg-final { check-function-bodies "**" "" "" { target { lp64 && { ! aarch64*-*-darwin* } } } } } */ struct X { }; struct Y { int : 0; }; diff --git gcc/testsuite/g++.target/aarch64/no_unique_address_2.C gcc/testsuite/g++.target/aarch64/no_unique_address_2.C index f0717133c..322ec127c 100644 --- gcc/testsuite/g++.target/aarch64/no_unique_address_2.C +++ gcc/testsuite/g++.target/aarch64/no_unique_address_2.C @@ -1,5 +1,5 @@ /* { dg-options "-std=c++17 -O -foptimize-sibling-calls -fpeephole2" } */ -/* { dg-final { check-function-bodies "**" "" "" { target lp64 } } } */ +/* { dg-final { check-function-bodies "**" "" "" { target { lp64 && { ! aarch64*-*-darwin* } } } } } */ struct X { }; struct Y { int : 0; }; diff --git gcc/testsuite/g++.target/aarch64/pr109661-1.C gcc/testsuite/g++.target/aarch64/pr109661-1.C index d668a544f..5b9645e92 100644 --- gcc/testsuite/g++.target/aarch64/pr109661-1.C +++ gcc/testsuite/g++.target/aarch64/pr109661-1.C @@ -1,4 +1,5 @@ /* { dg-options "-O2 -Wpsabi" } */ +/* { dg-skip-if "Darwin ABI is different, test separately" { *-*-darwin* } } */ /* { dg-final { check-function-bodies "**" "" "" } } */ #include diff --git gcc/testsuite/g++.target/aarch64/pr109661-2.C gcc/testsuite/g++.target/aarch64/pr109661-2.C index f081417da..0bb95ab3e 100644 --- gcc/testsuite/g++.target/aarch64/pr109661-2.C +++ gcc/testsuite/g++.target/aarch64/pr109661-2.C @@ -1,4 +1,5 @@ /* { dg-options "-O2 -Wpsabi" } */ +/* { dg-skip-if "Darwin ABI is different, test separately" { *-*-darwin* } } */ /* { dg-final { check-function-bodies "**" "" "" } } */ #include diff --git gcc/testsuite/g++.target/aarch64/pr109661-3.C gcc/testsuite/g++.target/aarch64/pr109661-3.C index dab2fb295..497efac2c 100644 --- gcc/testsuite/g++.target/aarch64/pr109661-3.C +++ gcc/testsuite/g++.target/aarch64/pr109661-3.C @@ -1,4 +1,5 @@ /* { dg-options "-O2 -Wpsabi" } */ +/* { dg-skip-if "Darwin ABI is different, test separately" { *-*-darwin* } } */ /* { dg-final { check-function-bodies "**" "" "" } } */ #include diff --git gcc/testsuite/g++.target/aarch64/pr109661-4.C gcc/testsuite/g++.target/aarch64/pr109661-4.C index d87e60fcc..28a2b1565 100644 --- gcc/testsuite/g++.target/aarch64/pr109661-4.C +++ gcc/testsuite/g++.target/aarch64/pr109661-4.C @@ -1,4 +1,5 @@ /* { dg-options "-O2 -Wpsabi" } */ +/* { dg-skip-if "Darwin ABI is different, test separately" { *-*-darwin* } } */ /* { dg-final { check-function-bodies "**" "" "" } } */ #include diff --git gcc/testsuite/g++.target/aarch64/sme/exceptions_1.C gcc/testsuite/g++.target/aarch64/sme/exceptions_1.C index a245546d8..8b66d8a0f 100644 --- gcc/testsuite/g++.target/aarch64/sme/exceptions_1.C +++ gcc/testsuite/g++.target/aarch64/sme/exceptions_1.C @@ -9,10 +9,10 @@ void callee_normal(); /* ** _Z5test1v: ** ... -** bl __arm_tpidr2_save +** bl _?__arm_tpidr2_save ** ... -** bl __cxa_begin_catch -** bl __cxa_end_catch +** bl _?__cxa_begin_catch +** bl _?__cxa_end_catch ** mov w0, #?2 ** ... */ @@ -33,14 +33,14 @@ test1 () /* ** _Z5test2v: ** ... -** bl __arm_tpidr2_save +** bl _?__arm_tpidr2_save ** ... -** bl __cxa_begin_catch +** bl _?__cxa_begin_catch ** smstart za -** bl _Z10callee_outv -** bl _Z9callee_inv +** bl _?_Z10callee_outv +** bl _?_Z9callee_inv ** smstop za -** bl __cxa_end_catch +** bl _?__cxa_end_catch ** mov w0, #?2 ** ... */ @@ -63,18 +63,18 @@ test2 () /* ** _Z5test3v: ** ... -** bl __arm_tpidr2_save +** bl _?__arm_tpidr2_save ** ... ** smstop za ** ... -** bl _Z13callee_normalv +** bl _?_Z13callee_normalv ** ... -** bl __cxa_begin_catch +** bl _?__cxa_begin_catch ** smstart za -** bl _Z10callee_outv -** bl _Z9callee_inv +** bl _?_Z10callee_outv +** bl _?_Z9callee_inv ** smstop za -** bl __cxa_end_catch +** bl _?__cxa_end_catch ** mov w0, #?2 ** ... */ @@ -114,28 +114,28 @@ test4 () /* ** _Z5test5v: ** ... -** bl __arm_tpidr2_save +** bl _?__arm_tpidr2_save ** ... ** smstart za ** ... -** bl _Z12callee_inoutv +** bl _?_Z12callee_inoutv ** add (x[0-9]+), [^\n]+ ** msr tpidr2_el0, \1 -** bl _Z13callee_normalv +** bl _?_Z13callee_normalv ** msr tpidr2_el0, xzr ** smstop za ** ... -** bl __cxa_begin_catch +** bl _?__cxa_begin_catch ** ... ** mrs x[0-9]+, tpidr2_el0 ** ... ** smstart za ** ... -** bl __arm_tpidr2_restore +** bl _?__arm_tpidr2_restore ** msr tpidr2_el0, xzr -** bl _Z12callee_inoutv +** bl _?_Z12callee_inoutv ** smstop za -** bl __cxa_end_catch +** bl _?__cxa_end_catch ** mov w0, #?2 ** ... */ @@ -159,17 +159,17 @@ test5 () ** _Z5test6v: ** ... ** msr tpidr2_el0, x[0-9]+ -** bl _Z13callee_normalv +** bl _?_Z13callee_normalv ** msr tpidr2_el0, xzr ** ... -** bl __cxa_begin_catch -** bl __cxa_end_catch +** bl _?__cxa_begin_catch +** bl _?__cxa_end_catch ** ... ** mrs x[0-9]+, tpidr2_el0 ** ... ** smstart za ** ... -** bl __arm_tpidr2_restore +** bl _?__arm_tpidr2_restore ** msr tpidr2_el0, xzr ** ... */ diff --git gcc/testsuite/g++.target/aarch64/sme/exceptions_2.C gcc/testsuite/g++.target/aarch64/sme/exceptions_2.C index b0be27661..758273999 100644 --- gcc/testsuite/g++.target/aarch64/sme/exceptions_2.C +++ gcc/testsuite/g++.target/aarch64/sme/exceptions_2.C @@ -32,11 +32,11 @@ void n_caller1() ** cntd (x[0-9]+) ** str \1, [^\n]+ ** ... -** bl __cxa_begin_catch +** bl _?__cxa_begin_catch ** smstart sm -** bl _Z11s_callee_nev +** bl _?_Z11s_callee_nev ** smstop sm -** bl __cxa_end_catch +** bl _?__cxa_end_catch ** ... */ void n_caller2() @@ -55,7 +55,7 @@ void n_caller2() /* ** _Z9s_caller1v: ** ... -** bl __cxa_end_catch +** bl _?__cxa_end_catch ** smstart sm ** ... */ @@ -75,11 +75,11 @@ int s_caller1() __arm_streaming /* ** _Z9s_caller2v: ** ... -** bl __cxa_begin_catch +** bl _?__cxa_begin_catch ** smstart sm -** bl _Z11s_callee_nev +** bl _?_Z11s_callee_nev ** smstop sm -** bl __cxa_end_catch +** bl _?__cxa_end_catch ** smstart sm ** ... */ @@ -105,7 +105,7 @@ int s_caller2() __arm_streaming ** mrs (x[0-9]+), svcr ** str \2, ([^\n]+) ** ... -** bl __cxa_end_catch +** bl _?__cxa_end_catch ** ldr (x[0-9]+), \3 ** tbz \4, 0, [^\n]+ ** smstart sm @@ -130,11 +130,11 @@ int sc_caller1() __arm_streaming_compatible ** cntd (x[0-9]+) ** str \1, [^\n]+ ** ... -** bl __cxa_begin_catch +** bl _?__cxa_begin_catch ** smstart sm -** bl _Z12sc_callee_nev +** bl _?_Z12sc_callee_nev ** smstop sm -** bl __cxa_end_catch +** bl _?__cxa_end_catch ** ... */ __arm_locally_streaming void ls_caller1() diff --git gcc/testsuite/g++.target/aarch64/sme2/aarch64-sme2-acle-asm.exp gcc/testsuite/g++.target/aarch64/sme2/aarch64-sme2-acle-asm.exp index 142b2a1c4..978ce57a4 100644 --- gcc/testsuite/g++.target/aarch64/sme2/aarch64-sme2-acle-asm.exp +++ gcc/testsuite/g++.target/aarch64/sme2/aarch64-sme2-acle-asm.exp @@ -24,6 +24,11 @@ if {![istarget aarch64*-*-*] } { return } +# Darwin's assembler support for sme2 appears incomplete. +if { [istarget *-*-darwin*] && ![info exists env(DARWIN_TEST_SME2)]} then { + return +} + # Load support procs. load_lib g++-dg.exp diff --git gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp index 917499283..5e3451fbf 100644 --- gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp +++ gcc/testsuite/g++.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp @@ -24,6 +24,11 @@ if { ![istarget aarch64*-*-*] } { return } +# Darwin doesn't support sve +if { [istarget *-*-darwin*] } then { + return +} + # Load support procs. load_lib g++-dg.exp diff --git gcc/testsuite/g++.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp gcc/testsuite/g++.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp index 7ee30a3d7..8a807fa37 100644 --- gcc/testsuite/g++.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp +++ gcc/testsuite/g++.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp @@ -24,6 +24,11 @@ if { ![istarget aarch64*-*-*] } { return } +# Darwin assembler sve2 support is incomplete in places +if { [istarget *-*-darwin*] && ![info exists env(DARWIN_TEST_SVE2)] } then { + return +} + # Load support procs. load_lib g++-dg.exp diff --git gcc/testsuite/gcc.dg/builtin-apply2.c gcc/testsuite/gcc.dg/builtin-apply2.c index 0f350f4ac..d1e70b3a3 100644 --- gcc/testsuite/gcc.dg/builtin-apply2.c +++ gcc/testsuite/gcc.dg/builtin-apply2.c @@ -1,7 +1,7 @@ /* { dg-do run } */ /* { dg-require-effective-target untyped_assembly } */ /* { dg-skip-if "Variadic funcs have all args on stack. Normal funcs have args in registers." { "avr-*-* nds32*-*-* amdgcn-*-*" } } */ -/* { dg-skip-if "Variadic funcs use different argument passing from normal funcs." { "csky*-*-* riscv*-*-* or1k*-*-* msp430-*-* pru-*-* loongarch*-*-*" } } */ +/* { dg-skip-if "Variadic funcs use different argument passing from normal funcs." { "csky*-*-* riscv*-*-* or1k*-*-* msp430-*-* pru-*-* loongarch*-*-* aarch64-apple-darwin*" } } */ /* { dg-skip-if "Variadic funcs use Base AAPCS. Normal funcs use VFP variant." { arm*-*-* && arm_hf_eabi } } */ /* PR target/12503 */ diff --git gcc/testsuite/gcc.dg/callgraph-info-1.c gcc/testsuite/gcc.dg/callgraph-info-1.c index 853ff9554..cccacaeff 100644 --- gcc/testsuite/gcc.dg/callgraph-info-1.c +++ gcc/testsuite/gcc.dg/callgraph-info-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-fcallgraph-info" } */ +/* { dg-require-alias "" } */ void f() {} void g() __attribute__ ((__alias__ ("f"))); diff --git gcc/testsuite/gcc.dg/cwsc1.c gcc/testsuite/gcc.dg/cwsc1.c index cccf4139c..99c4f63df 100644 --- gcc/testsuite/gcc.dg/cwsc1.c +++ gcc/testsuite/gcc.dg/cwsc1.c @@ -8,6 +8,8 @@ #elif defined(__aarch64__) # if defined __vxworks # define CHAIN "x9" +# elif defined(__APPLE__) +# define CHAIN "x16" # else # define CHAIN "x18" # endif diff --git gcc/testsuite/gcc.dg/darwin-segaddr.c gcc/testsuite/gcc.dg/darwin-segaddr.c index 77112ddb4..26ceee11a 100644 --- gcc/testsuite/gcc.dg/darwin-segaddr.c +++ gcc/testsuite/gcc.dg/darwin-segaddr.c @@ -1,5 +1,6 @@ /* Check that -segaddr gets through and works. */ /* { dg-do run { target *-*-darwin* } } */ +/* { dg-xfail-run-if "no-pie exes are not allowed" { aarch64-*-darwin* } } */ /* { dg-options "-O0 -segaddr __TEST 0x200000 -fno-pie" { target { *-*-darwin* && { ! lp64 } } } } */ /* { dg-options "-O0 -segaddr __TEST 0x110000000 -fno-pie" { target { *-*-darwin* && lp64 } } } */ /* { dg-prune-output "-no_pie is deprecated when targeting new OS versions" } */ diff --git gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro.c gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro.c index fd61296b2..7d7d0e695 100644 --- gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro.c +++ gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro.c @@ -1,7 +1,7 @@ /* Test to make sure the mcaro info includes a start file command for the main source */ /* { dg-do compile } */ /* { dg-options "-g3 -gdwarf -dA -fverbose-asm" } */ -/* { dg-final { scan-assembler "Start new file" } } */ +/* { dg-final { scan-assembler "Start new file" { xfail *-*-darwin23* } } } */ #define ADD(x) (M + x) diff --git gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro2.c gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro2.c index 3dfa2908e..3baecb959 100644 --- gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro2.c +++ gcc/testsuite/gcc.dg/debug/dwarf2/dwarf2-macro2.c @@ -1,7 +1,7 @@ /* Test to make sure the macro info includes the predefined macros with line number 0. */ /* { dg-do compile } */ /* { dg-options "-g3 -gdwarf -dA -fverbose-asm" } */ -/* { dg-final { scan-assembler "At line number 0" } } */ +/* { dg-final { scan-assembler "At line number 0" { xfail *-*-darwin23* } } } */ #define FOO 1 int i; diff --git gcc/testsuite/gcc.dg/ipa/iinline-attr.c gcc/testsuite/gcc.dg/ipa/iinline-attr.c index c183c1f92..acf27e7bf 100644 --- gcc/testsuite/gcc.dg/ipa/iinline-attr.c +++ gcc/testsuite/gcc.dg/ipa/iinline-attr.c @@ -23,5 +23,5 @@ int test (void) return 0; } -/* { dg-final { scan-ipa-dump "hooray\[^\\n\]*inline copy in test" "inline" { xfail { { sparc*-*-* && ilp32 } || visium-*-* } } } } */ +/* { dg-final { scan-ipa-dump "_?hooray\[^\\n\]*inline copy in test" "inline" { xfail { { sparc*-*-* && ilp32 } || visium-*-* } } } } */ /* Missing back-end support for attribute __optimize__ on SPARC and Visium. */ diff --git gcc/testsuite/gcc.dg/lto/20091216-1_0.c gcc/testsuite/gcc.dg/lto/20091216-1_0.c index 7bcf1f38d..ac6ea79ba 100644 --- gcc/testsuite/gcc.dg/lto/20091216-1_0.c +++ gcc/testsuite/gcc.dg/lto/20091216-1_0.c @@ -2,7 +2,7 @@ #include "../nop.h" -asm (".globl start_\nstart_: " NOP); +asm (".globl start_\n\t.p2align 2\nstart_: " NOP); int main () diff --git gcc/testsuite/gcc.dg/pch/pch.exp gcc/testsuite/gcc.dg/pch/pch.exp index 32cde39a4..c2171d49d 100644 --- gcc/testsuite/gcc.dg/pch/pch.exp +++ gcc/testsuite/gcc.dg/pch/pch.exp @@ -38,7 +38,7 @@ foreach test [lsort [glob -nocomplain $srcdir/$subdir/*.c]] { # unlikely to make any difference to PCH. However, we do want to # add -O0 -g, since users who want PCH usually want debugging and quick # compiles. - dg-pch $subdir $test [concat [list {-O0 -g}] $torture_without_loops] ".h" + dg-pch $subdir $test [concat [list {-O0 -g -Winvalid-pch}] $torture_without_loops] ".h" } set test "largefile.c" @@ -53,7 +53,7 @@ puts $f "#include \"largefile.h\"" close $f set f [open $testh w] close $f -dg-pch $subdir $test [concat [list {-O0 -g}] $torture_without_loops] ".h" +dg-pch $subdir $test [concat [list {-O0 -g -Winvalid-pch}] $torture_without_loops] ".h" file delete $test file delete $testh diff --git gcc/testsuite/gcc.dg/pr26427.c gcc/testsuite/gcc.dg/pr26427.c index add13ca20..834cf2cc5 100644 --- gcc/testsuite/gcc.dg/pr26427.c +++ gcc/testsuite/gcc.dg/pr26427.c @@ -1,4 +1,4 @@ -/* { dg-warning "this target does not support" "" {target *86*-*-darwin* } 0 } */ +/* { dg-warning "this target does not support" "" { target *86*-*-darwin* } 0 } */ /* { dg-do run { target { *-*-darwin* } } } */ /* { dg-options { -fsection-anchors -O } } */ /* PR target/26427 */ diff --git gcc/testsuite/gcc.dg/pr97172-2.c gcc/testsuite/gcc.dg/pr97172-2.c index 99cc6c29f..61f05626e 100644 --- gcc/testsuite/gcc.dg/pr97172-2.c +++ gcc/testsuite/gcc.dg/pr97172-2.c @@ -2,6 +2,7 @@ streams { dg-do link } { dg-options "-Wall -flto -fpic -shared" } + { dg-additional-options "-Wl,-undefined,dynamic_lookup" { target *-*-darwin* } } { dg-require-effective-target fpic } { dg-require-effective-target shared } { dg-require-effective-target lto } */ diff --git gcc/testsuite/gcc.dg/pubtypes-2.c gcc/testsuite/gcc.dg/pubtypes-2.c index 116e3489b..b3d1231ad 100644 --- gcc/testsuite/gcc.dg/pubtypes-2.c +++ gcc/testsuite/gcc.dg/pubtypes-2.c @@ -2,7 +2,8 @@ /* { dg-options "-O0 -gdwarf-2 -dA" } */ /* { dg-skip-if "Unmatchable assembly" { mmix-*-* } } */ /* { dg-final { scan-assembler "__debug_pubtypes" } } */ -/* { dg-final { scan-assembler {long+[ \t]+0x14d+[ \t]+[#;]+[ \t]+Pub Info Length} } } */ +/* { dg-final { scan-assembler {long+[ \t]+0x14d+[ \t]+[#;]+[ \t]+Pub Info Length} { target { ! aarch64-*-darwin* } } } } */ +/* { dg-final { scan-assembler {long+[ \t]+0x163+[ \t]+[#;]+[ \t]+Pub Info Length} { target aarch64-*-darwin* } } } */ /* { dg-final { scan-assembler "used_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ /* { dg-final { scan-assembler-not "unused_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ diff --git gcc/testsuite/gcc.dg/pubtypes-3.c gcc/testsuite/gcc.dg/pubtypes-3.c index 3fb3468fb..950a9ba72 100644 --- gcc/testsuite/gcc.dg/pubtypes-3.c +++ gcc/testsuite/gcc.dg/pubtypes-3.c @@ -2,7 +2,8 @@ /* { dg-options "-O0 -gdwarf-2 -dA" } */ /* { dg-skip-if "Unmatchable assembly" { mmix-*-* } } */ /* { dg-final { scan-assembler "__debug_pubtypes" } } */ -/* { dg-final { scan-assembler {long+[ \t]+0x14d+[ \t]+[#;]+[ \t]+Pub Info Length} } } */ +/* { dg-final { scan-assembler {long+[ \t]+0x14d+[ \t]+[#;]+[ \t]+Pub Info Length} { target { ! aarch64-*-darwin* } } } } */ +/* { dg-final { scan-assembler {long+[ \t]+0x163+[ \t]+[#;]+[ \t]+Pub Info Length} { target aarch64-*-darwin* } } } */ /* { dg-final { scan-assembler "used_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ /* { dg-final { scan-assembler-not "unused_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ /* { dg-final { scan-assembler-not "\"list_name_type\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ diff --git gcc/testsuite/gcc.dg/pubtypes-4.c gcc/testsuite/gcc.dg/pubtypes-4.c index 83fba8dfa..725077158 100644 --- gcc/testsuite/gcc.dg/pubtypes-4.c +++ gcc/testsuite/gcc.dg/pubtypes-4.c @@ -2,7 +2,8 @@ /* { dg-options "-O0 -gdwarf-2 -dA" } */ /* { dg-skip-if "Unmatchable assembly" { mmix-*-* } } */ /* { dg-final { scan-assembler "__debug_pubtypes" } } */ -/* { dg-final { scan-assembler {long+[ \t]+0x184+[ \t]+[#;]+[ \t]+Pub Info Length} } } */ +/* { dg-final { scan-assembler {long+[ \t]+0x184+[ \t]+[#;]+[ \t]+Pub Info Length} { target { ! aarch64-*-darwin* } } } } */ +/* { dg-final { scan-assembler {long+[ \t]+0x19a+[ \t]+[#;]+[ \t]+Pub Info Length} { target aarch64-*-darwin* } } } */ /* { dg-final { scan-assembler "used_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ /* { dg-final { scan-assembler-not "unused_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ /* { dg-final { scan-assembler "\"list_name_type\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ diff --git gcc/testsuite/gcc.dg/rtl/aarch64/big-endian-cse-1.c gcc/testsuite/gcc.dg/rtl/aarch64/big-endian-cse-1.c index 1559a489f..aa2da0cbc 100644 --- gcc/testsuite/gcc.dg/rtl/aarch64/big-endian-cse-1.c +++ gcc/testsuite/gcc.dg/rtl/aarch64/big-endian-cse-1.c @@ -1,4 +1,5 @@ /* { dg-do compile { target aarch64*-*-* } } */ +/* { dg-skip-if "Darwin platforms do not support big-endian arm64" *-*-darwin* } */ /* { dg-require-effective-target lp64 } */ /* { dg-options "-O3 -mbig-endian" } */ diff --git gcc/testsuite/gcc.dg/stack-check-10.c gcc/testsuite/gcc.dg/stack-check-10.c index 2f5a090cb..2be2a8a2b 100644 --- gcc/testsuite/gcc.dg/stack-check-10.c +++ gcc/testsuite/gcc.dg/stack-check-10.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fstack-clash-protection -fdump-rtl-pro_and_epilogue -fno-optimize-sibling-calls --param stack-clash-protection-probe-interval=12 --param stack-clash-protection-guard-size=12" } */ +/* { dg-additional-options "-fomit-frame-pointer" { target aarch64-*-darwin* } } */ /* { dg-require-effective-target supports_stack_clash_protection } */ int f (int *); diff --git gcc/testsuite/gcc.dg/stack-check-5.c gcc/testsuite/gcc.dg/stack-check-5.c index 024314793..a86455528 100644 --- gcc/testsuite/gcc.dg/stack-check-5.c +++ gcc/testsuite/gcc.dg/stack-check-5.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fstack-clash-protection -fdump-rtl-pro_and_epilogue -fno-optimize-sibling-calls --param stack-clash-protection-probe-interval=12 --param stack-clash-protection-guard-size=12" } */ +/* { dg-additional-options "-fomit-frame-pointer" { target aarch64-*-darwin* } } */ /* { dg-require-effective-target supports_stack_clash_protection } */ /* { dg-skip-if "" { *-*-* } { "-fstack-protector*" } { "" } } */ diff --git gcc/testsuite/gcc.dg/stack-check-6.c gcc/testsuite/gcc.dg/stack-check-6.c index 50eb19246..9a3a30771 100644 --- gcc/testsuite/gcc.dg/stack-check-6.c +++ gcc/testsuite/gcc.dg/stack-check-6.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fstack-clash-protection -fdump-rtl-pro_and_epilogue -fno-optimize-sibling-calls --param stack-clash-protection-probe-interval=12 --param stack-clash-protection-guard-size=12" } */ +/* { dg-additional-options "-fomit-frame-pointer" { target aarch64-*-darwin* } } */ /* { dg-require-effective-target supports_stack_clash_protection } */ /* { dg-skip-if "" { *-*-* } { "-fstack-protector*" } { "" } } */ diff --git gcc/testsuite/gcc.dg/stack-check-9.c gcc/testsuite/gcc.dg/stack-check-9.c index b84075b9b..96e6ee7c0 100644 --- gcc/testsuite/gcc.dg/stack-check-9.c +++ gcc/testsuite/gcc.dg/stack-check-9.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fstack-clash-protection -fdump-rtl-pro_and_epilogue -fno-optimize-sibling-calls --param stack-clash-protection-probe-interval=12 --param stack-clash-protection-guard-size=12" } */ +/* { dg-additional-options "-fomit-frame-pointer" { target aarch64-*-darwin* } } */ /* { dg-require-effective-target supports_stack_clash_protection } */ double f1 (void); diff --git gcc/testsuite/gcc.dg/tls/pr78796.c gcc/testsuite/gcc.dg/tls/pr78796.c index 96f87d47b..3868697cb 100644 --- gcc/testsuite/gcc.dg/tls/pr78796.c +++ gcc/testsuite/gcc.dg/tls/pr78796.c @@ -1,7 +1,7 @@ /* PR target/78796 */ /* { dg-do run } */ /* { dg-options "-O2" } */ -/* { dg-additional-options "-mcmodel=large -fno-pie -no-pie" { target aarch64-*-* } } */ +/* { dg-additional-options "-mcmodel=large -fno-pie -no-pie" { target { { aarch64-*-* } && { ! aarch64-*-darwin* } } } } */ /* { dg-require-effective-target tls_runtime } */ /* { dg-add-options tls } */ diff --git gcc/testsuite/gcc.dg/torture/bfloat16-complex.c gcc/testsuite/gcc.dg/torture/bfloat16-complex.c index fa27a774b..100862103 100644 --- gcc/testsuite/gcc.dg/torture/bfloat16-complex.c +++ gcc/testsuite/gcc.dg/torture/bfloat16-complex.c @@ -3,6 +3,7 @@ /* { dg-options "" } */ /* { dg-add-options bfloat16 } */ /* { dg-require-effective-target bfloat16_runtime } */ +/* { dg-xfail-if "PR111876" { aarch64-*-darwin* } } */ extern void exit (int); extern void abort (void); diff --git gcc/testsuite/gcc.dg/torture/convert-dfp-2.c gcc/testsuite/gcc.dg/torture/convert-dfp-2.c index f62b47159..9bbf543ac 100644 --- gcc/testsuite/gcc.dg/torture/convert-dfp-2.c +++ gcc/testsuite/gcc.dg/torture/convert-dfp-2.c @@ -38,9 +38,16 @@ int main () return 0; } -/* { dg-final { scan-assembler-times {\t__bid_truncsdhf} 2 { target { dfp_bid } } } } */ -/* { dg-final { scan-assembler-times {\t__bid_truncddhf} 2 { target { dfp_bid } } } } */ -/* { dg-final { scan-assembler-times {\t__bid_truncddsd2} 2 { target { dfp_bid } } } } */ -/* { dg-final { scan-assembler-times {\t__bid_trunctdhf} 2 { target { dfp_bid } } } } */ -/* { dg-final { scan-assembler-times {\t__bid_trunctdsd2} 2 { target { dfp_bid } } } } */ -/* { dg-final { scan-assembler-times {\t__bid_trunctddd2} 2 { target { dfp_bid } } } } */ +/* { dg-final { scan-assembler-times {\t__bid_truncsdhf} 2 { target { dfp_bid && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-times {\t__bid_truncddhf} 2 { target { dfp_bid && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-times {\t__bid_truncddsd2} 2 { target { dfp_bid && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-times {\t__bid_trunctdhf} 2 { target { dfp_bid && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-times {\t__bid_trunctdsd2} 2 { target { dfp_bid && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-times {\t__bid_trunctddd2} 2 { target { dfp_bid && { ! *-*-darwin* } } } } } */ + +/* { dg-final { scan-assembler-times {\t___bid_truncsdhf} 1 { target { dfp_bid && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {\t___bid_truncddhf} 1 { target { dfp_bid && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {\t___bid_truncddsd2} 1 { target { dfp_bid && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {\t___bid_trunctdhf} 1 { target { dfp_bid && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {\t___bid_trunctdsd2} 1 { target { dfp_bid && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {\t___bid_trunctddd2} 1 { target { dfp_bid && *-*-darwin* } } } } */ diff --git gcc/testsuite/gcc.dg/torture/convert-dfp.c gcc/testsuite/gcc.dg/torture/convert-dfp.c index a20253dd7..3faf46088 100644 --- gcc/testsuite/gcc.dg/torture/convert-dfp.c +++ gcc/testsuite/gcc.dg/torture/convert-dfp.c @@ -56,9 +56,16 @@ int main() return 0; } -/* { dg-final { scan-assembler-times {\t__bid_extendsddd2} 3 { target { dfp_bid } } } } */ -/* { dg-final { scan-assembler-times {\t__bid_extendsdtd2} 3 { target { dfp_bid } } } } */ -/* { dg-final { scan-assembler-times {\t__bid_extendddtd2} 3 { target { dfp_bid } } } } */ -/* { dg-final { scan-assembler-times {\t__bid_extendhfsd} 2 { target { dfp_bid } } } } */ -/* { dg-final { scan-assembler-times {\t__bid_extendhfdd} 2 { target { dfp_bid } } } } */ -/* { dg-final { scan-assembler-times {\t__bid_extendhftd} 2 { target { dfp_bid } } } } */ +/* { dg-final { scan-assembler-times {\t__bid_extendsddd2} 3 { target { dfp_bid && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-times {\t__bid_extendsdtd2} 3 { target { dfp_bid && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-times {\t__bid_extendddtd2} 3 { target { dfp_bid && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-times {\t__bid_extendhfsd} 2 { target { dfp_bid && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-times {\t__bid_extendhfdd} 2 { target { dfp_bid && { ! *-*-darwin* } } } } } */ +/* { dg-final { scan-assembler-times {\t__bid_extendhftd} 2 { target { dfp_bid && { ! *-*-darwin* } } } } } */ + +/* { dg-final { scan-assembler-times {\t___bid_extendsddd2} 2 { target { dfp_bid && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {\t___bid_extendsdtd2} 2 { target { dfp_bid && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {\t___bid_extendddtd2} 2 { target { dfp_bid && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {\t___bid_extendhfsd} 1 { target { dfp_bid && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {\t___bid_extendhfdd} 1 { target { dfp_bid && *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {\t___bid_extendhftd} 1 { target { dfp_bid && *-*-darwin* } } } } */ diff --git gcc/testsuite/gcc.dg/torture/darwin-cfstring-3.c gcc/testsuite/gcc.dg/torture/darwin-cfstring-3.c index 4be3a2526..95eec7d74 100644 --- gcc/testsuite/gcc.dg/torture/darwin-cfstring-3.c +++ gcc/testsuite/gcc.dg/torture/darwin-cfstring-3.c @@ -26,5 +26,5 @@ void foo(void) { /* { dg-final { scan-assembler "\\.long\[ \\t\]+___CFConstantStringClassReference\n\[ \\t\]*\\.long\[ \\t\]+1992\n\[ \\t\]*\\.long\[ \\t\]+L\.str\..*\n\[ \\t\]*\\.long\[ \\t\]+4\n" { target { *-*-darwin* && { ! lp64 } } } } } */ /* { dg-final { scan-assembler "\\.long\[ \\t\]+___CFConstantStringClassReference\n\[ \\t\]*\\.long\[ \\t\]+1992\n\[ \\t\]*\\.long\[ \\t\]+L\.str\..*\n\[ \\t\]*\\.long\[ \\t\]+10\n" { target { *-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t___CFConstantStringClassReference\n\t.long\t1992\n\t.space 4\n\t.quad\tL\.str\..*\n\t.quad\t4\n" { target { *-*-darwin* && { lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t___CFConstantStringClassReference\n\t.long\t1992\n\t.space 4\n\t.quad\tL\.str\..*\n\t.quad\t10\n" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t___CFConstantStringClassReference\n\t.(long|word)\t1992\n\t.space 4\n\t.(quad|xword)\tL\.str\..*\n\t.(quad|xword)\t4\n} { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t___CFConstantStringClassReference\n\t.(long|word)\t1992\n\t.space 4\n\t.(quad|xword)\tL\.str\..*\n\t.(quad|xword)\t10\n} { target { *-*-darwin* && { lp64 } } } } } */ diff --git gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c index 552ca1433..16643ceb1 100644 --- gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c +++ gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c @@ -9,7 +9,7 @@ /* arm_hf_eabi: Variadic funcs use Base AAPCS. Normal funcs use VFP variant. avr: Variadic funcs don't pass arguments in registers, while normal funcs do. */ -/* { dg-skip-if "Variadic funcs use different argument passing from normal funcs" { arm_hf_eabi || { csky*-*-* avr-*-* riscv*-*-* or1k*-*-* msp430-*-* amdgcn-*-* pru-*-* loongarch*-*-* } } } */ +/* { dg-skip-if "Variadic funcs use different argument passing from normal funcs" { arm_hf_eabi || { csky*-*-* avr-*-* riscv*-*-* or1k*-*-* msp430-*-* amdgcn-*-* pru-*-* loongarch*-*-* aarch64-apple-darwin* } } } */ /* { dg-skip-if "Variadic funcs have all args on stack. Normal funcs have args in registers." { nds32*-*-* } { v850*-*-* } } */ /* { dg-require-effective-target untyped_assembly } */ diff --git gcc/testsuite/gcc.dg/tree-ssa/stdarg-2.c gcc/testsuite/gcc.dg/tree-ssa/stdarg-2.c index 0224997f1..3684cffdc 100644 --- gcc/testsuite/gcc.dg/tree-ssa/stdarg-2.c +++ gcc/testsuite/gcc.dg/tree-ssa/stdarg-2.c @@ -25,9 +25,9 @@ f1 (int i, ...) /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -46,9 +46,9 @@ f2 (int i, ...) /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save \[148\] GPR units and 0 FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 8 GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 1 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 8 GPR units and 0 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 8 GPR units and 0 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -62,10 +62,10 @@ f3 (int i, ...) /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 0 GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { ! { ia32 || llp64 } } } } } } */ /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 0 GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ilp32 } } } } } */ /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 0 GPR units and 1 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 0 GPR units and 16 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 0 GPR units and 16 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 8 GPR units and 2" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[1-9\]\[0-9\]* GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[1-9\]\[0-9\]* GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[1-9\]\[0-9\]* GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[1-9\]\[0-9\]* GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -81,9 +81,9 @@ f4 (int i, ...) /* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f4: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -100,9 +100,9 @@ f5 (int i, ...) /* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f5: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -121,9 +121,9 @@ f6 (int i, ...) /* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save (3|12|24) GPR units and 0 FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save 24 GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save 3 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save 24 GPR units and 0 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save 24 GPR units and 0 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save (3|12|24) GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save (3|12|24) GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save (3|12|24) GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save (3|12|24) GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -139,9 +139,9 @@ f7 (int i, ...) /* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f7: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -159,9 +159,9 @@ f8 (int i, ...) /* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f8: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -177,9 +177,9 @@ f9 (int i, ...) /* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f9: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -197,9 +197,9 @@ f10 (int i, ...) /* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f10: va_list escapes 1, needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -218,9 +218,9 @@ f11 (int i, ...) /* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save (3|12|24) GPR units and 0 FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save 24 GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save 3 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save 24 GPR units and 0 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save 24 GPR units and 0 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save (3|12|24) GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save (3|12|24) GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save (3|12|24) GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f11: va_list escapes 0, needs to save (3|12|24) GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -239,9 +239,9 @@ f12 (int i, ...) /* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save 0 GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ilp32 } } } } } */ /* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save 24 GPR units and 2" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save 0 GPR units and 3 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save 0 GPR units and 48 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save 0 GPR units and 48 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f12: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -260,9 +260,9 @@ f13 (int i, ...) /* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save 0 GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ilp32 } } } } } */ /* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save 24 GPR units and 2" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save 0 GPR units and 3 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save 0 GPR units and 48 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save 0 GPR units and 48 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f13: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -281,9 +281,9 @@ f14 (int i, ...) /* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save \[148\] GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ilp32 } } } } } */ /* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save 24 GPR units and 3" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save 1 GPR units and 2 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save 8 GPR units and 32 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save 8 GPR units and 32 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f14: va_list escapes 0, needs to save \[1-9]\[0-9\]* GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ inline void __attribute__((always_inline)) @@ -305,11 +305,11 @@ f15 (int i, ...) /* { dg-final { scan-tree-dump "f15: va_list escapes 0, needs to save \[148\] GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { ! { ia32 || llp64 } } } } } } */ /* { dg-final { scan-tree-dump "f15: va_list escapes 0, needs to save \[148\] GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ilp32 } } } } } */ /* { dg-final { scan-tree-dump "f15: va_list escapes 0, needs to save 1 GPR units and 2 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f15: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f15: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* We may be able to improve upon this after fixing PR66010/PR66013. */ /* { dg-final { scan-tree-dump "f15: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump-not "f15: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump-not "f15: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump-not "f15: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump-not "f15: va_list escapes 0, needs to save 0 GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ diff --git gcc/testsuite/gcc.dg/tree-ssa/stdarg-4.c gcc/testsuite/gcc.dg/tree-ssa/stdarg-4.c index 1a637d6ef..77cdf384d 100644 --- gcc/testsuite/gcc.dg/tree-ssa/stdarg-4.c +++ gcc/testsuite/gcc.dg/tree-ssa/stdarg-4.c @@ -27,9 +27,9 @@ f1 (int i, ...) /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes \[01\], needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f1: va_list escapes \[01\], needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes \[01\], needs to save all GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes \[01\], needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -45,9 +45,9 @@ f2 (int i, ...) /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 0 GPR units and all FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ilp32 } } } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save all GPR units and 2" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 0 GPR units and all FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 0 GPR units and all FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save 0 GPR units and all FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes \[01\], needs to save all GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f2: va_list escapes \[01\], needs to save all GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes \[01\], needs to save all GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes \[01\], needs to save all GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ /* Here va_arg can be executed at most as many times as va_start. @@ -69,9 +69,9 @@ f3 (int i, ...) /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[148\] GPR units and 0 FPR units" "stdarg" { target { powerpc*-*-linux* && ilp32 } } } } */ /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 8 GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 1 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 8 GPR units and 0 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 8 GPR units and 0 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ void @@ -91,7 +91,7 @@ f4 (int i, ...) /* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 0 GPR units and \[1-9\]\[0-9\]* FPR units" "stdarg" { target { powerpc*-*-linux* && { powerpc_fprs && ilp32 } } } } } */ /* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 8 GPR units and 2" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 0 GPR units and 1 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 0 GPR units and 16 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 0 GPR units and 16 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ /* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && ia32 } } } } */ -/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target ia64-*-* } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target ia64-*-* aarch64-apple-darwin* } } } */ /* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save \[148\] GPR units" "stdarg" { target { powerpc*-*-* && lp64 } } } } */ diff --git gcc/testsuite/gcc.dg/tree-ssa/stdarg-5.c gcc/testsuite/gcc.dg/tree-ssa/stdarg-5.c index c8ad4fe32..b0484f2f0 100644 --- gcc/testsuite/gcc.dg/tree-ssa/stdarg-5.c +++ gcc/testsuite/gcc.dg/tree-ssa/stdarg-5.c @@ -25,7 +25,8 @@ f1 (int i, ...) /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { ! { ia32 || llp64 } } } } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ +/* { dg-final { scan-tree-dump "f1: va_list escapes 0, needs to save all GPR units" "stdarg" { target aarch64-apple-darwin* } } } */ void f2 (int i, ...) @@ -39,7 +40,8 @@ f2 (int i, ...) /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save all GPR units and all FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { ! { ia32 || llp64 } } } } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save all GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save all GPR units and 0 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ +/* { dg-final { scan-tree-dump "f2: va_list escapes 0, needs to save all GPR units" "stdarg" { target aarch64-apple-darwin* } } } */ /* Here va_arg can be executed at most as many times as va_start. */ void @@ -58,7 +60,8 @@ f3 (int i, ...) /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 0 GPR units and 0 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { ! { ia32 || llp64 } } } } } } */ /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 32 GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 1 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 8 GPR units and 0 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 8 GPR units and 0 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ +/* { dg-final { scan-tree-dump "f3: va_list escapes 0, needs to save 8 GPR units" "stdarg" { target aarch64-apple-darwin* } } } */ void f4 (int i, ...) @@ -77,7 +80,8 @@ f4 (int i, ...) /* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 16 GPR units and 16 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { ! { ia32 || llp64 } } } } } } */ /* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 24 GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 2 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 24 GPR units and 0 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 24 GPR units and 0 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ +/* { dg-final { scan-tree-dump "f4: va_list escapes 0, needs to save 24 GPR units" "stdarg" { target aarch64-apple-darwin* } } } */ void f5 (int i, ...) @@ -92,7 +96,8 @@ f5 (int i, ...) /* { dg-final { scan-tree-dump "f5: va_list escapes 0, needs to save 16 GPR units and 0 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { ! { ia32 || llp64 } } } } } } */ /* { dg-final { scan-tree-dump "f5: va_list escapes 0, needs to save 32 GPR units and 1" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f5: va_list escapes 0, needs to save (4|2) GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f5: va_list escapes 0, needs to save 16 GPR units and 0 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f5: va_list escapes 0, needs to save 16 GPR units and 0 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ +/* { dg-final { scan-tree-dump "f5: va_list escapes 0, needs to save 16 GPR units" "stdarg" { target aarch64-apple-darwin* } } } */ void f6 (int i, ...) @@ -107,7 +112,8 @@ f6 (int i, ...) /* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save 8 GPR units and 32 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { ! { ia32 || llp64 } } } } } } */ /* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save 32 GPR units and 3" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save (3|2) GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save 8 GPR units and 32 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save 8 GPR units and 32 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ +/* { dg-final { scan-tree-dump "f6: va_list escapes 0, needs to save 24 GPR units" "stdarg" { target aarch64-apple-darwin* } } } */ void f7 (int i, ...) @@ -122,4 +128,5 @@ f7 (int i, ...) /* { dg-final { scan-tree-dump "f7: va_list escapes 0, needs to save 0 GPR units and 64 FPR units" "stdarg" { target { { i?86-*-* x86_64-*-* } && { ! { ia32 || llp64 } } } } } } */ /* { dg-final { scan-tree-dump "f7: va_list escapes 0, needs to save 32 GPR units and 2" "stdarg" { target alpha*-*-linux* } } } */ /* { dg-final { scan-tree-dump "f7: va_list escapes 0, needs to save 2 GPR units and 0 FPR units" "stdarg" { target s390*-*-linux* } } } */ -/* { dg-final { scan-tree-dump "f7: va_list escapes 0, needs to save 0 GPR units and 64 FPR units" "stdarg" { target aarch64*-*-* } } } */ +/* { dg-final { scan-tree-dump "f7: va_list escapes 0, needs to save 0 GPR units and 64 FPR units" "stdarg" { target { { aarch64*-*-* } && { ! aarch64-apple-darwin* } } } } } */ +/* { dg-final { scan-tree-dump "f7: va_list escapes 0, needs to save 32 GPR units" "stdarg" { target aarch64-apple-darwin* } } } */ diff --git gcc/testsuite/gcc.dg/vla-init-2.c gcc/testsuite/gcc.dg/vla-init-2.c index f23630a36..b6e6f6eae 100644 --- gcc/testsuite/gcc.dg/vla-init-2.c +++ gcc/testsuite/gcc.dg/vla-init-2.c @@ -4,6 +4,7 @@ testcase. */ /* { dg-do compile } */ /* { dg-options "" } */ +/* { dg-additional-options "-fno-allow-const-var-array-size" { target *-*-darwin* } } */ const int i = 1; void foo() { char a[][i] = {""}; } /* { dg-error "variable-sized object may not be initialized" } */ diff --git gcc/testsuite/gcc.dg/vla-init-4.c gcc/testsuite/gcc.dg/vla-init-4.c index 7d1aa5bff..cc978e276 100644 --- gcc/testsuite/gcc.dg/vla-init-4.c +++ gcc/testsuite/gcc.dg/vla-init-4.c @@ -2,6 +2,7 @@ /* Origin: Joseph Myers */ /* { dg-do compile } */ /* { dg-options "" } */ +/* { dg-additional-options "-fno-allow-const-var-array-size" { target *-*-darwin* } } */ const int i = 1; void foo() { char *p = (char [i]){ "" }; } /* { dg-error "variable-sized object" } */ diff --git gcc/testsuite/gcc.dg/vla-init-5.c gcc/testsuite/gcc.dg/vla-init-5.c index 2c249ecda..3c92a6e64 100644 --- gcc/testsuite/gcc.dg/vla-init-5.c +++ gcc/testsuite/gcc.dg/vla-init-5.c @@ -2,6 +2,7 @@ /* Origin: Joseph Myers */ /* { dg-do compile } */ /* { dg-options "" } */ +/* { dg-additional-options "-fno-allow-const-var-array-size" { target *-*-darwin* } } */ const int i = 1; void foo() { void *p = (char [][i]){ "" }; } /* { dg-error "variable-sized object" } */ diff --git gcc/testsuite/gcc.misc-tests/gcov-pr85350.c gcc/testsuite/gcc.misc-tests/gcov-pr85350.c index 7bb8b0a35..742fdade8 100644 --- gcc/testsuite/gcc.misc-tests/gcov-pr85350.c +++ gcc/testsuite/gcc.misc-tests/gcov-pr85350.c @@ -1,5 +1,6 @@ /* { dg-options "-fprofile-arcs -ftest-coverage" } */ /* { dg-do run } */ +/* { dg-additional-options "-fno-allow-const-var-array-size" { target *-*-darwin* } } */ int main (void) { diff --git gcc/testsuite/gcc.misc-tests/outputs.exp gcc/testsuite/gcc.misc-tests/outputs.exp index 3da6423c0..2aa0b666f 100644 --- gcc/testsuite/gcc.misc-tests/outputs.exp +++ gcc/testsuite/gcc.misc-tests/outputs.exp @@ -60,6 +60,8 @@ if !$skip_lto { # created, and thus fail. Configuring the compiler --with-gnu-ld # fixes this. set gld [check_effective_target_gld] +# Darwin's linker is not silent about missing -L values. +set ld64 [istarget *-*-darwin*] # Prepare additional options to be used for linking. # We do not compile to an executable, because that requires naming an output. @@ -185,7 +187,7 @@ proc outest { test sources opts dirs outputs } { foreach og $olist { if { [string index $og 0] == "!" } { global gspd ltop - global gld + global gld ld64 set cond [expr $og] continue } @@ -371,7 +373,12 @@ if !$skip_atsave { outest "$b-22 exe savetmp namedb-2" $sing "@$devnull -o $b.exe -save-temps" {} {{--0.i --0.s --0.o .args.0 !!$gld .ld1_args !0 .exe}} outest "$b-23 exe savetmp named2-2" $mult "@$devnull -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o .args.0 !!$gld .ld1_args !0 .exe}} outest "$b-24 exe savetmp named2-3" $mult "@$devnull -I dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 !!$gld .ld1_args !0 .exe}} -outest "$b-25 exe savetmp named2-4" $mult "@$devnull -I dummy -L dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 .args.3 !!$gld .ld1_args !0 .exe}} + if $ld64 { + # Darwin's linker warns about missing args to -L. + outest "$b-25 exe savetmp named2-4" $mult "@$devnull -I dummy -L dummy -o $b.exe -save-temps -Wl,-w" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 !!0 .args.3 !!$gld .ld1_args !0 .exe}} + } else { + outest "$b-25 exe savetmp named2-4" $mult "@$devnull -I dummy -L dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 .args.3 !!$gld .ld1_args !0 .exe}} + } } # Setting the main output to a dir selects it as the default aux&dump diff --git gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp index 1cdefdbcd..e6c6b96e0 100644 --- gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp +++ gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp @@ -25,6 +25,11 @@ if { ![istarget aarch64*-*-*] } then { return } +if { [istarget *-*-darwin*] } then { + # darwinpcs and mach-o will need different test mechanisms. + return +} + torture-init set-torture-options $C_TORTURE_OPTIONS set additional_flags "-W -Wall -Wno-abi -fno-pie -no-pie" diff --git gcc/testsuite/gcc.target/aarch64/advsimd_shl_add.c gcc/testsuite/gcc.target/aarch64/advsimd_shl_add.c index a161f89a3..d75c7c22d 100644 --- gcc/testsuite/gcc.target/aarch64/advsimd_shl_add.c +++ gcc/testsuite/gcc.target/aarch64/advsimd_shl_add.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-additional-options "--save-temps -O1" } */ +/* { dg-additional-options "--save-temps -O1 -std=c99" } */ /* { dg-final { check-function-bodies "**" "" "" } } */ typedef __INT64_TYPE__ __attribute__ ((vector_size (16))) v2di; diff --git gcc/testsuite/gcc.target/aarch64/and-be.c gcc/testsuite/gcc.target/aarch64/and-be.c index 7457dd5e3..b012ad350 100644 --- gcc/testsuite/gcc.target/aarch64/and-be.c +++ gcc/testsuite/gcc.target/aarch64/and-be.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -mbig-endian" } */ /* { dg-final { check-function-bodies "**" "" "" } } */ +/* { dg-skip-if "no big-endian support" *-*-darwin* } */ typedef short v4hi __attribute__ ((vector_size (8))); typedef char v8qi __attribute__ ((vector_size (8))); diff --git gcc/testsuite/gcc.target/aarch64/ands_3.c gcc/testsuite/gcc.target/aarch64/ands_3.c index 42cb7f0f0..31ba76939 100644 --- gcc/testsuite/gcc.target/aarch64/ands_3.c +++ gcc/testsuite/gcc.target/aarch64/ands_3.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2" } */ +/* { dg-skip-if "darwinpcs extends in the caller" *-*-darwin* } */ int f9 (unsigned char x, int y) diff --git gcc/testsuite/gcc.target/aarch64/arm_align_max_pwr.c gcc/testsuite/gcc.target/aarch64/arm_align_max_pwr.c index ffa4d2299..38b9ef01e 100644 --- gcc/testsuite/gcc.target/aarch64/arm_align_max_pwr.c +++ gcc/testsuite/gcc.target/aarch64/arm_align_max_pwr.c @@ -19,5 +19,7 @@ dummy () return result; } -/* { dg-final { scan-assembler-times "zero\t4" 2 } } */ -/* { dg-final { scan-assembler "zero\t268435452" } } */ +/* { dg-final { scan-assembler-times "zero\t4" 2 { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler "zero\t268435452" { target { ! *-*-darwin*} } } } */ +/* { dg-final { scan-assembler-times ".zerofill __DATA,__bss,_y,4,28" 1 { target { *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times ".zerofill __DATA,__bss,_x,4,28" 1 { target { *-*-darwin* } } } } */ diff --git gcc/testsuite/gcc.target/aarch64/auto-init-2.c gcc/testsuite/gcc.target/aarch64/auto-init-2.c index 375befd32..3a0387a59 100644 --- gcc/testsuite/gcc.target/aarch64/auto-init-2.c +++ gcc/testsuite/gcc.target/aarch64/auto-init-2.c @@ -12,11 +12,11 @@ enum E { N3 }; -extern void bar (char, short, int, enum E, long, long long, int *, bool); +extern void bar (unsigned char, short, int, enum E, long, long long, int *, bool); void foo() { - char temp1; + unsigned char temp1; short temp2; int temp3; enum E temp4; diff --git gcc/testsuite/gcc.target/aarch64/auto-init-3.c gcc/testsuite/gcc.target/aarch64/auto-init-3.c index 7008f76b2..85a4e4dae 100644 --- gcc/testsuite/gcc.target/aarch64/auto-init-3.c +++ gcc/testsuite/gcc.target/aarch64/auto-init-3.c @@ -2,13 +2,19 @@ /* { dg-do compile } */ /* { dg-options "-ftrivial-auto-var-init=zero -fdump-rtl-expand" } */ -long double result; +#ifdef __APPLE__ +# define TYPE _Float128 +#else +# define TYPE long double +#endif -long double foo() +TYPE result; + +TYPE foo() { float temp1; double temp2; - long double temp3; + TYPE temp3; result = temp1 + temp2 + temp3; return result; diff --git gcc/testsuite/gcc.target/aarch64/auto-init-4.c gcc/testsuite/gcc.target/aarch64/auto-init-4.c index 10197045b..0c6840ba2 100644 --- gcc/testsuite/gcc.target/aarch64/auto-init-4.c +++ gcc/testsuite/gcc.target/aarch64/auto-init-4.c @@ -2,13 +2,19 @@ /* { dg-do compile } */ /* { dg-options "-O -ftrivial-auto-var-init=pattern -fdump-rtl-expand" } */ -long double result; +#ifdef __APPLE__ +# define TYPE _Float128 +#else +# define TYPE long double +#endif -long double foo() +TYPE result; + +TYPE foo() { float temp1; double temp2; - long double temp3; + TYPE temp3; result = temp1 + temp2 + temp3; return result; diff --git gcc/testsuite/gcc.target/aarch64/auto-init-5.c gcc/testsuite/gcc.target/aarch64/auto-init-5.c index ac69ac3df..0dda3c201 100644 --- gcc/testsuite/gcc.target/aarch64/auto-init-5.c +++ gcc/testsuite/gcc.target/aarch64/auto-init-5.c @@ -2,14 +2,19 @@ /* { dg-do compile } */ /* { dg-options "-ftrivial-auto-var-init=zero" } */ +#ifdef __APPLE__ +# define TYPE _Float128 +#else +# define TYPE long double +#endif -_Complex long double result; +_Complex TYPE result; -_Complex long double foo() +_Complex TYPE foo() { _Complex float temp1; _Complex double temp2; - _Complex long double temp3; + _Complex TYPE temp3; result = temp1 + temp2 + temp3; return result; diff --git gcc/testsuite/gcc.target/aarch64/auto-init-6.c gcc/testsuite/gcc.target/aarch64/auto-init-6.c index 0456c66f4..23323115a 100644 --- gcc/testsuite/gcc.target/aarch64/auto-init-6.c +++ gcc/testsuite/gcc.target/aarch64/auto-init-6.c @@ -2,14 +2,19 @@ /* { dg-do compile } */ /* { dg-options "-ftrivial-auto-var-init=pattern" } */ +#ifdef __APPLE__ +# define TYPE _Float128 +#else +# define TYPE long double +#endif -_Complex long double result; +_Complex TYPE result; -_Complex long double foo() +_Complex TYPE foo() { _Complex float temp1; _Complex double temp2; - _Complex long double temp3; + _Complex TYPE temp3; result = temp1 + temp2 + temp3; return result; diff --git gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2-extra.c gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2-extra.c index 3b2c932ac..d44428814 100644 --- gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2-extra.c +++ gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2-extra.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "Darwin ABI is different, test separately" { *-*-darwin* } } */ /* { dg-options "-O2 -fno-stack-protector -save-temps" } */ #define ALIGN 16 diff --git gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2.c gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2.c index ee5d6faa4..aca137ec7 100644 --- gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2.c +++ gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "Darwin ABI is different, test separately" { *-*-darwin* } } */ /* { dg-options "-O2 -fno-stack-protector -save-temps" } */ #define ALIGN 16 diff --git gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2-extra.c gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2-extra.c index 6d4a883a9..782aab485 100644 --- gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2-extra.c +++ gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2-extra.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "Darwin ABI is different, test separately" { *-*-darwin* } } */ /* { dg-options "-O2 -fno-stack-protector -save-temps" } */ #define ALIGN 32 diff --git gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2.c gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2.c index 331daba35..2511c3dcb 100644 --- gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2.c +++ gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "Darwin ABI is different, test separately" { *-*-darwin* } } */ /* { dg-options "-O2 -fno-stack-protector -save-temps" } */ #define ALIGN 32 diff --git gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align8-O2.c gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align8-O2.c index e6d45f5dd..fef850147 100644 --- gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align8-O2.c +++ gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align8-O2.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "Darwin ABI is different, test separately" { *-*-darwin* } } */ /* { dg-options "-O2 -fno-stack-protector -save-temps" } */ #define ALIGN 8 diff --git gcc/testsuite/gcc.target/aarch64/bitfield-bitint-abi-align16.c gcc/testsuite/gcc.target/aarch64/bitfield-bitint-abi-align16.c index c29a230a7..46cf39048 100644 --- gcc/testsuite/gcc.target/aarch64/bitfield-bitint-abi-align16.c +++ gcc/testsuite/gcc.target/aarch64/bitfield-bitint-abi-align16.c @@ -1,5 +1,6 @@ /* { dg-do compile { target bitint } } */ /* { dg-additional-options "-std=c23 -O2 -fno-stack-protector -save-temps -fno-schedule-insns -fno-schedule-insns2 -fno-late-combine-instructions" } */ +/* { dg-skip-if "aligned x-reg passing is altered by darwinpcs" { aarch64-*-darwin* } } */ /* { dg-final { check-function-bodies "**" "" "" } } */ #define ALIGN 16 diff --git gcc/testsuite/gcc.target/aarch64/bitfield-bitint-abi-align8.c gcc/testsuite/gcc.target/aarch64/bitfield-bitint-abi-align8.c index 13ffbf416..3a64c36fe 100644 --- gcc/testsuite/gcc.target/aarch64/bitfield-bitint-abi-align8.c +++ gcc/testsuite/gcc.target/aarch64/bitfield-bitint-abi-align8.c @@ -1,5 +1,6 @@ /* { dg-do compile { target bitint } } */ /* { dg-additional-options "-std=c23 -O2 -fno-stack-protector -save-temps -fno-schedule-insns -fno-schedule-insns2 -fno-late-combine-instructions" } */ +/* { dg-skip-if "aligned x-reg passing is altered by darwinpcs" { aarch64-*-darwin* } } */ /* { dg-final { check-function-bodies "**" "" "" } } */ #define ALIGN 8 diff --git gcc/testsuite/gcc.target/aarch64/bti-4.c gcc/testsuite/gcc.target/aarch64/bti-4.c index 28495a5c1..109ab60fc 100644 --- gcc/testsuite/gcc.target/aarch64/bti-4.c +++ gcc/testsuite/gcc.target/aarch64/bti-4.c @@ -56,5 +56,7 @@ retbr_trampolines2 (void *a, int b) return 0; } -/* Trampoline should have BTI C. */ -/* { dg-final { scan-assembler "\.LTRAMP0:\n\thint\t34" } } */ +/* Trampoline should have BTI C. + but Darwin trampolines are constructed on demand by a builtin and do not + appear in the generated code for this TU. */ +/* { dg-final { scan-assembler "\.LTRAMP0:\n\thint\t34" { target { ! *-*-darwin* } } } } */ diff --git gcc/testsuite/gcc.target/aarch64/c-output-template-2.c gcc/testsuite/gcc.target/aarch64/c-output-template-2.c index ced96d045..86e4f5fa8 100644 --- gcc/testsuite/gcc.target/aarch64/c-output-template-2.c +++ gcc/testsuite/gcc.target/aarch64/c-output-template-2.c @@ -6,4 +6,4 @@ test (void) __asm__ ("@ %c0" : : "S" (test)); } -/* { dg-final { scan-assembler "@ test" } } */ +/* { dg-final { scan-assembler "@ _?test" } } */ diff --git gcc/testsuite/gcc.target/aarch64/c-output-template-3.c gcc/testsuite/gcc.target/aarch64/c-output-template-3.c index 8bde4cbeb..4531a3815 100644 --- gcc/testsuite/gcc.target/aarch64/c-output-template-3.c +++ gcc/testsuite/gcc.target/aarch64/c-output-template-3.c @@ -7,4 +7,4 @@ test (void) __asm__ ("@ %c0" : : "S" (&test + 4)); } -/* { dg-final { scan-assembler "@ test\\+4" } } */ +/* { dg-final { scan-assembler "@ _?test\\+4" } } */ diff --git gcc/testsuite/gcc.target/aarch64/c-output-template-4.c gcc/testsuite/gcc.target/aarch64/c-output-template-4.c index c5a93915a..800d52bfa 100644 --- gcc/testsuite/gcc.target/aarch64/c-output-template-4.c +++ gcc/testsuite/gcc.target/aarch64/c-output-template-4.c @@ -7,4 +7,4 @@ test (void) __asm__ ("@ %c0" : : "S" (&test + 4)); } -/* { dg-final { scan-assembler "@ test\\+4" } } */ +/* { dg-final { scan-assembler "@ _?test\\+4" } } */ diff --git gcc/testsuite/gcc.target/aarch64/chkfeat-2.c gcc/testsuite/gcc.target/aarch64/chkfeat-2.c index f98d7096f..5da74cd7e 100644 --- gcc/testsuite/gcc.target/aarch64/chkfeat-2.c +++ gcc/testsuite/gcc.target/aarch64/chkfeat-2.c @@ -13,7 +13,7 @@ void bar (void); ** ... ** hint 40 // chkfeat x16 ** ... -** bl bar +** bl _?bar ** ... ** mov x16, 1 ** ... diff --git gcc/testsuite/gcc.target/aarch64/cmpbr-1.c gcc/testsuite/gcc.target/aarch64/cmpbr-1.c index 39f1549ed..516440fd9 100644 --- gcc/testsuite/gcc.target/aarch64/cmpbr-1.c +++ gcc/testsuite/gcc.target/aarch64/cmpbr-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2" } */ +/* { dg-require-effective-target aarch64_asm_cmpbr_ok } */ /* PR target/121385 */ #pragma GCC target "+cmpbr" diff --git gcc/testsuite/gcc.target/aarch64/cmpbr-2.c gcc/testsuite/gcc.target/aarch64/cmpbr-2.c index 2c2764f13..3913477e4 100644 --- gcc/testsuite/gcc.target/aarch64/cmpbr-2.c +++ gcc/testsuite/gcc.target/aarch64/cmpbr-2.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2" } */ +/* { dg-require-effective-target aarch64_asm_cmpbr_ok } */ /* PR target/121388 */ #pragma GCC target "+cmpbr" diff --git gcc/testsuite/gcc.target/aarch64/cmpbr-3.c gcc/testsuite/gcc.target/aarch64/cmpbr-3.c index ab0ba4816..1847e0b76 100644 --- gcc/testsuite/gcc.target/aarch64/cmpbr-3.c +++ gcc/testsuite/gcc.target/aarch64/cmpbr-3.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target aarch64_asm_cmpbr_ok } */ /* { dg-options "-O2" } */ #pragma GCC target "+cmpbr" diff --git gcc/testsuite/gcc.target/aarch64/cmpbr-4.c gcc/testsuite/gcc.target/aarch64/cmpbr-4.c index e266ce1cc..7ab1b0e7c 100644 --- gcc/testsuite/gcc.target/aarch64/cmpbr-4.c +++ gcc/testsuite/gcc.target/aarch64/cmpbr-4.c @@ -1,4 +1,5 @@ // { dg-do compile } +/* { dg-require-effective-target aarch64_asm_cmpbr_ok } */ // { dg-options "-O2" } #pragma GCC target "+cmpbr" diff --git gcc/testsuite/gcc.target/aarch64/cmpbr-5.c gcc/testsuite/gcc.target/aarch64/cmpbr-5.c index 049e8c107..ef7eeb021 100644 --- gcc/testsuite/gcc.target/aarch64/cmpbr-5.c +++ gcc/testsuite/gcc.target/aarch64/cmpbr-5.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target aarch64_asm_cmpbr_ok } */ /* { dg-options "-fgimple -O1" } */ #pragma GCC target "+cmpbr" typedef unsigned short us; diff --git gcc/testsuite/gcc.target/aarch64/cmpbr.c gcc/testsuite/gcc.target/aarch64/cmpbr.c index 23f462f7d..c8aba1864 100644 --- gcc/testsuite/gcc.target/aarch64/cmpbr.c +++ gcc/testsuite/gcc.target/aarch64/cmpbr.c @@ -1,7 +1,8 @@ // Test that the instructions added by FEAT_CMPBR are emitted // { dg-do compile } +/* { dg-require-effective-target aarch64_asm_cmpbr_ok } */ // { dg-options "-march=armv9.5-a+cmpbr -O2" } -// { dg-final { check-function-bodies "**" "*/" "" { target *-*-* } {\.L[0-9]+} } } +// { dg-final { check-function-bodies "**" "*/" "" { target *-*-* } {\.?L[0-9]+} } } #include @@ -120,1644 +121,1644 @@ FAR_BRANCH(u64, 42); /* ** u8_x0_eq_x1: -** cbbeq (?:w1, w0|w0, w1), .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbbeq (?:w1, w0|w0, w1), .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u8_x0_ne_x1: -** cbbne (?:w1, w0|w0, w1), .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbbne (?:w1, w0|w0, w1), .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u8_x0_ult_x1: -** (?:cbbhi w1, w0|cbblo w0, w1), .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** (?:cbbhi w1, w0|cbblo w0, w1), .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u8_x0_ule_x1: -** (?:cbbhs w1, w0|cbbls w0, w1), .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** (?:cbbhs w1, w0|cbbls w0, w1), .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u8_x0_ugt_x1: -** (?:cbblo w1, w0|cbbhi w0, w1), .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** (?:cbblo w1, w0|cbbhi w0, w1), .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u8_x0_uge_x1: -** (?:cbbls w1, w0|cbbhs w0, w1), .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** (?:cbbls w1, w0|cbbhs w0, w1), .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i8_x0_slt_x1: -** (?:cbbgt w1, w0|cbblt w0, w1), .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** (?:cbbgt w1, w0|cbblt w0, w1), .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i8_x0_sle_x1: -** (?:cbbge w1, w0|cbble w0, w1), .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** (?:cbbge w1, w0|cbble w0, w1), .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i8_x0_sgt_x1: -** (?:cbblt w1, w0|cbbgt w0, w1), .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** (?:cbblt w1, w0|cbbgt w0, w1), .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i8_x0_sge_x1: -** (?:cbble w1, w0|cbbge w0, w1), .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** (?:cbble w1, w0|cbbge w0, w1), .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u16_x0_eq_x1: -** cbheq (?:w1, w0|w0, w1), .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbheq (?:w1, w0|w0, w1), .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u16_x0_ne_x1: -** cbhne (?:w1, w0|w0, w1), .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbhne (?:w1, w0|w0, w1), .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u16_x0_ult_x1: -** (?:cbhhi w1, w0|cbhlo w0, w1), .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** (?:cbhhi w1, w0|cbhlo w0, w1), .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u16_x0_ule_x1: -** (?:cbhhs w1, w0|cbhls w0, w1), .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** (?:cbhhs w1, w0|cbhls w0, w1), .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u16_x0_ugt_x1: -** (?:cbhlo w1, w0|cbhhi w0, w1), .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** (?:cbhlo w1, w0|cbhhi w0, w1), .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u16_x0_uge_x1: -** (?:cbhls w1, w0|cbhhs w0, w1), .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** (?:cbhls w1, w0|cbhhs w0, w1), .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i16_x0_slt_x1: -** (?:cbhgt w1, w0|cbhlt w0, w1), .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** (?:cbhgt w1, w0|cbhlt w0, w1), .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i16_x0_sle_x1: -** (?:cbhge w1, w0|cbhle w0, w1), .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** (?:cbhge w1, w0|cbhle w0, w1), .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i16_x0_sgt_x1: -** (?:cbhlt w1, w0|cbhgt w0, w1), .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** (?:cbhlt w1, w0|cbhgt w0, w1), .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i16_x0_sge_x1: -** (?:cbhle w1, w0|cbhge w0, w1), .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** (?:cbhle w1, w0|cbhge w0, w1), .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u32_x0_eq_x1: -** cbeq w0, w1, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbeq w0, w1, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u32_x0_ne_x1: -** cbne w0, w1, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbne w0, w1, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u32_x0_ult_x1: -** cblo w0, w1, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cblo w0, w1, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u32_x0_ule_x1: -** cbls w0, w1, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbls w0, w1, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u32_x0_ugt_x1: -** cbhi w0, w1, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbhi w0, w1, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u32_x0_uge_x1: -** cbhs w0, w1, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbhs w0, w1, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i32_x0_slt_x1: -** cblt w0, w1, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cblt w0, w1, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i32_x0_sle_x1: -** cble w0, w1, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cble w0, w1, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i32_x0_sgt_x1: -** cbgt w0, w1, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbgt w0, w1, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i32_x0_sge_x1: -** cbge w0, w1, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbge w0, w1, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u64_x0_eq_x1: -** cbeq x0, x1, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbeq x0, x1, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u64_x0_ne_x1: -** cbne x0, x1, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbne x0, x1, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u64_x0_ult_x1: -** cblo x0, x1, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cblo x0, x1, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u64_x0_ule_x1: -** cbls x0, x1, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbls x0, x1, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u64_x0_ugt_x1: -** cbhi x0, x1, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbhi x0, x1, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u64_x0_uge_x1: -** cbhs x0, x1, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbhs x0, x1, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i64_x0_slt_x1: -** cblt x0, x1, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cblt x0, x1, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i64_x0_sle_x1: -** cble x0, x1, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cble x0, x1, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i64_x0_sgt_x1: -** cbgt x0, x1, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbgt x0, x1, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i64_x0_sge_x1: -** cbge x0, x1, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbge x0, x1, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u32_x0_eq_42: -** cbeq w0, 42, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbeq w0, 42, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u32_x0_ne_42: -** cbne w0, 42, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbne w0, 42, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u32_x0_ult_42: -** cbls w0, 41, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbls w0, 41, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u32_x0_ule_42: -** cbls w0, 42, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbls w0, 42, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u32_x0_ugt_42: -** cbhi w0, 42, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbhi w0, 42, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u32_x0_uge_42: -** cbhi w0, 41, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbhi w0, 41, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i32_x0_slt_42: -** cble w0, 41, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cble w0, 41, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i32_x0_sle_42: -** cble w0, 42, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cble w0, 42, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i32_x0_sgt_42: -** cbgt w0, 42, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbgt w0, 42, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i32_x0_sge_42: -** cbgt w0, 41, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbgt w0, 41, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u64_x0_eq_42: -** cbeq x0, 42, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbeq x0, 42, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u64_x0_ne_42: -** cbne x0, 42, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbne x0, 42, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u64_x0_ult_42: -** cbls x0, 41, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbls x0, 41, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u64_x0_ule_42: -** cbls x0, 42, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbls x0, 42, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u64_x0_ugt_42: -** cbhi x0, 42, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbhi x0, 42, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u64_x0_uge_42: -** cbhi x0, 41, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbhi x0, 41, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i64_x0_slt_42: -** cble x0, 41, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cble x0, 41, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i64_x0_sle_42: -** cble x0, 42, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cble x0, 42, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i64_x0_sgt_42: -** cbgt x0, 42, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbgt x0, 42, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i64_x0_sge_42: -** cbgt x0, 41, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbgt x0, 41, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u8_x0_eq_0: -** cbbeq w0, wzr, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbbeq w0, wzr, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u8_x0_ne_0: -** cbbne w0, wzr, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbbne w0, wzr, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u8_x0_ult_0: -** b not_taken +** b _?not_taken */ /* ** u8_x0_ule_0: -** cbbeq w0, wzr, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbbeq w0, wzr, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u8_x0_ugt_0: -** cbbne w0, wzr, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbbne w0, wzr, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u8_x0_uge_0: -** b taken +** b _?taken */ /* ** i8_x0_slt_0: -** tbnz w0, #7, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** tbnz w0, #7, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i8_x0_sle_0: -** cbble w0, wzr, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbble w0, wzr, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i8_x0_sgt_0: -** cbbgt w0, wzr, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbbgt w0, wzr, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i8_x0_sge_0: -** tbz w0, #7, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** tbz w0, #7, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u16_x0_eq_0: -** cbheq w0, wzr, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbheq w0, wzr, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u16_x0_ne_0: -** cbhne w0, wzr, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbhne w0, wzr, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u16_x0_ult_0: -** b not_taken +** b _?not_taken */ /* ** u16_x0_ule_0: -** cbheq w0, wzr, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbheq w0, wzr, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u16_x0_ugt_0: -** cbhne w0, wzr, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbhne w0, wzr, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u16_x0_uge_0: -** b taken +** b _?taken */ /* ** i16_x0_slt_0: -** tbnz w0, #15, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** tbnz w0, #15, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i16_x0_sle_0: -** cbhle w0, wzr, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbhle w0, wzr, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i16_x0_sgt_0: -** cbhgt w0, wzr, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbhgt w0, wzr, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i16_x0_sge_0: -** tbz w0, #15, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** tbz w0, #15, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u32_x0_eq_0: -** cbz w0, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbz w0, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u32_x0_ne_0: -** cbnz w0, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbnz w0, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u32_x0_ult_0: -** b not_taken +** b _?not_taken */ /* ** u32_x0_ule_0: -** cbz w0, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbz w0, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u32_x0_ugt_0: -** cbnz w0, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbnz w0, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u32_x0_uge_0: -** b taken +** b _?taken */ /* ** i32_x0_slt_0: -** tbnz w0, #31, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** tbnz w0, #31, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i32_x0_sle_0: -** cble w0, wzr, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cble w0, wzr, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i32_x0_sgt_0: -** cbgt w0, wzr, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbgt w0, wzr, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i32_x0_sge_0: -** tbz w0, #31, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** tbz w0, #31, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u64_x0_eq_0: -** cbz x0, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbz x0, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u64_x0_ne_0: -** cbnz x0, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbnz x0, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u64_x0_ult_0: -** b not_taken +** b _?not_taken */ /* ** u64_x0_ule_0: -** cbz x0, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbz x0, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u64_x0_ugt_0: -** cbnz x0, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbnz x0, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u64_x0_uge_0: -** b taken +** b _?taken */ /* ** i64_x0_slt_0: -** tbnz x0, #63, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** tbnz x0, #63, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i64_x0_sle_0: -** cble x0, xzr, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cble x0, xzr, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i64_x0_sgt_0: -** cbgt x0, xzr, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** cbgt x0, xzr, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i64_x0_sge_0: -** tbz x0, #63, .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** tbz x0, #63, .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u8_x0_eq_42: ** mov w([0-9]+), 42 -** cbbeq w0, w\1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbbeq w0, w\1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u8_x0_ne_42: ** mov (w[0-9]+), 42 -** cbbne w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbbne w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u8_x0_ult_42: ** mov (w[0-9]+), 41 -** cbbls w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbbls w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u8_x0_ule_42: ** mov (w[0-9]+), 42 -** cbbls w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbbls w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u8_x0_ugt_42: ** mov (w[0-9]+), 42 -** cbbhi w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbbhi w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u8_x0_uge_42: ** mov (w[0-9]+), 41 -** cbbhi w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbbhi w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i8_x0_slt_42: ** mov (w[0-9]+), 41 -** cbble w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbble w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i8_x0_sle_42: ** mov (w[0-9]+), 42 -** cbble w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbble w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i8_x0_sgt_42: ** mov (w[0-9]+), 42 -** cbbgt w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbbgt w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i8_x0_sge_42: ** mov (w[0-9]+), 41 -** cbbgt w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbbgt w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u16_x0_eq_42: ** mov w([0-9]+), 42 -** cbheq w0, w\1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbheq w0, w\1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u16_x0_ne_42: ** mov (w[0-9]+), 42 -** cbhne w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhne w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u16_x0_ult_42: ** mov (w[0-9]+), 41 -** cbhls w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhls w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u16_x0_ule_42: ** mov (w[0-9]+), 42 -** cbhls w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhls w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u16_x0_ugt_42: ** mov (w[0-9]+), 42 -** cbhhi w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhhi w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u16_x0_uge_42: ** mov (w[0-9]+), 41 -** cbhhi w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhhi w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i16_x0_slt_42: ** mov (w[0-9]+), 41 -** cbhle w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhle w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i16_x0_sle_42: ** mov (w[0-9]+), 42 -** cbhle w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhle w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i16_x0_sgt_42: ** mov (w[0-9]+), 42 -** cbhgt w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhgt w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i16_x0_sge_42: ** mov (w[0-9]+), 41 -** cbhgt w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhgt w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u8_x0_eq_64: ** mov w([0-9]+), 64 -** cbbeq w0, w\1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbbeq w0, w\1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u8_x0_ne_64: ** mov (w[0-9]+), 64 -** cbbne w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbbne w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u8_x0_ult_64: ** mov (w[0-9]+), 63 -** cbbls w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbbls w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u8_x0_ule_64: ** mov (w[0-9]+), 64 -** cbbls w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbbls w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u8_x0_ugt_64: ** mov (w[0-9]+), 64 -** cbbhi w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbbhi w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u8_x0_uge_64: ** mov (w[0-9]+), 63 -** cbbhi w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbbhi w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i8_x0_slt_64: ** mov (w[0-9]+), 63 -** cbble w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbble w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i8_x0_sle_64: ** mov (w[0-9]+), 64 -** cbble w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbble w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i8_x0_sgt_64: ** mov (w[0-9]+), 64 -** cbbgt w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbbgt w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i8_x0_sge_64: ** mov (w[0-9]+), 63 -** cbbgt w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbbgt w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u16_x0_eq_64: ** mov w([0-9]+), 64 -** cbheq w0, w\1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbheq w0, w\1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u16_x0_ne_64: ** mov (w[0-9]+), 64 -** cbhne w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhne w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u16_x0_ult_64: ** mov (w[0-9]+), 63 -** cbhls w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhls w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u16_x0_ule_64: ** mov (w[0-9]+), 64 -** cbhls w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhls w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u16_x0_ugt_64: ** mov (w[0-9]+), 64 -** cbhhi w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhhi w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u16_x0_uge_64: ** mov (w[0-9]+), 63 -** cbhhi w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhhi w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i16_x0_slt_64: ** mov (w[0-9]+), 63 -** cbhle w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhle w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i16_x0_sle_64: ** mov (w[0-9]+), 64 -** cbhle w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhle w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i16_x0_sgt_64: ** mov (w[0-9]+), 64 -** cbhgt w0, w1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhgt w0, w1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i16_x0_sge_64: ** mov (w[0-9]+), 63 -** cbhgt w0, w1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhgt w0, w1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u32_x0_eq_64: ** cmp w0, 64 -** beq .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** beq .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u32_x0_ne_64: ** cmp w0, 64 -** bne .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** bne .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u32_x0_ult_64: { xfail *-*-* } -** cbhi w0, 63, .L([0-9]+) -** b taken -** .L\1: -** b not_taken +** cbhi w0, 63, .?L([0-9]+) +** b _?taken +** .?L\1: +** b _?not_taken */ /* ** u32_x0_ule_64: ** cmp w0, 64 -** bls .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** bls .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u32_x0_ugt_64: ** cmp w0, 64 -** bhi .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** bhi .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u32_x0_uge_64: ** cmp w0, 63 -** bhi .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** bhi .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i32_x0_slt_64: { xfail *-*-* } -** cbgt w0, 63, .L([0-9]+) -** b taken -** .L\1: -** b not_taken +** cbgt w0, 63, .?L([0-9]+) +** b _?taken +** .?L\1: +** b _?not_taken */ /* ** i32_x0_sle_64: ** cmp w0, 64 -** ble .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** ble .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i32_x0_sgt_64: ** cmp w0, 64 -** bgt .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** bgt .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i32_x0_sge_64: ** cmp w0, 63 -** bgt .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** bgt .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u64_x0_eq_64: ** cmp x0, 64 -** beq .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** beq .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u64_x0_ne_64: ** cmp x0, 64 -** bne .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** bne .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u64_x0_ult_64: { xfail *-*-* } -** cbhi x0, 63, .L([0-9]+) -** b taken -** .L\1: -** b not_taken +** cbhi x0, 63, .?L([0-9]+) +** b _?taken +** .?L\1: +** b _?not_taken */ /* ** u64_x0_ule_64: ** cmp x0, 64 -** bls .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** bls .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u64_x0_ugt_64: ** cmp x0, 64 -** bhi .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** bhi .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u64_x0_uge_64: ** cmp x0, 63 -** bhi .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** bhi .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i64_x0_slt_64: { xfail *-*-* } -** cbgt x0, 63, .L([0-9]+) -** b taken -** .L\1: -** b not_taken +** cbgt x0, 63, .?L([0-9]+) +** b _?taken +** .?L\1: +** b _?not_taken */ /* ** i64_x0_sle_64: ** cmp x0, 64 -** ble .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** ble .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i64_x0_sgt_64: ** cmp x0, 64 -** bgt .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** bgt .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** i64_x0_sge_64: ** cmp x0, 63 -** bgt .L([0-9]+) -** b not_taken -** .L\1: -** b taken +** bgt .?L([0-9]+) +** b _?not_taken +** .?L\1: +** b _?taken */ /* ** u16_x0_eq_4098: ** mov w([0-9]+), 4098 -** cbheq w0, w\1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbheq w0, w\1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u16_x0_ne_4098: ** mov (w[0-9]+), 4098 -** cbhne w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhne w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u16_x0_ult_4098: ** mov (w[0-9]+), 4097 -** cbhls w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhls w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u16_x0_ule_4098: ** mov (w[0-9]+), 4098 -** cbhls w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhls w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u16_x0_ugt_4098: ** mov (w[0-9]+), 4098 -** cbhhi w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhhi w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u16_x0_uge_4098: ** mov (w[0-9]+), 4097 -** cbhhi w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhhi w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i16_x0_slt_4098: ** mov (w[0-9]+), 4097 -** cbhle w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhle w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i16_x0_sle_4098: ** mov (w[0-9]+), 4098 -** cbhle w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhle w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i16_x0_sgt_4098: ** mov (w[0-9]+), 4098 -** cbhgt w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhgt w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i16_x0_sge_4098: ** mov (w[0-9]+), 4097 -** cbhgt w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhgt w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u32_x0_eq_4098: ** mov w([0-9]+), 4098 -** cbeq w0, w\1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbeq w0, w\1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u32_x0_ne_4098: ** mov (w[0-9]+), 4098 -** cbne w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbne w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u32_x0_ult_4098: ** mov (w[0-9]+), 4097 -** cbls w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbls w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u32_x0_ule_4098: ** mov (w[0-9]+), 4098 -** cbls w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbls w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u32_x0_ugt_4098: ** mov (w[0-9]+), 4098 -** cbhi w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhi w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u32_x0_uge_4098: ** mov (w[0-9]+), 4097 -** cbhi w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhi w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i32_x0_slt_4098: ** mov (w[0-9]+), 4097 -** cble w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cble w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i32_x0_sle_4098: ** mov (w[0-9]+), 4098 -** cble w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cble w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i32_x0_sgt_4098: ** mov (w[0-9]+), 4098 -** cbgt w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbgt w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i32_x0_sge_4098: ** mov (w[0-9]+), 4097 -** cbgt w0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbgt w0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u64_x0_eq_4098: ** mov x([0-9]+), 4098 -** cbeq x0, x\1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbeq x0, x\1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u64_x0_ne_4098: ** mov (x[0-9]+), 4098 -** cbne x0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbne x0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u64_x0_ult_4098: ** mov (x[0-9]+), 4097 -** cbls x0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbls x0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u64_x0_ule_4098: ** mov (x[0-9]+), 4098 -** cbls x0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbls x0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u64_x0_ugt_4098: ** mov (x[0-9]+), 4098 -** cbhi x0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhi x0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** u64_x0_uge_4098: ** mov (x[0-9]+), 4097 -** cbhi x0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbhi x0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i64_x0_slt_4098: ** mov (x[0-9]+), 4097 -** cble x0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cble x0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i64_x0_sle_4098: ** mov (x[0-9]+), 4098 -** cble x0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cble x0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i64_x0_sgt_4098: ** mov (x[0-9]+), 4098 -** cbgt x0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbgt x0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** i64_x0_sge_4098: ** mov (x[0-9]+), 4097 -** cbgt x0, \1, .L([0-9]+) -** b not_taken -** .L\2: -** b taken +** cbgt x0, \1, .?L([0-9]+) +** b _?not_taken +** .?L\2: +** b _?taken */ /* ** far_branch_u8_x0_eq_x1: ** sub sp, sp, #16 ** str wzr, \[sp, 12\] -** cbbeq w0|w1, w1|w0, .L([0-9]+) -** b .L([0-9]+) -** .L\1: +** cbbeq w0|w1, w1|w0, .?L([0-9]+) +** b .?L([0-9]+) +** .?L\1: ** str wzr, \[sp, 12\] ** ... ** str wzr, \[sp, 12\] -** .L\2: +** .?L\2: ** add sp, sp, 16 -** b taken +** b _?taken */ /* ** far_branch_u16_x0_eq_x1: ** sub sp, sp, #16 ** str wzr, \[sp, 12\] -** cbheq w0|w1, w1|w0, .L([0-9]+) -** b .L([0-9]+) -** .L\1: +** cbheq w0|w1, w1|w0, .?L([0-9]+) +** b .?L([0-9]+) +** .?L\1: ** str wzr, \[sp, 12\] ** ... ** str wzr, \[sp, 12\] -** .L\2: +** .?L\2: ** add sp, sp, 16 -** b taken +** b _?taken */ /* ** far_branch_u32_x0_eq_x1: ** sub sp, sp, #16 ** str wzr, \[sp, 12\] -** cbeq w0, w1, .L([0-9]+) -** b .L([0-9]+) -** .L\1: +** cbeq w0, w1, .?L([0-9]+) +** b .?L([0-9]+) +** .?L\1: ** str wzr, \[sp, 12\] ** ... ** str wzr, \[sp, 12\] -** .L\2: +** .?L\2: ** add sp, sp, 16 -** b taken +** b _?taken */ /* ** far_branch_u64_x0_eq_x1: ** sub sp, sp, #16 ** str wzr, \[sp, 12\] -** cbeq x0, x1, .L([0-9]+) -** b .L([0-9]+) -** .L\1: +** cbeq x0, x1, .?L([0-9]+) +** b .?L([0-9]+) +** .?L\1: ** str wzr, \[sp, 12\] ** ... ** str wzr, \[sp, 12\] -** .L\2: +** .?L\2: ** add sp, sp, 16 -** b taken +** b _?taken */ /* @@ -1765,15 +1766,15 @@ FAR_BRANCH(u64, 42); ** sub sp, sp, #16 ** mov w([0-9]+), 42 ** str wzr, \[sp, 12\] -** cbbeq w0, w\1, .L([0-9]+) -** b .L([0-9]+) -** .L\2: +** cbbeq w0, w\1, .?L([0-9]+) +** b .?L([0-9]+) +** .?L\2: ** str wzr, \[sp, 12\] ** ... ** str wzr, \[sp, 12\] -** .L\3: +** .?L\3: ** add sp, sp, 16 -** b taken +** b _?taken */ /* @@ -1781,43 +1782,43 @@ FAR_BRANCH(u64, 42); ** sub sp, sp, #16 ** mov w([0-9]+), 42 ** str wzr, \[sp, 12\] -** cbheq w0, w\1, .L([0-9]+) -** b .L([0-9]+) -** .L\2: +** cbheq w0, w\1, .?L([0-9]+) +** b .?L([0-9]+) +** .?L\2: ** str wzr, \[sp, 12\] ** ... ** str wzr, \[sp, 12\] -** .L\3: +** .?L\3: ** add sp, sp, 16 -** b taken +** b _?taken */ /* ** far_branch_u32_x0_eq_42: ** sub sp, sp, #16 ** str wzr, \[sp, 12\] -** cbeq w0, 42, .L([0-9]+) -** b .L([0-9]+) -** .L\1: +** cbeq w0, 42, .?L([0-9]+) +** b .?L([0-9]+) +** .?L\1: ** str wzr, \[sp, 12\] ** ... ** str wzr, \[sp, 12\] -** .L\2: +** .?L\2: ** add sp, sp, 16 -** b taken +** b _?taken */ /* ** far_branch_u64_x0_eq_42: ** sub sp, sp, #16 ** str wzr, \[sp, 12\] -** cbeq x0, 42, .L([0-9]+) -** b .L([0-9]+) -** .L\1: +** cbeq x0, 42, .?L([0-9]+) +** b .?L([0-9]+) +** .?L\1: ** str wzr, \[sp, 12\] ** ... ** str wzr, \[sp, 12\] -** .L\2: +** .?L\2: ** add sp, sp, 16 -** b taken +** b _?taken */ diff --git gcc/testsuite/gcc.target/aarch64/cpymem-size.c gcc/testsuite/gcc.target/aarch64/cpymem-size.c index 4a6f2495d..b8ef4745c 100644 --- gcc/testsuite/gcc.target/aarch64/cpymem-size.c +++ gcc/testsuite/gcc.target/aarch64/cpymem-size.c @@ -6,7 +6,7 @@ /* ** cpy_127: ** mov (w|x)2, 127 -** b memcpy +** b _?memcpy */ void cpy_127 (char *out, char *in) @@ -17,7 +17,7 @@ cpy_127 (char *out, char *in) /* ** cpy_128: ** mov (w|x)2, 128 -** b memcpy +** b _?memcpy */ void cpy_128 (char *out, char *in) diff --git gcc/testsuite/gcc.target/aarch64/darwin/aarch64-darwin.exp gcc/testsuite/gcc.target/aarch64/darwin/aarch64-darwin.exp new file mode 100644 index 000000000..b0b7f49ae --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/aarch64-darwin.exp @@ -0,0 +1,46 @@ +# Specific tests for the darwinpcs and codegen. +# Copyright (C) GNU Toolchain Authors +# Contributed by Iain Sandoe +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . */ + +# GCC testsuite that uses the `dg.exp' driver. + +# Exit immediately if this isn't aarch64-darwin. + +if { ![istarget aarch64*-*-darwin*] } then { + return +} + +# Load support procs. +load_lib gcc-dg.exp + +# If a testcase doesn't have special options, use these. +global DEFAULT_CFLAGS +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS " -ansi -pedantic-errors" +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \ + "" $DEFAULT_CFLAGS + +# All done. +dg-finish diff --git gcc/testsuite/gcc.target/aarch64/darwin/complex-in-regs.c gcc/testsuite/gcc.target/aarch64/darwin/complex-in-regs.c new file mode 100644 index 000000000..9c9e8b877 --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/complex-in-regs.c @@ -0,0 +1,95 @@ +/* { dg-do compile } */ +/* we need this for complex and gnu initializers. */ +/* { dg-options "-std=gnu99 " } */ +/* We use the sections anchors to make the code easier to match. */ +/* { dg-additional-options " -O -fsection-anchors -fno-schedule-insns -fno-schedule-insns2 " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + + +__attribute__((__noinline__)) +_Complex char +cc_regs_fun (_Complex char r0, _Complex char r1, + _Complex char r2, _Complex char r3, + _Complex char r4, _Complex char r5, + _Complex char r6, _Complex char r7); + +/* +**call_cc_regs_fun: +** ... +** ldrh w7, \[x0\] +** ldrh w6, \[x0, 2\] +** ldrh w5, \[x0, 4\] +** ldrh w4, \[x0, 6\] +** ldrh w3, \[x0, 8\] +** ldrh w2, \[x0, 10\] +** ldrh w1, \[x0, 12\] +** ldrh w0, \[x0, 14]\ +** bl _cc_regs_fun +** ... +*/ + +_Complex char +call_cc_regs_fun (void) +{ + return cc_regs_fun ((_Complex char) (1 + 1i), (_Complex char) (2 + 2i), + (_Complex char) (3 + 3i), (_Complex char) (4 + 4i), + (_Complex char) (5 + 5i), (_Complex char) (6 + 6i), + (_Complex char) (7 + 7i), (_Complex char) (8 + 8i)); +} + + +__attribute__((__noinline__)) +_Complex short +cs_regs_fun (_Complex short r0, _Complex short r1, + _Complex short r2, _Complex short r3, + _Complex short r4, _Complex short r5, + _Complex short r6, _Complex short r7); + +/* +**call_cs_regs_fun: +** ... +** ldp w7, w6, \[x0, 16\] +** ldp w5, w4, \[x0, 24\] +** ldp w3, w2, \[x0, 32\] +** ldp w1, w0, \[x0, 40\] +** bl _cs_regs_fun +** ... +*/ + +__attribute__((__noinline__)) +_Complex short +call_cs_regs_fun (void) +{ + return cs_regs_fun ((_Complex short) (1 + 1i), (_Complex short) (2 + 2i), + (_Complex short) (3 + 3i), (_Complex short) (4 + 4i), + (_Complex short) (5 + 5i), (_Complex short) (6 + 6i), + (_Complex short) (7 + 7i), (_Complex short) (8 + 8i)); +} + +__attribute__((__noinline__)) +_Complex int +ci_regs_fun (_Complex int r0, _Complex int r1, + _Complex int r2, _Complex int r3, + _Complex int r4, _Complex int r5, + _Complex int r6, _Complex int r7); + +/* +**call_ci_regs_fun: +** ... +** ldp x7, x6, \[x0, 48\] +** ldp x5, x4, \[x0, 64\] +** ldp x3, x2, \[x0, 80\] +** ldp x1, x0, \[x0, 96\] +** bl _ci_regs_fun +** ... +*/ + +__attribute__((__noinline__)) +_Complex int +call_ci_regs_fun (void) +{ + return ci_regs_fun ((_Complex int) (1 + 1i), (_Complex int) (2 + 2i), + (_Complex int) (3 + 3i), (_Complex int) (4 + 4i), + (_Complex int) (5 + 5i), (_Complex int) (6 + 6i), + (_Complex int) (7 + 7i), (_Complex int) (8 + 8i)); +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d1.c gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d1.c new file mode 100644 index 000000000..e2dd574fa --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d1.c @@ -0,0 +1,54 @@ +/* { dg-do compile } */ +/* we need this for the empty struct. */ +/* { dg-options "-std=gnu99 " } */ +/* { dg-additional-options "-O -fno-schedule-insns -fno-schedule-insns2 " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +/* Make sure we do no consume any registers in passing zero-sized entities */ + +typedef struct es {} Empty; + +__attribute__((__noinline__)) void +use_no_regs (int a, Empty b, int c, Empty d, Empty e, int f); + +/* +**call_use_no_regs: +** ... +** mov w2, 3 +** mov w1, 2 +** mov w0, 1 +** bl _use_no_regs +** ... +*/ + +__attribute__((__noinline__)) void +call_use_no_regs (void) +{ + Empty e; + use_no_regs (1, e, 2, e, e, 3); +} + +/* Make sure we consume no stack in passing zero-sized entities. */ + +/* +**call_use_no_stack: +** ... +** mov w[0-9]+, 108 +** strb w[0-9]+, \[sp, 1\] +** mov w[0-9]+, 106 +** strb w[0-9]+, \[sp\] +** ... +** bl _use_no_stack +** ... +*/ + +__attribute__((__noinline__)) void +use_no_stack (int a, int b, int c, int d, int e, int f, int g, int h, + Empty i, char j, Empty k, char l); + +void +call_use_no_stack (void) +{ + Empty e; + use_no_stack (0, 1, 2, 3, 4, 5, 6, 7, e, 'j', e, 'l'); +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-00.c gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-00.c new file mode 100644 index 000000000..4b10db5f8 --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-00.c @@ -0,0 +1,125 @@ +/* { dg-do compile } */ +/* { dg-additional-options " -O -fno-schedule-insns -fno-schedule-insns2 " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +/* In each case we consume the parm registers with 8 ints, forcing + the test values to be spilled to the stack. */ + +/* The important thing here is that the chars are assigned to the stack + * with no padding - so that they occupy bytes 0-8. */ + +/* +**call_char_packing: +** ... +** mov w[0-9]+, 113 +** strb w[0-9]+, \[sp, 8\] +** mov w[0-9]+, 112 +** strb w[0-9]+, \[sp, 7\] +** mov w[0-9]+, 111 +** strb w[0-9]+, \[sp, 6\] +** mov w[0-9]+, 110 +** strb w[0-9]+, \[sp, 5\] +** mov w[0-9]+, 109 +** strb w[0-9]+, \[sp, 4\] +** mov w[0-9]+, 108 +** strb w[0-9]+, \[sp, 3\] +** mov w[0-9]+, 107 +** strb w[0-9]+, \[sp, 2\] +** mov w[0-9]+, 106 +** strb w[0-9]+, \[sp, 1\] +** mov w[0-9]+, 105 +** strb w[0-9]+, \[sp\] +** mov w7, 7 +** mov w6, 6 +** mov w5, 5 +** mov w4, 4 +** mov w3, 3 +** mov w2, 2 +** mov w1, 1 +** mov w0, 0 +** bl _char_packing +** ... +*/ + +__attribute__((__noinline__)) void +char_packing (int a, int b, int c, int d, int e, int f, int g, int h, + char i, char j, char k, char l, + char m, char n, char o, char p, + char q); + +void call_char_packing (void) +{ + char_packing (0, 1, 2, 3, 4, 5, 6, 7, + 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q'); +} + +/* Here we should occupy the first 7 short words on the stack. */ + +/* +**call_short_packing: +** ... +** mov w[0-9]+, 12 +** strh w[0-9]+, \[sp, 8\] +** mov w[0-9]+, 11 +** strh w[0-9]+, \[sp, 6\] +** mov w[0-9]+, 10 +** strh w[0-9]+, \[sp, 4\] +** mov w[0-9]+, 9 +** strh w[0-9]+, \[sp, 2\] +** mov w[0-9]+, 8 +** strh w[0-9]+, \[sp\] +** mov w7, 7 +** mov w6, 6 +** mov w5, 5 +** mov w4, 4 +** mov w3, 3 +** mov w2, 2 +** mov w1, 1 +** mov w0, 0 +** bl _short_packing +** ... +*/ + +__attribute__((__noinline__)) void +short_packing (int a, int b, int c, int d, int e, int f, int g, int h, + short i, short j, short k, short l, + short m); + +void call_short_packing (void) +{ + short_packing (0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12); +} + +/* Here we should occupy the first 3 ints on the stack. */ + +/* +**call_int_packing: +** ... +** mov w[0-9]+, 10 +** str w[0-9]+, \[sp, 8\] +** mov w[0-9]+, 9 +** mov w[0-9]+, 8 +** stp w[0-9]+, w[0-9]+, \[sp\] +** mov w7, 7 +** mov w6, 6 +** mov w5, 5 +** mov w4, 4 +** mov w3, 3 +** mov w2, 2 +** mov w1, 1 +** mov w0, 0 +** bl _int_packing +** ... +*/ + +__attribute__((__noinline__)) void +int_packing (int a, int b, int c, int d, int e, int f, int g, int h, + int i, int j, int k); + +void call_int_packing (void) +{ + int_packing (0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10); +} + diff --git gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-01.c gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-01.c new file mode 100644 index 000000000..d21fd551b --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-01.c @@ -0,0 +1,115 @@ +/* { dg-do compile } */ +/* { dg-additional-options " -O -fno-schedule-insns -fno-schedule-insns2 " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +/* In each case we consume the parm registers with 8 ints, forcing + the test values to be spilled to the stack. */ + +/* char short char short - everything on 2byte boundaries */ + +/* +**call_c_s_packing: +** ... +** mov w[0-9]+, 109 +** strb w[0-9]+, \[sp, 8\] +** mov w[0-9]+, 9 +** strh w[0-9]+, \[sp, 6\] +** mov w[0-9]+, 107 +** strb w[0-9]+, \[sp, 4\] +** mov w[0-9]+, 8 +** strh w[0-9]+, \[sp, 2\] +** mov w[0-9]+, 105 +** strb w[0-9]+, \[sp\] +** mov w7, 7 +** mov w6, 6 +** mov w5, 5 +** mov w4, 4 +** mov w3, 3 +** mov w2, 2 +** mov w1, 1 +** mov w0, 0 +** bl _c_s_packing +** ... +*/ + +__attribute__((__noinline__)) void +c_s_packing (int a, int b, int c, int d, int e, int f, int g, int h, + char i, short j, char k, short l, + char m); + +void call_c_s_packing (void) +{ + c_s_packing (0, 1, 2, 3, 4, 5, 6, 7, + 'i', 8 , 'k', 9, 'm'); +} + +/* +**call_s_c_packing: +** ... +** mov w[0-9]+, 109 +** strb w[0-9]+, \[sp, 7\] +** mov w[0-9]+, 108 +** strb w[0-9]+, \[sp, 6\] +** mov w[0-9]+, 9 +** strh w[0-9]+, \[sp, 4\] +** mov w[0-9]+, 106 +** strb w[0-9]+, \[sp, 2\] +** mov w[0-9]+, 8 +** strh w[0-9]+, \[sp\] +** mov w7, 7 +** mov w6, 6 +** mov w5, 5 +** mov w4, 4 +** mov w3, 3 +** mov w2, 2 +** mov w1, 1 +** mov w0, 0 +** bl _s_c_packing +** ... +*/ + +__attribute__((__noinline__)) void +s_c_packing (int a, int b, int c, int d, int e, int f, int g, int h, + short i, char j, short k, char l, + char m); + +void call_s_c_packing (void) +{ + s_c_packing (0, 1, 2, 3, 4, 5, 6, 7, + 8, 'j' , 9, 'l', 'm'); +} + +/* 0, 2, 4, 0 */ + +/* +**call_csi_packing: +** ... +** mov w[0-9]+, 108 +** strb w[0-9]+, \[sp, 8\] +** mov w[0-9]+, 9 +** str w[0-9]+, \[sp, 4\] +** mov w[0-9]+, 8 +** strh w[0-9]+, \[sp, 2\] +** mov w[0-9]+, 105 +** strb w[0-9]+, \[sp\] +** mov w7, 7 +** mov w6, 6 +** mov w5, 5 +** mov w4, 4 +** mov w3, 3 +** mov w2, 2 +** mov w1, 1 +** mov w0, 0 +** bl _csi_packing +** ... +*/ + +__attribute__((__noinline__)) void +csi_packing (int a, int b, int c, int d, int e, int f, int g, int h, + char i, short j, int k, char l); + +void call_csi_packing (void) +{ + csi_packing (0, 1, 2, 3, 4, 5, 6, 7, + 'i', 8 , 9, 'l'); +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-02.c gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-02.c new file mode 100644 index 000000000..03851637a --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-02.c @@ -0,0 +1,73 @@ +/* { dg-do compile } */ +/* we need this for complex literals. */ +/* { dg-options "-std=gnu99 " } */ +/* { dg-additional-options "-O -fsection-anchors -fno-schedule-insns -fno-schedule-insns2 " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + + +__attribute__((__noinline__)) void +c_cc_packing (int a, int b, int c, int d, int e, int f, int g, int h, + _Complex char i, _Complex char j); + +/* We check that these values are not packed on the stack. +**call_c_cc_packing: +** ... +** ldrh w[0-9]+, \[x[0-9]+\] +** strh w[0-9]+, \[sp, 8\] +** ldrh w[0-9]+, \[x[0-9]+, 2\] +** strh w[0-9]+, \[sp\] +** ... +** bl _c_cc_packing +** ... +*/ + +void +call_c_cc_packing (void) +{ + c_cc_packing (0, 1, 2, 3, 4, 5, 6, 7, + (_Complex char) (1 + 1i),(_Complex char) (2 + 2i)); +} + + +__attribute__((__noinline__)) void +c_cs_packing (int a, int b, int c, int d, int e, int f, int g, int h, + _Complex short i, _Complex short j); + +/* +**call_c_cs_packing: +** ... +** ldp (w[0-9]+), (w[0-9]+), \[x[0-9]+, 4\] +** str \1, \[sp, 8\] +** str \2, \[sp\] +** ... +** bl _c_cs_packing +** ... +*/ + +void +call_c_cs_packing (void) +{ + c_cs_packing (0, 1, 2, 3, 4, 5, 6, 7, + (_Complex short) (1 + 1i),(_Complex short) (2 + 2i)); +} + +void c_ci_packing (int a, int b, int c, int d, int e, int f, int g, int h, + _Complex int i, _Complex int j); + +/* +**call_c_ci_packing: +** ... +** ldr (x[0-9]+), \[x[0-9]+, 12\] +** ldr (x[0-9]+), \[x[0-9]+, 20\] +** stp \2, \1, \[sp\] +** ... +** bl _c_ci_packing +** ... +*/ + +void +call_c_ci_packing (void) +{ + c_ci_packing (0, 1, 2, 3, 4, 5, 6, 7, + (_Complex int) (1 + 1i),(_Complex int) (2 + 2i)); +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-03.c gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-03.c new file mode 100644 index 000000000..9ebf4f54d --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-03.c @@ -0,0 +1,66 @@ +/* { dg-do compile } */ + +/* { dg-additional-options "-O2 -fno-schedule-insns -fno-schedule-insns2 " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +typedef union u { char a; short b; } U; +typedef struct sf { float a; float b; float c;} SF; + +__attribute__((__noinline__)) void +u_packing (int a, int b, int c, int d, int e, int f, int g, int h, + U i, U j); + +/* We check that these values are not packed on the stack. +**call_u_packing: +** ... +** strh w[0-9]+, \[sp, 8\] +** strh w[0-9]+, \[sp\] +** ... +** bl _u_packing +** ... +*/ + +void +call_u_packing (void) +{ + U x = { 'a' }; + u_packing (0, 1, 2, 3, 4, 5, 6, 7, x, x); +} + +/* But a homogeneous float aggregate is treated as if it were the contained + floats. */ + +__attribute__((__noinline__)) void +sf_packing (float a, float b, float c, float d, + float e, float f, float g, float h, + SF i, SF j); + +/* So the stores to sp+12 and 20 pack the floats onto the stack. +**call_sf_packing: +** ... +** mov (x[0-9]+), 1065353216 +** movk \1, 0x4000, lsl 48 +** mov w[0-9]+, 1077936128 +** fmov s7, 7.0e\+0 +** fmov s6, 6.0e\+0 +** fmov s5, 5.0e\+0 +** fmov s4, 4.0e\+0 +** fmov s3, 3.0e\+0 +** fmov s2, 2.0e\+0 +** fmov s1, 1.0e\+0 +** movi v0.2s, #0 +** str x[0-9]+, \[sp\] +** str w[0-9]+, \[sp, 8\] +** str x[0-9]+, \[sp, 12\] +** str w[0-9]+, \[sp, 20\] +** bl _sf_packing +** ... +*/ + +void +call_sf_packing (void) +{ + SF A = {1.0F, 2.0F, 3.0F}; + sf_packing (0.0F, 1.0F, 2.0F, 3.0F, 4.0F, 5.0F, 6.0F, 7.0F, + A, A); +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-04.c gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-04.c new file mode 100644 index 000000000..1d1af4e74 --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d2-04.c @@ -0,0 +1,64 @@ +/* { dg-do compile } */ + +/* { dg-additional-options "-O -fno-schedule-insns -fno-schedule-insns2 " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +typedef short v2hi __attribute__ ((vector_size (4))); +typedef int v4si __attribute__ ((vector_size (16))); + +v4si t; +int al = __alignof__ (t); + +__attribute__((__noinline__)) void +v2hi_packing (v2hi a, v2hi b, v2hi c, v2hi d, v2hi e, v2hi f, v2hi g, v2hi h, + v2hi i, v2hi j); + +/* We check that v2hi is packed on the stack. +**call_v2hi_packing: +** ... +** mov w[0-9]+, 1 +** movk (w[0-9]+), 0x2, lsl 16 +** stp \1, \1, \[sp\] +** mov w7, \1 +** mov w6, \1 +** mov w5, \1 +** mov w4, \1 +** mov w3, \1 +** mov w2, \1 +** mov w1, \1 +** bl _v2hi_packing +** ... +*/ + +void +call_v2hi_packing (void) +{ + v2hi x = {1,2}; + v2hi_packing (x, x, x, x, x, x, x, x, x, x); +} + + +__attribute__((__noinline__)) void +v4si_packing (int r0, int r1, int r2, int r3, int r4, int r5, int r6, int r7, + v4si a, v4si b, v4si c, v4si d, v4si e, v4si f, v4si g, v4si h, + int stack, v4si i, v4si j); + +/* Test that we align a 16b vector on the stack. +**call_v4si_packing: +** ... +** adrp x0, lC0@PAGE +** ldr (q[0-9]+), \[x[0-9]+, #lC0@PAGEOFF\] +** stp \1, \1, \[sp, 16\] +** mov w[0-9]+, 42 +** str w[0-9]+, \[sp\] +** ... +** bl _v4si_packing +** ... +*/ + +void +call_v4si_packing (void) +{ + v4si x = {3,1,2,4}; + v4si_packing (0, 1, 2, 3, 4, 5, 6, 7, x, x, x, x, x, x, x, x, 42, x, x); +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d3.c gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d3.c new file mode 100644 index 000000000..21c6b696b --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d3.c @@ -0,0 +1,40 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +/* This will fail, because of issue #74 +**foo: +** cmp w0, w1 +** cset w0, eq +** ret +*/ + +__attribute__((__noinline__)) +int +foo (char a, unsigned char b) +{ + return a == b ? 1 : 0; +} + +__attribute__((__noinline__)) +int +bar (short a, unsigned short b) +{ + return a == b ? 1 : 0; +} + +void pop (char *, unsigned char *, short *, unsigned short *); + +int main () +{ + char a; + unsigned char b; + short c; + unsigned short d; + int result; + pop (&a, &b, &c, &d); + + result = foo (a, b); + result += bar (c, d); + return result; +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d4.c gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d4.c new file mode 100644 index 000000000..2aab48260 --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/darwinpcs-d4.c @@ -0,0 +1,62 @@ +/* { dg-do compile } */ +/* we need this for __int128. */ +/* { dg-options "-std=gnu99 " } */ +/* { dg-additional-options "-O -fno-schedule-insns -fno-schedule-insns2 " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +/* we should use x0, x1 and x2 - not skip x1. +**foo: +** eor x0, x0, x1 +** orr x0, x0, x2 +** cmp x0, 0 +** cset w0, eq +** ret +*/ + +__attribute__((__noinline__)) +int +foo (unsigned long long x,unsigned __int128 y) +{ + return x == y ? 1 : 0; +} + +/* we should use x0, x1 and x2. +**bar: +** eor x2, x2, x0 +** orr x2, x2, x1 +** cmp x2, 0 +** cset w0, eq +** ret +*/ + +__attribute__((__noinline__)) +int +bar (unsigned __int128 y, unsigned long long x) +{ + return x == y ? 1 : 0; +} + +int fooo (unsigned long long x, unsigned __int128 y); +int baro (unsigned __int128 y, unsigned long long x); + +/* we should use x0, x1 and x2 in both calls. +**main: +** ... +** mov x1, 25 +** mov x2, 0 +** mov x0, 10 +** bl _fooo +** mov x2, 10 +** mov x0, 25 +** mov x1, 0 +** bl _baro +** ... +*/ + +int main () +{ + unsigned long long x = 10; + unsigned __int128 y = 25; + int r = fooo (x, y); + r += baro (y, x); +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/float128-00.c gcc/testsuite/gcc.target/aarch64/darwin/float128-00.c new file mode 100644 index 000000000..29aec80fb --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/float128-00.c @@ -0,0 +1,38 @@ + +/* we need this for _Float128. */ +/* { dg-options "-std=gnu99 " } */ +/* We use the sections anchors to make the code easier to match. */ +/* { dg-additional-options " -O2 -fsection-anchors " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +/* we should just pass q0 and q1 through +**foo: +** ... +** bl ___addtf3 +** ... +*/ + +__attribute__((__noinline__)) +_Float128 +foo (_Float128 a, _Float128 b) +{ + return a + b; +} + + +/* we should just load q0 and q1 +**call_foo: +** ... +** ldr q1, \[x[0-9]+\] +** ... +** ldr q0, \[x[0-9]+\] +** b _foo +** ... +*/ + +__attribute__((__noinline__)) +_Float128 +call_foo (void) +{ + return foo (1.0, 2.0); +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/float128-01.c gcc/testsuite/gcc.target/aarch64/darwin/float128-01.c new file mode 100644 index 000000000..93f6d24ce --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/float128-01.c @@ -0,0 +1,48 @@ +/* { dg-do run } */ +/* we need this for _Float128. */ +/* { dg-options "-std=gnu99 " } */ +/* { dg-additional-options "-Wfloat-conversion" } */ + +float f1 (__float128 z1, _Float128 z2) +{ + float x, y; + x = z1; /* { dg-warning "conversion from '_Float128' to 'float'" } */ + y = z2; /* { dg-warning "conversion from '_Float128' to 'float'" } */ + return x + y; +} + +__float128 f2 () { + float f = 0.q; + return f; +} + +_Float128 f3 () { + float f = 0.q; + return f; +} + +int main () +{ + __float128 x1 = __builtin_huge_valq (); + __float128 x2 = __builtin_infq (); + + _Float128 y1 = __builtin_huge_valq (); + _Float128 y2 = __builtin_infq (); + + if (!__builtin_isinf (x1)) + __builtin_abort(); + if (!__builtin_isinf (x2)) + __builtin_abort(); + + if (!__builtin_isinf (y1)) + __builtin_abort(); + if (!__builtin_isinf (y2)) + __builtin_abort(); + + if (x1 != x2) + __builtin_abort(); + if (y1 != y2) + __builtin_abort(); + + return 0; +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/float128-02.c gcc/testsuite/gcc.target/aarch64/darwin/float128-02.c new file mode 100644 index 000000000..5a8522f96 --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/float128-02.c @@ -0,0 +1,101 @@ +/* { dg-do run } */ +/* we need this for _Float128. */ +/* { dg-options "-std=gnu99 " } */ + +void test (__float128 z1, __float128 z2, __float128 z3, __float128 z4) +{ + __float128 w; + + if (!__builtin_isinf (z1)) + __builtin_abort(); + if (__builtin_isnan (z1)) + __builtin_abort(); + if (__builtin_isfinite (z1)) + __builtin_abort(); + if (__builtin_isnormal (z1)) + __builtin_abort(); + if (__builtin_signbit (z1)) + __builtin_abort(); + + if (__builtin_isinf (z2)) + __builtin_abort(); + if (!__builtin_isnan (z2)) + __builtin_abort(); + if (__builtin_isfinite (z2)) + __builtin_abort(); + if (__builtin_isnormal (z2)) + __builtin_abort(); + if (__builtin_signbit (z2)) + __builtin_abort(); + + if (__builtin_isinf (z3)) + __builtin_abort(); + if (!__builtin_isnan (z3)) + __builtin_abort(); + if (__builtin_isfinite (z3)) + __builtin_abort(); + if (__builtin_isnormal (z3)) + __builtin_abort(); + if (__builtin_signbit (z3)) + __builtin_abort(); + + if (__builtin_isinf (z4)) + __builtin_abort(); + if (__builtin_isnan (z4)) + __builtin_abort(); + if (!__builtin_isfinite (z4)) + __builtin_abort(); + if (!__builtin_isnormal (z4)) + __builtin_abort(); + if (__builtin_signbit (z4)) + __builtin_abort(); + + w = __builtin_copysignq (z1, -z4); + if (!__builtin_signbit (w)) + __builtin_abort(); + + w = __builtin_copysignq (z2, -z4); + if (!__builtin_signbit (w)) + __builtin_abort(); + + w = __builtin_copysignq (z3, -z4); + if (!__builtin_signbit (w)) + __builtin_abort(); + + w = __builtin_copysignq (z4, -z4); + if (!__builtin_signbit (w)) + __builtin_abort(); + + w = __builtin_copysignq (z1, -z4); + w = __builtin_fabsq (w); + if (__builtin_signbit (w)) + __builtin_abort(); + + w = __builtin_copysignq (z2, -z4); + w = __builtin_fabsq (w); + if (__builtin_signbit (w)) + __builtin_abort(); + + w = __builtin_copysignq (z3, -z4); + w = __builtin_fabsq (w); + if (__builtin_signbit (w)) + __builtin_abort(); + + w = __builtin_copysignq (z4, -z4); + w = __builtin_fabsq (w); + if (__builtin_signbit (w)) + __builtin_abort(); + +} + +int main () +{ + __float128 x1 = __builtin_infq (); + __float128 x2 = __builtin_nanq (""); + __float128 x3 = __builtin_nansq (""); + __float128 x4 = 41.1094721q; + + test (x1, x2, x3, x4); + + return 0; +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/homogeneous-aggr.c gcc/testsuite/gcc.target/aarch64/darwin/homogeneous-aggr.c new file mode 100644 index 000000000..bee97557a --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/homogeneous-aggr.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +typedef struct sf { float a; float b; float c;} SF; + +__attribute__((__noinline__)) void +hmg_f (SF a); + +/* we should use registers for each item +**call_hmg_f: +** ... +** fmov s0, 1.0e\+0 +** fmov s1, 2.0e\+0 +** fmov s2, 3.0e\+0 +** bl _hmg_f +** ... +*/ + +void +call_hmg_f (void) +{ + SF A = { 1.0F, 2.0F, 3.0F }; + hmg_f (A); +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/k+r-00.c gcc/testsuite/gcc.target/aarch64/darwin/k+r-00.c new file mode 100644 index 000000000..443fb9688 --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/k+r-00.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ + +/* { dg-options "-std=gnu99 " } */ +/* { dg-additional-options "-O2 -fsection-anchors" } */ + + +/* What we care about here is that we get int loads from sp, sp+4 and sp+8. + * This code will change when we implement darwinpcs d.3 - since the + * promotions will no longer be needed (although they are harmless). +**test_k_r00: +** ldrsb w[0-9]+, \[sp, 4\] +** ldr x[0-9]+, \[sp, 8\] +** ... +** ldrsb w[0-9]+, \[sp\] +** ... +*/ + +const char * +test_k_r00 (r0, r1, r2, r3, r4, r5, r6, r7, a, b, c) + char r0, r1, r2, r3, r4, r5, r6, r7; + char a; + char b; + const char *c; +{ + if (a > 10 && b < 100) + return c; + return (char *)0; +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/tu-accesses-0.c gcc/testsuite/gcc.target/aarch64/darwin/tu-accesses-0.c new file mode 100644 index 000000000..ba5cc493b --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/tu-accesses-0.c @@ -0,0 +1,82 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fcommon -mno-pc-relative-literal-loads" } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +/* This checks that we perform the correct accesses for file-scope vars + including GOT indirections. */ + +double gd = 1.0; + +__attribute__((__weak__)) +double wd = 2.0; + +__attribute__((__visibility__("hidden"))) +double hd = 3.0; + +__attribute__((__weak__, __visibility__("hidden"))) +double whd = 4.0; + +extern double ed; + +double cd; + +static double sd = 5.0; + +struct { + double a; + double b; +} two_dbls = { 1.0, 42.0 }; + +double arr[3] = { 6.0, 7.0, 8.0 }; + +/* +**test: +** adrp x[0-9]+, _gd@PAGE +** ldr d[0-9]+, \[x[0-9]+, #_gd@PAGEOFF\] +** adrp x[0-9]+, lC0@PAGE +** ldr d[0-9]+, \[x[0-9]+, #lC0@PAGEOFF\] +** fadd d[0-9]+, d[0-9]+, d[0-9]+ +** adrp x[0-9]+, _wd@GOTPAGE +** ldr x[0-9]+, \[x[0-9]+, _wd@GOTPAGEOFF\] +** ldr d[0-9]+, \[x[0-9]+\] +** fadd d[0-9]+, d[0-9]+, d[0-9]+ +** adrp x[0-9]+, _hd@PAGE +** ldr d[0-9]+, \[x[0-9]+, #_hd@PAGEOFF\] +** fadd d[0-9]+, d[0-9]+, d[0-9]+ +** adrp x[0-9]+, _whd@PAGE +** ldr d[0-9]+, \[x[0-9]+, #_whd@PAGEOFF\] +** fadd d[0-9]+, d[0-9]+, d[0-9]+ +** adrp x[0-9]+, _ed@GOTPAGE +** ldr x[0-9]+, \[x[0-9]+, _ed@GOTPAGEOFF\] +** ldr d[0-9]+, \[x[0-9]+\] +** fadd d[0-9]+, d[0-9]+, d[0-9]+ +** adrp x[0-9]+, _cd@GOTPAGE +** ldr x[0-9]+, \[x[0-9]+, _cd@GOTPAGEOFF\] +** ldr d[0-9]+, \[x[0-9]+\] +** fadd d[0-9]+, d[0-9]+, d[0-9]+ +** fmov d[0-9]+, 5.0e\+0 +** fadd d[0-9]+, d[0-9]+, d[0-9]+ +** adrp x[0-9]+, _two_dbls@PAGE\+8 +** ldr d[0-9]+, \[x[0-9]+, #_two_dbls@PAGEOFF\+8\] +** fadd d[0-9]+, d[0-9]+, d[0-9]+ +** adrp x[0-9]+, _arr@PAGE\+16 +** ldr d[0-9]+, \[x[0-9]+, #_arr@PAGEOFF\+16\] +** fadd d[0-9]+, d[0-9]+, d[0-9]+ +** ret +*/ + +double test (void) +{ + double x = 123456123456123456.0; + x += gd; + x += wd; + x += hd; + x += whd; + x += ed; + x += cd; + x += sd; + x += two_dbls.b; + x += arr[2]; + + return x; +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/variadic-00.c gcc/testsuite/gcc.target/aarch64/darwin/variadic-00.c new file mode 100644 index 000000000..6420fca11 --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/variadic-00.c @@ -0,0 +1,91 @@ +/* { dg-do compile } */ + +/* We use the sections anchors to make the code easier to match. */ +/* { dg-additional-options " -O -fsection-anchors -fno-schedule-insns -fno-schedule-insns2 " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +#include + +/* What we care about here is that the load of w0 is from the incoming [SP] +**fooi: +** sub sp, sp, #16 +** add x[0-9]+, sp, 24 +** str x[0-9]+, \[sp, 8\] +** ldr w0, \[sp, 16\] +** ... +*/ + +__attribute__((__noinline__)) int +fooi (int a, ...) +{ + int x; + va_list ap; + va_start(ap, a); + x = va_arg(ap, int); + va_end(ap); + return x; +} + +__attribute__((__noinline__)) int +fooo (char a, ...); + +/* +**call_foo: +** ... +** mov w[0-9]+, 42 +** str w[0-9]+, \[sp\] +** mov w0, 1 +** bl _fooo +** ... +*/ + +__attribute__((__noinline__)) int +call_foo (void) +{ + int y = fooo (1, 42); + return y; +} + +/* What we care about here is that the load of w0 is from the incoming [SP+8] +**bari: +** sub sp, sp, #16 +** add x[0-9]+, sp, 32 +** str x[0-9]+, \[sp, 8\] +** ldr w0, \[sp, 24\] +** ... +*/ + +__attribute__((__noinline__)) int +bari (int a, int b, int c, int d, int e, int f, int g, int h, + int i, ...) +{ + int x; + va_list ap; + va_start(ap, i); + x = va_arg(ap, int); + va_end(ap); + return x; +} + +/* +**call_bar: +** ... +** mov w[0-9]+, 42 +** str w[0-9]+, \[sp, 8\] +** mov w[0-9]+, 9 +** str w[0-9]+, \[sp\] +** ... + bl _baro +** ... +*/ + +__attribute__((__noinline__)) int +baro (int a, int b, int c, int d, int e, int f, int g, int h, + int i, ...); + +__attribute__((__noinline__)) int +call_bar (void) +{ + int y = baro (1, 2, 3, 4, 5, 6, 7, 8, 9, 42); + return y; +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/variadic-01.c gcc/testsuite/gcc.target/aarch64/darwin/variadic-01.c new file mode 100644 index 000000000..6134abdb7 --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/variadic-01.c @@ -0,0 +1,104 @@ +/* { dg-do compile } */ + +/* we need this for _Float128. */ +/* { dg-options "-std=gnu99 " } */ +/* We use the sections anchors to make the code easier to match. */ +/* { dg-additional-options " -O2 -fsection-anchors " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +#include + +/* What we care about here is that q0 and q1 are loaded from incoming sp and + sp+16. +**foo: +** ... +** mov x29, sp +** add (x[0-9]+), x29, 32 +** ... +** ldp q1, q0, \[x29, 32\] +** ... +** bl ___addtf3 +** ... +*/ + +__attribute__((__noinline__)) +_Float128 +foo (int n, ...) +{ + _Float128 a, b; + va_list ap; + + va_start(ap, n); + a = va_arg(ap, _Float128); + b = va_arg(ap, _Float128); + va_end(ap); + return a + b; +} + +/* +**call_foo: +** ... +** mov w0, 2 +** stp q[0-9]+, q[0-9]+, \[sp\] +** bl _foo +** ... +*/ + +__attribute__((__noinline__)) +_Float128 +call_foo (void) +{ + return foo (2, (_Float128)1.0, (_Float128)2.0); +} + +/* What we care about here is that q0 and q1 are loaded from incoming sp and + sp+32 (with the int at sp+16). +**bar: +** ... +** ldr w[0-9]+, \[x29, 48\] +** ... +** ldr q0, \[x29, 32\] +** ... +** ldr q1, \[x29, 64\] +** bl ___addtf3 +** ... +*/ + +__attribute__((__noinline__)) +_Float128 +bar (int n, ...) +{ + _Float128 a, b; + va_list ap; + + va_start(ap, n); + a = va_arg(ap, _Float128); + n = va_arg(ap, int); + if (n != 42) + __builtin_abort (); + b = va_arg(ap, _Float128); + va_end(ap); + return a + b; +} + +/* +**call_bar: +** ... +** mov (w[0-9]+), 42 +** ... +** str \1, \[sp, 16\] +** ... +** mov w0, 2 +** str q[0-9]+, \[sp, 32\] +** str q[0-9]+, \[sp\] +** bl _bar +** ... +*/ + +__attribute__((__noinline__)) +_Float128 +call_bar (void) +{ + return bar (2, (_Float128)1.0, + 42, (_Float128)2.0); +} diff --git gcc/testsuite/gcc.target/aarch64/darwin/variadic-02.c gcc/testsuite/gcc.target/aarch64/darwin/variadic-02.c new file mode 100644 index 000000000..f85968510 --- /dev/null +++ gcc/testsuite/gcc.target/aarch64/darwin/variadic-02.c @@ -0,0 +1,102 @@ +/* { dg-do compile } */ + +/* we need this for __int128. */ +/* { dg-options "-std=gnu99 " } */ +/* We use the sections anchors to make the code easier to match. */ +/* { dg-additional-options " -O2 -fsection-anchors " } */ +/* { dg-final { check-function-bodies "**" "" "" { target *-*-darwin* } } } */ + +#include + +/* What we care about here is that we load the values from incoming sp and + sp + 16. +**foo: +** sub sp, sp, #16 +** ... +** ldp x[0-9]+, x[0-9]+, \[sp, 16\] +** ... +** ldp x[0-9]+, x[0-9]+, \[sp, 32\] +** ... +*/ + +__attribute__((__noinline__)) +__int128 +foo (int n, ...) +{ + __int128 a, b; + va_list ap; + + va_start(ap, n); + a = va_arg(ap, __int128); + b = va_arg(ap, __int128); + va_end(ap); + return a + b; +} + +/* +**call_foo: +** ... +** mov w0, 2 +** stp x[0-9]+, x[0-9]+, \[sp\] +** stp x[0-9]+, x[0-9]+, \[sp, 16\] +** bl _foo +** ... +*/ + +__attribute__((__noinline__)) +__int128 +call_foo (void) +{ + return foo (2, (__int128)1, (__int128)2); +} + + +/* sp = one int128, sp+16 = int sp + 32 = other int128 +**bar: +** ... +** sub sp, sp, #16 +** ... +** ldp x[0-9]+, x[0-9]+, \[sp, 16\] +** ... +** ldp x[0-9]+, x[0-9]+, \[sp, 48\] +** ... +*/ + +__attribute__((__noinline__)) +__int128 +bar (int n, ...) +{ + __int128 a, b; + va_list ap; + + va_start(ap, n); + a = va_arg(ap, __int128); + n = va_arg(ap, int); + b = va_arg(ap, __int128); + va_end(ap); + return a + b; +} + +__attribute__((__noinline__)) +__int128 +baro (int n, ...); + +/* +**call_bar: +** ... +** mov w[0-9]+, 42 +** ... +** mov w0, 2 +** stp x[0-9]+, x[0-9]+, \[sp\] +** str w[0-9]+, \[sp, 16\] +** stp x[0-9]+, x[0-9]+, \[sp, 32\] +** bl _baro +** ... +*/ + +__attribute__((__noinline__)) +__int128 +call_bar (void) +{ + return baro (2, (__int128)1, 42, (__int128)2); +} diff --git gcc/testsuite/gcc.target/aarch64/dbl_mov_immediate_1.c gcc/testsuite/gcc.target/aarch64/dbl_mov_immediate_1.c index fac32df8c..bc7106610 100644 --- gcc/testsuite/gcc.target/aarch64/dbl_mov_immediate_1.c +++ gcc/testsuite/gcc.target/aarch64/dbl_mov_immediate_1.c @@ -41,8 +41,10 @@ double d4(void) /* { dg-final { scan-assembler-times "movi\td\[0-9\]+, #?0" 1 } } */ -/* { dg-final { scan-assembler-times "adrp\tx\[0-9\]+, " 2 } } */ -/* { dg-final { scan-assembler-times "ldr\td\[0-9\]+, \\\[x\[0-9\], #:lo12:" 2 } } */ +/* { dg-final { scan-assembler-times "adrp\tx\[0-9\]+, " 2 { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times "ldr\td\[0-9\]+, \\\[x\[0-9\], #:lo12:" 2 { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times "adrp\tx\[0-9\]+, lC\[0-9\]@PAGE" 2 { target *-*-darwin* } } } */ +/* { dg-final { scan-assembler-times "ldr\td\[0-9\]+, \\\[x\[0-9\], #lC\[0-9\]@PAGEOFF\\\]" 2 { target *-*-darwin* } } } */ /* { dg-final { scan-assembler-times "fmov\td\[0-9\]+, 1\\\.5e\\\+0" 1 } } */ diff --git gcc/testsuite/gcc.target/aarch64/dwarf-cfa-reg.c gcc/testsuite/gcc.target/aarch64/dwarf-cfa-reg.c index ae5b37970..8a691add2 100644 --- gcc/testsuite/gcc.target/aarch64/dwarf-cfa-reg.c +++ gcc/testsuite/gcc.target/aarch64/dwarf-cfa-reg.c @@ -1,5 +1,6 @@ /* Verify that CFA register is restored to SP after FP is restored. */ /* { dg-do compile } */ +/* { dg-skip-if "no cfi insn support yet" *-*-darwin* } */ /* { dg-options "-O0 -gdwarf-2" } */ /* { dg-final { scan-assembler ".cfi_restore 30" } } */ /* { dg-final { scan-assembler ".cfi_restore 29" } } */ diff --git gcc/testsuite/gcc.target/aarch64/extend.c gcc/testsuite/gcc.target/aarch64/extend.c index f399e55ce..9556d4c2f 100644 --- gcc/testsuite/gcc.target/aarch64/extend.c +++ gcc/testsuite/gcc.target/aarch64/extend.c @@ -95,14 +95,16 @@ subdi_uxth (unsigned long long a, unsigned short i) unsigned long long subdi_uxth0 (unsigned long long a, unsigned short i) { - /* { dg-final { scan-assembler "sub\tx\[0-9\]+,.*uxth\n" } } */ + /* { dg-final { scan-assembler "sub\tx\[0-9\]+,.*uxth\n" { target { ! *-*-darwin* } } } } */ + /* { dg-final { scan-assembler "sub\tx\[0-9\]+,.*uxtw" { target *-*-darwin* } } } */ return a - i; } long long subdi_sxth (long long a, short i) { - /* { dg-final { scan-assembler "sub\tx\[0-9\]+,.*sxth #?1" } } */ + /* { dg-final { scan-assembler "sub\tx\[0-9\]+,.*sxth #?1" { target { ! *-*-darwin* } } } } */ + /* { dg-final { scan-assembler "sub\tx\[0-9\]+,.*sxtw #?1" { target *-*-darwin* } } } */ return a - ((long long)i << 1); } @@ -116,55 +118,63 @@ subdi_sxth0 (long long a, short i) unsigned int subsi_uxth (unsigned int a, unsigned short i) { - /* { dg-final { scan-assembler "sub\tw\[0-9\]+,.*uxth #?1" } } */ + /* { dg-final { scan-assembler "sub\tw\[0-9\]+,.*uxth #?1" { target { ! *-*-darwin* } } } } */ + /* { dg-final { scan-assembler "sub\tw\[0-9\]+,.*lsl #?1" { target *-*-darwin* } } } */ return a - ((unsigned int)i << 1); } unsigned int subsi_uxth0 (unsigned int a, unsigned short i) { - /* { dg-final { scan-assembler "sub\tw\[0-9\]+,.*uxth\n" } } */ + /* { dg-final { scan-assembler "sub\tw\[0-9\]+,.*uxth\n" { target { ! *-*-darwin* } } } } */ + /* { dg-final { scan-assembler "sub\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+" { target *-*-darwin* } } } */ return a - i; } int subsi_sxth (int a, short i) { - /* { dg-final { scan-assembler "sub\tw\[0-9\]+,.*sxth #?1" } } */ + /* { dg-final { scan-assembler "sub\tw\[0-9\]+,.*sxth #?1" { target { ! *-*-darwin* } } } } */ + /* { dg-final { scan-assembler "sub\tw\[0-9\]+,.*lsl #?1" { target *-*-darwin* } } } */ return a - ((int)i << 1); } int subsi_sxth0 (int a, short i) { - /* { dg-final { scan-assembler "sub\tw\[0-9\]+,.*sxth\n" } } */ + /* { dg-final { scan-assembler "sub\tw\[0-9\]+,.*sxth\n" { target { ! *-*-darwin* } } } } */ + /* { dg-final { scan-assembler "sub\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+" { target *-*-darwin* } } } */ return a - (int)i; } unsigned int addsi_uxth (unsigned int a, unsigned short i) { - /* { dg-final { scan-assembler "add\tw\[0-9\]+,.*uxth #?1" } } */ + /* { dg-final { scan-assembler "add\tw\[0-9\]+,.*uxth #?1" { target { ! *-*-darwin* } } } } */ + /* { dg-final { scan-assembler "add\tw\[0-9\]+,.*lsl #?1" { target *-*-darwin* } } } */ return a + ((unsigned int)i << 1); } unsigned int addsi_uxth0 (unsigned int a, unsigned short i) { - /* { dg-final { scan-assembler "add\tw\[0-9\]+,.*uxth\n" } } */ + /* { dg-final { scan-assembler "add\tw\[0-9\]+,.*uxth\n" { target { ! *-*-darwin* } } } } */ + /* { dg-final { scan-assembler "add\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+" { target *-*-darwin* } } } */ return a + i; } int addsi_sxth (int a, short i) { - /* { dg-final { scan-assembler "add\tw\[0-9\]+,.*sxth #?1" } } */ + /* { dg-final { scan-assembler "add\tw\[0-9\]+,.*sxth #?1" { target { ! *-*-darwin* } } } } */ + /* { dg-final { scan-assembler "add\tw\[0-9\]+,.*lsl #?1" { target *-*-darwin* } } } */ return a + ((int)i << 1); } int addsi_sxth0 (int a, short i) { - /* { dg-final { scan-assembler "add\tw\[0-9\]+,.*sxth\n" } } */ + /* { dg-final { scan-assembler "add\tw\[0-9\]+,.*sxth\n" { target { ! *-*-darwin* } } } } */ + /* { dg-final { scan-assembler "add\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+" { target *-*-darwin* } } } */ return a + (int)i; } diff --git gcc/testsuite/gcc.target/aarch64/fmov-1-be.c gcc/testsuite/gcc.target/aarch64/fmov-1-be.c index 4227c6772..7e9431fbb 100644 --- gcc/testsuite/gcc.target/aarch64/fmov-1-be.c +++ gcc/testsuite/gcc.target/aarch64/fmov-1-be.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -mbig-endian" } */ /* { dg-final { check-function-bodies "**" "" "" } } */ +/* { dg-skip-if "no big-endian support" *-*-darwin* } */ #pragma GCC target ("arch=armv8-a") diff --git gcc/testsuite/gcc.target/aarch64/fmov-2-be.c gcc/testsuite/gcc.target/aarch64/fmov-2-be.c index 1e38066b4..16e0ed6d5 100644 --- gcc/testsuite/gcc.target/aarch64/fmov-2-be.c +++ gcc/testsuite/gcc.target/aarch64/fmov-2-be.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -mbig-endian" } */ /* { dg-final { check-function-bodies "**" "" "" } } */ +/* { dg-skip-if "no big-endian support" *-*-darwin* } */ #pragma GCC target ("arch=armv8.2-a+fp16") diff --git gcc/testsuite/gcc.target/aarch64/fmov-3-be.c gcc/testsuite/gcc.target/aarch64/fmov-3-be.c index 0bddd96ea..a718ec55f 100644 --- gcc/testsuite/gcc.target/aarch64/fmov-3-be.c +++ gcc/testsuite/gcc.target/aarch64/fmov-3-be.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -mbig-endian" } */ /* { dg-final { check-function-bodies "**" "" "" } } */ +/* { dg-skip-if "no big-endian support" *-*-darwin* } */ #pragma GCC target ("arch=armv8-a") diff --git gcc/testsuite/gcc.target/aarch64/fmov-4-be.c gcc/testsuite/gcc.target/aarch64/fmov-4-be.c index 58212ef43..d85b0f820 100644 --- gcc/testsuite/gcc.target/aarch64/fmov-4-be.c +++ gcc/testsuite/gcc.target/aarch64/fmov-4-be.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -mbig-endian" } */ /* { dg-final { check-function-bodies "**" "" "" } } */ +/* { dg-skip-if "no big-endian support" *-*-darwin* } */ #pragma GCC target ("arch=armv8.2-a+fp16") diff --git gcc/testsuite/gcc.target/aarch64/fmov-5-be.c gcc/testsuite/gcc.target/aarch64/fmov-5-be.c index 0fcefa7c9..84cae2790 100644 --- gcc/testsuite/gcc.target/aarch64/fmov-5-be.c +++ gcc/testsuite/gcc.target/aarch64/fmov-5-be.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -mbig-endian" } */ /* { dg-final { check-function-bodies "**" "" "" } } */ +/* { dg-skip-if "no big-endian support" *-*-darwin* } */ #pragma GCC target ("arch=armv8.2-a+fp16") diff --git gcc/testsuite/gcc.target/aarch64/fmovld-zero-mem.c gcc/testsuite/gcc.target/aarch64/fmovld-zero-mem.c index e649404ae..d17a889b3 100644 --- gcc/testsuite/gcc.target/aarch64/fmovld-zero-mem.c +++ gcc/testsuite/gcc.target/aarch64/fmovld-zero-mem.c @@ -1,8 +1,14 @@ /* { dg-do compile } */ /* { dg-options "-O2" } */ +#if __APPLE__ +#define F128TYPE __float128 +#else +#define F128TYPE long double +#endif + void -foo (long double *output) +foo (F128TYPE *output) { *output = 0.0; } diff --git gcc/testsuite/gcc.target/aarch64/fmovld-zero-reg.c gcc/testsuite/gcc.target/aarch64/fmovld-zero-reg.c index ca602cb38..f9aa405a6 100644 --- gcc/testsuite/gcc.target/aarch64/fmovld-zero-reg.c +++ gcc/testsuite/gcc.target/aarch64/fmovld-zero-reg.c @@ -1,7 +1,13 @@ /* { dg-do compile } */ /* { dg-options "-O2" } */ -void bar (long double); +#if __APPLE__ +#define F128TYPE __float128 +#else +#define F128TYPE long double +#endif + +void bar (F128TYPE); void foo (void) { diff --git gcc/testsuite/gcc.target/aarch64/fuse_adrp_add_1.c gcc/testsuite/gcc.target/aarch64/fuse_adrp_add_1.c index d66fe3a4b..1361452c6 100644 --- gcc/testsuite/gcc.target/aarch64/fuse_adrp_add_1.c +++ gcc/testsuite/gcc.target/aarch64/fuse_adrp_add_1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target aarch64_small } */ +/* { dg-skip-if "Darwin ABI indirects externs" { *-*-darwin* } } */ /* { dg-options "-O3 -mcpu=cortex-a57 -fno-pie" } */ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS, diff --git gcc/testsuite/gcc.target/aarch64/indirect_return-1.c gcc/testsuite/gcc.target/aarch64/indirect_return-1.c index 9ab133ffb..b177a6aaf 100644 --- gcc/testsuite/gcc.target/aarch64/indirect_return-1.c +++ gcc/testsuite/gcc.target/aarch64/indirect_return-1.c @@ -12,7 +12,7 @@ foo (int a) **func1: ** hint 34 // bti c ** ... -** bl foo +** bl _?foo ** hint 36 // bti j ** ... ** ret @@ -27,7 +27,7 @@ func1 (int a, int b) **func2: ** hint 34 // bti c ** ... -** b foo +** b _?foo */ int __attribute((indirect_return,weak)) func2 (int a, int b) @@ -39,7 +39,7 @@ func2 (int a, int b) **func3: ** hint 34 // bti c ** ... -** bl func2 +** bl _?func2 ** hint 36 // bti j ** ... ** ret diff --git gcc/testsuite/gcc.target/aarch64/indirect_return-2.c gcc/testsuite/gcc.target/aarch64/indirect_return-2.c index 4759ed777..174789428 100644 --- gcc/testsuite/gcc.target/aarch64/indirect_return-2.c +++ gcc/testsuite/gcc.target/aarch64/indirect_return-2.c @@ -11,7 +11,7 @@ foo (int a) /* **func1: ** ... -** bl foo +** bl _?foo ** ... ** ret */ @@ -24,7 +24,7 @@ func1 (int a, int b) /* **func2: ** ... -** b foo +** b _?foo */ int __attribute((indirect_return,weak)) func2 (int a, int b) @@ -35,7 +35,7 @@ func2 (int a, int b) /* **func3: ** ... -** bl func2 +** bl _?func2 ** ... ** ret */ diff --git gcc/testsuite/gcc.target/aarch64/inline-lrint_1.c gcc/testsuite/gcc.target/aarch64/inline-lrint_1.c index 478875ff8..9a2b2e448 100644 --- gcc/testsuite/gcc.target/aarch64/inline-lrint_1.c +++ gcc/testsuite/gcc.target/aarch64/inline-lrint_1.c @@ -15,4 +15,4 @@ TEST (fllf, float , long long, l) /* { dg-final { scan-assembler-times "frintx\t\[d,s\]\[0-9\]+, \[d,s\]\[0-9\]+" 6 } } */ /* { dg-final { scan-assembler-times "fcvtzs\tx\[0-9\]+, \[d,s\]\[0-9\]+" 6 } } */ -/* { dg-final { scan-assembler-not "bl" } } */ +/* { dg-final { scan-assembler-not "bl\t" } } */ diff --git gcc/testsuite/gcc.target/aarch64/inline-mem-set-pr112804.c gcc/testsuite/gcc.target/aarch64/inline-mem-set-pr112804.c index 276c10cd0..7c3fa323e 100644 --- gcc/testsuite/gcc.target/aarch64/inline-mem-set-pr112804.c +++ gcc/testsuite/gcc.target/aarch64/inline-mem-set-pr112804.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "-mabi=ilp32 unsupported" { aarch64-*-darwin* } } */ /* { dg-options "-finline-stringops -mabi=ilp32 -Wno-deprecated -ftrivial-auto-var-init=zero" } */ short m(unsigned k) { diff --git gcc/testsuite/gcc.target/aarch64/ins_bitfield_2.c gcc/testsuite/gcc.target/aarch64/ins_bitfield_2.c index 152418889..cf37fb91c 100644 --- gcc/testsuite/gcc.target/aarch64/ins_bitfield_2.c +++ gcc/testsuite/gcc.target/aarch64/ins_bitfield_2.c @@ -1,5 +1,6 @@ /* { dg-do assemble } */ /* { dg-options "-O2 -mbig-endian --save-temps" } */ +/* { dg-skip-if "no BE" { *-*-darwin* } } */ /* { dg-final { check-function-bodies "**" "" "" } } */ typedef unsigned char v16qi __attribute__((vector_size(16))); diff --git gcc/testsuite/gcc.target/aarch64/ins_bitfield_4.c gcc/testsuite/gcc.target/aarch64/ins_bitfield_4.c index 98e25c869..ca428ea4e 100644 --- gcc/testsuite/gcc.target/aarch64/ins_bitfield_4.c +++ gcc/testsuite/gcc.target/aarch64/ins_bitfield_4.c @@ -1,5 +1,6 @@ /* { dg-do assemble } */ /* { dg-options "-O2 -mbig-endian --save-temps" } */ +/* { dg-skip-if "no BE" { *-*-darwin* } } */ /* { dg-final { check-function-bodies "**" "" "" { target lp64 } } } */ struct di_qi_1 { unsigned char c[4]; unsigned int x; }; diff --git gcc/testsuite/gcc.target/aarch64/ins_bitfield_6.c gcc/testsuite/gcc.target/aarch64/ins_bitfield_6.c index cb8af6b06..21d56cba6 100644 --- gcc/testsuite/gcc.target/aarch64/ins_bitfield_6.c +++ gcc/testsuite/gcc.target/aarch64/ins_bitfield_6.c @@ -1,5 +1,6 @@ /* { dg-do assemble } */ /* { dg-options "-O2 -mbig-endian --save-temps" } */ +/* { dg-skip-if "no BE" { *-*-darwin* } } */ /* { dg-final { check-function-bodies "**" "" "" } } */ struct di_qi_1 { unsigned char c[4]; unsigned int x; }; diff --git gcc/testsuite/gcc.target/aarch64/ldar_1.c gcc/testsuite/gcc.target/aarch64/ldar_1.c index d968a72b3..5fba03a18 100644 --- gcc/testsuite/gcc.target/aarch64/ldar_1.c +++ gcc/testsuite/gcc.target/aarch64/ldar_1.c @@ -1,6 +1,7 @@ /* Test the LDAR instruction generation from atomic acquire loads. */ /* { dg-do assemble } */ /* { dg-additional-options "--save-temps -O1" } */ +/* { dg-additional-options "--save-temps -O2" { target *-*-darwin* } } */ /* { dg-final { check-function-bodies "**" "" "" } } */ #include diff --git gcc/testsuite/gcc.target/aarch64/ldp_stp_14.c gcc/testsuite/gcc.target/aarch64/ldp_stp_14.c index c7b5f7d6b..3cee5ba21 100644 --- gcc/testsuite/gcc.target/aarch64/ldp_stp_14.c +++ gcc/testsuite/gcc.target/aarch64/ldp_stp_14.c @@ -1,4 +1,5 @@ /* { dg-options "-O2 -fno-tree-loop-distribute-patterns" } */ +/* { dg-additional-options "-mtune=generic -fomit-frame-pointer" { target *-*-darwin* } } */ /* { dg-final { check-function-bodies "**" "" "" { target lp64 } } } */ #include "ldp_stp_14.h" diff --git gcc/testsuite/gcc.target/aarch64/ldp_stp_15.c gcc/testsuite/gcc.target/aarch64/ldp_stp_15.c index 131cd0a63..f265b7a51 100644 --- gcc/testsuite/gcc.target/aarch64/ldp_stp_15.c +++ gcc/testsuite/gcc.target/aarch64/ldp_stp_15.c @@ -1,4 +1,5 @@ /* { dg-options "-O2 -fno-tree-loop-distribute-patterns" } */ +/* { dg-additional-options "-mtune=generic -fomit-frame-pointer" { target *-*-darwin* } } */ /* { dg-final { check-function-bodies "**" "" "" { target lp64 } } } */ #include "ldp_stp_14.h" diff --git gcc/testsuite/gcc.target/aarch64/ldp_stp_16.c gcc/testsuite/gcc.target/aarch64/ldp_stp_16.c index 95835aa2e..252d756d5 100644 --- gcc/testsuite/gcc.target/aarch64/ldp_stp_16.c +++ gcc/testsuite/gcc.target/aarch64/ldp_stp_16.c @@ -1,4 +1,5 @@ /* { dg-options "-O2 -fno-tree-loop-distribute-patterns" } */ +/* { dg-additional-options "-mtune=generic -fomit-frame-pointer" { target *-*-darwin* } } */ /* { dg-final { check-function-bodies "**" "" "" { target lp64 } } } */ #include "ldp_stp_14.h" diff --git gcc/testsuite/gcc.target/aarch64/ldp_stp_18.c gcc/testsuite/gcc.target/aarch64/ldp_stp_18.c index 49aa0b20a..84fcf63bd 100644 --- gcc/testsuite/gcc.target/aarch64/ldp_stp_18.c +++ gcc/testsuite/gcc.target/aarch64/ldp_stp_18.c @@ -1,4 +1,5 @@ /* { dg-options "-O2 -fno-tree-loop-distribute-patterns" } */ +/* { dg-additional-options "-mtune=generic -fomit-frame-pointer" { target *-*-darwin* } } */ /* { dg-final { check-function-bodies "**" "" "" { target lp64 } } } */ #include "ldp_stp_14.h" diff --git gcc/testsuite/gcc.target/aarch64/lse128-flag.c gcc/testsuite/gcc.target/aarch64/lse128-flag.c index 71339c3af..2fbf3e84e 100644 --- gcc/testsuite/gcc.target/aarch64/lse128-flag.c +++ gcc/testsuite/gcc.target/aarch64/lse128-flag.c @@ -6,5 +6,6 @@ int main() return 0; } -/* { dg-final { scan-assembler {\.arch armv9\.4-a\+crc\+lse128} } } */ +/* { dg-final { scan-assembler {\.arch armv9\.4-a\+crc\+lse128} { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {\.arch armv9\.4-a\+lse128} { target *-*-darwin* } } } */ /* Test a normal looking procinfo. */ diff --git gcc/testsuite/gcc.target/aarch64/memset-corner-cases-2.c gcc/testsuite/gcc.target/aarch64/memset-corner-cases-2.c index 9ee96f332..dec73f985 100644 --- gcc/testsuite/gcc.target/aarch64/memset-corner-cases-2.c +++ gcc/testsuite/gcc.target/aarch64/memset-corner-cases-2.c @@ -7,7 +7,7 @@ /* 127 bytes should use libcall for size. **set127byte: ** mov x2, 127 -** b memset +** b _?memset */ void __attribute__((__noinline__)) set127byte (int64_t *src, int c) @@ -18,7 +18,7 @@ set127byte (int64_t *src, int c) /* 128 bytes should use libcall for size. **set128byte: ** mov x2, 128 -** b memset +** b _?memset */ void __attribute__((__noinline__)) set128byte (int64_t *src, int c) diff --git gcc/testsuite/gcc.target/aarch64/memset-corner-cases.c gcc/testsuite/gcc.target/aarch64/memset-corner-cases.c index 0b12c88c9..7f911a119 100644 --- gcc/testsuite/gcc.target/aarch64/memset-corner-cases.c +++ gcc/testsuite/gcc.target/aarch64/memset-corner-cases.c @@ -77,7 +77,7 @@ set256byte (int64_t *src, char c) **set257byte: ** mov x2, 257 ** mov w1, 99 -** b memset +** b _?memset */ void __attribute__((__noinline__)) set257byte (int64_t *src) diff --git gcc/testsuite/gcc.target/aarch64/mops_4.c gcc/testsuite/gcc.target/aarch64/mops_4.c index dd796115c..49b5c3966 100644 --- gcc/testsuite/gcc.target/aarch64/mops_4.c +++ gcc/testsuite/gcc.target/aarch64/mops_4.c @@ -124,9 +124,9 @@ set1 (char *x, char y, long z, char **res) ** ret */ void -set2 (char *x, char *yptr, long z, char *res) +set2 (unsigned char *x, unsigned char *yptr, long z, unsigned char *res) { - char y = *yptr; + unsigned char y = *yptr; __builtin_memset (x, y, z); *res = y; } diff --git gcc/testsuite/gcc.target/aarch64/movhi_1.c gcc/testsuite/gcc.target/aarch64/movhi_1.c index 8017abc5f..145b9bae1 100644 --- gcc/testsuite/gcc.target/aarch64/movhi_1.c +++ gcc/testsuite/gcc.target/aarch64/movhi_1.c @@ -49,7 +49,7 @@ zero_to_fpr () /* ** fpr_to_gpr: -** fmov w0, s0 +** (fmov w0, s0|umov w0, v0.h\[0\]) ** ret */ uint16_t diff --git gcc/testsuite/gcc.target/aarch64/movqi_1.c gcc/testsuite/gcc.target/aarch64/movqi_1.c index 401a79630..c1d93d55b 100644 --- gcc/testsuite/gcc.target/aarch64/movqi_1.c +++ gcc/testsuite/gcc.target/aarch64/movqi_1.c @@ -49,7 +49,7 @@ zero_to_fpr () /* ** fpr_to_gpr: -** fmov w0, s0 +** (fmov w0, s0|umov w0, v0.b\[0\]) ** ret */ uint8_t diff --git gcc/testsuite/gcc.target/aarch64/mv-1.c gcc/testsuite/gcc.target/aarch64/mv-1.c index 6f095ecd7..eab320465 100644 --- gcc/testsuite/gcc.target/aarch64/mv-1.c +++ gcc/testsuite/gcc.target/aarch64/mv-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O0" } */ +/* { dg-require-ifunc "" } */ __attribute__ ((target_version ("default"))) int foo () diff --git gcc/testsuite/gcc.target/aarch64/mv-symbols1.c gcc/testsuite/gcc.target/aarch64/mv-symbols1.c index 798227826..7549c58f3 100644 --- gcc/testsuite/gcc.target/aarch64/mv-symbols1.c +++ gcc/testsuite/gcc.target/aarch64/mv-symbols1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O0" } */ +/* { dg-require-ifunc "" } */ // Basic case of fmv correctness with all functions and use in one TU. diff --git gcc/testsuite/gcc.target/aarch64/mv-symbols10.c gcc/testsuite/gcc.target/aarch64/mv-symbols10.c index d5256389d..0c41ccb33 100644 --- gcc/testsuite/gcc.target/aarch64/mv-symbols10.c +++ gcc/testsuite/gcc.target/aarch64/mv-symbols10.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O0" } */ +/* { dg-require-ifunc "" } */ int foo (); diff --git gcc/testsuite/gcc.target/aarch64/mv-symbols11.c gcc/testsuite/gcc.target/aarch64/mv-symbols11.c index fd3dc345a..70fd995fa 100644 --- gcc/testsuite/gcc.target/aarch64/mv-symbols11.c +++ gcc/testsuite/gcc.target/aarch64/mv-symbols11.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O0" } */ +/* { dg-require-ifunc "" } */ // Check that types can be combined diff --git gcc/testsuite/gcc.target/aarch64/mv-symbols12.c gcc/testsuite/gcc.target/aarch64/mv-symbols12.c index 1a0b667eb..1a9c6a706 100644 --- gcc/testsuite/gcc.target/aarch64/mv-symbols12.c +++ gcc/testsuite/gcc.target/aarch64/mv-symbols12.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O0" } */ +/* { dg-require-ifunc "" } */ __attribute__ ((target_version ("default"))) int foo () { return 1; } diff --git gcc/testsuite/gcc.target/aarch64/mv-symbols13.c gcc/testsuite/gcc.target/aarch64/mv-symbols13.c index 308dace64..7c520696c 100644 --- gcc/testsuite/gcc.target/aarch64/mv-symbols13.c +++ gcc/testsuite/gcc.target/aarch64/mv-symbols13.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O0" } */ +/* { dg-require-ifunc "" } */ __attribute__ ((target_version ("default"))) int foo (); diff --git gcc/testsuite/gcc.target/aarch64/mv-symbols14.c gcc/testsuite/gcc.target/aarch64/mv-symbols14.c index d1af69fe3..f7feaecbd 100644 --- gcc/testsuite/gcc.target/aarch64/mv-symbols14.c +++ gcc/testsuite/gcc.target/aarch64/mv-symbols14.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O0" } */ +/* { dg-require-ifunc "" } */ int foo (); diff --git gcc/testsuite/gcc.target/aarch64/mv-symbols2.c gcc/testsuite/gcc.target/aarch64/mv-symbols2.c index a8732caf2..14662dcfa 100644 --- gcc/testsuite/gcc.target/aarch64/mv-symbols2.c +++ gcc/testsuite/gcc.target/aarch64/mv-symbols2.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O0" } */ +/* { dg-require-ifunc "" } */ // FMV correctness with definitions but no call diff --git gcc/testsuite/gcc.target/aarch64/mv-symbols3.c gcc/testsuite/gcc.target/aarch64/mv-symbols3.c index 962bae935..21e75d6f3 100644 --- gcc/testsuite/gcc.target/aarch64/mv-symbols3.c +++ gcc/testsuite/gcc.target/aarch64/mv-symbols3.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O0" } */ +/* { dg-require-ifunc "" } */ // FMV correctness with declarations but no implementation diff --git gcc/testsuite/gcc.target/aarch64/mv-symbols4.c gcc/testsuite/gcc.target/aarch64/mv-symbols4.c index a476800b2..bddb0e7bf 100644 --- gcc/testsuite/gcc.target/aarch64/mv-symbols4.c +++ gcc/testsuite/gcc.target/aarch64/mv-symbols4.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O0" } */ +/* { dg-require-ifunc "" } */ // FMV correctness with a default implementation and declarations of other // versions diff --git gcc/testsuite/gcc.target/aarch64/mv-symbols5.c gcc/testsuite/gcc.target/aarch64/mv-symbols5.c index 4df20009f..d0b70bce7 100644 --- gcc/testsuite/gcc.target/aarch64/mv-symbols5.c +++ gcc/testsuite/gcc.target/aarch64/mv-symbols5.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O0" } */ +/* { dg-require-ifunc "" } */ // FMV correctness with default declaration, and implementations of other // versions. diff --git gcc/testsuite/gcc.target/aarch64/mv-symbols6.c gcc/testsuite/gcc.target/aarch64/mv-symbols6.c index cbf8bcaf8..128d479e7 100644 --- gcc/testsuite/gcc.target/aarch64/mv-symbols6.c +++ gcc/testsuite/gcc.target/aarch64/mv-symbols6.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O0" } */ +/* { dg-require-ifunc "" } */ __attribute__ ((target_version ("default"))) int foo () diff --git gcc/testsuite/gcc.target/aarch64/mv-symbols7.c gcc/testsuite/gcc.target/aarch64/mv-symbols7.c index 2ea4d2ebf..d2b3c257e 100644 --- gcc/testsuite/gcc.target/aarch64/mv-symbols7.c +++ gcc/testsuite/gcc.target/aarch64/mv-symbols7.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O0" } */ +/* { dg-require-ifunc "" } */ __attribute__ ((target_version ("dotprod"))) int foo (); diff --git gcc/testsuite/gcc.target/aarch64/mv-symbols8.c gcc/testsuite/gcc.target/aarch64/mv-symbols8.c index 3e3eaf21a..32229749e 100644 --- gcc/testsuite/gcc.target/aarch64/mv-symbols8.c +++ gcc/testsuite/gcc.target/aarch64/mv-symbols8.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O0" } */ +/* { dg-require-ifunc "" } */ __attribute__ ((target_version ("dotprod"))) int foo (); diff --git gcc/testsuite/gcc.target/aarch64/mv-symbols9.c gcc/testsuite/gcc.target/aarch64/mv-symbols9.c index 8e0864f16..ac5dc5c33 100644 --- gcc/testsuite/gcc.target/aarch64/mv-symbols9.c +++ gcc/testsuite/gcc.target/aarch64/mv-symbols9.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O0" } */ +/* { dg-require-ifunc "" } */ __attribute__ ((target_version ("dotprod"))) int foo (); diff --git gcc/testsuite/gcc.target/aarch64/mvc-symbols1.c gcc/testsuite/gcc.target/aarch64/mvc-symbols1.c index 3ad15e5bb..cd3150b70 100644 --- gcc/testsuite/gcc.target/aarch64/mvc-symbols1.c +++ gcc/testsuite/gcc.target/aarch64/mvc-symbols1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O0" } */ +/* { dg-require-ifunc "" } */ __attribute__ ((target_clones ("default", "dotprod", "sve+sve2"))) int foo () diff --git gcc/testsuite/gcc.target/aarch64/mvc-symbols2.c gcc/testsuite/gcc.target/aarch64/mvc-symbols2.c index 78385ed90..b7b7a42f9 100644 --- gcc/testsuite/gcc.target/aarch64/mvc-symbols2.c +++ gcc/testsuite/gcc.target/aarch64/mvc-symbols2.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O0" } */ +/* { dg-require-ifunc "" } */ __attribute__ ((target_clones ("default", "dotprod", "sve+sve2"))) int foo () diff --git gcc/testsuite/gcc.target/aarch64/mvc-symbols3.c gcc/testsuite/gcc.target/aarch64/mvc-symbols3.c index 1cbe3fd08..4c9f7443a 100644 --- gcc/testsuite/gcc.target/aarch64/mvc-symbols3.c +++ gcc/testsuite/gcc.target/aarch64/mvc-symbols3.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O0" } */ +/* { dg-require-ifunc "" } */ __attribute__ ((target_clones ("default", "dotprod", "sve+sve2"))) int foo (); diff --git gcc/testsuite/gcc.target/aarch64/mvc-symbols4.c gcc/testsuite/gcc.target/aarch64/mvc-symbols4.c index abaf60f91..adb6c9fc8 100644 --- gcc/testsuite/gcc.target/aarch64/mvc-symbols4.c +++ gcc/testsuite/gcc.target/aarch64/mvc-symbols4.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O0" } */ +/* { dg-require-ifunc "" } */ __attribute__ ((target_clones ("default", "dotprod", "sve+sve2"))) int foo (); diff --git gcc/testsuite/gcc.target/aarch64/no-inline-lrint_1.c gcc/testsuite/gcc.target/aarch64/no-inline-lrint_1.c index d5e920056..7f504ad68 100644 --- gcc/testsuite/gcc.target/aarch64/no-inline-lrint_1.c +++ gcc/testsuite/gcc.target/aarch64/no-inline-lrint_1.c @@ -14,6 +14,6 @@ TEST (dlld, double, long long, l) TEST (fllf, float , long long, l) /* { dg-final { scan-assembler-times "frintx\t\[d,s\]\[0-9\]+, \[d,s\]\[0-9\]+" 6 } } */ -/* { dg-final { scan-assembler-times "bl\tlrint" 4 } } */ -/* { dg-final { scan-assembler-times "bl\tllrint" 2 } } */ +/* { dg-final { scan-assembler-times "bl\t_*lrint" 4 } } */ +/* { dg-final { scan-assembler-times "bl\t_*llrint" 2 } } */ /* { dg-final { scan-assembler-not "fcvtzs" } } */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_1.c gcc/testsuite/gcc.target/aarch64/options_set_1.c index dc5eff8c9..ed2aa86e4 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_1.c +++ gcc/testsuite/gcc.target/aarch64/options_set_1.c @@ -6,6 +6,7 @@ int main () return 0; } -/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crc\n} 1 } } */ +/* Darwin's assembler does not need this fix, and we need to omit it. */ +/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crc} 1 { xfail *-*-darwin* } } } */ /* Check to see if crc is output by default. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_11.c gcc/testsuite/gcc.target/aarch64/options_set_11.c index e0e82cf51..2c7473a25 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_11.c +++ gcc/testsuite/gcc.target/aarch64/options_set_11.c @@ -6,6 +6,7 @@ int main () return 0; } -/* { dg-final { scan-assembler {\.arch armv8\.2-a\+crc\n} } } */ +/* { dg-final { scan-assembler {\.arch armv8\.2-a\+crc\n} { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {\.arch armv8\.2-a} { target *-*-darwin* } } } */ /* FP is default on, no need to pass on to assembler. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_12.c gcc/testsuite/gcc.target/aarch64/options_set_12.c index aef44b331..e18053589 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_12.c +++ gcc/testsuite/gcc.target/aarch64/options_set_12.c @@ -6,6 +6,7 @@ int main () return 0; } -/* { dg-final { scan-assembler {\.arch armv8\.2-a\+crc\+fp16\n} } } */ +/* { dg-final { scan-assembler {\.arch armv8\.2-a\+crc\+fp16\n} { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {\.arch armv8\.2-a\+fp16} { target *-*-darwin* } } } */ /* fp16 not default, should be emitted. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_13.c gcc/testsuite/gcc.target/aarch64/options_set_13.c index b116e08e7..23b32428b 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_13.c +++ gcc/testsuite/gcc.target/aarch64/options_set_13.c @@ -6,6 +6,7 @@ int main () return 0; } -/* { dg-final { scan-assembler {\.arch armv8\.2-a\+crc\+fp16\n} } } */ +/* { dg-final { scan-assembler {\.arch armv8\.2-a\+crc\+fp16\n} { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {\.arch armv8\.2-a\+fp16} { target *-*-darwin* } } } */ /* FP is part of FP16, don't emit it. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_14.c gcc/testsuite/gcc.target/aarch64/options_set_14.c index e9fc3e5dc..530d05b0b 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_14.c +++ gcc/testsuite/gcc.target/aarch64/options_set_14.c @@ -6,6 +6,7 @@ int main () return 0; } -/* { dg-final { scan-assembler {\.arch armv8\.2-a\+crc\+fp16fml\n} } } */ +/* { dg-final { scan-assembler {\.arch armv8\.2-a\+crc\+fp16fml\n} { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {\.arch armv8\.2-a\+fp16fml} { target *-*-darwin* } } } */ /* fmp16fml is smallest option to emit. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_15.c gcc/testsuite/gcc.target/aarch64/options_set_15.c index 999791b9f..94e076200 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_15.c +++ gcc/testsuite/gcc.target/aarch64/options_set_15.c @@ -6,6 +6,7 @@ int main () return 0; } -/* { dg-final { scan-assembler {\.arch armv8\.2-a\+crc\+fp16fml*\n} } } */ +/* { dg-final { scan-assembler {\.arch armv8\.2-a\+crc\+fp16fml*\n} { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {\.arch armv8\.2-a\+fp16fml*} { target *-*-darwin* } } } */ /* fp included in fp16fml, only emit latter. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_16.c gcc/testsuite/gcc.target/aarch64/options_set_16.c index 477b71c38..72a31f6da 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_16.c +++ gcc/testsuite/gcc.target/aarch64/options_set_16.c @@ -6,6 +6,7 @@ int main () return 0; } -/* { dg-final { scan-assembler {\.arch armv8\.2-a\+crc\+fp16fml\n} } } */ +/* { dg-final { scan-assembler {\.arch armv8\.2-a\+crc\+fp16fml\n} { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {\.arch armv8\.2-a\+fp16fml} { target *-*-darwin* } } } */ /* fp16fml is smallest options to emit. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_17.c gcc/testsuite/gcc.target/aarch64/options_set_17.c index b1603fbcf..b8900e0d1 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_17.c +++ gcc/testsuite/gcc.target/aarch64/options_set_17.c @@ -6,6 +6,7 @@ int main () return 0; } -/* { dg-final { scan-assembler {\.arch armv8\.2-a\+dotprod\+crc\n} } } */ +/* { dg-final { scan-assembler {\.arch armv8\.2-a\+dotprod\+crc\n} { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {\.arch armv8\.2-a\+dotprod} { target *-*-darwin* } } } */ /* dotprod needs to be emitted pre armv8.4. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_18.c gcc/testsuite/gcc.target/aarch64/options_set_18.c index 977b41e3e..28c74ed40 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_18.c +++ gcc/testsuite/gcc.target/aarch64/options_set_18.c @@ -6,6 +6,7 @@ int main () return 0; } -/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\n} } } */ +/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\n} { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-not {\+dotprod} } } */ /* dotprod is default in armv8.4-a, don't emit. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_19.c gcc/testsuite/gcc.target/aarch64/options_set_19.c index 0b2ec02e5..d27e7cb03 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_19.c +++ gcc/testsuite/gcc.target/aarch64/options_set_19.c @@ -6,6 +6,7 @@ int main () return 0; } -/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\n} } } */ +/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\n} { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-not {\+fp} } } */ /* fp default, don't emit. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_2.c gcc/testsuite/gcc.target/aarch64/options_set_2.c index 937edc693..117979aaf 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_2.c +++ gcc/testsuite/gcc.target/aarch64/options_set_2.c @@ -6,6 +6,7 @@ int main () return 0; } -/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crc\+crypto\n} 1 } } */ +/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crc\+crypto\n} 1 { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crypto} 1 { target *-*-darwin* } } } */ /* Check to see if crc and crypto are maintained if crypto specified. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_20.c gcc/testsuite/gcc.target/aarch64/options_set_20.c index 452b48c72..52688e269 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_20.c +++ gcc/testsuite/gcc.target/aarch64/options_set_20.c @@ -6,6 +6,7 @@ int main () return 0; } -/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\+fp16\n} } } */ +/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\+fp16\n} { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {\.arch armv8\.4-a\+fp16} { target *-*-darwin* } } } */ /* fp16 smallest set to emit. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_21.c gcc/testsuite/gcc.target/aarch64/options_set_21.c index f142e70fb..1e2fbf074 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_21.c +++ gcc/testsuite/gcc.target/aarch64/options_set_21.c @@ -6,6 +6,7 @@ int main () return 0; } -/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\+fp16\n} } } */ +/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\+fp16\n} { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {\.arch armv8\.4-a\+fp16} { target *-*-darwin* } } } */ /* fp16 smallest set to emit. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_22.c gcc/testsuite/gcc.target/aarch64/options_set_22.c index 04ddd4618..61ce788eb 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_22.c +++ gcc/testsuite/gcc.target/aarch64/options_set_22.c @@ -6,6 +6,8 @@ int main () return 0; } -/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\+fp16\n} } } */ +/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\+fp16\n} { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {\.arch armv8\.4-a\+fp16} { target *-*-darwin* } } } */ +/* { dg-final { scan-assembler-not {\+fp16fml} } } */ /* fp16 smallest set to emit. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_23.c gcc/testsuite/gcc.target/aarch64/options_set_23.c index 81cfe0189..e6cb3bb4e 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_23.c +++ gcc/testsuite/gcc.target/aarch64/options_set_23.c @@ -6,6 +6,8 @@ int main () return 0; } -/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\+fp16\n} } } */ +/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\+fp16\n} { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {\.arch armv8\.4-a\+fp16} { target *-*-darwin* } } } */ +/* { dg-final { scan-assembler-not {\+fp16fml} } } */ /* fp16 smallest set to emit. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_24.c gcc/testsuite/gcc.target/aarch64/options_set_24.c index 425cc513e..395444837 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_24.c +++ gcc/testsuite/gcc.target/aarch64/options_set_24.c @@ -6,6 +6,8 @@ int main () return 0; } -/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\+fp16\n} } } */ +/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\+fp16\n} { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {\.arch armv8\.4-a\+fp16} { target *-*-darwin* } } } */ +/* { dg-final { scan-assembler-not {\+fp16fml} } } */ /* fp16 smallest set to emit. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_25.c gcc/testsuite/gcc.target/aarch64/options_set_25.c index 5a3c10593..9a2b1df72 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_25.c +++ gcc/testsuite/gcc.target/aarch64/options_set_25.c @@ -6,6 +6,8 @@ int main () return 0; } -/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\+fp16\n} } } */ +/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\+fp16\n} { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {\.arch armv8\.4-a\+fp16} { target *-*-darwin* } } } */ +/* { dg-final { scan-assembler-not {\+fp16fml} } } */ /* fp16 smallest set to emit. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_26.c gcc/testsuite/gcc.target/aarch64/options_set_26.c index 452b48c72..52688e269 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_26.c +++ gcc/testsuite/gcc.target/aarch64/options_set_26.c @@ -6,6 +6,7 @@ int main () return 0; } -/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\+fp16\n} } } */ +/* { dg-final { scan-assembler {\.arch armv8\.4-a\+crc\+fp16\n} { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler {\.arch armv8\.4-a\+fp16} { target *-*-darwin* } } } */ /* fp16 smallest set to emit. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_27.c gcc/testsuite/gcc.target/aarch64/options_set_27.c index e35744640..4fa94d224 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_27.c +++ gcc/testsuite/gcc.target/aarch64/options_set_27.c @@ -6,4 +6,5 @@ int main () return 0; } -/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crc\+aes\+sha3\n} 1 } } */ +/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crc\+aes\+sha3\n} 1 { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+aes\+sha3\n} 1 { target *-*-darwin* } } } */ \ No newline at end of file diff --git gcc/testsuite/gcc.target/aarch64/options_set_28.c gcc/testsuite/gcc.target/aarch64/options_set_28.c index d5b15f8bc..a00e84939 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_28.c +++ gcc/testsuite/gcc.target/aarch64/options_set_28.c @@ -6,4 +6,5 @@ int main () return 0; } -/* { dg-final { scan-assembler-times {\.arch armv9\.3\-a\+crc\+nopredres\+nomops\n} 1 } } */ +/* { dg-final { scan-assembler-times {\.arch armv9\.3\-a\+crc\+nopredres\+nomops\n} 1 { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {\.arch armv9\.3\-a\+nopredres\+nomops\n} 1 { target *-*-darwin* } } } */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_3.c gcc/testsuite/gcc.target/aarch64/options_set_3.c index 96140e362..ebe5a47e9 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_3.c +++ gcc/testsuite/gcc.target/aarch64/options_set_3.c @@ -6,6 +6,7 @@ int main () return 0; } -/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crc\+crypto\n} 1 } } */ +/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crc\+crypto\n} 1 { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crypto} 1 { target *-*-darwin* } } } */ /* Check if smallest set is maintained when outputting. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_4.c gcc/testsuite/gcc.target/aarch64/options_set_4.c index 7b00d09a4..fb2594e0c 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_4.c +++ gcc/testsuite/gcc.target/aarch64/options_set_4.c @@ -6,7 +6,8 @@ int main () return 0; } -/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crc\+crypto\n} 1 } } */ +/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crc\+crypto\n} 1 { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crypto} 1 { target *-*-darwin* } } } */ /* Check if individual bits that make up a grouping is specified that only the grouping is kept. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_5.c gcc/testsuite/gcc.target/aarch64/options_set_5.c index 028fbc46e..81452696d 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_5.c +++ gcc/testsuite/gcc.target/aarch64/options_set_5.c @@ -6,7 +6,8 @@ int main () return 0; } -/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crc\+aes\n} 1 } } */ +/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crc\+aes\n} 1 { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+aes} 1 { target *-*-darwin* } } } */ /* Check if turning off feature bits works correctly and grouping is no longer valid. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_6.c gcc/testsuite/gcc.target/aarch64/options_set_6.c index 09ebdaa21..1abe5d3fb 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_6.c +++ gcc/testsuite/gcc.target/aarch64/options_set_6.c @@ -6,6 +6,7 @@ int main () return 0; } -/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crc\+aes\n} 1 } } */ +/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+crc\+aes\n} 1 { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {\.arch armv8\.2\-a\+aes} 1 { target *-*-darwin* } } } */ /* +crypto turns on +aes and +sha2, but +nosha2 disables +crypto. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_7.c gcc/testsuite/gcc.target/aarch64/options_set_7.c index eb5724f74..6cf65a2e0 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_7.c +++ gcc/testsuite/gcc.target/aarch64/options_set_7.c @@ -6,6 +6,8 @@ int main () return 0; } -/* { dg-final { scan-assembler-times {\.arch armv8\.4\-a\+crc\n} 1 } } */ +/* { dg-final { scan-assembler-times {\.arch armv8\.4\-a\+crc\n} 1 { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {\.arch armv8\.4\-a} 1 { target *-*-darwin* } } } */ +/* { dg-final { scan-assembler-not {\+dotprod} } } */ /* Checking if enabling default features drops the superfluous bits. */ diff --git gcc/testsuite/gcc.target/aarch64/options_set_8.c gcc/testsuite/gcc.target/aarch64/options_set_8.c index a0eacff9c..eb9d5c61f 100644 --- gcc/testsuite/gcc.target/aarch64/options_set_8.c +++ gcc/testsuite/gcc.target/aarch64/options_set_8.c @@ -6,7 +6,9 @@ int main () return 0; } -/* { dg-final { scan-assembler-times {\.arch armv8\.4\-a\+crc\+nodotprod\n} 1 } } */ +/* { dg-final { scan-assembler-times {\.arch armv8\.4\-a\+crc\+nodotprod\n} 1 { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {\.arch armv8\.4\-a} 1 { target *-*-darwin* } } } */ +/* { dg-final { scan-assembler-not {\+dotprod} } } */ /* Checking if trying to turn off default features propagates the commandline option. */ diff --git gcc/testsuite/gcc.target/aarch64/pcs_attribute-2.c gcc/testsuite/gcc.target/aarch64/pcs_attribute-2.c index e85465f25..9eff866e0 100644 --- gcc/testsuite/gcc.target/aarch64/pcs_attribute-2.c +++ gcc/testsuite/gcc.target/aarch64/pcs_attribute-2.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "Not applicable to darwinpcs" { *-*-darwin* } } */ /* { dg-require-effective-target aarch64_variant_pcs } */ /* Test that .variant_pcs is emitted for vector PCS symbol references. */ diff --git gcc/testsuite/gcc.target/aarch64/pr100518.c gcc/testsuite/gcc.target/aarch64/pr100518.c index 177991cfb..4666fd1ad 100644 --- gcc/testsuite/gcc.target/aarch64/pr100518.c +++ gcc/testsuite/gcc.target/aarch64/pr100518.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_mabi_ilp32 } */ /* { dg-options "-mabi=ilp32 -Wno-deprecated -mstrict-align -O2" } */ int unsigned_range_min, unsigned_range_max, a11___trans_tmp_1; diff --git gcc/testsuite/gcc.target/aarch64/pr103147-10.c gcc/testsuite/gcc.target/aarch64/pr103147-10.c index 8ae44a722..00b74191c 100644 --- gcc/testsuite/gcc.target/aarch64/pr103147-10.c +++ gcc/testsuite/gcc.target/aarch64/pr103147-10.c @@ -11,7 +11,7 @@ ** ( ** strb .* ** | -** bl memcpy +** bl _?memcpy ** ) ** ... */ @@ -29,7 +29,7 @@ ld2 (int32x4x2_t *a, int32_t *b) ** ( ** strb .* ** | -** bl memcpy +** bl _?memcpy ** ) ** ... */ @@ -47,7 +47,7 @@ ld3 (int32x4x3_t *a, int32_t *b) ** ( ** strb .* ** | -** bl memcpy +** bl _?memcpy ** ) ** ... */ diff --git gcc/testsuite/gcc.target/aarch64/pr104689.c gcc/testsuite/gcc.target/aarch64/pr104689.c index 3b7adbdfe..de6d8f82a 100644 --- gcc/testsuite/gcc.target/aarch64/pr104689.c +++ gcc/testsuite/gcc.target/aarch64/pr104689.c @@ -2,6 +2,7 @@ /* { dg-do run } */ /* { dg-require-effective-target lp64 } */ /* { dg-options "-fexceptions -O2" } */ +/* { dg-skip-if "asm incompatible with mach-o" { *-*-darwin* } } */ #include #include diff --git gcc/testsuite/gcc.target/aarch64/pr109072_1.c gcc/testsuite/gcc.target/aarch64/pr109072_1.c index 39d802221..534e902a6 100644 --- gcc/testsuite/gcc.target/aarch64/pr109072_1.c +++ gcc/testsuite/gcc.target/aarch64/pr109072_1.c @@ -240,7 +240,7 @@ void consume (float32x4_t, float32x4_t, float32x4_t, float32x4_t); ** dup v1\.4s, v1\.s\[0\] ** dup v0\.4s, v0\.s\[0\] ** ) -** b consume +** b _?consume */ void produce_1 (float32_t a, float32_t b, float32_t c, float32_t d) @@ -268,7 +268,7 @@ produce_1 (float32_t a, float32_t b, float32_t c, float32_t d) ** dup v1\.4s, v1\.s\[0\] ** dup v0\.4s, v0\.s\[0\] ** ) -** b consume +** b _?consume */ void produce_2 (float32_t a, float32_t b, float32_t c, float32_t d) diff --git gcc/testsuite/gcc.target/aarch64/pr109661-1.c gcc/testsuite/gcc.target/aarch64/pr109661-1.c index 5686b2b1c..f40fd5c77 100644 --- gcc/testsuite/gcc.target/aarch64/pr109661-1.c +++ gcc/testsuite/gcc.target/aarch64/pr109661-1.c @@ -1,4 +1,5 @@ /* { dg-options "-O2 -Wpsabi" } */ +/* { dg-skip-if "Darwin ABI is different, test separately" { *-*-darwin* } } */ /* { dg-final { check-function-bodies "**" "" "" } } */ enum __attribute__((aligned(16))) e { E }; diff --git gcc/testsuite/gcc.target/aarch64/pr113114.c gcc/testsuite/gcc.target/aarch64/pr113114.c index 976e2db71..53447e879 100644 --- gcc/testsuite/gcc.target/aarch64/pr113114.c +++ gcc/testsuite/gcc.target/aarch64/pr113114.c @@ -1,5 +1,7 @@ /* { dg-do compile } */ +/* { dg-skip-if "-mabi=ilp32 unsupported" { aarch64-*-darwin* } } */ /* { dg-options "-mabi=ilp32 -Wno-deprecated -O -mearly-ldp-fusion -mlate-ldp-fusion" } */ + void foo_n(double *a) { int i = 1; for (; i < (int)foo_n; i++) diff --git gcc/testsuite/gcc.target/aarch64/pr122763.c gcc/testsuite/gcc.target/aarch64/pr122763.c index bd90c6652..f14e0b47d 100644 --- gcc/testsuite/gcc.target/aarch64/pr122763.c +++ gcc/testsuite/gcc.target/aarch64/pr122763.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-std=gnu99 " } */ -/* { dg-additional-options "-O -fno-schedule-insns -fno-schedule-insns2 " } */ +/* { dg-additional-options "-O -fno-schedule-insns -fno-schedule-insns2 -fno-reorder-blocks" } */ /* { dg-final { check-function-bodies "**" "" "" } } */ /* { dg-skip-if "" { *-*-mingw* } } */ @@ -20,7 +20,7 @@ aarchpcs_overflow (int, int, int, int, int, int, int, int, Empty); ** mov w2, 2 ** mov w1, 1 ** mov w0, 0 -** bl aarchpcs_overflow +** bl _?aarchpcs_overflow ** ... */ @@ -62,7 +62,7 @@ preserve_none_overflow (int, int, int, int, int, int, int, int, int, int, int, i ** mov w21, 1 ** mov w20, 0 ** ... -** bl preserve_none_overflow +** bl _?preserve_none_overflow ** ... */ diff --git gcc/testsuite/gcc.target/aarch64/pr62308.c gcc/testsuite/gcc.target/aarch64/pr62308.c index 1cf6e212d..4c1a733e8 100644 --- gcc/testsuite/gcc.target/aarch64/pr62308.c +++ gcc/testsuite/gcc.target/aarch64/pr62308.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "Darwin platforms do not support big-endian arm64" *-*-darwin* } */ /* { dg-options "-mbig-endian" } */ typedef int __attribute__((vector_size(16))) v4si; diff --git gcc/testsuite/gcc.target/aarch64/pr63304_1.c gcc/testsuite/gcc.target/aarch64/pr63304_1.c index 134fd469b..8ca6a0f48 100644 --- gcc/testsuite/gcc.target/aarch64/pr63304_1.c +++ gcc/testsuite/gcc.target/aarch64/pr63304_1.c @@ -1,6 +1,8 @@ /* { dg-do assemble } */ /* { dg-require-effective-target lp64 } */ /* { dg-options "-O1 --save-temps -fno-pie" } */ +/* { dg-xfail-if "issue #100" { *-*-darwin* } } */ + #pragma GCC push_options #pragma GCC target ("+nothing+simd,cmodel=small") @@ -45,4 +47,4 @@ cal3 (double a) return 1; } -/* { dg-final { scan-assembler-times "adrp" 4 } } */ +/* { dg-final { scan-assembler-times "adrp" 4 { xfail *-*-darwin* } } } */ diff --git gcc/testsuite/gcc.target/aarch64/pr70120-2.c gcc/testsuite/gcc.target/aarch64/pr70120-2.c index 8f5cdc93f..a96710048 100644 --- gcc/testsuite/gcc.target/aarch64/pr70120-2.c +++ gcc/testsuite/gcc.target/aarch64/pr70120-2.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-require-effective-target lp64 } */ /* { dg-options "-Og -freorder-functions -g3 -mcmodel=large -fno-pie" } */ +/* { dg-xfail-if "issue #100" { *-*-darwin* } } */ typedef short v32u16 __attribute__ ((vector_size (32))); typedef int v32u32 __attribute__ ((vector_size (32))); diff --git gcc/testsuite/gcc.target/aarch64/pr78255.c gcc/testsuite/gcc.target/aarch64/pr78255.c index b078cf3e1..fc5d859ee 100644 --- gcc/testsuite/gcc.target/aarch64/pr78255.c +++ gcc/testsuite/gcc.target/aarch64/pr78255.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "Darwin platforms do not support tiny" *-*-darwin* } */ /* { dg-options "-O2 -mcmodel=tiny" } */ extern int bar (void *); diff --git gcc/testsuite/gcc.target/aarch64/pr78561.c gcc/testsuite/gcc.target/aarch64/pr78561.c index 048d2d796..635214edd 100644 --- gcc/testsuite/gcc.target/aarch64/pr78561.c +++ gcc/testsuite/gcc.target/aarch64/pr78561.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "Darwin platforms do not support tiny" *-*-darwin* } */ /* { dg-options "-Og -O3 -mcmodel=tiny" } */ int diff --git gcc/testsuite/gcc.target/aarch64/pr78733.c gcc/testsuite/gcc.target/aarch64/pr78733.c index 8556ef3f3..da31d0ff1 100644 --- gcc/testsuite/gcc.target/aarch64/pr78733.c +++ gcc/testsuite/gcc.target/aarch64/pr78733.c @@ -2,6 +2,7 @@ /* { dg-options "-O2 -mcmodel=large -mpc-relative-literal-loads -fno-pie" } */ /* { dg-require-effective-target lp64 } */ /* { dg-skip-if "-mcmodel=large, no support for -fpic" { aarch64-*-* } { "-fpic" } { "" } } */ +/* { dg-xfail-if "issue #100" { *-*-darwin* } } */ __int128 t (void) @@ -9,5 +10,5 @@ t (void) return ((__int128)0x123456789abcdef << 64) | 0xfedcba987654321; } -/* { dg-final { scan-assembler "adr" } } */ +/* { dg-final { scan-assembler "adr" { xfail { *-*-darwin* } } } } */ /* { dg-final { scan-assembler-not "adrp" } } */ diff --git gcc/testsuite/gcc.target/aarch64/pr79041-2.c gcc/testsuite/gcc.target/aarch64/pr79041-2.c index 8556ef3f3..da31d0ff1 100644 --- gcc/testsuite/gcc.target/aarch64/pr79041-2.c +++ gcc/testsuite/gcc.target/aarch64/pr79041-2.c @@ -2,6 +2,7 @@ /* { dg-options "-O2 -mcmodel=large -mpc-relative-literal-loads -fno-pie" } */ /* { dg-require-effective-target lp64 } */ /* { dg-skip-if "-mcmodel=large, no support for -fpic" { aarch64-*-* } { "-fpic" } { "" } } */ +/* { dg-xfail-if "issue #100" { *-*-darwin* } } */ __int128 t (void) @@ -9,5 +10,5 @@ t (void) return ((__int128)0x123456789abcdef << 64) | 0xfedcba987654321; } -/* { dg-final { scan-assembler "adr" } } */ +/* { dg-final { scan-assembler "adr" { xfail { *-*-darwin* } } } } */ /* { dg-final { scan-assembler-not "adrp" } } */ diff --git gcc/testsuite/gcc.target/aarch64/pr80295.c gcc/testsuite/gcc.target/aarch64/pr80295.c index c79427517..618479589 100644 --- gcc/testsuite/gcc.target/aarch64/pr80295.c +++ gcc/testsuite/gcc.target/aarch64/pr80295.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_mabi_ilp32 } */ /* { dg-options "-mabi=ilp32 -Wno-deprecated" } */ void f (void *b) diff --git gcc/testsuite/gcc.target/aarch64/pr84882.c gcc/testsuite/gcc.target/aarch64/pr84882.c index 89b5d1a58..e99d10481 100644 --- gcc/testsuite/gcc.target/aarch64/pr84882.c +++ gcc/testsuite/gcc.target/aarch64/pr84882.c @@ -1,6 +1,7 @@ /* This is a copy of pr71727.c with scanning reversed. */ /* { dg-do compile } */ /* { dg-options "-mstrict-align -O3 -mno-strict-align" } */ +/* { dg-additional-options "-mtune=generic -fomit-frame-pointer" { target *-*-darwin* } } */ struct test_struct_s { diff --git gcc/testsuite/gcc.target/aarch64/pr87305.c gcc/testsuite/gcc.target/aarch64/pr87305.c index 7a3e41820..6c47d6cc0 100644 --- gcc/testsuite/gcc.target/aarch64/pr87305.c +++ gcc/testsuite/gcc.target/aarch64/pr87305.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "Darwin platforms do not support big-endian arm64" *-*-darwin* } */ /* { dg-options "-fpermissive -Ofast -mbig-endian -w" } */ int cc; diff --git gcc/testsuite/gcc.target/aarch64/pr92424-1.c gcc/testsuite/gcc.target/aarch64/pr92424-1.c index c413a2c30..59f7435dc 100644 --- gcc/testsuite/gcc.target/aarch64/pr92424-1.c +++ gcc/testsuite/gcc.target/aarch64/pr92424-1.c @@ -1,6 +1,7 @@ /* { dg-do "compile" } */ /* { dg-options "-O1" } */ /* { dg-final { check-function-bodies "**" "" } } */ +/* { dg-skip-if "unimplemented patchable function entry" *-*-darwin* } */ /* Note: this test only checks the instructions in the function bodies, not the placement of the patch label or nops before the futncion. */ diff --git gcc/testsuite/gcc.target/aarch64/pr92424-2.c gcc/testsuite/gcc.target/aarch64/pr92424-2.c index 0a7990110..ce59d3eb5 100644 --- gcc/testsuite/gcc.target/aarch64/pr92424-2.c +++ gcc/testsuite/gcc.target/aarch64/pr92424-2.c @@ -1,5 +1,6 @@ /* { dg-do "compile" } */ /* { dg-options "-O1" } */ +/* { dg-skip-if "unimplemented patchable function entry" *-*-darwin* } */ /* Test the placement of the .LPFE0 label. */ diff --git gcc/testsuite/gcc.target/aarch64/pr92424-3.c gcc/testsuite/gcc.target/aarch64/pr92424-3.c index 854bb7f9f..2ef99991c 100644 --- gcc/testsuite/gcc.target/aarch64/pr92424-3.c +++ gcc/testsuite/gcc.target/aarch64/pr92424-3.c @@ -1,5 +1,6 @@ /* { dg-do "compile" } */ /* { dg-options "-O1" } */ +/* { dg-skip-if "unimplemented patchable function entry" *-*-darwin* } */ /* Test the placement of the .LPFE0 label. */ diff --git gcc/testsuite/gcc.target/aarch64/pr94201.c gcc/testsuite/gcc.target/aarch64/pr94201.c index cd21f7c06..5ec1d5bb8 100644 --- gcc/testsuite/gcc.target/aarch64/pr94201.c +++ gcc/testsuite/gcc.target/aarch64/pr94201.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_mabi_ilp32 } */ /* { dg-options "-mcmodel=tiny -mabi=ilp32 -Wno-deprecated -fPIC" } */ /* { dg-require-effective-target fpic } */ diff --git gcc/testsuite/gcc.target/aarch64/pr94530.c gcc/testsuite/gcc.target/aarch64/pr94530.c index 5dfdbe331..e273b0357 100644 --- gcc/testsuite/gcc.target/aarch64/pr94530.c +++ gcc/testsuite/gcc.target/aarch64/pr94530.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-require-effective-target lp64 } */ /* { dg-options "-Os -mcpu=falkor -mpc-relative-literal-loads -mcmodel=large -fno-pie" } */ +/* { dg-xfail-if "issue #100" { *-*-darwin* } } */ extern void bar(const char *); diff --git gcc/testsuite/gcc.target/aarch64/pr94577.c gcc/testsuite/gcc.target/aarch64/pr94577.c index 49cb6e10a..2f5aae663 100644 --- gcc/testsuite/gcc.target/aarch64/pr94577.c +++ gcc/testsuite/gcc.target/aarch64/pr94577.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-effective-target arm_mabi_ilp32 } */ /* { dg-options "-mcmodel=large -mabi=ilp32 -Wno-deprecated -fno-pie" } */ void diff --git gcc/testsuite/gcc.target/aarch64/pr97535.c gcc/testsuite/gcc.target/aarch64/pr97535.c index 7d4db485f..6f1ee8035 100644 --- gcc/testsuite/gcc.target/aarch64/pr97535.c +++ gcc/testsuite/gcc.target/aarch64/pr97535.c @@ -13,4 +13,4 @@ void setRaw(const void *raw) /* At any optimization level this should be a function call and not inlined. */ -/* { dg-final { scan-assembler "bl\tmemcpy" } } */ +/* { dg-final { scan-assembler "bl\t_*memcpy" } } */ diff --git gcc/testsuite/gcc.target/aarch64/pr98776.c gcc/testsuite/gcc.target/aarch64/pr98776.c index b075b8f75..89a68717d 100644 --- gcc/testsuite/gcc.target/aarch64/pr98776.c +++ gcc/testsuite/gcc.target/aarch64/pr98776.c @@ -1,5 +1,6 @@ /* { dg-do "compile" } */ /* { dg-options "-O1 -fpatchable-function-entry=1 -fasynchronous-unwind-tables" } */ +/* { dg-skip-if "unimplemented patchable function entry" *-*-darwin* } */ /* Test the placement of the .LPFE0 label. */ diff --git gcc/testsuite/gcc.target/aarch64/preserve_none_1.c gcc/testsuite/gcc.target/aarch64/preserve_none_1.c index 139017383..35d2b8172 100644 --- gcc/testsuite/gcc.target/aarch64/preserve_none_1.c +++ gcc/testsuite/gcc.target/aarch64/preserve_none_1.c @@ -35,7 +35,7 @@ void preserve_none_caller1() [[gnu::preserve_none]] ** preserve_none_caller2: ** stp x29, x30, \[sp, #?-16\]! ** mov x29, sp -** bl normal_callee +** bl _?normal_callee ** mov w0, w20 ** ldp x29, x30, \[sp\], #?16 ** ret @@ -50,9 +50,9 @@ int preserve_none_caller2(int x) [[gnu::preserve_none]] ** preserve_none_caller3: ** stp x29, x30, \[sp, #?-32\]! ** mov x29, sp -** str w20, \[sp, #?[0-9]+\] -** bl preserve_none_callee -** ldr w0, \[sp, #?[0-9]+\] +** str w20, \[(sp|x29), #?[0-9]+\] +** bl _?preserve_none_callee +** ldr w0, \[(sp|x29), #?[0-9]+\] ** ldp x29, x30, \[sp\], #?32 ** ret */ @@ -64,7 +64,7 @@ int preserve_none_caller3(int x) [[gnu::preserve_none]] /* ** preserve_none_caller4: -** b preserve_none_callee +** b _?preserve_none_callee */ void preserve_none_caller4() [[gnu::preserve_none]] { @@ -73,7 +73,7 @@ void preserve_none_caller4() [[gnu::preserve_none]] /* ** preserve_none_caller5: -** b preserve_none_callee +** b _?preserve_none_callee */ void preserve_none_caller5(__SVBool_t x) [[gnu::preserve_none]] { @@ -93,7 +93,7 @@ void preserve_none_caller5(__SVBool_t x) [[gnu::preserve_none]] ** stp d10, d11, \[sp, #?112\] ** stp d12, d13, \[sp, #?128\] ** stp d14, d15, \[sp, #?144\] -** bl preserve_none_callee +** bl _?preserve_none_callee ** ldp d8, d9, \[sp, #?96\] ** ldp d10, d11, \[sp, #?112\] ** ldp d12, d13, \[sp, #?128\] diff --git gcc/testsuite/gcc.target/aarch64/preserve_none_4.c gcc/testsuite/gcc.target/aarch64/preserve_none_4.c index fc8347d6c..a0300b3b4 100644 --- gcc/testsuite/gcc.target/aarch64/preserve_none_4.c +++ gcc/testsuite/gcc.target/aarch64/preserve_none_4.c @@ -40,7 +40,7 @@ int no_arg_stack_use_callee ** mov w22, 2 ** mov w21, 1 ** mov w20, 0 -** bl no_arg_stack_use_callee +** bl _?no_arg_stack_use_callee ** add w0, w0, 1 ** ... */ @@ -87,7 +87,7 @@ int arg_stack_use_callee ** mov w20, 0 ** str w0, \[sp\] ** mov w0, 9 -** bl arg_stack_use_callee +** bl _?arg_stack_use_callee ** add w0, w0, 1 ** ... */ diff --git gcc/testsuite/gcc.target/aarch64/reg-alloc-4.c gcc/testsuite/gcc.target/aarch64/reg-alloc-4.c index 0576dc27e..fb1b86d93 100644 --- gcc/testsuite/gcc.target/aarch64/reg-alloc-4.c +++ gcc/testsuite/gcc.target/aarch64/reg-alloc-4.c @@ -22,7 +22,7 @@ struct L ** ldr (x[0-9]+), \[\2, #?16\] ** str \3, \[\2\] ** ldr \2, \[\2, #?8\] -** cbn?z \4, .* +** cbn?z \4, .?L[0-9]+ ** ... ** ret */ diff --git gcc/testsuite/gcc.target/aarch64/reload-valid-spoff.c gcc/testsuite/gcc.target/aarch64/reload-valid-spoff.c index 37e00ac9a..0859f0741 100644 --- gcc/testsuite/gcc.target/aarch64/reload-valid-spoff.c +++ gcc/testsuite/gcc.target/aarch64/reload-valid-spoff.c @@ -2,6 +2,7 @@ /* { dg-require-effective-target lp64 } */ /* { dg-options "-O2 -mcmodel=large -fno-builtin -fno-pie" } */ /* { dg-skip-if "-mcmodel=large -fPIC not currently supported" { aarch64-*-* } { "-fPIC" } { "" } } */ +/* { dg-skip-if "-mcmodel=large current unsupported" { aarch64-*-darwin* } } */ typedef long unsigned int size_t; typedef unsigned short int sa_family_t; diff --git gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-2.c gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-2.c index 8eec6824f..193c65717 100644 --- gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-2.c +++ gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-2.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-Ofast" } */ +/* { dg-skip-if "no system variant_pcs support" *-*-darwin* } */ __attribute__ ((__simd__ ("notinbranch"))) __attribute__ ((__nothrow__ , __leaf__ , __const__)) @@ -12,5 +13,5 @@ void bar(double * f, int n) f[i] = foo(f[i]); } -/* { dg-final { scan-assembler-not {\.variant_pcs\tfoo} } } */ -/* { dg-final { scan-assembler-times {\.variant_pcs\t_ZGVnN2v_foo} 1 } } */ +/* { dg-final { scan-assembler-not {\.variant_pcs\t_?foo} } } */ +/* { dg-final { scan-assembler-times {\.variant_pcs\t_?_ZGVnN2v_foo} 1 } } */ diff --git gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-3.c gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-3.c index c6dac6b10..8d81105de 100644 --- gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-3.c +++ gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute-3.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-Ofast" } */ +/* { dg-skip-if "no system variant_pcs support" *-*-darwin* } */ __attribute__ ((__simd__)) __attribute__ ((__nothrow__ , __leaf__ , __const__)) diff --git gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute.c gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute.c index eddcef359..62ee482a8 100644 --- gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute.c +++ gcc/testsuite/gcc.target/aarch64/simd_pcs_attribute.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-Ofast" } */ +/* { dg-skip-if "no system variant_pcs support" *-*-darwin* } */ __attribute__ ((__simd__ ("notinbranch"))) __attribute__ ((__nothrow__ , __leaf__ , __const__)) @@ -12,5 +13,5 @@ void foo(double *f, int n) f[i] = log(f[i]); } -/* { dg-final { scan-assembler-not {\.variant_pcs\tlog} } } */ -/* { dg-final { scan-assembler-times {\.variant_pcs\t_ZGVnN2v_log} 1 } } */ +/* { dg-final { scan-assembler-not {\.variant_pcs\t_?log} } } */ +/* { dg-final { scan-assembler-times {\.variant_pcs\t_?_ZGVnN2v_log} 1 } } */ diff --git gcc/testsuite/gcc.target/aarch64/sme/aarch64-sme.exp gcc/testsuite/gcc.target/aarch64/sme/aarch64-sme.exp index 39fcc5128..b1e460dfb 100644 --- gcc/testsuite/gcc.target/aarch64/sme/aarch64-sme.exp +++ gcc/testsuite/gcc.target/aarch64/sme/aarch64-sme.exp @@ -24,6 +24,11 @@ if {![istarget aarch64*-*-*] } { return } +# Exit immediately if this is Darwin (for now). +if {[istarget *-*-darwin*] } { + return +} + # Load support procs. load_lib gcc-dg.exp diff --git gcc/testsuite/gcc.target/aarch64/sme2/aarch64-sme2-acle-asm.exp gcc/testsuite/gcc.target/aarch64/sme2/aarch64-sme2-acle-asm.exp index 304c0886d..186698bae 100644 --- gcc/testsuite/gcc.target/aarch64/sme2/aarch64-sme2-acle-asm.exp +++ gcc/testsuite/gcc.target/aarch64/sme2/aarch64-sme2-acle-asm.exp @@ -24,6 +24,11 @@ if {![istarget aarch64*-*-*] } { return } +# Darwin's assembler support for sme2 appears incomplete. +if { [istarget *-*-darwin*] && ![info exists env(DARWIN_TEST_SME2)]} then { + return +} + # Load support procs. load_lib gcc-dg.exp diff --git gcc/testsuite/gcc.target/aarch64/stack-check-cfa-1.c gcc/testsuite/gcc.target/aarch64/stack-check-cfa-1.c index 412a9ed1a..8c71ab2ec 100644 --- gcc/testsuite/gcc.target/aarch64/stack-check-cfa-1.c +++ gcc/testsuite/gcc.target/aarch64/stack-check-cfa-1.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -funwind-tables -fno-stack-protector" } */ /* { dg-require-effective-target supports_stack_clash_protection } */ +/* { dg-skip-if "no cfi insn support yet" *-*-darwin* } */ #define SIZE 128*1024 #include "stack-check-prologue.h" diff --git gcc/testsuite/gcc.target/aarch64/stack-check-cfa-2.c gcc/testsuite/gcc.target/aarch64/stack-check-cfa-2.c index e440569a0..24cf904f4 100644 --- gcc/testsuite/gcc.target/aarch64/stack-check-cfa-2.c +++ gcc/testsuite/gcc.target/aarch64/stack-check-cfa-2.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-guard-size=16 -funwind-tables -fno-stack-protector" } */ /* { dg-require-effective-target supports_stack_clash_protection } */ +/* { dg-skip-if "no cfi insn support yet" *-*-darwin* } */ #define SIZE 1280*1024 + 512 #include "stack-check-prologue.h" diff --git gcc/testsuite/gcc.target/aarch64/stack-check-cfa-3.c gcc/testsuite/gcc.target/aarch64/stack-check-cfa-3.c index c4b7bb601..ccaf2e6f8 100644 --- gcc/testsuite/gcc.target/aarch64/stack-check-cfa-3.c +++ gcc/testsuite/gcc.target/aarch64/stack-check-cfa-3.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O3 -fopenmp-simd -march=armv8-a+sve -fstack-clash-protection --param stack-clash-protection-guard-size=16 -funwind-tables" } */ /* { dg-require-effective-target supports_stack_clash_protection } */ +/* { dg-skip-if "no cfi insn support yet" *-*-darwin* } */ #include "stack-check-prologue-16.c" diff --git gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c index 1cf6fbbb0..936d94ea4 100644 --- gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c +++ gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c @@ -1,3 +1,4 @@ +/* { dg-skip-if "incompatible stack layout" { *-*-darwin* } } */ /* { dg-options "-O2 -fstack-clash-protection -fomit-frame-pointer --param stack-clash-protection-guard-size=12 -fno-stack-protector" } */ /* { dg-final { check-function-bodies "**" "" } } */ diff --git gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c index 2e06346c1..2791f3725 100644 --- gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c +++ gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c @@ -1,3 +1,4 @@ +/* { dg-skip-if "incompatible stack layout" { *-*-darwin* } } */ /* { dg-options "-O2 -fstack-clash-protection -fomit-frame-pointer --param stack-clash-protection-guard-size=12 -fno-stack-protector" } */ /* { dg-final { check-function-bodies "**" "" } } */ diff --git gcc/testsuite/gcc.target/aarch64/stack-check-prologue-19.c gcc/testsuite/gcc.target/aarch64/stack-check-prologue-19.c index 49dc51142..a2a7fdc8f 100644 --- gcc/testsuite/gcc.target/aarch64/stack-check-prologue-19.c +++ gcc/testsuite/gcc.target/aarch64/stack-check-prologue-19.c @@ -1,3 +1,4 @@ +/* { dg-skip-if "incompatible stack layout" { *-*-darwin* } } */ /* { dg-options "-O2 -fstack-clash-protection -fomit-frame-pointer --param stack-clash-protection-guard-size=12 -fsanitize=shadow-call-stack -ffixed-x18 -fno-stack-protector" } */ /* { dg-skip-if "conflicts with x18" { aarch64-*-vxworks* } } */ /* { dg-final { check-function-bodies "**" "" } } */ diff --git gcc/testsuite/gcc.target/aarch64/stack-protector-1.c gcc/testsuite/gcc.target/aarch64/stack-protector-1.c index 73e83bc41..e3232b2cc 100644 --- gcc/testsuite/gcc.target/aarch64/stack-protector-1.c +++ gcc/testsuite/gcc.target/aarch64/stack-protector-1.c @@ -1,4 +1,5 @@ /* { dg-do run } */ +/* { dg-skip-if "incompatible asm" { *-*-darwin* } } */ /* { dg-require-effective-target fstack_protector } */ /* { dg-options "-fstack-protector-all -O2" } */ diff --git gcc/testsuite/gcc.target/aarch64/stack-protector-2.c gcc/testsuite/gcc.target/aarch64/stack-protector-2.c index 266c36fdb..48f044d03 100644 --- gcc/testsuite/gcc.target/aarch64/stack-protector-2.c +++ gcc/testsuite/gcc.target/aarch64/stack-protector-2.c @@ -1,4 +1,5 @@ /* { dg-do run } */ +/* { dg-skip-if "incompatible asm" { *-*-darwin* } } */ /* { dg-require-effective-target fstack_protector } */ /* { dg-require-effective-target fpic } */ /* { dg-options "-fstack-protector-all -O2 -fpic" } */ diff --git gcc/testsuite/gcc.target/aarch64/stack-protector-3.c gcc/testsuite/gcc.target/aarch64/stack-protector-3.c index 909e26c4c..3700e30c0 100644 --- gcc/testsuite/gcc.target/aarch64/stack-protector-3.c +++ gcc/testsuite/gcc.target/aarch64/stack-protector-3.c @@ -1,4 +1,5 @@ /* { dg-do run } */ +/* { dg-skip-if "incompatible asm" { *-*-darwin* } } */ /* { dg-require-effective-target fstack_protector } */ /* { dg-options "-fstack-protector-all -O2" } */ diff --git gcc/testsuite/gcc.target/aarch64/stack-protector-4.c gcc/testsuite/gcc.target/aarch64/stack-protector-4.c index 6334dd009..fa8a01181 100644 --- gcc/testsuite/gcc.target/aarch64/stack-protector-4.c +++ gcc/testsuite/gcc.target/aarch64/stack-protector-4.c @@ -1,4 +1,5 @@ /* { dg-do run } */ +/* { dg-skip-if "incompatible asm" { *-*-darwin* } } */ /* { dg-require-effective-target fstack_protector } */ /* { dg-require-effective-target fpic } */ /* { dg-options "-fstack-protector-all -O2 -fpic" } */ diff --git gcc/testsuite/gcc.target/aarch64/stack-protector-8.c gcc/testsuite/gcc.target/aarch64/stack-protector-8.c index e71d820e3..8159efe86 100644 --- gcc/testsuite/gcc.target/aarch64/stack-protector-8.c +++ gcc/testsuite/gcc.target/aarch64/stack-protector-8.c @@ -1,4 +1,5 @@ /* { dg-options " -O -fstack-protector-strong -mstack-protector-guard=sysreg -mstack-protector-guard-reg=tpidr2_el0 -mstack-protector-guard-offset=16" } */ +/* { dg-skip-if "incompatible stack layout" { *-*-darwin* } } */ /* { dg-final { check-function-bodies "**" "" } } */ void g(void *); diff --git gcc/testsuite/gcc.target/aarch64/sve/aarch64-sve.exp gcc/testsuite/gcc.target/aarch64/sve/aarch64-sve.exp index f9ee84fef..eaa023bb7 100644 --- gcc/testsuite/gcc.target/aarch64/sve/aarch64-sve.exp +++ gcc/testsuite/gcc.target/aarch64/sve/aarch64-sve.exp @@ -25,6 +25,11 @@ if {![istarget aarch64*-*-*] } then { return } +# Darwin doesn't have SVE and the testing is expensive, so make it optional. +if { [istarget *-*-darwin*] && ![info exists env(DARWIN_TEST_SVE)]} then { + return +} + # Load support procs. load_lib gcc-dg.exp diff --git gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp index e8216a007..521ef598b 100644 --- gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp +++ gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle-asm.exp @@ -24,6 +24,11 @@ if {![istarget aarch64*-*-*] } { return } +# Darwin doesn't have SVE and the testing is expensive, so make it optional. +if { [istarget *-*-darwin*] && ![info exists env(DARWIN_TEST_SVE)]} then { + return +} + # Load support procs. load_lib gcc-dg.exp diff --git gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp index 68747eff2..c1c0177bc 100644 --- gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp +++ gcc/testsuite/gcc.target/aarch64/sve/acle/aarch64-sve-acle.exp @@ -25,6 +25,11 @@ if {![istarget aarch64*-*-*] } { return } +# Darwin doesn't have SVE and the testing is expensive, so make it optional. +if { [istarget *-*-darwin*] && ![info exists env(DARWIN_TEST_SVE)] } then { + return +} + # Load support procs. load_lib gcc-dg.exp diff --git gcc/testsuite/gcc.target/aarch64/sve/acle/general/dupq_2.c gcc/testsuite/gcc.target/aarch64/sve/acle/general/dupq_2.c index 13ebb9fd6..f8b81062d 100644 --- gcc/testsuite/gcc.target/aarch64/sve/acle/general/dupq_2.c +++ gcc/testsuite/gcc.target/aarch64/sve/acle/general/dupq_2.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "no BE support" { aarch64-*-darwin* } } */ /* { dg-options "-O2 -mbig-endian" } */ /* To avoid needing big-endian header files. */ diff --git gcc/testsuite/gcc.target/aarch64/sve/acle/general/dupq_4.c gcc/testsuite/gcc.target/aarch64/sve/acle/general/dupq_4.c index 13d27e278..53869f688 100644 --- gcc/testsuite/gcc.target/aarch64/sve/acle/general/dupq_4.c +++ gcc/testsuite/gcc.target/aarch64/sve/acle/general/dupq_4.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "no BE support" { aarch64-*-darwin* } } */ /* { dg-options "-O2 -mbig-endian" } */ /* To avoid needing big-endian header files. */ diff --git gcc/testsuite/gcc.target/aarch64/sve/acle/general/dupq_6.c gcc/testsuite/gcc.target/aarch64/sve/acle/general/dupq_6.c index 20e692118..efd2251d2 100644 --- gcc/testsuite/gcc.target/aarch64/sve/acle/general/dupq_6.c +++ gcc/testsuite/gcc.target/aarch64/sve/acle/general/dupq_6.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-skip-if "no BE support" { aarch64-*-darwin* } } */ /* { dg-options "-O2 -mbig-endian" } */ /* To avoid needing big-endian header files. */ diff --git gcc/testsuite/gcc.target/aarch64/sve/pcs/aarch64-sve-pcs.exp gcc/testsuite/gcc.target/aarch64/sve/pcs/aarch64-sve-pcs.exp index 4c27e98ac..6763cef2a 100644 --- gcc/testsuite/gcc.target/aarch64/sve/pcs/aarch64-sve-pcs.exp +++ gcc/testsuite/gcc.target/aarch64/sve/pcs/aarch64-sve-pcs.exp @@ -25,6 +25,11 @@ if {![istarget aarch64*-*-*] } then { return } +# Darwin does not support .variant_pcs at present. +if { [istarget *-*-darwin*] } then { + return +} + # Load support procs. load_lib gcc-dg.exp diff --git gcc/testsuite/gcc.target/aarch64/sve/pr108603.c gcc/testsuite/gcc.target/aarch64/sve/pr108603.c index 18aa4cfe7..0ea28c2f6 100644 --- gcc/testsuite/gcc.target/aarch64/sve/pr108603.c +++ gcc/testsuite/gcc.target/aarch64/sve/pr108603.c @@ -1,3 +1,4 @@ +/* { dg-skip-if "no 32b support" { aarch64-*-darwin* } } */ /* { dg-options "-O2 -mabi=ilp32 -Wno-deprecated -fdata-sections" } */ int a[128]; diff --git gcc/testsuite/gcc.target/aarch64/sve/pr88847.c gcc/testsuite/gcc.target/aarch64/sve/pr88847.c index b7504add9..1188f1c0d 100644 --- gcc/testsuite/gcc.target/aarch64/sve/pr88847.c +++ gcc/testsuite/gcc.target/aarch64/sve/pr88847.c @@ -1,4 +1,5 @@ /* { dg-do assemble { target aarch64_asm_sve_ok } } */ +/* { dg-skip-if "no BE support" { aarch64-*-darwin* } } */ /* { dg-additional-options "-O0 -msve-vector-bits=256 -mbig-endian --save-temps" } */ typedef struct _b { diff --git gcc/testsuite/gcc.target/aarch64/sve/revb_2.c gcc/testsuite/gcc.target/aarch64/sve/revb_2.c index 389739cc8..a5b176629 100644 --- gcc/testsuite/gcc.target/aarch64/sve/revb_2.c +++ gcc/testsuite/gcc.target/aarch64/sve/revb_2.c @@ -1,4 +1,5 @@ /* { dg-do assemble { target aarch64_asm_sve_ok } } */ +/* { dg-skip-if "no BE support" { aarch64-*-darwin* } } */ /* { dg-options "-O -msve-vector-bits=256 --save-temps -mbig-endian" } */ #include "revb_1.c" diff --git gcc/testsuite/gcc.target/aarch64/sve/revh_2.c gcc/testsuite/gcc.target/aarch64/sve/revh_2.c index e821b6402..9fff22704 100644 --- gcc/testsuite/gcc.target/aarch64/sve/revh_2.c +++ gcc/testsuite/gcc.target/aarch64/sve/revh_2.c @@ -1,4 +1,5 @@ /* { dg-do assemble { target aarch64_asm_sve_ok } } */ +/* { dg-skip-if "no BE support" { aarch64-*-darwin* } } */ /* { dg-options "-O -msve-vector-bits=256 --save-temps -mbig-endian" } */ #include "revh_1.c" diff --git gcc/testsuite/gcc.target/aarch64/sve/revhw_2.c gcc/testsuite/gcc.target/aarch64/sve/revhw_2.c index 7634d01b2..b231066b5 100644 --- gcc/testsuite/gcc.target/aarch64/sve/revhw_2.c +++ gcc/testsuite/gcc.target/aarch64/sve/revhw_2.c @@ -1,4 +1,5 @@ /* { dg-do assemble { target aarch64_asm_sve_ok } } */ +/* { dg-skip-if "no BE support" { aarch64-*-darwin* } } */ /* { dg-options "-O -msve-vector-bits=2048 -mbig-endian --save-temps" } */ /* { dg-final { check-function-bodies "**" "" } } */ diff --git gcc/testsuite/gcc.target/aarch64/sve/revw_2.c gcc/testsuite/gcc.target/aarch64/sve/revw_2.c index 17243c05c..fca6e8fea 100644 --- gcc/testsuite/gcc.target/aarch64/sve/revw_2.c +++ gcc/testsuite/gcc.target/aarch64/sve/revw_2.c @@ -1,4 +1,5 @@ /* { dg-do assemble { target aarch64_asm_sve_ok } } */ +/* { dg-skip-if "no BE support" { aarch64-*-darwin* } } */ /* { dg-options "-O -msve-vector-bits=256 --save-temps -mbig-endian" } */ #include "revw_1.c" diff --git gcc/testsuite/gcc.target/aarch64/sve/struct_move_1.c gcc/testsuite/gcc.target/aarch64/sve/struct_move_1.c index 16e48bef0..f8e6efff4 100644 --- gcc/testsuite/gcc.target/aarch64/sve/struct_move_1.c +++ gcc/testsuite/gcc.target/aarch64/sve/struct_move_1.c @@ -1,4 +1,5 @@ /* { dg-do assemble { target aarch64_asm_sve_ok } } */ +/* { dg-skip-if "no BE support" { aarch64-*-darwin* } } */ /* { dg-options "-O -msve-vector-bits=256 -mbig-endian --save-temps" } */ typedef char vnx16qi __attribute__((vector_size(32))); diff --git gcc/testsuite/gcc.target/aarch64/sve/struct_move_2.c gcc/testsuite/gcc.target/aarch64/sve/struct_move_2.c index 6041f2a2a..c18730a2a 100644 --- gcc/testsuite/gcc.target/aarch64/sve/struct_move_2.c +++ gcc/testsuite/gcc.target/aarch64/sve/struct_move_2.c @@ -1,4 +1,5 @@ /* { dg-do assemble { target aarch64_asm_sve_ok } } */ +/* { dg-skip-if "no BE support" { aarch64-*-darwin* } } */ /* { dg-options "-O -msve-vector-bits=256 -mbig-endian --save-temps" } */ typedef char vnx16qi __attribute__((vector_size(32))); diff --git gcc/testsuite/gcc.target/aarch64/sve/struct_move_3.c gcc/testsuite/gcc.target/aarch64/sve/struct_move_3.c index d6092e791..4cace483d 100644 --- gcc/testsuite/gcc.target/aarch64/sve/struct_move_3.c +++ gcc/testsuite/gcc.target/aarch64/sve/struct_move_3.c @@ -1,4 +1,5 @@ /* { dg-do assemble { target aarch64_asm_sve_ok } } */ +/* { dg-skip-if "no BE support" { aarch64-*-darwin* } } */ /* { dg-options "-O -msve-vector-bits=256 -mbig-endian --save-temps" } */ typedef char vnx16qi __attribute__((vector_size(32))); diff --git gcc/testsuite/gcc.target/aarch64/sve2/aarch64-sve2.exp gcc/testsuite/gcc.target/aarch64/sve2/aarch64-sve2.exp index 8117028ae..7028b1bfd 100644 --- gcc/testsuite/gcc.target/aarch64/sve2/aarch64-sve2.exp +++ gcc/testsuite/gcc.target/aarch64/sve2/aarch64-sve2.exp @@ -25,6 +25,11 @@ if {![istarget aarch64*-*-*] } then { return } +# Darwin assembler sve2 support is incomplete in places +if { [istarget *-*-darwin*] && ![info exists env(DARWIN_TEST_SVE2)] } then { + return +} + # Load support procs. load_lib gcc-dg.exp diff --git gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp index ffb884db4..5ef579a68 100644 --- gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp +++ gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle-asm.exp @@ -24,6 +24,11 @@ if {![istarget aarch64*-*-*] } { return } +# Darwin assembler sve2 support is incomplete in places +if { [istarget *-*-darwin*] && ![info exists env(DARWIN_TEST_SVE2)] } then { + return +} + # Load support procs. load_lib gcc-dg.exp diff --git gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle.exp gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle.exp index 309cb8c2c..228bcf22c 100644 --- gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle.exp +++ gcc/testsuite/gcc.target/aarch64/sve2/acle/aarch64-sve2-acle.exp @@ -25,6 +25,11 @@ if {![istarget aarch64*-*-*] } { return } +# Darwin assembler sve2 support is incomplete in places +if { [istarget *-*-darwin*] && ![info exists env(DARWIN_TEST_SVE2)] } then { + return +} + # Load support procs. load_lib gcc-dg.exp diff --git gcc/testsuite/gcc.target/aarch64/symbol-range-tiny.c gcc/testsuite/gcc.target/aarch64/symbol-range-tiny.c index fc6a4f3ec..2d9e94bc6 100644 --- gcc/testsuite/gcc.target/aarch64/symbol-range-tiny.c +++ gcc/testsuite/gcc.target/aarch64/symbol-range-tiny.c @@ -1,4 +1,5 @@ /* { dg-do link } */ +/* { dg-skip-if "no mcmodel tiny" *-*-darwin* } */ /* { dg-options "-O3 -save-temps -mcmodel=tiny" } */ char fixed_regs[0x00080000]; diff --git gcc/testsuite/gcc.target/aarch64/target_attr_1.c gcc/testsuite/gcc.target/aarch64/target_attr_1.c index 4a3a1ee23..3a297931d 100644 --- gcc/testsuite/gcc.target/aarch64/target_attr_1.c +++ gcc/testsuite/gcc.target/aarch64/target_attr_1.c @@ -10,5 +10,5 @@ foo (int a) return a + 1; } -/* { dg-final { scan-assembler "//.tune cortex-a72.cortex-a53" } } */ +/* { dg-final { scan-assembler "(//|;).tune cortex-a72.cortex-a53" } } */ /* { dg-final { scan-assembler-not "thunderx" } } */ diff --git gcc/testsuite/gcc.target/aarch64/target_attr_7.c gcc/testsuite/gcc.target/aarch64/target_attr_7.c index 6067ffed3..2260e5101 100644 --- gcc/testsuite/gcc.target/aarch64/target_attr_7.c +++ gcc/testsuite/gcc.target/aarch64/target_attr_7.c @@ -19,6 +19,6 @@ bam (int a) return a - bar (a); } -/* { dg-final { scan-assembler-times "//.tune xgene1" 1 } } */ -/* { dg-final { scan-assembler-times "//.tune cortex-a53" 1 } } */ +/* { dg-final { scan-assembler-times "(//|;).tune xgene1" 1 } } */ +/* { dg-final { scan-assembler-times "(//|;).tune cortex-a53" 1 } } */ /* { dg-final { scan-assembler-not "thunderx" } } */ diff --git gcc/testsuite/gcc.target/aarch64/tbz_1.c gcc/testsuite/gcc.target/aarch64/tbz_1.c index 39deb58e2..c98066d7a 100644 --- gcc/testsuite/gcc.target/aarch64/tbz_1.c +++ gcc/testsuite/gcc.target/aarch64/tbz_1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-additional-options "-O2 -std=c99 -fno-unwind-tables -fno-asynchronous-unwind-tables" } */ +/* { dg-additional-options "-O2 -std=c99 " } */ +/* { dg-additional-options " -fno-unwind-tables -fno-asynchronous-unwind-tables" { target { ! *-*-darwin* } } } */ /* { dg-final { check-function-bodies "**" "" "" { target { le } } } } */ #include @@ -8,9 +9,9 @@ void h(void); /* ** g1: -** tbnz w[0-9]+, #?0, .L([0-9]+) +** tbnz (w|x)[0-9]+, #?0, .?L([0-9]+) ** ret -** ... +** ... */ void g1(bool x) { @@ -20,9 +21,9 @@ void g1(bool x) /* ** g2: -** tbz w[0-9]+, #?0, .L([0-9]+) -** b h -** ... +** tbz (w|x)[0-9]+, #?0, .?L([0-9]+) +** b _?h +** ... */ void g2(bool x) { @@ -32,8 +33,8 @@ void g2(bool x) /* ** g3_ge: -** tbnz w[0-9]+, #?31, .L[0-9]+ -** b h +** tbnz w[0-9]+, #?31, .?L[0-9]+ +** b _?h ** ... */ void g3_ge(int x) @@ -45,8 +46,8 @@ void g3_ge(int x) /* ** g3_gt: ** cmp w[0-9]+, 0 -** ble .L[0-9]+ -** b h +** ble .?L[0-9]+ +** b _?h ** ... */ void g3_gt(int x) @@ -57,8 +58,8 @@ void g3_gt(int x) /* ** g3_lt: -** tbz w[0-9]+, #?31, .L[0-9]+ -** b h +** tbz w[0-9]+, #?31, .?L[0-9]+ +** b _?h ** ... */ void g3_lt(int x) @@ -70,8 +71,8 @@ void g3_lt(int x) /* ** g3_le: ** cmp w[0-9]+, 0 -** bgt .L[0-9]+ -** b h +** bgt .?L[0-9]+ +** b _?h ** ... */ void g3_le(int x) @@ -84,8 +85,8 @@ void g3_le(int x) ** g5: ** mov w[0-9]+, 65279 ** tst w[0-9]+, w[0-9]+ -** beq .L[0-9]+ -** b h +** beq .?L[0-9]+ +** b _?h ** ... */ void g5(int x) diff --git gcc/testsuite/gcc.target/aarch64/tbz_2.c gcc/testsuite/gcc.target/aarch64/tbz_2.c index 8d41e58ea..774273ab1 100644 --- gcc/testsuite/gcc.target/aarch64/tbz_2.c +++ gcc/testsuite/gcc.target/aarch64/tbz_2.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ -/* { dg-additional-options "-O2 -std=c99 -fno-unwind-tables -fno-asynchronous-unwind-tables" } */ +/* { dg-additional-options "-O2 -std=c99 " } */ +/* { dg-additional-options " -fno-unwind-tables -fno-asynchronous-unwind-tables" { target { ! *-*-darwin* } } } */ /* { dg-final { check-function-bodies "**" "" "" { target { le } } } } */ #include @@ -8,7 +9,7 @@ void h(void); /* ** g1: -** cbnz w0, .L[0-9]+ +** cbnz w0, .?L[0-9]+ ** ret ** ... */ @@ -20,7 +21,7 @@ void g1(int x) /* ** g2: -** tbnz [wx]0, 0, .L[0-9]+ +** tbnz [wx]0, 0, .?L[0-9]+ ** ret ** ... */ @@ -32,7 +33,7 @@ void g2(int x) /* ** g3: -** tbnz [wx]0, 3, .L[0-9]+ +** tbnz [wx]0, 3, .?L[0-9]+ ** ret ** ... */ @@ -44,7 +45,7 @@ void g3(int x) /* ** g4: -** tbnz [wx]0, #31, .L[0-9]+ +** tbnz [wx]0, #31, .?L[0-9]+ ** ret ** ... */ @@ -57,11 +58,11 @@ void g4(int x) /* ** g5: ** tst [wx]0, 255 -** bne .L[0-9]+ +** bne .?L[0-9]+ ** ret ** ... */ -void g5(char x) +void g5(unsigned char x) { if (__builtin_expect (x, 0)) h (); @@ -69,7 +70,7 @@ void g5(char x) /* ** g6: -** tbnz [wx]0, 0, .L[0-9]+ +** tbnz [wx]0, 0, .?L[0-9]+ ** ret ** ... */ @@ -82,7 +83,7 @@ void g6(char x) /* ** g7: ** tst [wx]0, 3 -** bne .L[0-9]+ +** bne .?L[0-9]+ ** ret ** ... */ @@ -94,11 +95,11 @@ void g7(char x) /* ** g8: -** tbnz [wx]0, 7, .L[0-9]+ +** tbnz [wx]0, 7, .?L[0-9]+ ** ret ** ... */ -void g8(char x) +void g8(unsigned char x) { if (__builtin_expect (x & (1 << 7), 0)) h (); @@ -106,7 +107,7 @@ void g8(char x) /* ** g9: -** tbnz [wx]0, 0, .L[0-9]+ +** tbnz [wx]0, 0, .?L[0-9]+ ** ret ** ... */ @@ -118,7 +119,7 @@ void g9(bool x) /* ** g10: -** tbnz [wx]0, 0, .L[0-9]+ +** tbnz [wx]0, 0, .?L[0-9]+ ** ret ** ... */ diff --git gcc/testsuite/gcc.target/aarch64/tbz_3.c gcc/testsuite/gcc.target/aarch64/tbz_3.c index 74f758d33..7c5ab7ec8 100644 --- gcc/testsuite/gcc.target/aarch64/tbz_3.c +++ gcc/testsuite/gcc.target/aarch64/tbz_3.c @@ -15,4 +15,5 @@ f (unsigned int x, _Bool y) } } -/* { dg-final { scan-assembler-times {and\t} 1 } } */ +/* { dg-final { scan-assembler-times {and\t} 1 { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-not {and\t} { target *-*-darwin* } } } */ diff --git gcc/testsuite/gcc.target/aarch64/test-framepointer-2.c gcc/testsuite/gcc.target/aarch64/test-framepointer-2.c index 9b2022aea..2391991e3 100644 --- gcc/testsuite/gcc.target/aarch64/test-framepointer-2.c +++ gcc/testsuite/gcc.target/aarch64/test-framepointer-2.c @@ -10,5 +10,5 @@ Since we asked to have no frame pointers anywhere, we expect no frame record in main or the leaf. */ -/* { dg-final { scan-assembler-not "stp\tx29, x30, \\\[sp, -\[0-9\]+\\\]!" } } */ +/* { dg-final { scan-assembler-not "stp\tx29, x30, \\\[sp, -\[0-9\]+\\\]!" { target { ! *-*-darwin* } } } } */ diff --git gcc/testsuite/gcc.target/aarch64/test-framepointer-3.c gcc/testsuite/gcc.target/aarch64/test-framepointer-3.c index b8c23209c..f970b265a 100644 --- gcc/testsuite/gcc.target/aarch64/test-framepointer-3.c +++ gcc/testsuite/gcc.target/aarch64/test-framepointer-3.c @@ -10,5 +10,5 @@ Since we asked to have no frame pointers anywhere, we expect no frame record in main or the leaf. */ -/* { dg-final { scan-assembler-not "stp\tx29, x30, \\\[sp, -\[0-9\]+\\\]!" } } */ +/* { dg-final { scan-assembler-not "stp\tx29, x30, \\\[sp, -\[0-9\]+\\\]!" { target { ! *-*-darwin* } } } } */ diff --git gcc/testsuite/gcc.target/aarch64/test-framepointer-6.c gcc/testsuite/gcc.target/aarch64/test-framepointer-6.c index 4af5d8896..41658785b 100644 --- gcc/testsuite/gcc.target/aarch64/test-framepointer-6.c +++ gcc/testsuite/gcc.target/aarch64/test-framepointer-6.c @@ -10,5 +10,5 @@ Since we asked to have no frame pointers anywhere, we expect no frame record in main or the leaf. */ -/* { dg-final { scan-assembler-not "stp\tx29, x30, \\\[sp, -\[0-9\]+\\\]!" } } */ +/* { dg-final { scan-assembler-not "stp\tx29, x30, \\\[sp, -\[0-9\]+\\\]!" { target { ! *-*-darwin* } } } } */ diff --git gcc/testsuite/gcc.target/aarch64/uaddw-3.c gcc/testsuite/gcc.target/aarch64/uaddw-3.c index 39cbd6b6c..b4ed187bd 100644 --- gcc/testsuite/gcc.target/aarch64/uaddw-3.c +++ gcc/testsuite/gcc.target/aarch64/uaddw-3.c @@ -1,10 +1,11 @@ /* { dg-do compile } */ /* { dg-options "-O3" } */ +/* { dg-additional-options "-fno-signed-char" { target *-*-darwin* } } */ #pragma GCC target "+nosve" int -t6(int len, void * dummy, char * __restrict x) +t6(int len, void * dummy, unsigned char * __restrict x) { len = len & ~31; unsigned short result = 0; diff --git gcc/testsuite/gcc.target/aarch64/vect-cse-codegen.c gcc/testsuite/gcc.target/aarch64/vect-cse-codegen.c index 1aa0d3edd..83f754270 100644 --- gcc/testsuite/gcc.target/aarch64/vect-cse-codegen.c +++ gcc/testsuite/gcc.target/aarch64/vect-cse-codegen.c @@ -38,6 +38,7 @@ test1 (uint64_t a, uint64x2_t b, uint64x2_t* rt) ** orr x[0-9]+, x[0-9]+, x[0-9]+ ** str q[0-9]+, \[x[0-9]+\] ** ret + */ uint64_t diff --git gcc/testsuite/gcc.target/aarch64/vect-early-break-cbranch.c gcc/testsuite/gcc.target/aarch64/vect-early-break-cbranch.c index ca4ef4984..a69667f0b 100644 --- gcc/testsuite/gcc.target/aarch64/vect-early-break-cbranch.c +++ gcc/testsuite/gcc.target/aarch64/vect-early-break-cbranch.c @@ -15,7 +15,7 @@ int b[N] = {0}; ** cmgt v[0-9]+.4s, v[0-9]+.4s, #0 ** umaxp v[0-9]+.4s, v[0-9]+.4s, v[0-9]+.4s ** fmov x[0-9]+, d[0-9]+ -** cbn?z x[0-9]+, \.L[0-9]+ +** cbn?z x[0-9]+, \.?L[0-9]+ ** ... */ void f1 () @@ -34,7 +34,7 @@ void f1 () ** cmge v[0-9]+.4s, v[0-9]+.4s, #0 ** umaxp v[0-9]+.4s, v[0-9]+.4s, v[0-9]+.4s ** fmov x[0-9]+, d[0-9]+ -** cbn?z x[0-9]+, \.L[0-9]+ +** cbn?z x[0-9]+, \.?L[0-9]+ ** ... */ void f2 () @@ -52,7 +52,7 @@ void f2 () ** ... ** umaxp v[0-9]+.4s, v[0-9]+.4s, v[0-9]+.4s ** fmov x[0-9]+, d[0-9]+ -** cbn?z x[0-9]+, \.L[0-9]+ +** cbn?z x[0-9]+, \.?L[0-9]+ ** ... */ void f3 () @@ -70,7 +70,7 @@ void f3 () ** ... ** umaxp v[0-9]+.4s, v[0-9]+.4s, v[0-9]+.4s ** fmov x[0-9]+, d[0-9]+ -** cbn?z x[0-9]+, \.L[0-9]+ +** cbn?z x[0-9]+, \.?L[0-9]+ ** ... */ void f4 () @@ -89,7 +89,7 @@ void f4 () ** cmlt v[0-9]+.4s, v[0-9]+.4s, #0 ** umaxp v[0-9]+.4s, v[0-9]+.4s, v[0-9]+.4s ** fmov x[0-9]+, d[0-9]+ -** cbn?z x[0-9]+, \.L[0-9]+ +** cbn?z x[0-9]+, \.?L[0-9]+ ** ... */ void f5 () @@ -108,7 +108,7 @@ void f5 () ** cmle v[0-9]+.4s, v[0-9]+.4s, #0 ** umaxp v[0-9]+.4s, v[0-9]+.4s, v[0-9]+.4s ** fmov x[0-9]+, d[0-9]+ -** cbn?z x[0-9]+, \.L[0-9]+ +** cbn?z x[0-9]+, \.?L[0-9]+ ** ... */ void f6 () diff --git gcc/testsuite/gcc.target/aarch64/xorsign.c gcc/testsuite/gcc.target/aarch64/xorsign.c index dfb7ba7f1..8b93604c5 100644 --- gcc/testsuite/gcc.target/aarch64/xorsign.c +++ gcc/testsuite/gcc.target/aarch64/xorsign.c @@ -79,8 +79,11 @@ check_l_neg_rev (long double x, long double y) return __builtin_copysignl (-1.0, y) * x; } -/* { dg-final { scan-assembler-times {eor\tv[0-9]+\.16b, v[0-9]+\.16b, v[0-9]+\.16b} 8 } } */ -/* { dg-final { scan-assembler-times {and\tv[0-9]+\.16b, v[0-9]+\.16b, v[0-9]+\.16b} 8 } } */ +/* Darwin's long double is the same as double. */ +/* { dg-final { scan-assembler-times {eor\tv[0-9]+\.16b, v[0-9]+\.16b, v[0-9]+\.16b} 8 { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {and\tv[0-9]+\.16b, v[0-9]+\.16b, v[0-9]+\.16b} 8 { target { ! *-*-darwin* } } } } */ +/* { dg-final { scan-assembler-times {eor\tv[0-9]+\.16b, v[0-9]+\.16b, v[0-9]+\.16b} 12 { target *-*-darwin* } } } */ +/* { dg-final { scan-assembler-times {and\tv[0-9]+\.16b, v[0-9]+\.16b, v[0-9]+\.16b} 12 { target *-*-darwin* } } } */ /* { dg-final { scan-assembler-not "copysign" } } */ /* { dg-final { scan-assembler-not "fmov" } } */ /* { dg-final { scan-assembler-not "\[ \t\]?orr\[ \t\]?" } } */ diff --git gcc/testsuite/gcc.target/i386/pr78035.c gcc/testsuite/gcc.target/i386/pr78035.c index 7d3a983b2..def5d6545 100644 --- gcc/testsuite/gcc.target/i386/pr78035.c +++ gcc/testsuite/gcc.target/i386/pr78035.c @@ -22,4 +22,6 @@ int bar () } /* We should not optimize away either comparison. */ -/* { dg-final { scan-assembler-times "cmp" 2 } } */ +/* { dg-final { scan-assembler-times "cmp" 2 { target { ! *-*-darwin* } } } } */ +/* Darwin codegens equivalent code with 3 cmps. */ +/* { dg-final { scan-assembler-times "cmp" 3 { target *-*-darwin* } } } */ diff --git gcc/testsuite/gm2/pim/intrinsic/run/pass/pim-intrinsic-run-pass.exp gcc/testsuite/gm2/pim/intrinsic/run/pass/pim-intrinsic-run-pass.exp index 99bf3b594..496c2c213 100644 --- gcc/testsuite/gm2/pim/intrinsic/run/pass/pim-intrinsic-run-pass.exp +++ gcc/testsuite/gm2/pim/intrinsic/run/pass/pim-intrinsic-run-pass.exp @@ -31,7 +31,7 @@ set gm2src ${srcdir}/../m2 gm2_init_pim "${srcdir}/gm2/pim/intrinsic/run/pass/" gm2_link_obj "cstub.o" -if { [istarget powerpc*-*-*] } then { +if { [istarget powerpc*-*-*] && ![istarget "powerpc-*-darwin*"] } { set mabi_flags "-mabi=ieeelongdouble" set options [concat "{additional_flags=$mabi_flags}" $options] } diff --git gcc/testsuite/lib/gm2.exp gcc/testsuite/lib/gm2.exp index b1093e1bd..ccab4bcba 100644 --- gcc/testsuite/lib/gm2.exp +++ gcc/testsuite/lib/gm2.exp @@ -187,7 +187,7 @@ proc gm2_target_compile_default { source dest type options } { if [istarget *-*-solaris2*] { lappend options "ldflags=-lnsl -lsocket" } - if [istarget "powerpc-*-*"] { + if { [istarget "powerpc-*-*"] && ![istarget "powerpc-*-darwin*"] } { lappend options "-mabi=ieeelongdouble" } @@ -251,7 +251,7 @@ proc gm2_link_flags { paths } { set shlib_ext [get_shlib_extension] verbose "shared lib extension: $shlib_ext" - if [istarget "powerpc-*-*"] { + if { [istarget "powerpc-*-*"] && ![istarget "powerpc-*-darwin*"] } { lappend flags "-mabi=ieeelongdouble" } diff --git gcc/testsuite/lib/scanasm.exp gcc/testsuite/lib/scanasm.exp index abfdd6a3a..2fe942e40 100644 --- gcc/testsuite/lib/scanasm.exp +++ gcc/testsuite/lib/scanasm.exp @@ -37,6 +37,21 @@ proc append_encoding_arg { args enc } { return $args } +# Remove LTO-prefixed sections from TEXT. + +proc remove_lto_sections { text } { + set p1 {(^|\n)[[:space:]]*\.section[[:space:]]*"?} + set lto_sect_prefix {\.gnu\.lto_} + set p3 {(?:[^\n]*\n(?![[:space:]]*\.(section|text|data|bss)))*[^\n]*\n} + if { [istarget *-*-darwin*] } { + # Darwin/Mach-O LTO sections are in the __GNU_LTO segment. + set lto_sect_prefix {__GNU_LTO} + } + set patt ${p1}${lto_sect_prefix}${p3} + regsub -all ${patt} $text {\1} text + return $text +} + # Scan the OUTPUT_FILE for a pattern. If it is present and POSITIVE # is non-zero, or it is not present and POSITIVE is zero, the test # passes. The ORIG_ARGS is the list of arguments provided by dg-final @@ -80,10 +95,8 @@ proc dg-scan { name positive testcase output_file orig_args } { set text [read $fd] close $fd if { [string compare -length 14 $name scan-assembler] == 0 } { - # Remove LTO sections. - # ??? Somehow, .*? is still greedy. - # regsub -all {(^|\n)[[:space:]]*\.section[[:space:]]*"?\.gnu\.lto_.*?\n(?=[[:space:]]*\.text\n)} $text {\1} text - regsub -all {(^|\n)[[:space:]]*\.section[[:space:]]*"?\.gnu\.lto_(?:[^\n]*\n(?![[:space:]]*\.(section|text|data|bss)))*[^\n]*\n} $text {\1} text + # Remove LTO sections. + set text [remove_lto_sections $text] } set match [regexp -- $pattern $text] @@ -550,8 +563,8 @@ proc scan-assembler-times { args } { set fd [open $output_file r] set text [read $fd] close $fd - regsub -all {(^|\n)[[:space:]]*\.section[[:space:]]*"?\.gnu\.lto_(?:[^\n]*\n(?![[:space:]]*\.(section|text|data|bss)))*[^\n]*\n} $text {\1} text - + # Remove LTO sections. + set text [remove_lto_sections $text] set result_count [regexp -all -- $pattern $text] if {$result_count == $times} { pass "$testcase scan-assembler-times $pp_pattern $times" @@ -614,7 +627,7 @@ proc scan-assembler-bound { args } { set fd [open $output_file r] set text [read $fd] close $fd - regsub -all {(^|\n)[[:space:]]*\.section[[:space:]]*"?\.gnu\.lto_(?:[^\n]*\n(?![[:space:]]*\.(section|text|data|bss)))*[^\n]*\n} $text {\1} text + set text [remove_lto_sections $text] set result_count [regexp -all -- $pattern $text] if [expr $result_count $cmp $bound] { @@ -676,7 +689,7 @@ proc scan-assembler-dem { args } { set output [remote_exec host "$cxxfilt" "" "$output_file"] set text [lindex $output 1] - regsub -all {(^|\n)[[:space:]]*\.section[[:space:]]*"?\.gnu\.lto_(?:[^\n]*\n(?![[:space:]]*\.(section|text|data|bss)))*[^\n]*\n} $text {\1} text + set text [remove_lto_sections $text] if [regexp -- $pattern $text] { pass "$testcase scan-assembler-dem $pp_pattern" @@ -733,7 +746,7 @@ proc scan-assembler-dem-not { args } { set output [remote_exec host "$cxxfilt" "" "$output_file"] set text [lindex $output 1] - regsub -all {(^|\n)[[:space:]]*\.section[[:space:]]*"?\.gnu\.lto_(?:[^\n]*\n(?![[:space:]]*\.(section|text|data|bss)))*[^\n]*\n} $text {\1} text + set text [remove_lto_sections $text] if ![regexp -- $pattern $text] { pass "$testcase scan-assembler-dem-not $pp_pattern" diff --git gcc/testsuite/lib/target-libpath.exp gcc/testsuite/lib/target-libpath.exp index a983563fe..2ce780930 100644 --- gcc/testsuite/lib/target-libpath.exp +++ gcc/testsuite/lib/target-libpath.exp @@ -86,6 +86,32 @@ proc set_ld_library_path_env_vars { } { return } + # Darwin's equivalent of LD_LIBRARY_PATH. + if { [istarget *-*-darwin\[89\]*] || [istarget *-*-darwin1\[0-4\]*] } { + if { $orig_environment_saved == 0 } { + set orig_environment_saved 1 + if [info exists env(DYLD_LIBRARY_PATH)] { + set orig_dyld_library_path "$env(DYLD_LIBRARY_PATH)" + set orig_dyld_library_path_saved 1 + } + if [info exists env(PATH)] { + set orig_path "$env(PATH)" + set orig_path_saved 1 + } + } + if { $orig_dyld_library_path_saved } { + setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path" + } else { + setenv DYLD_LIBRARY_PATH "$ld_library_path" + } + verbose -log "DYLD_LIBRARY_PATH=[getenv DYLD_LIBRARY_PATH]" + return + } elseif { [istarget *-*-darwin*] } { + # Later versions exclude DYLD_* variables when calling via system apps + # which includes, for example, the shells - so this cannot work there. + return + } + if { $orig_environment_saved == 0 } { set orig_environment_saved 1 @@ -110,10 +136,6 @@ proc set_ld_library_path_env_vars { } { set orig_ld_library_path_64 "$env(LD_LIBRARY_PATH_64)" set orig_ld_library_path_64_saved 1 } - if [info exists env(DYLD_LIBRARY_PATH)] { - set orig_dyld_library_path "$env(DYLD_LIBRARY_PATH)" - set orig_dyld_library_path_saved 1 - } if [info exists env(PATH)] { set orig_path "$env(PATH)" set orig_path_saved 1 @@ -125,16 +147,14 @@ proc set_ld_library_path_env_vars { } { # It only sets SHLIB_PATH and LD_LIBRARY_PATH when it executes a # program. We also need the environment set for compilations, etc. # - # On Darwin, we have to set variables akin to LD_LIBRARY_PATH, but called - # DYLD_LIBRARY_PATH. The same applies to Solaris 32 bit - # (LD_LIBRARY_PATH_32), Solaris 64 bit (LD_LIBRARY_PATH_64), and HP-UX - # (SHLIB_PATH). In some cases, the variables are independent of - # LD_LIBRARY_PATH, and in other cases LD_LIBRARY_PATH is used if the + # On Solaris, we have to set variables akin to LD_LIBRARY_PATH, but called + # LD_LIBRARY_PATH_32 (Solaris 32 bit) and LD_LIBRARY_PATH_32 (Solaris 64 bit). + # and, on HP-UX, (SHLIB_PATH). In some cases, the variables are independent + # of LD_LIBRARY_PATH, and in other cases LD_LIBRARY_PATH is used if the # variable is not defined. # # Doing this is somewhat of a hack as ld_library_path gets repeated in # SHLIB_PATH and LD_LIBRARY_PATH when unix_load sets these variables. - if { ![istarget *-*-darwin*] } { if { $orig_ld_library_path_saved } { setenv LD_LIBRARY_PATH "$ld_library_path:$orig_ld_library_path" } else { @@ -168,23 +188,7 @@ proc set_ld_library_path_env_vars { } { } else { setenv LD_LIBRARY_PATH_64 "$ld_library_path" } - } - if { [istarget *-*-darwin*] } { - if { [info exists ENABLE_DARWIN_AT_RPATH] || [istarget *-*-darwin1\[5-9\]*] - || [istarget *-*-darwin2*] } { - # Either we are not using DYLD_LIBRARY_PATH or we're on a version of the - # OS for which it is not passed through system exes. - if [info exists env(DYLD_LIBRARY_PATH)] { - unsetenv DYLD_LIBRARY_PATH - } - } else { - if { $orig_dyld_library_path_saved } { - setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path" - } else { - setenv DYLD_LIBRARY_PATH "$ld_library_path" - } - } - } + if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } { if { $orig_path_saved } { setenv PATH "$ld_library_path:$orig_path" @@ -199,7 +203,6 @@ proc set_ld_library_path_env_vars { } { verbose -log "SHLIB_PATH=[getenv SHLIB_PATH]" verbose -log "LD_LIBRARY_PATH_32=[getenv LD_LIBRARY_PATH_32]" verbose -log "LD_LIBRARY_PATH_64=[getenv LD_LIBRARY_PATH_64]" - verbose -log "DYLD_LIBRARY_PATH=[getenv DYLD_LIBRARY_PATH]" } ####################################### diff --git gcc/testsuite/lib/target-supports.exp gcc/testsuite/lib/target-supports.exp index 55775d036..19bfdac4b 100644 --- gcc/testsuite/lib/target-supports.exp +++ gcc/testsuite/lib/target-supports.exp @@ -3529,8 +3529,12 @@ proc check_effective_target_long_double_ieee128 { } { # 128-bit format on PowerPC. proc add_options_for_long_double_ieee128 { flags } { if { [istarget powerpc*-*-*] } { - return "$flags -mlong-double-128 -Wno-psabi -mabi=ieeelongdouble" - } + if { ![istarget "powerpc-*-darwin*"] } { + return "$flags -mlong-double-128 -Wno-psabi " + } else { + return "$flags -mlong-double-128 -Wno-psabi -mabi=ieeelongdouble" + } + } return "$flags" } @@ -10252,7 +10256,7 @@ proc check_effective_target_section_anchors { } { return [check_cached_effective_target section_anchors { expr { [istarget powerpc*-*-*] || [istarget arm*-*-*] - || [istarget aarch64*-*-*] + || ([istarget aarch64*-*-*] && ![istarget aarch64*-*-darwin*]) || [istarget loongarch*-*-*] }}] } @@ -14008,6 +14012,15 @@ proc check_effective_target_arm_thumb2_ok_no_arm_v8_1m_lob { } { return 0 } +# Return 1 if this is an ARM target where -mabi=ilp32 can be used. + +proc check_effective_target_arm_mabi_ilp32 { } { + return [check_no_compiler_messages_nocache arm_mabi_ilp32 assembly { + int main() { return 0; } + } "-mabi=ilp32"] +} + + # Returns 1 if the target is using glibc, 0 otherwise. proc check_effective_target_glibc { } { diff --git gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm index 92852c3ec..e0974539e 100644 --- gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm +++ gcc/testsuite/obj-c++.dg/gnu-api-2-class-meta.mm @@ -19,6 +19,7 @@ /* { dg-do run } */ /* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */ +/* { dg-skip-if "API unsupported" { arm64*-*-darwin* aarch64*-*-darwin* } { "-fnext-runtime" } { "" } } */ /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ /* { dg-additional-options "-DOBJC_OLD_DISPATCH_PROTOTYPES" { target { *-*-darwin* } } } */ // { dg-additional-options "-Wno-objc-root-class" } diff --git gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm index f6e3d8d22..a23968a89 100644 --- gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm +++ gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm @@ -6,6 +6,7 @@ /* { dg-do run } */ /* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */ +/* { dg-skip-if "API unsupported" { arm64*-*-darwin* aarch64*-*-darwin* } { "-fnext-runtime" } { "" } } */ /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ /* { dg-additional-options "-DOBJC_OLD_DISPATCH_PROTOTYPES" { target { *-*-darwin* } } } */ // { dg-additional-options "-Wno-objc-root-class" } diff --git gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-4.mm gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-4.mm index 1155db5f8..e0dd80623 100644 --- gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-4.mm +++ gcc/testsuite/obj-c++.dg/torture/strings/const-cfstring-4.mm @@ -18,4 +18,4 @@ void *foo (void) /* { dg-final { scan-assembler ".section __DATA, __cfstring" } } */ /* { dg-final { scan-assembler ".long\t___CFConstantStringClassReference\n\t.long\t1992\n\t.long\t.*\n\t.long\t19\n" { target { *-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t___CFConstantStringClassReference\n\t.long\t1992\n\t.space 4\n\t.quad\t.*\n\t.quad\t19\n" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t___CFConstantStringClassReference\n\t.(long|word)\t1992\n\t.space 4\n\t.(quad|xword)\t.*\n\t.(quad|xword)\t19\n} { target { *-*-darwin* && { lp64 } } } } } */ diff --git gcc/testsuite/obj-c++.dg/torture/strings/const-str-10.mm gcc/testsuite/obj-c++.dg/torture/strings/const-str-10.mm index e1dad124c..eb89710d8 100644 --- gcc/testsuite/obj-c++.dg/torture/strings/const-str-10.mm +++ gcc/testsuite/obj-c++.dg/torture/strings/const-str-10.mm @@ -33,4 +33,4 @@ const NSConstantString *appKey = @"MyApp"; /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" { target { *-*-darwin* && { ! lp64 } } } } } */ /* { dg-final { scan-assembler ".section __DATA, __objc_stringobj" { target { *-*-darwin* && { lp64 } } } } } */ /* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" { target { *-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t_OBJC_CLASS_._NSConstantString\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t_OBJC_CLASS_._NSConstantString\n\t.(quad|xword)\t.*\n\t.(long|word)\t5\n\t.space} { target { *-*-darwin* && { lp64 } } } } } */ diff --git gcc/testsuite/obj-c++.dg/torture/strings/const-str-11.mm gcc/testsuite/obj-c++.dg/torture/strings/const-str-11.mm index 30a9228a6..c1b58dc6c 100644 --- gcc/testsuite/obj-c++.dg/torture/strings/const-str-11.mm +++ gcc/testsuite/obj-c++.dg/torture/strings/const-str-11.mm @@ -33,4 +33,4 @@ const XStr *appKey = @"MyApp"; /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" { target { *-*-darwin* && { ! lp64 } } } } } */ /* { dg-final { scan-assembler ".section __DATA, __objc_stringobj" { target { *-*-darwin* && { lp64 } } } } } */ /* { dg-final { scan-assembler ".long\t__XStrClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" { target { *-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t_OBJC_CLASS_._XStr\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t_OBJC_CLASS_._XStr\n\t.(quad|xword)\t.*\n\t.(long|word)\t5\n\t.space} { target { *-*-darwin* && { lp64 } } } } } */ diff --git gcc/testsuite/obj-c++.dg/torture/strings/const-str-9.mm gcc/testsuite/obj-c++.dg/torture/strings/const-str-9.mm index a1a14295e..8457f46be 100644 --- gcc/testsuite/obj-c++.dg/torture/strings/const-str-9.mm +++ gcc/testsuite/obj-c++.dg/torture/strings/const-str-9.mm @@ -25,4 +25,4 @@ const NSConstantString *appKey = @"MyApp"; /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" { target { *-*-darwin* && { ! lp64 } } } } } */ /* { dg-final { scan-assembler ".section __DATA, __objc_stringobj" { target { *-*-darwin* && { lp64 } } } } } */ /* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" { target { *-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t_OBJC_CLASS_._NSConstantString\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t_OBJC_CLASS_._NSConstantString\n\t.(quad|xword)\t.*\n\t.(long|word)\t5\n\t.space} { target { *-*-darwin* && { lp64 } } } } } */ diff --git gcc/testsuite/objc.dg/gnu-api-2-class-meta.m gcc/testsuite/objc.dg/gnu-api-2-class-meta.m index 6c1c76a87..41a48f9c6 100644 --- gcc/testsuite/objc.dg/gnu-api-2-class-meta.m +++ gcc/testsuite/objc.dg/gnu-api-2-class-meta.m @@ -19,6 +19,7 @@ /* { dg-do run } */ /* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */ +/* { dg-skip-if "API unsupported" { arm64*-*-darwin* aarch64*-*-darwin* } { "-fnext-runtime" } { "" } } */ /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ /* { dg-additional-options "-Wno-objc-root-class" } */ /* { dg-additional-options "-DOBJC_OLD_DISPATCH_PROTOTYPES" { target { *-*-darwin* } } } */ diff --git gcc/testsuite/objc.dg/gnu-api-2-class.m gcc/testsuite/objc.dg/gnu-api-2-class.m index d11dae0e6..1386ebc2f 100644 --- gcc/testsuite/objc.dg/gnu-api-2-class.m +++ gcc/testsuite/objc.dg/gnu-api-2-class.m @@ -6,6 +6,7 @@ /* { dg-do run } */ /* { dg-skip-if "No API#2 pre-Darwin9" { *-*-darwin[5-8]* } { "-fnext-runtime" } { "" } } */ +/* { dg-skip-if "API unsupported" { arm64*-*-darwin* aarch64*-*-darwin* } { "-fnext-runtime" } { "" } } */ /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */ /* { dg-additional-options "-Wno-objc-root-class" } */ /* { dg-additional-options "-DOBJC_OLD_DISPATCH_PROTOTYPES" { target { *-*-darwin* } } } */ diff --git gcc/testsuite/objc.dg/torture/strings/const-cfstring-4.m gcc/testsuite/objc.dg/torture/strings/const-cfstring-4.m index 1155db5f8..e0dd80623 100644 --- gcc/testsuite/objc.dg/torture/strings/const-cfstring-4.m +++ gcc/testsuite/objc.dg/torture/strings/const-cfstring-4.m @@ -18,4 +18,4 @@ void *foo (void) /* { dg-final { scan-assembler ".section __DATA, __cfstring" } } */ /* { dg-final { scan-assembler ".long\t___CFConstantStringClassReference\n\t.long\t1992\n\t.long\t.*\n\t.long\t19\n" { target { *-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t___CFConstantStringClassReference\n\t.long\t1992\n\t.space 4\n\t.quad\t.*\n\t.quad\t19\n" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t___CFConstantStringClassReference\n\t.(long|word)\t1992\n\t.space 4\n\t.(quad|xword)\t.*\n\t.(quad|xword)\t19\n} { target { *-*-darwin* && { lp64 } } } } } */ diff --git gcc/testsuite/objc.dg/torture/strings/const-str-10.m gcc/testsuite/objc.dg/torture/strings/const-str-10.m index 6565dc200..81b0d326c 100644 --- gcc/testsuite/objc.dg/torture/strings/const-str-10.m +++ gcc/testsuite/objc.dg/torture/strings/const-str-10.m @@ -34,4 +34,4 @@ const NSConstantString *appKey = @"MyApp"; /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" { target { *-*-darwin* && { ! lp64 } } } } } */ /* { dg-final { scan-assembler ".section __DATA, __objc_stringobj" { target { *-*-darwin* && { lp64 } } } } } */ /* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" { target { *-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t_OBJC_CLASS_._NSConstantString\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t_OBJC_CLASS_._NSConstantString\n\t.(quad|xword)\t.*\n\t.(long|word)\t5\n\t.space} { target { *-*-darwin* && { lp64 } } } } } */ diff --git gcc/testsuite/objc.dg/torture/strings/const-str-11.m gcc/testsuite/objc.dg/torture/strings/const-str-11.m index 2bdb1531e..b044b0fd8 100644 --- gcc/testsuite/objc.dg/torture/strings/const-str-11.m +++ gcc/testsuite/objc.dg/torture/strings/const-str-11.m @@ -33,4 +33,4 @@ const XStr *appKey = @"MyApp"; /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" { target { *-*-darwin* && { ! lp64 } } } } } */ /* { dg-final { scan-assembler ".section __DATA, __objc_stringobj" { target { *-*-darwin* && { lp64 } } } } } */ /* { dg-final { scan-assembler ".long\t__XStrClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" { target { *-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t_OBJC_CLASS_._XStr\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t_OBJC_CLASS_._XStr\n\t.(quad|xword)\t.*\n\t.(long|word)\t5\n\t.space} { target { *-*-darwin* && { lp64 } } } } } */ diff --git gcc/testsuite/objc.dg/torture/strings/const-str-9.m gcc/testsuite/objc.dg/torture/strings/const-str-9.m index 966ea5e49..d3d2916ed 100644 --- gcc/testsuite/objc.dg/torture/strings/const-str-9.m +++ gcc/testsuite/objc.dg/torture/strings/const-str-9.m @@ -25,4 +25,4 @@ const NSConstantString *appKey = @"MyApp"; /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" { target { *-*-darwin* && { ! lp64 } } } } } */ /* { dg-final { scan-assembler ".section __DATA, __objc_stringobj" { target { *-*-darwin* && { lp64 } } } } } */ /* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n\t.data" { target { *-*-darwin* && { ! lp64 } } } } } */ -/* { dg-final { scan-assembler ".quad\t_OBJC_CLASS_._NSConstantString\n\t.quad\t.*\n\t.long\t5\n\t.space" { target { *-*-darwin* && { lp64 } } } } } */ +/* { dg-final { scan-assembler {.(quad|xword)\t_OBJC_CLASS_._NSConstantString\n\t.(quad|xword)\t.*\n\t.(long|word)\t5\n\t.space} { target { *-*-darwin* && { lp64 } } } } } */ diff --git libgcc/config.host libgcc/config.host index ac10ccc43..e09c95bc2 100644 --- libgcc/config.host +++ libgcc/config.host @@ -85,7 +85,7 @@ m32c*-*-*) cpu_type=m32c tmake_file=t-fdpbit ;; -aarch64*-*-*) +aarch64*-*-* | arm64*-*-*) cpu_type=aarch64 ;; alpha*-*-*) @@ -267,7 +267,7 @@ case ${host} in if test "x$enable_darwin_at_rpath" = "xyes"; then tmake_file="$tmake_file t-darwin-rpath " fi - extra_parts="crt3.o libd10-uwfef.a crttms.o crttme.o libemutls_w.a" + extra_parts="crt3.o crttms.o crttme.o libemutls_w.a " ;; *-*-dragonfly*) tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip" @@ -373,8 +373,8 @@ case ${host} in esac case ${host} in -*-*-darwin* | *-*-dragonfly* | *-*-freebsd* | *-*-netbsd* | *-*-openbsd* | \ - *-*-solaris2*) +i[34567]86-*-darwin* | powerpc*-*-darwin* | x86_64-*-darwin* | \ +*-*-dragonfly* | *-*-freebsd* | *-*-netbsd* | *-*-openbsd* | *-*-solaris2*) enable_execute_stack=enable-execute-stack-mprotect.c ;; i[34567]86-*-mingw* | x86_64-*-mingw*) @@ -399,6 +399,17 @@ aarch64*-*-elf | aarch64*-*-rtems*) md_unwind_def_header=aarch64/aarch64-unwind-def.h md_unwind_header=aarch64/aarch64-unwind.h ;; +aarch64*-*-darwin*) + extra_parts="$extra_parts crtfastmath.o libheapt_w.a" + tmake_file="${tmake_file} ${cpu_type}/t-aarch64" + tmake_file="${tmake_file} ${cpu_type}/t-lse" + tmake_file="${tmake_file} t-crtfm t-dfprules" + tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp" + tmake_file="${tmake_file} ${cpu_type}/t-heap-trampoline" + tmake_file="${tmake_file} ${cpu_type}/t-no-eh" + md_unwind_def_header=aarch64/aarch64-unwind-def.h + md_unwind_header=aarch64/aarch64-unwind.h + ;; aarch64*-*-freebsd*) extra_parts="$extra_parts crtfastmath.o" tmake_file="${tmake_file} ${cpu_type}/t-aarch64" @@ -730,14 +741,14 @@ i[34567]86-*-darwin*) tmake_file="$tmake_file i386/t-crtpc t-crtfm i386/t-msabi" tm_file="$tm_file i386/darwin-lib.h" extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o" - extra_parts="$extra_parts crtfastmath.o libheapt_w.a" + extra_parts="$extra_parts crtfastmath.o libd10-uwfef.a libheapt_w.a" tmake_file="${tmake_file} i386/t-heap-trampoline" ;; x86_64-*-darwin*) tmake_file="$tmake_file i386/t-crtpc t-crtfm i386/t-msabi" tm_file="$tm_file i386/darwin-lib.h" extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o" - extra_parts="$extra_parts crtfastmath.o libheapt_w.a" + extra_parts="$extra_parts crtfastmath.o libd10-uwfef.a libheapt_w.a" tmake_file="${tmake_file} i386/t-heap-trampoline" ;; i[34567]86-*-elfiamcu) @@ -1219,12 +1230,14 @@ powerpc-*-darwin*) # We build the darwin10 EH shim for Rosetta (running on x86 machines). tm_file="$tm_file i386/darwin-lib.h" tmake_file="$tmake_file rs6000/t-ppc64-fp rs6000/t-ibm-ldouble" + extra_parts="$extra_parts libd10-uwfef.a " extra_parts="$extra_parts crt2.o crt3_2.o libef_ppc.a dw_ppc.o" ;; powerpc64-*-darwin*) # We build the darwin10 EH shim for Rosetta (running on x86 machines). tm_file="$tm_file i386/darwin-lib.h" tmake_file="$tmake_file rs6000/t-darwin64 rs6000/t-ibm-ldouble" + extra_parts="$extra_parts libd10-uwfef.a " extra_parts="$extra_parts crt2.o crt3_2.o libef_ppc.a dw_ppc.o" ;; powerpc*-*-freebsd*) diff --git libgcc/config/aarch64/__arm_get_current_vg.S libgcc/config/aarch64/__arm_get_current_vg.S index c0b8988d1..4b8e5f12b 100644 --- libgcc/config/aarch64/__arm_get_current_vg.S +++ libgcc/config/aarch64/__arm_get_current_vg.S @@ -31,14 +31,19 @@ - Returns the value of the current VG in x0 if this value exists, and returns zero otherwise. */ -HIDDEN (__aarch64_cpu_features) +HIDDEN (ASMNAME (__aarch64_cpu_features)) -variant_pcs (__arm_get_current_vg) +variant_pcs (ASMNAME (__arm_get_current_vg)) -ENTRY (__arm_get_current_vg) +ENTRY (ASMNAME (__arm_get_current_vg)) /* Check if SVE is available. */ +#ifdef __APPLE__ + adrp x16, ASMNAME (__aarch64_cpu_features)@PAGE + ldr x16, [x1, ASMNAME (__aarch64_cpu_features)@PAGEOFF] +#else adrp x16, __aarch64_cpu_features ldr x16, [x16, :lo12:__aarch64_cpu_features] +#endif tbnz x16, #30, L(end_cntd) /* Check if SME is available. */ @@ -53,4 +58,4 @@ L(end_cntd): L(end_zero): mov x0, 0 ret -END (__arm_get_current_vg) +ENDm ASMNAME(__arm_get_current_vg) diff --git libgcc/config/aarch64/__arm_sme_state.S libgcc/config/aarch64/__arm_sme_state.S index d9cfb490a..7a30d0584 100644 --- libgcc/config/aarch64/__arm_sme_state.S +++ libgcc/config/aarch64/__arm_sme_state.S @@ -30,14 +30,19 @@ - Takes no argument. - Returns SME state in x0 and TPIDR2_EL0 in x1. */ -HIDDEN (__aarch64_have_sme) +HIDDEN (ASMNAME (__aarch64_have_sme)) -variant_pcs (__arm_sme_state) +variant_pcs (ASMNAME (__arm_sme_state)) -ENTRY (__arm_sme_state) +ENTRY (ASMNAME (__arm_sme_state)) /* Check if SME is available. */ - adrp x1, __aarch64_have_sme - ldrb w1, [x1, :lo12:__aarch64_have_sme] +#ifdef __APPLE__ + adrp x1, ASMNAME (__aarch64_have_sme)@PAGE + ldrb w1, [x1, ASMNAME (__aarch64_have_sme)@PAGEOFF] +#else + adrp x1, ASMNAME (__aarch64_have_sme) + ldrb w1, [x1, :lo12:ASMNAME (__aarch64_have_sme)] +#endif cbz w1, L(nosme) /* Expose the bottom 2 bits of svcr (SM, ZA) in x0 and set the @@ -52,4 +57,4 @@ L(nosme): mov x0, 0 mov x1, 0 ret -END (__arm_sme_state) +ENDm ASMNAME(__arm_sme_state) diff --git libgcc/config/aarch64/__arm_tpidr2_restore.S libgcc/config/aarch64/__arm_tpidr2_restore.S index 1d6e2000e..f0a088687 100644 --- libgcc/config/aarch64/__arm_tpidr2_restore.S +++ libgcc/config/aarch64/__arm_tpidr2_restore.S @@ -31,9 +31,9 @@ - Does not return a value. - Can abort on failure (then registers are not preserved). */ -variant_pcs (__arm_tpidr2_restore) +variant_pcs (ASMNAME (__arm_tpidr2_restore)) -ENTRY (__arm_tpidr2_restore) +ENTRY (ASMNAME (__arm_tpidr2_restore)) .inst 0xd53bd0ae /* mrs x14, tpidr2_el0 */ cbnz x14, L(fail) @@ -85,5 +85,5 @@ L(fail): str x16, [sp, 16] .cfi_rel_offset 46, 16 .inst 0xd503467f /* smstop */ - bl abort -END (__arm_tpidr2_restore) + bl ASMNAME (abort) +ENDm ASMNAME (__arm_tpidr2_restore) diff --git libgcc/config/aarch64/__arm_tpidr2_save.S libgcc/config/aarch64/__arm_tpidr2_save.S index 5a22ca5e2..1c2d43901 100644 --- libgcc/config/aarch64/__arm_tpidr2_save.S +++ libgcc/config/aarch64/__arm_tpidr2_save.S @@ -35,10 +35,15 @@ HIDDEN (__aarch64_have_sme) variant_pcs (__arm_tpidr2_save) -ENTRY (__arm_tpidr2_save) +ENTRY (ASMNAME (__arm_tpidr2_save)) /* Check if SME is available. */ - adrp x14, __aarch64_have_sme - ldrb w14, [x14, :lo12:__aarch64_have_sme] +#if __APPLE__ + adrp x14, ASMNAME (__aarch64_have_sme)@PAGE + ldrb w14, [x14, ASMNAME (__aarch64_have_sme)@PAGEOFF] +#else + adrp x14, ASMNAME (__aarch64_have_sme) + ldrb w14, [x14, :lo12:ASMNAME (__aarch64_have_sme)] +#endif cbz w14, L(end) .inst 0xd53bd0ae /* mrs x14, tpidr2_el0 */ @@ -92,10 +97,18 @@ L(fail): str x16, [sp, 16] .cfi_rel_offset 46, 16 .inst 0xd503467f /* smstop */ - bl abort -END (__arm_tpidr2_save) - + bl ASMNAME (abort) +ENDm ASMNAME (__arm_tpidr2_save) + + GLOBAL(ASMNAME (__libgcc_arm_tpidr2_save)) + HIDDEN (ASMNAME (__libgcc_arm_tpidr2_save)) +#if __APPLE__ + .text + .p2align 4 +ASMNAME (__libgcc_arm_tpidr2_save): + b ASMNAME (__arm_tpidr2_save) +#else /* Hidden alias used by __arm_za_disable. */ -.global __libgcc_arm_tpidr2_save -HIDDEN (__libgcc_arm_tpidr2_save) -.set __libgcc_arm_tpidr2_save, __arm_tpidr2_save +.set ASMNAME (__libgcc_arm_tpidr2_save), ASMNAME (__arm_tpidr2_save) +#endif + diff --git libgcc/config/aarch64/__arm_za_disable.S libgcc/config/aarch64/__arm_za_disable.S index efe464fd3..589d476f1 100644 --- libgcc/config/aarch64/__arm_za_disable.S +++ libgcc/config/aarch64/__arm_za_disable.S @@ -31,16 +31,33 @@ - Does not return a value. - Can abort on failure (then registers are not preserved). */ -HIDDEN (__aarch64_have_sme) +HIDDEN (ASMNAME(__aarch64_have_sme)) -HIDDEN (__libgcc_arm_tpidr2_save) +HIDDEN (ASMNAME(__libgcc_arm_tpidr2_save)) -variant_pcs (__arm_za_disable) +variant_pcs (ASMNAME(__arm_za_disable)) -ENTRY (__arm_za_disable) +GLOBAL (ASMNAME (__libgcc_arm_za_disable)) +HIDDEN (ASMNAME (__libgcc_arm_za_disable)) +#if __APPLE__ + .text + .p2align 4 +ASMNAME (__libgcc_arm_za_disable): + b ASMNAME (__arm_za_disable) +#else +/* Hidden alias used by the unwinder. */ +.set ASMNAME (__libgcc_arm_za_disable), ASMNAME (__arm_za_disable) +#endif + +ENTRY (ASMNAME (__arm_za_disable)) /* Check if SME is available. */ - adrp x14, __aarch64_have_sme - ldrb w14, [x14, :lo12:__aarch64_have_sme] +#if __APPLE__ + adrp x14, ASMNAME (__aarch64_have_sme)@PAGE + ldrb w14, [x14, ASMNAME (__aarch64_have_sme)@PAGEOFF] +#else + adrp x14, ASMNAME (__aarch64_have_sme) + ldrb w14, [x14, :lo12:ASMNAME (__aarch64_have_sme)] +#endif cbz w14, L(end) .inst 0xd53bd0ae /* mrs x14, tpidr2_el0 */ @@ -52,7 +69,7 @@ ENTRY (__arm_za_disable) .cfi_rel_offset x29, 0 .cfi_rel_offset x30, 8 mov x29, sp - bl __libgcc_arm_tpidr2_save + bl ASMNAME (__libgcc_arm_tpidr2_save) .inst 0xd51bd0bf /* msr tpidr2_el0, xzr */ .inst 0xd503447f /* smstop za */ ldp x29, x30, [sp], 16 @@ -62,9 +79,5 @@ ENTRY (__arm_za_disable) AUTIASP L(end): ret -END (__arm_za_disable) +ENDm ASMNAME(__arm_za_disable) -/* Hidden alias used by the unwinder. */ -.global __libgcc_arm_za_disable -HIDDEN (__libgcc_arm_za_disable) -.set __libgcc_arm_za_disable, __arm_za_disable diff --git libgcc/config/aarch64/aarch64-asm.h libgcc/config/aarch64/aarch64-asm.h index 135065e0d..35d89f608 100644 --- libgcc/config/aarch64/aarch64-asm.h +++ libgcc/config/aarch64/aarch64-asm.h @@ -27,8 +27,6 @@ #include "auto-target.h" -#define L(label) .L ## label - /* Marking variant PCS symbol references is important for PLT calls otherwise it is for documenting the PCS in the symbol table. */ #ifdef HAVE_AS_VARIANT_PCS @@ -68,12 +66,31 @@ # define GCS_FLAG 0 #endif +#define PASTE2(a, b) PASTE2a(a, b) +#define PASTE2a(a, b) a ## b + +#ifdef __USER_LABEL_PREFIX__ +# define ASMNAME(name) PASTE2(__USER_LABEL_PREFIX__, name) +#else +# define ASMNAME(name) name +#endif + #ifdef __ELF__ +#define L(label) .L ## label #define HIDDEN(name) .hidden name +#define GLOBAL(name) .global name #define SYMBOL_SIZE(name) .size name, .-name #define SYMBOL_TYPE(name, _type) .type name, _type +#elif __APPLE__ +#define L(label) L ## label +#define HIDDEN(name) .private_extern name +#define GLOBAL(name) .globl name +#define SYMBOL_SIZE(name) +#define SYMBOL_TYPE(name, _type) #else +#define L(label) .L ## label #define HIDDEN(name) +#define GLOBAL(name) .global name #define SYMBOL_SIZE(name) #define SYMBOL_TYPE(name, _type) #endif @@ -103,18 +120,24 @@ GNU_PROPERTY (FEATURE_1_AND, BTI_FLAG|PAC_FLAG|GCS_FLAG) # endif #endif -#define ENTRY_ALIGN(name, align) \ - .global name; \ - SYMBOL_TYPE(name, %function); \ - .balign align; \ - name: \ - .cfi_startproc; \ - BTI_C +.macro ENTRY_ALIGNP2m, name, align + .text + .p2align \align + GLOBAL (\name) + SYMBOL_TYPE(\name, %function) +\name: + .cfi_startproc + BTI_C +.endm -#define ENTRY(name) ENTRY_ALIGN(name, 16) +#define ENTRY(name) ENTRY_ALIGNP2m name, 4 #define END(name) \ .cfi_endproc; \ SYMBOL_SIZE(name) +.macro ENDm, name + .cfi_endproc + SYMBOL_SIZE (\name) +.endm #endif diff --git libgcc/config/aarch64/lse.S libgcc/config/aarch64/lse.S index e31ffa415..bc69d18dd 100644 --- libgcc/config/aarch64/lse.S +++ libgcc/config/aarch64/lse.S @@ -66,7 +66,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #endif /* Declare the symbol gating the LSE implementations. */ - HIDDEN(__aarch64_have_lse_atomics) + HIDDEN (ASMNAME (__aarch64_have_lse_atomics)) /* Turn size and memory model defines into mnemonic fragments. */ #if SIZE == 1 @@ -89,6 +89,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # error #endif +#undef L #if MODEL == 1 # define SUFF _relax # define A @@ -171,32 +172,21 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define tmp3 14 #define tmp4 13 -/* Start and end a function. */ -.macro STARTFN name - .text - .balign 16 - .globl \name - HIDDEN(\name) - SYMBOL_TYPE(\name, %function) - .cfi_startproc -\name: -.endm - -.macro ENDFN name - .cfi_endproc - SYMBOL_SIZE(\name) -.endm - /* Branch to LABEL if LSE is disabled. */ .macro JUMP_IF_NOT_LSE label - adrp x(tmp0), __aarch64_have_lse_atomics - ldrb w(tmp0), [x(tmp0), :lo12:__aarch64_have_lse_atomics] +#if __APPLE__ + adrp x(tmp0), ASMNAME (__aarch64_have_lse_atomics)@PAGE + ldrb w(tmp0), [x(tmp0), ASMNAME (__aarch64_have_lse_atomics)@PAGEOFF] +#else + adrp x(tmp0), ASMNAME (__aarch64_have_lse_atomics) + ldrb w(tmp0), [x(tmp0), :lo12:ASMNAME (__aarch64_have_lse_atomics)] +#endif cbz w(tmp0), \label .endm #ifdef L_cas -STARTFN NAME(cas) +ENTRY (ASMNAME (NAME(cas))) JUMP_IF_NOT_LSE 8f #if SIZE < 16 @@ -249,7 +239,7 @@ STARTFN NAME(cas) #endif -ENDFN NAME(cas) +ENDm ASMNAME (NAME(cas)) #endif #ifdef L_swp @@ -259,7 +249,7 @@ ENDFN NAME(cas) # define SWP .inst 0x38208020 + B + N #endif -STARTFN NAME(swp) +ENTRY (ASMNAME (NAME (swp))) JUMP_IF_NOT_LSE 8f SWP /* s(0), s(0), [x1] */ @@ -272,7 +262,7 @@ STARTFN NAME(swp) BARRIER ret -ENDFN NAME(swp) +ENDm ASMNAME (NAME (swp)) #endif #if defined(L_ldadd) || defined(L_ldclr) \ @@ -303,7 +293,7 @@ ENDFN NAME(swp) # define LDOP .inst 0x38200020 + OPN + B + N #endif -STARTFN NAME(LDNM) +ENTRY (ASMNAME (NAME (LDNM))) JUMP_IF_NOT_LSE 8f LDOP /* s(0), s(0), [x1] */ @@ -317,5 +307,5 @@ STARTFN NAME(LDNM) BARRIER ret -ENDFN NAME(LDNM) +ENDm ASMNAME (NAME (LDNM)) #endif diff --git libgcc/config/aarch64/sfp-machine.h libgcc/config/aarch64/sfp-machine.h index e2ced8e3c..f3a5080fc 100644 --- libgcc/config/aarch64/sfp-machine.h +++ libgcc/config/aarch64/sfp-machine.h @@ -124,6 +124,27 @@ void __sfp_handle_exceptions (int); /* Define ALIASNAME as a strong alias for NAME. */ +#if defined __APPLE__ +/* Mach-O doesn't support aliasing, so we build a secondary function for + the alias - we need to do a bit of a dance to find out what the type of + the arguments is and then apply that to the secondary function. + If these functions ever return anything but CMPtype we need to revisit + this... */ +typedef float alias_HFtype __attribute__ ((mode (HF))); +typedef float alias_SFtype __attribute__ ((mode (SF))); +typedef float alias_DFtype __attribute__ ((mode (DF))); +typedef float alias_TFtype __attribute__ ((mode (TF))); +#define ALIAS_SELECTOR \ + CMPtype (*) (alias_HFtype, alias_HFtype): (alias_HFtype) 0, \ + CMPtype (*) (alias_SFtype, alias_SFtype): (alias_SFtype) 0, \ + CMPtype (*) (alias_DFtype, alias_DFtype): (alias_DFtype) 0, \ + CMPtype (*) (alias_TFtype, alias_TFtype): (alias_TFtype) 0 +#define strong_alias(name, aliasname) \ + CMPtype aliasname (__typeof (_Generic (name, ALIAS_SELECTOR)) a, \ + __typeof (_Generic (name, ALIAS_SELECTOR)) b) \ + { return name (a, b); } +#else # define strong_alias(name, aliasname) _strong_alias(name, aliasname) # define _strong_alias(name, aliasname) \ extern __typeof (name) aliasname __attribute__ ((alias (#name))); +#endif diff --git libgcc/config/aarch64/t-darwin libgcc/config/aarch64/t-darwin new file mode 100644 index 000000000..3f6c3163f --- /dev/null +++ libgcc/config/aarch64/t-darwin @@ -0,0 +1,5 @@ +# Ensure we have a suitable minimum OS version. + +HOST_LIBGCC2_CFLAGS += -mmacosx-version-min=11.0 + +LIB2_SIDITI_CONV_FUNCS = yes diff --git libgcc/config/libbid/bid_binarydecimal.c libgcc/config/libbid/bid_binarydecimal.c index b4b0e1028..37b0fb1e2 100644 --- libgcc/config/libbid/bid_binarydecimal.c +++ libgcc/config/libbid/bid_binarydecimal.c @@ -413,7 +413,7 @@ BID_BINARY80LDOUBLE; } #define unpack_binary80(x,s,e,c,t,zero,inf,nan) \ -{ BID_BINARY80LDOUBLE x_in; \ +{ BID_BINARY80LDOUBLE x_in = {0}; \ x_in.f = x; \ c = x_in.i.lo4 + ((UINT64)x_in.i.lo3 << 16) + \ ((UINT64)x_in.i.lo2 << 32) + ((UINT64)x_in.i.lo1 << 48); \ diff --git libgcobol/configure.tgt libgcobol/configure.tgt index 310d7e0cd..278ad16a5 100644 --- libgcobol/configure.tgt +++ libgcobol/configure.tgt @@ -26,7 +26,7 @@ LIBGCOBOL_SUPPORTED=no case "${target}" in - aarch64*-*-linux*) + aarch64*-*-linux* | aarch64-*-darwin*) LIBGCOBOL_SUPPORTED=yes ;; powerpc64le-*-linux*) diff --git libitm/config/aarch64/sjlj.S libitm/config/aarch64/sjlj.S index 62ce4f8ee..d516efc6b 100644 --- libitm/config/aarch64/sjlj.S +++ libitm/config/aarch64/sjlj.S @@ -57,10 +57,19 @@ .text .align 2 +#if __ELF__ .global _ITM_beginTransaction .type _ITM_beginTransaction, %function _ITM_beginTransaction: + +#elif __MACH__ + .global __ITM_beginTransaction + +__ITM_beginTransaction: + +#endif + cfi_startproc CFI_PAC_KEY PAC_AND_BTI @@ -84,8 +93,13 @@ _ITM_beginTransaction: /* Invoke GTM_begin_transaction with the struct we just built. */ mov x1, sp +#if __ELF__ bl GTM_begin_transaction - +#elif __MACH__ + bl _GTM_begin_transaction +#else +#error "unexpected object format" +#endif /* Return; we don't need to restore any of the call-saved regs. */ ldp x29, x30, [sp], 11*16 cfi_adjust_cfa_offset(-11*16) @@ -95,14 +109,23 @@ _ITM_beginTransaction: CFI_PAC_TOGGLE ret cfi_endproc +#if __ELF__ .size _ITM_beginTransaction, . - _ITM_beginTransaction +#endif .align 2 +#if __ELF__ .global GTM_longjmp .hidden GTM_longjmp .type GTM_longjmp, %function GTM_longjmp: + +#elif __MACH__ + .private_extern _GTM_longjmp + +_GTM_longjmp: +#endif /* The first parameter becomes the return value (x0). The third parameter is ignored for now. */ cfi_startproc @@ -126,7 +149,9 @@ GTM_longjmp: CFI_PAC_TOGGLE br x30 cfi_endproc +#if __ELF__ .size GTM_longjmp, . - GTM_longjmp +#endif /* GNU_PROPERTY_AARCH64_* macros from elf.h for use in asm code. */ #define FEATURE_1_AND 0xc0000000 diff --git libitm/configure.tgt libitm/configure.tgt index c6424ffab..f09621f61 100644 --- libitm/configure.tgt +++ libitm/configure.tgt @@ -50,7 +50,7 @@ fi # Map the target cpu to an ARCH sub-directory. At the same time, # work out any special compilation flags as necessary. case "${target_cpu}" in - aarch64*) ARCH=aarch64 ;; + aarch64* | arm64*) ARCH=aarch64 ;; alpha*) ARCH=alpha ;; rs6000 | powerpc*) XCFLAGS="${XCFLAGS} -mhtm" diff --git libsanitizer/configure.tgt libsanitizer/configure.tgt index 3161ab3ee..8fe52baa8 100644 --- libsanitizer/configure.tgt +++ libsanitizer/configure.tgt @@ -65,6 +65,11 @@ case "${target}" in HWASAN_SUPPORTED=yes fi ;; + aarch64-*-darwin2*) + TSAN_SUPPORTED=no + LSAN_SUPPORTED=no + EXTRA_CXXFLAGS="${EXTRA_CXXFLAGS} -Wl,-undefined,dynamic_lookup " + ;; x86_64-*-darwin2* | x86_64-*-darwin1[6-9]* | i?86-*-darwin1[6-8]*) TSAN_SUPPORTED=no EXTRA_CXXFLAGS="${EXTRA_CXXFLAGS} -Wl,-undefined,dynamic_lookup"