From 8ccdc7ce33f5e7ca509e5b9f835ed4719db21ffd Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 19 May 2022 23:38:23 +0100 Subject: libstdc++: Ensure pmr aliases work without Currently the alias templates for std::pmr::vector, std::pmr::string etc. are defined using a forward declaration for polymorphic_allocator. This means you can't actually use the alias templates unless you also include . The rationale for that is that it's a fairly large header, and most users don't need it. This isn't uncontroversial though, and LWG 3681 questions whether it's even conforming. This change adds a new header with the minimum needed to use polymorphic_allocator and the std::pmr container aliases. Including is still necessary to use the program-wide resource objects, or the pool resources or monotonic buffer resource. libstdc++-v3/ChangeLog: * include/Makefile.am: Add new header. * include/Makefile.in: Regenerate. * include/bits/memory_resource.h: New file. * include/std/deque: Include . * include/std/forward_list: Likewise. * include/std/list: Likewise. * include/std/map: Likewise. * include/std/memory_resource (pmr::memory_resource): Move to new header. (pmr::polymorphic_allocator): Likewise. * include/std/regex: Likewise. * include/std/set: Likewise. * include/std/stacktrace: Likewise. * include/std/string: Likewise. * include/std/unordered_map: Likewise. * include/std/unordered_set: Likewise. * include/std/vector: Likewise. * testsuite/21_strings/basic_string/types/pmr_typedefs.cc: Remove header and check construction. * testsuite/23_containers/deque/types/pmr_typedefs.cc: Likewise. * testsuite/23_containers/forward_list/pmr_typedefs.cc: Likewise. * testsuite/23_containers/list/pmr_typedefs.cc: Likewise. * testsuite/23_containers/map/pmr_typedefs.cc: Likewise. * testsuite/23_containers/multimap/pmr_typedefs.cc: Likewise. * testsuite/23_containers/multiset/pmr_typedefs.cc: Likewise. * testsuite/23_containers/set/pmr_typedefs.cc: Likewise. * testsuite/23_containers/unordered_map/pmr_typedefs.cc: Likewise. * testsuite/23_containers/unordered_multimap/pmr_typedefs.cc: Likewise. * testsuite/23_containers/unordered_multiset/pmr_typedefs.cc: Likewise. * testsuite/23_containers/unordered_set/pmr_typedefs.cc: Likewise. * testsuite/23_containers/vector/pmr_typedefs.cc: Likewise. * testsuite/28_regex/match_results/pmr_typedefs.cc: Likewise. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/variadic-tuple.C: Qualify function to avoid ADL finding std::make_tuple. --- gcc/testsuite/g++.dg/cpp0x/variadic-tuple.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-tuple.C b/gcc/testsuite/g++.dg/cpp0x/variadic-tuple.C index b1c6b3d..e2699d9 100644 --- a/gcc/testsuite/g++.dg/cpp0x/variadic-tuple.C +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-tuple.C @@ -272,7 +272,7 @@ int main() // t3a = t3b; DPG: triggers an error, as it should. tuple t3c = - make_tuple(17, 2.718281828, std::string("Fun")); + ::make_tuple(17, 2.718281828, std::string("Fun")); int seventeen = 17; double pi = 3.14159; -- cgit v1.1 From 12750f80bffe7072a7fcc7620305a40d071ff388 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Fri, 20 May 2022 00:16:32 +0000 Subject: Daily bump. --- gcc/ChangeLog | 55 +++++++++ gcc/DATESTAMP | 2 +- gcc/ada/ChangeLog | 316 ++++++++++++++++++++++++++++++++++++++++++++++++ gcc/testsuite/ChangeLog | 26 ++++ 4 files changed, 398 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 66fe54b..bb3fd55 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,58 @@ +2022-05-19 Roger Sayle + + PR middle-end/98865 + * expr.cc (expand_expr_real_2) [MULT_EXPR]: Expand X*Y as X&Y + when both X and Y are [0, 1], X*Y as X&-Y when Y is [0,1] and + likewise X*Y as -X&Y when X is [0,1] using tree_nonzero_bits. + +2022-05-19 Will Schmidt + + * config/rs6000/rs6000-builtins.def: Rephrase + to remove RS6000_BTC_SPECIAL from comment. + * config/rs6000/rs6000.h (RS6000_BTC_UNARY, RS6000_BTC_BINARY, + RS6000_BTC_TERNARY, RS6000_BTC_QUATERNARY, + RS6000_BTC_QUINARY, RS6000_BTC_SENARY, RS6000_BTC_OPND_MASK, + RS6000_BTC_SPECIAL, RS6000_BTC_PREDICATE, RS6000_BTC_ABS, + RS6000_BTC_DST, RS6000_BTC_TYPE_MASK, RS6000_BTC_MISC, + RS6000_BTC_CONST, RS6000_BTC_PURE, RS6000_BTC_FP, + RS6000_BTC_QUAD, RS6000_BTC_PAIR, RS6000_BTC_QUADPAIR, + RS6000_BTC_ATTR_MASK, RS6000_BTC_SPR, RS6000_BTC_VOID, + RS6000_BTC_CR, RS6000_BTC_OVERLOADED, RS6000_BTC_GIMPLE, + RS6000_BTC_MISC_MASK, RS6000_BTC_MEM, RS6000_BTC_SAT, + RS6000_BTM_ALWAYS): Delete. + +2022-05-19 Richard Biener + + * omp-expand.cc (expand_omp_atomic_cas): Do not short-cut + computation of the new value. + +2022-05-19 Richard Biener + + * tree-ssa-pre.cc (get_or_alloc_expression_id): Remove. + (add_to_value): Use get_expression_id. + (bitmap_insert_into_set): Likewise. + (bitmap_value_insert_into_set): Likewise. + +2022-05-19 David Malcolm + + * doc/invoke.texi (-fanalyzer-checker=): Add + -Wanalyzer-va-list-leak and -Wanalyzer-va-list-use-after-va-end to + the list of analyzer warnings disabled by + -fanalyzer-checker=taint. + +2022-05-19 Jakub Jelinek + + PR debug/105630 + * cfgexpand.cc (expand_debug_expr): For VAR_DECL, punt for + global vars without symtab node even when they have DECL_RTL + set. + +2022-05-19 Jakub Jelinek + + PR c/105635 + * pointer-query.cc (gimple_parm_array_size): Return NULL if var + doesn't have pointer or reference type. + 2022-05-18 Marek Polacek PR c/105131 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 756cdcb..dc35e22 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20220519 +20220520 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 746aee8..0a766f2 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,319 @@ +2022-05-19 Eric Botcazou + + * gcc-interface/decl.cc (gnat_to_gnu_entity) : Deal with + a constant related to a return in a function specially. + * gcc-interface/trans.cc (Call_to_gnu): Use return slot optimization + if the target is a return object. + (gnat_to_gnu) : Deal with a constant related + to a return in a function specially. + +2022-05-19 Eric Botcazou + + * gcc-interface/utils.cc (gnat_pushdecl): Also set TREE_NO_WARNING + on the decl if Comes_From_Source is false for the associated node. + +2022-05-19 Eric Botcazou + + * gcc-interface/trans.cc (gnat_gimplify_expr): Tidy up. + +2022-05-19 Eric Botcazou + + * gcc-interface/decl.cc (gnat_to_gnu_entity) : Also call + process_attributes for built-in functions. + (prepend_one_attribute_pragma): Deal with "simd" attribute. + * gcc-interface/utils.cc (handle_simd_attribute): New function. + (gnat_internal_attribute_table): Add entry for "simd" attribute. + +2022-05-19 Eric Botcazou + + * gcc-interface/decl.cc (components_to_record): Use NULL recursively + as P_GNU_REP_LIST for the innermost variant level in the unchecked + union case with a fixed part. + +2022-05-19 Eric Botcazou + + * gcc-interface/trans.cc (gnat_to_gnu): Do not set Current_Error_Node + to a node without location. + +2022-05-19 Eric Botcazou + + * gcc-interface/decl.cc (gnat_to_gnu_entity) : And + skip the elaboration of the designated subtype when that of its base + type has been delayed. + +2022-05-19 Eric Botcazou + + * gcc-interface/decl.cc (gnat_to_gnu_entity) : If + it is a special subtype designated by an access subtype, then defer + the completion of incomplete types. + +2022-05-19 Eric Botcazou + + * gcc-interface/ada-tree.h, gcc-interface/ada.h, + gcc-interface/gadaint.h, gcc-interface/targtyps.cc: Adjust + copyright line. + +2022-05-19 Eric Botcazou + + * gcc-interface/utils.cc (unchecked_convert): Do not fold a string + constant if the target type is pointer to character. + +2022-05-19 Piotr Trojanek + + * sem_prag.adb (Analyze_Pragma): Remove redundant call to + Set_Error_Posted. + +2022-05-19 Piotr Trojanek + + * sem_ch8.adb (Find_Expanded_Name): Emit a main error message + before adding a continuation with the call to + Error_Missing_With_Of_Known_Unit. + +2022-05-19 Eric Botcazou + + * sem_util.ads (Requires_Transient_Scope): Add pragma Inline. + +2022-05-19 Steve Baird + + * sem_ch13.adb (Build_Predicate_Functions): If a semantic error + has been detected then ignore Predicate_Failure aspect + specifications in the same way as is done for CodePeer and + SPARK. This avoids an internal compiler error if + Ancestor_Predicate_Function_Called is True but Result_Expr is + not an N_And_Then node (and is therefore unsuitable as an + argument in a call to Left_Opnd). + +2022-05-19 Eric Botcazou + + * exp_ch7.adb (Wrap_Transient_Declaration): Propagate Uses_Sec_Stack + to enclosing function if it does not return on the secondary stack. + * exp_ch6.adb (Expand_Call_Helper): Call Establish_Transient_Scope + with Manage_Sec_Stack set to True only when necessary. + * sem_res.adb (Resolve_Call): Likewise. + (Resolve_Entry_Call): Likewise. + +2022-05-19 Daniel Mercier + + * sem_ch13.adb (Build_Predicate_Function): Ignore predicate + failure in CodePeer mode. + +2022-05-19 Arnaud Charlet + + * raise-gcc.c: Fix compilation with -DSTANDALONE under windows. + +2022-05-19 Eric Botcazou + + * exp_ch4.adb (Narrow_Large_Operation): Preserve and reuse Etype. + +2022-05-19 Javier Miranda + + * exp_attr.adb (Add_Implicit_Interface_Type_Conversion): New + subprogram which factorizes code. + (Expand_N_Attribute_Reference): Call the new subprogram to add + the missing implicit interface type conversion. + +2022-05-19 Piotr Trojanek + + * sem_ch13.adb (Build_Predicate_Function): Ignore predicate + failure in GNATprove mode. + +2022-05-19 Steve Baird + + * einfo-utils.ads, einfo-utils.adb: Delete Predicate_Function_M + function and Set_Predicate_Function_M procedure. + * einfo.ads: Delete comments for Is_Predicate_Function_M and + Predicate_Function_M functions. Add comment for new + Predicate_Expression function. Update comment describing + predicate functions. + * exp_util.ads, exp_util.adb (Make_Predicate_Call): Replace Mem + formal parameter with Static_Mem and Dynamic_Mem formals. + (Make_Predicate_Check): Delete Add_Failure_Expression and call + to it. + * exp_ch4.adb (Expand_N_In.Predicate_Check): Update + Make_Predicate_Call call to match profile change. + * gen_il-fields.ads: Delete Is_Predicate_Function_M field, add + Predicate_Expression field. + * gen_il-gen-gen_entities.adb: Delete Is_Predicate_Function_M + use, add Predicate_Expression use. + * sem_ch13.adb (Build_Predicate_Functions): Rename as singular, + not plural; we no longer build a Predicate_M function. Delete + Predicate_M references. Add new Boolean parameter for predicate + functions when needed. Restructure body of generated predicate + functions to implement required Predicate_Failure behavior and + to set new Predicate_Expression attribute. Remove special + treatment of raise expressions within predicate expressions. + * sem_util.ads (Predicate_Failure_Expression, + Predicate_Function_Needs_Membership_Parameter): New functions. + * sem_util.adb (Is_Current_Instance): Fix bugs which caused + wrong result. + (Is_Current_Instance_Reference_In_Type_Aspect): Delete + Is_Predicate_Function_M reference. + (Predicate_Failure_Expression): New function. + (Propagate_Predicate_Attributes): Delete Is_Predicate_Function_M + references. + +2022-05-19 Eric Botcazou + + * exp_ch6.adb (Expand_Call_Helper): Adjust comment. + (Expand_Simple_Function_Return): For the case of a type which needs + finalization and is returned on the primary stack, do not create a + copy if the expression originates from a function call. + * exp_ch7.adb (Transient Scope Management): Adjust comment. + * exp_util.ads (Is_Related_To_Func_Return): Add WARNING line. + * fe.h (Is_Related_To_Func_Return): Declare. + +2022-05-19 Piotr Trojanek + + * exp_ch9.adb (Build_Find_Body_Index): Remove empty Elsif_Parts + from the constructed IF statement. + +2022-05-19 Piotr Trojanek + + * exp_ch9.adb (Build_Find_Body_Index): Remove IF statement whose + condition was true-by-construction; remove excessive assertion + (since the call to Elsif_Parts will check that Nod is present + and it is an if-statement). + +2022-05-19 Arnaud Charlet + + * gnat1drv.adb, gnatcmd.adb: Remove references to gnatfind/xref. + * doc/gnat_ugn/building_executable_programs_with_gnat.rst, + doc/gnat_ugn/the_gnat_compilation_model.rst: Ditto. + * gnat_ugn.texi: Regenerate. + * gnatfind.adb, gnatxref.adb, xr_tabls.adb, xr_tabls.ads, + xref_lib.adb, xref_lib.ads: Removed, no longer used. + +2022-05-19 Claire Dross + + * libgnat/a-strfix.adb: Add assertions. + * libgnat/a-strsup.adb: Idem. + +2022-05-19 Ed Schonberg + + * erroutc.ads: Fix a single-character typo in a comment. + * exp_aggr.adb: Fix a single-character typo in a comment. + Replace several pairs of calls to Low_Bound and + High_Bound (which do not handle an identifier that denotes a + scalar subtype) with corresponding calls to Get_Index_Bounds + (which does handle that case). + * par-ch4.adb (P_Aggregate_Or_Paren_Expr): Set the + Component_Associations attribute of a null array aggregate to + New_List. + * sem_aggr.ads: New visible function + Is_Null_Array_Aggregate_High_Bound. + * sem_aggr.adb (Is_Null_Array_Aggregate_High_Bound, + Is_Null_Aggregate, Resolve_Null_Array_Aggregate): New functions. + (Resolve_Aggregate): Recognize null array aggregates (using + Is_Null_Aggregate) and, when one is recognized, resolve + it (using Resolve_Null_Array_Aggregate). Avoid calling + Array_Aggr_Subtype for a null array aggregate; the needed + subtype is built in Resolve_Null_Array_Aggregate. Do not + incorrectly flag a null aggregate (after it is transformed by + expansion) as being both positional and named. + * sem_attr.adb (Eval_Attribute): Special treatment for null + array aggregate high bounds to avoid incorrectly flagging + something like Integer'Pred (Integer'First) as an illegal static + expression. + * sem_eval.adb (Out_Of_Range): Special treatment for null array + aggregate high bounds to avoid incorrectly flagging something + like Integer'Pred (Integer'First) as an illegal static + expression. + +2022-05-19 Yannick Moy + + * libgnat/s-aridou.adb (Lemma_Abs_Range, + Lemma_Double_Shift_Left, Lemma_Shift_Left): New lemmas. + (Double_Divide): Add ghost code. + (Lemma_Concat_Definition, Lemma_Double_Shift_Left, + Lemma_Shift_Left, Lemma_Shift_Right): Define or complete lemmas. + (Scaled_Divide): Add ghost code. + +2022-05-19 Bob Duff + + * exp_pakd.adb (Expand_Packed_Eq): Replace the check for *same* + modular type, with a check for any modular type, and assert that + the two types have the same modulus and so on. + * exp_pakd.ads: Minor comment improvements. + +2022-05-19 Bob Duff + + * style.adb (Check_Identifier): Deal with the case where a + record component definition has been transformed; we want to + warn if the original came from source. + * libgnat/s-objrea.ads, libgnat/s-objrea.adb: Fix casing of MF + to be consistent. + * uname.adb: Fix casing of Chars to be consistent. + * sem_util.ads: Minor comment fix. + +2022-05-19 Eric Botcazou + + * Makefile.rtl (GNATRTL_NONTASKING_OBJS): Add s-retsta. + * debug.adb (d_r): Document usage. + * exp_ch4.adb (Expand_N_Allocato): Deal with the return stack pool. + * exp_ch6.adb (Expand_Simple_Function_Return): Replace calls to + Requires_Transient_Scope with Returns_On_Secondary_Stack. Deal + with types that need finalization returned on the primary stack, + use CW_Or_Needs_Finalization for those returned on the secondary. + * exp_util.adb (Build_Allocate_Deallocate_Proc): Return early + for the return stack pool. + (Remove_Side_Effects): Call CW_Or_Needs_Finalization. + * fe.h (Requires_Transient_Scope): Delete. + (Returns_On_Secondary_Stack): Declare. + * gnat1drv.adb (Adjust_Global_Switches): Set Back_End_Return_Slot + to False when generating C code or if -gnatd_r is specified. + * opt.ads (Back_End_Return_Slot): New boolean variable. + * rtsfind.ads (RTU_Id): Add System_Return_Stack. + (RE_Id): Add RE_RS_Allocate and RE_RS_Pool. + (RE_Unit_Table): Add entries for RE_RS_Allocate and RE_RS_Pool. + * sem_util.ads (CW_Or_Has_Controlled_Part): Delete. + (CW_Or_Needs_Finalization): Declare. + (Requires_Transient_Scope): Adjust description. + (Returns_On_Secondary_Stack): Declare. + * sem_util.adb (Compute_Returns_By_Ref): Set Returns_By_Ref on types + which need finalization if they are returned on the secondary stack. + (CW_Or_Has_Controlled_Part): Rename to... + (CW_Or_Needs_Finalization): ...this. + (Requires_Transient_Scope): Move bulk of implementation to... + (Returns_On_Secondary_Stack): ...here. Return true for types which + need finalization only if the back-end return slot is not supported. + * libgnat/s-retsta.ads: New file. + * gcc-interface/ada-builtin-types.def (BT_FN_PTR_SSIZE): Define. + * gcc-interface/ada-builtins.def (return_slot): Likewise. + * gcc-interface/ada-tree.h (BUILT_IN_RETURN_SLOT): Likewise. + * gcc-interface/decl.cc (gnat_to_gnu_subprog_type): Replace call to + Requires_Transient_Scope with Returns_On_Secondary_Stack. + * gcc-interface/trans.cc (gnat_to_gnu) : + In the return by invisible reference, skip the copy if the source + is the same as the destination. + * gcc-interface/utils2.cc (build_call_alloc_dealloc_proc): Deal with + the return stack pool. + +2022-05-19 Eric Botcazou + + * gcc-interface/trans.cc: Fix formatting issues in comments. + (Subprogram_Body_to_gnu): Tidy up. + (Exception_Handler_to_gnu_gcc): Rename into... + (Exception_Handler_to_gnu): ...this. + (gnat_to_gnu) : Adjust to above renaming. + +2022-05-19 Eric Botcazou + + * gcc-interface/trans.cc (Subprogram_Body_to_gnu): Rename a couple + of local variables and use Is_Generic_Subprogram predicate. + (process_decls): Likewise. + +2022-05-19 Eric Botcazou + + * gcc-interface/trans.cc (Subprogram_Body_to_gnu): Do not deal with + inlining heuristics for expression functions here but... + * gcc-interface/decl.cc (inline_status_for_subprog): ...here instead + and do not override them at -Os. + +2022-05-19 Piotr Trojanek + + * gcc-interface/decl.cc (gnat_to_gnu_entity): Remove dead code + which expected Scope to return E_Subprogram_Body entity. + 2022-05-18 Claire Dross * libgnat/s-imageu.adb (Set_Image_Unsigned): Change assertion. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e4c2c46..613dbbe 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,29 @@ +2022-05-19 Jonathan Wakely + + * g++.dg/cpp0x/variadic-tuple.C: Qualify function to avoid ADL + finding std::make_tuple. + +2022-05-19 Roger Sayle + + PR middle-end/98865 + * gcc.target/i386/pr98865.c: New test case. + +2022-05-19 Giuliano Belinassi + + PR target/105647 + * g++.dg/modules/pr105169_a.C: Change -fpatchable-function-entry to 2. + * g++.dg/modules/pr105169_b.C: Likewise. + +2022-05-19 Jakub Jelinek + + PR debug/105630 + * gcc.dg/pr105630.c: New test. + +2022-05-19 Jakub Jelinek + + PR c/105635 + * gcc.dg/pr105635.c: New test. + 2022-05-18 Marek Polacek PR c/105131 -- cgit v1.1 From afd82c104b1038572ed4d473a0b5f6e2c778fa01 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Wed, 9 Mar 2022 14:27:10 +0000 Subject: aarch64: Enable DFP (Decimal Floating-point) (BID format) This patch enables DFP support on aarch64, by updating config/dfp.m4 and regenerating the involved configure scripts. We enable the BID format. 2022-03-31 Christophe Lyon config/ * dfp.m4: Add aarch64 support. gcc/ * configure: Regenerate. libdecnumber/ * configure: Regenerate. libgcc/ * configure: Regenerate. --- gcc/configure | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/configure b/gcc/configure index 5ce0557..37e0dd5 100755 --- a/gcc/configure +++ b/gcc/configure @@ -7896,6 +7896,7 @@ Valid choices are 'yes', 'bid', 'dpd', and 'no'." "$LINENO" 5 ;; else case $target in + aarch64* | \ powerpc*-*-linux* | i?86*-*-linux* | x86_64*-*-linux* | s390*-*-linux* | \ i?86*-*-elfiamcu | i?86*-*-gnu* | x86_64*-*-gnu* | \ i?86*-*-mingw* | x86_64*-*-mingw* | \ @@ -7916,7 +7917,7 @@ fi case x$enable_decimal_float in xyes) case $target in - i?86*-*-* | x86_64*-*-*) + aarch64* | i?86*-*-* | x86_64*-*-*) enable_decimal_float=bid ;; *) -- cgit v1.1 From 0dc8e1e7026d9b8ec8b669c051786d426a52cd22 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Fri, 11 Mar 2022 16:21:02 +0000 Subject: aarch64: Add backend support for DFP This patch updates the aarch64 backend as needed to support DFP modes (SD, DD and TD). Changes v1->v2: * Drop support for DFP modes in aarch64_gen_{load||store}[wb]_pair as these are only used in prologue/epilogue where DFP modes are not used. Drop the changes to the corresponding patterns in aarch64.md, and useless GPF_PAIR iterator. * In aarch64_reinterpret_float_as_int, handle DDmode the same way as DFmode (needed in case the representation of the floating-point value can be loaded using mov/movk. * In aarch64_float_const_zero_rtx_p, reject constants with DFP mode: when X is zero, the callers want to emit either '0' or 'zr' depending on the context, which is not the way 0.0 is represented in DFP mode (in particular fmov d0, #0 is not right for DFP). * In aarch64_legitimate_constant_p, accept DFP 2022-03-31 Christophe Lyon gcc/ * config/aarch64/aarch64.cc (aarch64_split_128bit_move): Handle DFP modes. (aarch64_mode_valid_for_sched_fusion_p): Likewise. (aarch64_classify_address): Likewise. (aarch64_legitimize_address_displacement): Likewise. (aarch64_reinterpret_float_as_int): Likewise. (aarch64_float_const_zero_rtx_p): Likewise. (aarch64_can_const_movi_rtx_p): Likewise. (aarch64_anchor_offset): Likewise. (aarch64_secondary_reload): Likewise. (aarch64_rtx_costs): Likewise. (aarch64_legitimate_constant_p): Likewise. (aarch64_gimplify_va_arg_expr): Likewise. (aapcs_vfp_sub_candidate): Likewise. (aarch64_vfp_is_call_or_return_candidate): Likewise. (aarch64_output_scalar_simd_mov_immediate): Likewise. (aarch64_gen_adjusted_ldpstp): Likewise. (aarch64_scalar_mode_supported_p): Accept DFP modes if enabled. * config/aarch64/aarch64.md (movsf_aarch64): Use SFD iterator and rename into mov_aarch64. (movdf_aarch64): Use DFD iterator and rename into mov_aarch64. (movtf_aarch64): Use TFD iterator and rename into mov_aarch64. (split pattern for move TF mode): Use TFD iterator. * config/aarch64/iterators.md (GPF_TF_F16_MOV): Add DFP modes. (SFD, DFD, TFD): New iterators. (GPF_TF): Add DFP modes. (TX, DX, DX2): Likewise. --- gcc/config/aarch64/aarch64.cc | 82 +++++++++++++++++++++++++++-------------- gcc/config/aarch64/aarch64.md | 34 ++++++++--------- gcc/config/aarch64/iterators.md | 24 ++++++++---- 3 files changed, 89 insertions(+), 51 deletions(-) (limited to 'gcc') diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 2902f94..4aad14c 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -4828,7 +4828,7 @@ aarch64_split_128bit_move (rtx dst, rtx src) machine_mode mode = GET_MODE (dst); - gcc_assert (mode == TImode || mode == TFmode); + gcc_assert (mode == TImode || mode == TFmode || mode == TDmode); gcc_assert (!(side_effects_p (src) || side_effects_p (dst))); gcc_assert (mode == GET_MODE (src) || GET_MODE (src) == VOIDmode); @@ -10568,6 +10568,7 @@ aarch64_mode_valid_for_sched_fusion_p (machine_mode mode) { return mode == SImode || mode == DImode || mode == SFmode || mode == DFmode + || mode == SDmode || mode == DDmode || (aarch64_vector_mode_supported_p (mode) && (known_eq (GET_MODE_SIZE (mode), 8) || (known_eq (GET_MODE_SIZE (mode), 16) @@ -10610,12 +10611,13 @@ aarch64_classify_address (struct aarch64_address_info *info, vec_flags &= ~VEC_PARTIAL; /* On BE, we use load/store pair for all large int mode load/stores. - TI/TFmode may also use a load/store pair. */ + TI/TF/TDmode may also use a load/store pair. */ bool advsimd_struct_p = (vec_flags == (VEC_ADVSIMD | VEC_STRUCT)); bool load_store_pair_p = (type == ADDR_QUERY_LDP_STP || type == ADDR_QUERY_LDP_STP_N || mode == TImode || mode == TFmode + || mode == TDmode || (BYTES_BIG_ENDIAN && advsimd_struct_p)); /* If we are dealing with ADDR_QUERY_LDP_STP_N that means the incoming mode corresponds to the actual size of the memory being loaded/stored and the @@ -10689,7 +10691,7 @@ aarch64_classify_address (struct aarch64_address_info *info, info->offset = op1; info->const_offset = offset; - /* TImode and TFmode values are allowed in both pairs of X + /* TImode, TFmode and TDmode values are allowed in both pairs of X registers and individual Q registers. The available address modes are: X,X: 7-bit signed scaled offset @@ -10698,7 +10700,7 @@ aarch64_classify_address (struct aarch64_address_info *info, When performing the check for pairs of X registers i.e. LDP/STP pass down DImode since that is the natural size of the LDP/STP instruction memory accesses. */ - if (mode == TImode || mode == TFmode) + if (mode == TImode || mode == TFmode || mode == TDmode) return (aarch64_offset_7bit_signed_scaled_p (DImode, offset) && (aarch64_offset_9bit_signed_unscaled_p (mode, offset) || offset_12bit_unsigned_scaled_p (mode, offset))); @@ -10821,14 +10823,14 @@ aarch64_classify_address (struct aarch64_address_info *info, info->offset = XEXP (XEXP (x, 1), 1); info->const_offset = offset; - /* TImode and TFmode values are allowed in both pairs of X + /* TImode, TFmode and TDmode values are allowed in both pairs of X registers and individual Q registers. The available address modes are: X,X: 7-bit signed scaled offset Q: 9-bit signed offset We conservatively require an offset representable in either mode. */ - if (mode == TImode || mode == TFmode) + if (mode == TImode || mode == TFmode || mode == TDmode) return (aarch64_offset_7bit_signed_scaled_p (mode, offset) && aarch64_offset_9bit_signed_unscaled_p (mode, offset)); @@ -10990,9 +10992,9 @@ aarch64_legitimize_address_displacement (rtx *offset1, rtx *offset2, offset. Use 4KB range for 1- and 2-byte accesses and a 16KB range otherwise to increase opportunities for sharing the base address of different sizes. Unaligned accesses use the signed - 9-bit range, TImode/TFmode use the intersection of signed + 9-bit range, TImode/TFmode/TDmode use the intersection of signed scaled 7-bit and signed 9-bit offset. */ - if (mode == TImode || mode == TFmode) + if (mode == TImode || mode == TFmode || mode == TDmode) second_offset = ((const_offset + 0x100) & 0x1f8) - 0x100; else if ((const_offset & (size - 1)) != 0) second_offset = ((const_offset + 0x100) & 0x1ff) - 0x100; @@ -11073,7 +11075,7 @@ aarch64_reinterpret_float_as_int (rtx value, unsigned HOST_WIDE_INT *intval) CONST_DOUBLE_REAL_VALUE (value), REAL_MODE_FORMAT (mode)); - if (mode == DFmode) + if (mode == DFmode || mode == DDmode) { int order = BYTES_BIG_ENDIAN ? 1 : 0; ival = zext_hwi (res[order], 32); @@ -11114,11 +11116,15 @@ aarch64_float_const_rtx_p (rtx x) return false; } -/* Return TRUE if rtx X is immediate constant 0.0 */ +/* Return TRUE if rtx X is immediate constant 0.0 (but not in Decimal + Floating Point). */ bool aarch64_float_const_zero_rtx_p (rtx x) { - if (GET_MODE (x) == VOIDmode) + /* 0.0 in Decimal Floating Point cannot be represented by #0 or + zr as our callers expect, so no need to check the actual + value if X is of Decimal Floating Point type. */ + if (GET_MODE_CLASS (GET_MODE (x)) == MODE_DECIMAL_FLOAT) return false; if (REAL_VALUE_MINUS_ZERO (*CONST_DOUBLE_REAL_VALUE (x))) @@ -11156,7 +11162,7 @@ aarch64_can_const_movi_rtx_p (rtx x, machine_mode mode) else return false; - /* use a 64 bit mode for everything except for DI/DF mode, where we use + /* use a 64 bit mode for everything except for DI/DF/DD mode, where we use a 128 bit vector mode. */ int width = GET_MODE_BITSIZE (imode) == 64 ? 128 : 64; @@ -12356,7 +12362,7 @@ aarch64_anchor_offset (HOST_WIDE_INT offset, HOST_WIDE_INT size, if (IN_RANGE (offset, -256, 0)) return 0; - if (mode == TImode || mode == TFmode) + if (mode == TImode || mode == TFmode || mode == TDmode) return (offset + 0x100) & ~0x1ff; /* Use 12-bit offset by access size. */ @@ -12465,7 +12471,9 @@ aarch64_secondary_reload (bool in_p ATTRIBUTE_UNUSED, rtx x, /* Without the TARGET_SIMD instructions we cannot move a Q register to a Q register directly. We need a scratch. */ - if (REG_P (x) && (mode == TFmode || mode == TImode) && mode == GET_MODE (x) + if (REG_P (x) + && (mode == TFmode || mode == TImode || mode == TDmode) + && mode == GET_MODE (x) && FP_REGNUM_P (REGNO (x)) && !TARGET_SIMD && reg_class_subset_p (rclass, FP_REGS)) { @@ -12473,14 +12481,16 @@ aarch64_secondary_reload (bool in_p ATTRIBUTE_UNUSED, rtx x, return NO_REGS; } - /* A TFmode or TImode memory access should be handled via an FP_REGS + /* A TFmode, TImode or TDmode memory access should be handled via an FP_REGS because AArch64 has richer addressing modes for LDR/STR instructions than LDP/STP instructions. */ if (TARGET_FLOAT && rclass == GENERAL_REGS && known_eq (GET_MODE_SIZE (mode), 16) && MEM_P (x)) return FP_REGS; - if (rclass == FP_REGS && (mode == TImode || mode == TFmode) && CONSTANT_P(x)) + if (rclass == FP_REGS + && (mode == TImode || mode == TFmode || mode == TDmode) + && CONSTANT_P(x)) return GENERAL_REGS; return NO_REGS; @@ -13611,9 +13621,9 @@ aarch64_rtx_costs (rtx x, machine_mode mode, int outer ATTRIBUTE_UNUSED, *cost += extra_cost->ldst.storev; else if (GET_MODE_CLASS (mode) == MODE_INT) *cost += extra_cost->ldst.store; - else if (mode == SFmode) + else if (mode == SFmode || mode == SDmode) *cost += extra_cost->ldst.storef; - else if (mode == DFmode) + else if (mode == DFmode || mode == DDmode) *cost += extra_cost->ldst.stored; *cost += @@ -13737,11 +13747,11 @@ aarch64_rtx_costs (rtx x, machine_mode mode, int outer ATTRIBUTE_UNUSED, /* mov[df,sf]_aarch64. */ if (aarch64_float_const_representable_p (x)) /* FMOV (scalar immediate). */ - *cost += extra_cost->fp[mode == DFmode].fpconst; + *cost += extra_cost->fp[mode == DFmode || mode == DDmode].fpconst; else if (!aarch64_float_const_zero_rtx_p (x)) { /* This will be a load from memory. */ - if (mode == DFmode) + if (mode == DFmode || mode == DDmode) *cost += extra_cost->ldst.loadd; else *cost += extra_cost->ldst.loadf; @@ -13767,9 +13777,9 @@ aarch64_rtx_costs (rtx x, machine_mode mode, int outer ATTRIBUTE_UNUSED, *cost += extra_cost->ldst.loadv; else if (GET_MODE_CLASS (mode) == MODE_INT) *cost += extra_cost->ldst.load; - else if (mode == SFmode) + else if (mode == SFmode || mode == SDmode) *cost += extra_cost->ldst.loadf; - else if (mode == DFmode) + else if (mode == DFmode || mode == DDmode) *cost += extra_cost->ldst.loadd; *cost += @@ -19352,7 +19362,7 @@ aarch64_legitimate_constant_p (machine_mode mode, rtx x) { /* Support CSE and rematerialization of common constants. */ if (CONST_INT_P (x) - || (CONST_DOUBLE_P (x) && GET_MODE_CLASS (mode) == MODE_FLOAT)) + || CONST_DOUBLE_P (x)) return true; /* Only accept variable-length vector constants if they can be @@ -19793,6 +19803,18 @@ aarch64_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, field_t = long_double_type_node; field_ptr_t = long_double_ptr_type_node; break; + case SDmode: + field_t = dfloat32_type_node; + field_ptr_t = build_pointer_type (dfloat32_type_node); + break; + case DDmode: + field_t = dfloat64_type_node; + field_ptr_t = build_pointer_type (dfloat64_type_node); + break; + case TDmode: + field_t = dfloat128_type_node; + field_ptr_t = build_pointer_type (dfloat128_type_node); + break; case E_HFmode: field_t = aarch64_fp16_type_node; field_ptr_t = aarch64_fp16_ptr_type_node; @@ -20044,7 +20066,8 @@ aapcs_vfp_sub_candidate (const_tree type, machine_mode *modep, case REAL_TYPE: mode = TYPE_MODE (type); if (mode != DFmode && mode != SFmode - && mode != TFmode && mode != HFmode) + && mode != TFmode && mode != HFmode + && mode != SDmode && mode != DDmode && mode != TDmode) return -1; if (*modep == VOIDmode) @@ -20360,7 +20383,9 @@ aarch64_vfp_is_call_or_return_candidate (machine_mode mode, machine_mode new_mode = VOIDmode; bool composite_p = aarch64_composite_type_p (type, mode); - if ((!composite_p && GET_MODE_CLASS (mode) == MODE_FLOAT) + if ((!composite_p + && (GET_MODE_CLASS (mode) == MODE_FLOAT + || GET_MODE_CLASS (mode) == MODE_DECIMAL_FLOAT)) || aarch64_short_vector_p (type, mode)) { *count = 1; @@ -23268,7 +23293,7 @@ aarch64_output_scalar_simd_mov_immediate (rtx immediate, scalar_int_mode mode) } machine_mode vmode; - /* use a 64 bit mode for everything except for DI/DF mode, where we use + /* use a 64 bit mode for everything except for DI/DF/DD mode, where we use a 128 bit vector mode. */ int width = GET_MODE_BITSIZE (mode) == 64 ? 128 : 64; @@ -26086,7 +26111,7 @@ aarch64_gen_adjusted_ldpstp (rtx *operands, bool load, base_off = (off_val_1 + off_val_3) / 2; else /* However, due to issues with negative LDP/STP offset generation for - larger modes, for DF, DI and vector modes. we must not use negative + larger modes, for DF, DD, DI and vector modes. we must not use negative addresses smaller than 9 signed unadjusted bits can store. This provides the most range in this case. */ base_off = off_val_1; @@ -26364,6 +26389,9 @@ aarch64_libgcc_floating_mode_supported_p (scalar_float_mode mode) static bool aarch64_scalar_mode_supported_p (scalar_mode mode) { + if (DECIMAL_FLOAT_MODE_P (mode)) + return default_decimal_float_supported_p (); + return (mode == HFmode ? true : default_scalar_mode_supported_p (mode)); diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index f5c6359..2ac8d56 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -1477,11 +1477,11 @@ (set_attr "arch" "simd,fp16,simd,simd,simd,fp16,simd,*,*,*,*,*")] ) -(define_insn "*movsf_aarch64" - [(set (match_operand:SF 0 "nonimmediate_operand" "=w,w ,?r,w,w ,w ,w,m,r,m ,r,r") - (match_operand:SF 1 "general_operand" "Y ,?rY, w,w,Ufc,Uvi,m,w,m,rY,r,M"))] - "TARGET_FLOAT && (register_operand (operands[0], SFmode) - || aarch64_reg_or_fp_zero (operands[1], SFmode))" +(define_insn "*mov_aarch64" + [(set (match_operand:SFD 0 "nonimmediate_operand" "=w,w ,?r,w,w ,w ,w,m,r,m ,r,r") + (match_operand:SFD 1 "general_operand" "Y ,?rY, w,w,Ufc,Uvi,m,w,m,rY,r,M"))] + "TARGET_FLOAT && (register_operand (operands[0], mode) + || aarch64_reg_or_fp_zero (operands[1], mode))" "@ movi\\t%0.2s, #0 fmov\\t%s0, %w1 @@ -1501,11 +1501,11 @@ (set_attr "arch" "simd,*,*,*,*,simd,*,*,*,*,*,*")] ) -(define_insn "*movdf_aarch64" - [(set (match_operand:DF 0 "nonimmediate_operand" "=w, w ,?r,w,w ,w ,w,m,r,m ,r,r") - (match_operand:DF 1 "general_operand" "Y , ?rY, w,w,Ufc,Uvi,m,w,m,rY,r,N"))] - "TARGET_FLOAT && (register_operand (operands[0], DFmode) - || aarch64_reg_or_fp_zero (operands[1], DFmode))" +(define_insn "*mov_aarch64" + [(set (match_operand:DFD 0 "nonimmediate_operand" "=w, w ,?r,w,w ,w ,w,m,r,m ,r,r") + (match_operand:DFD 1 "general_operand" "Y , ?rY, w,w,Ufc,Uvi,m,w,m,rY,r,N"))] + "TARGET_FLOAT && (register_operand (operands[0], mode) + || aarch64_reg_or_fp_zero (operands[1], mode))" "@ movi\\t%d0, #0 fmov\\t%d0, %x1 @@ -1545,13 +1545,13 @@ } ) -(define_insn "*movtf_aarch64" - [(set (match_operand:TF 0 +(define_insn "*mov_aarch64" + [(set (match_operand:TFD 0 "nonimmediate_operand" "=w,?r ,w ,?r,w,?w,w,m,?r,m ,m") - (match_operand:TF 1 + (match_operand:TFD 1 "general_operand" " w,?rY,?r,w ,Y,Y ,m,w,m ,?r,Y"))] - "TARGET_FLOAT && (register_operand (operands[0], TFmode) - || aarch64_reg_or_fp_zero (operands[1], TFmode))" + "TARGET_FLOAT && (register_operand (operands[0], mode) + || aarch64_reg_or_fp_zero (operands[1], mode))" "@ mov\\t%0.16b, %1.16b # @@ -1571,8 +1571,8 @@ ) (define_split - [(set (match_operand:TF 0 "register_operand" "") - (match_operand:TF 1 "nonmemory_operand" ""))] + [(set (match_operand:TFD 0 "register_operand" "") + (match_operand:TFD 1 "nonmemory_operand" ""))] "reload_completed && aarch64_split_128bit_move_p (operands[0], operands[1])" [(const_int 0)] { diff --git a/gcc/config/aarch64/iterators.md b/gcc/config/aarch64/iterators.md index 88af964..1c10483 100644 --- a/gcc/config/aarch64/iterators.md +++ b/gcc/config/aarch64/iterators.md @@ -64,14 +64,24 @@ (define_mode_iterator HFBF [HF BF]) ;; Iterator for all scalar floating point modes suitable for moving, including -;; special BF type (HF, SF, DF, TF and BF) -(define_mode_iterator GPF_TF_F16_MOV [HF BF SF DF TF]) +;; special BF type and decimal floating point types (HF, SF, DF, TF, BF, +;; SD, DD and TD) +(define_mode_iterator GPF_TF_F16_MOV [HF BF SF DF TF SD DD TD]) + +;; Iterator for scalar 32bit fp modes (SF, SD) +(define_mode_iterator SFD [SD SF]) + +;; Iterator for scalar 64bit fp modes (DF, DD) +(define_mode_iterator DFD [DD DF]) + +;; Iterator for scalar 128bit fp modes (TF, TD) +(define_mode_iterator TFD [TD TF]) ;; Double vector modes. (define_mode_iterator VDF [V2SF V4HF]) -;; Iterator for all scalar floating point modes (SF, DF and TF) -(define_mode_iterator GPF_TF [SF DF TF]) +;; Iterator for all scalar floating point modes (SF, DF, TF, SD, DD, and TD) +(define_mode_iterator GPF_TF [SF DF TF SD DD TD]) ;; Integer Advanced SIMD modes. (define_mode_iterator VDQ_I [V8QI V16QI V4HI V8HI V2SI V4SI V2DI]) @@ -298,7 +308,7 @@ ;; 2 and 4 lane SI modes. (define_mode_iterator VS [V2SI V4SI]) -(define_mode_iterator TX [TI TF]) +(define_mode_iterator TX [TI TF TD]) ;; Advanced SIMD opaque structure modes. (define_mode_iterator VSTRUCT [OI CI XI]) @@ -400,10 +410,10 @@ V4x8HF V4x4SF V4x2DF V4x8BF]) ;; Double scalar modes -(define_mode_iterator DX [DI DF]) +(define_mode_iterator DX [DI DF DD]) ;; Duplicate of the above -(define_mode_iterator DX2 [DI DF]) +(define_mode_iterator DX2 [DI DF DD]) ;; Single scalar modes (define_mode_iterator SX [SI SF]) -- cgit v1.1 From 4ca320112e4bc6fd65475dea37fd5034e97ace17 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Fri, 25 Mar 2022 09:20:06 +0000 Subject: testsuite:: Fix pr39986.c testcase for AArch64 The testcase in c-c++-common/dfp/pr39986.c detects if DFP constants are correctly emitted in the assembly. However, AArch64 uses .word instead of the expected .long directive. With this patch, we now accept both. 2022-03-31 Christophe Lyon gcc/testsuite/ * c-c++-common/dfp/pr39986.c: Accept .word directive. --- gcc/testsuite/c-c++-common/dfp/pr39986.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/c-c++-common/dfp/pr39986.c b/gcc/testsuite/c-c++-common/dfp/pr39986.c index e7c9ce9..4dfbf24 100644 --- a/gcc/testsuite/c-c++-common/dfp/pr39986.c +++ b/gcc/testsuite/c-c++-common/dfp/pr39986.c @@ -14,19 +14,19 @@ _Decimal128 f = -678901.234e-6dl; /* The first value is DPD, the second is BID. The order differs depending on whether the target is big-endian or little-endian. */ -/* { dg-final { scan-assembler ".long\t(572653859|822183807)\n" } } */ +/* { dg-final { scan-assembler "(.long|.word)\t(572653859|822183807)\n" } } */ -/* { dg-final { scan-assembler ".long\t(-1572863965|-1308622825)\n" } } */ +/* { dg-final { scan-assembler "(.long|.word)\t(-1572863965|-1308622825)\n" } } */ -/* { dg-final { scan-assembler ".long\t(52|34)\n" } } */ -/* { dg-final { scan-assembler ".long\t(572784640|824180736)\n" } } */ +/* { dg-final { scan-assembler "(.long|.word)\t(52|34)\n" } } */ +/* { dg-final { scan-assembler "(.long|.word)\t(572784640|824180736)\n" } } */ -/* { dg-final { scan-assembler ".long\t(4736|4500)\n" } } */ -/* { dg-final { scan-assembler ".long\t(-1574174720|-1319108608)\n" } } */ +/* { dg-final { scan-assembler "(.long|.word)\t(4736|4500)\n" } } */ +/* { dg-final { scan-assembler "(.long|.word)\t(-1574174720|-1319108608)\n" } } */ -/* { dg-final { scan-assembler ".long\t(-1975952433|957645077)\n" } } */ -/* { dg-final { scan-assembler ".long\t(190215|132222)\n" } } */ -/* { dg-final { scan-assembler ".long\t(574193664|835452928)\n" } } */ +/* { dg-final { scan-assembler "(.long|.word)\t(-1975952433|957645077)\n" } } */ +/* { dg-final { scan-assembler "(.long|.word)\t(190215|132222)\n" } } */ +/* { dg-final { scan-assembler "(.long|.word)\t(574193664|835452928)\n" } } */ -/* { dg-final { scan-assembler ".long\t(931280180|678901234)\n" } } */ -/* { dg-final { scan-assembler ".long\t(-1576681472|-1339162624)\n" } } */ +/* { dg-final { scan-assembler "(.long|.word)\t(931280180|678901234)\n" } } */ +/* { dg-final { scan-assembler "(.long|.word)\t(-1576681472|-1339162624)\n" } } */ -- cgit v1.1 From 1b99d71bb27e308aed7a586de20d6dc6768de32d Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Wed, 30 Mar 2022 18:24:27 +0100 Subject: testsuite: Add new tests for DFP under aarch64/aapcs64 This patch copies all existing tests involving float/double/long double types and replaces them with _Decimal32/_Decimal64/_Decimal128. I thought it would be clearer/easier to maintain to do it this way rather than adding tests for DFP types in the existing testcases, except for func-ret-1.c and func-ret-3.c. This makes sure all cases tested for traditional floating-point are equally tested for decimal floating-point. The patch also adds a test involving loading DFP values from memory. 2022-03-31 Christophe Lyon gcc/testsuite/ * gcc.target/aarch64/aapcs64/aapcs64.exp: Support new dfp*.c tests. * gcc.target/aarch64/aapcs64/func-ret-1.c: Add DFP tests. * gcc.target/aarch64/aapcs64/func-ret-3.c: Add DFP tests. * gcc.target/aarch64/aapcs64/type-def.h: Add DFP types. * gcc.target/aarch64/aapcs64/dfp-1.c: New test. * gcc.target/aarch64/aapcs64/ice_dfp_5.c: New test. * gcc.target/aarch64/aapcs64/test_align_dfp-1.c: New test. * gcc.target/aarch64/aapcs64/test_align_dfp-4.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_1.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_10.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_11.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_12.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_13.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_14.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_15.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_16.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_17.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_18.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_19.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_2.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_20.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_21.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_22.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_23.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_24.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_25.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_26.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_27.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_3.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_5.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_6.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_7.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_8.c: New test. * gcc.target/aarch64/aapcs64/test_dfp_9.c: New test. * gcc.target/aarch64/aapcs64/test_quad_double_dfp.c: New test. * gcc.target/aarch64/aapcs64/va_arg_dfp-1.c: New test. * gcc.target/aarch64/aapcs64/va_arg_dfp-10.c: New test. * gcc.target/aarch64/aapcs64/va_arg_dfp-11.c: New test. * gcc.target/aarch64/aapcs64/va_arg_dfp-12.c: New test. * gcc.target/aarch64/aapcs64/va_arg_dfp-13.c: New test. * gcc.target/aarch64/aapcs64/va_arg_dfp-14.c: New test. * gcc.target/aarch64/aapcs64/va_arg_dfp-16.c: New test. * gcc.target/aarch64/aapcs64/va_arg_dfp-2.c: New test. * gcc.target/aarch64/aapcs64/va_arg_dfp-3.c: New test. * gcc.target/aarch64/aapcs64/va_arg_dfp-4.c: New test. * gcc.target/aarch64/aapcs64/va_arg_dfp-5.c: New test. * gcc.target/aarch64/aapcs64/va_arg_dfp-6.c: New test. * gcc.target/aarch64/aapcs64/va_arg_dfp-8.c: New test. * gcc.target/aarch64/aapcs64/va_arg_dfp-9.c: New test. --- .../gcc.target/aarch64/aapcs64/aapcs64.exp | 8 ++ gcc/testsuite/gcc.target/aarch64/aapcs64/dfp-1.c | 24 ++++ .../gcc.target/aarch64/aapcs64/func-ret-1.c | 7 ++ .../gcc.target/aarch64/aapcs64/func-ret-3.c | 67 +++++++++++ .../gcc.target/aarch64/aapcs64/ice_dfp_5.c | 20 ++++ .../gcc.target/aarch64/aapcs64/test_align_dfp-1.c | 126 ++++++++++++++++++++ .../gcc.target/aarch64/aapcs64/test_align_dfp-4.c | 42 +++++++ .../gcc.target/aarch64/aapcs64/test_dfp_1.c | 31 +++++ .../gcc.target/aarch64/aapcs64/test_dfp_10.c | 26 ++++ .../gcc.target/aarch64/aapcs64/test_dfp_11.c | 34 ++++++ .../gcc.target/aarch64/aapcs64/test_dfp_12.c | 44 +++++++ .../gcc.target/aarch64/aapcs64/test_dfp_13.c | 34 ++++++ .../gcc.target/aarch64/aapcs64/test_dfp_14.c | 35 ++++++ .../gcc.target/aarch64/aapcs64/test_dfp_15.c | 21 ++++ .../gcc.target/aarch64/aapcs64/test_dfp_16.c | 32 +++++ .../gcc.target/aarch64/aapcs64/test_dfp_17.c | 37 ++++++ .../gcc.target/aarch64/aapcs64/test_dfp_18.c | 34 ++++++ .../gcc.target/aarch64/aapcs64/test_dfp_19.c | 35 ++++++ .../gcc.target/aarch64/aapcs64/test_dfp_2.c | 17 +++ .../gcc.target/aarch64/aapcs64/test_dfp_20.c | 22 ++++ .../gcc.target/aarch64/aapcs64/test_dfp_21.c | 21 ++++ .../gcc.target/aarch64/aapcs64/test_dfp_22.c | 19 +++ .../gcc.target/aarch64/aapcs64/test_dfp_23.c | 42 +++++++ .../gcc.target/aarch64/aapcs64/test_dfp_24.c | 22 ++++ .../gcc.target/aarch64/aapcs64/test_dfp_25.c | 61 ++++++++++ .../gcc.target/aarch64/aapcs64/test_dfp_26.c | 54 +++++++++ .../gcc.target/aarch64/aapcs64/test_dfp_27.c | 46 +++++++ .../gcc.target/aarch64/aapcs64/test_dfp_3.c | 18 +++ .../gcc.target/aarch64/aapcs64/test_dfp_5.c | 24 ++++ .../gcc.target/aarch64/aapcs64/test_dfp_6.c | 26 ++++ .../gcc.target/aarch64/aapcs64/test_dfp_7.c | 30 +++++ .../gcc.target/aarch64/aapcs64/test_dfp_8.c | 24 ++++ .../gcc.target/aarch64/aapcs64/test_dfp_9.c | 32 +++++ .../aarch64/aapcs64/test_quad_double_dfp.c | 26 ++++ .../gcc.target/aarch64/aapcs64/type-def.h | 132 +++++++++++++++++++++ .../gcc.target/aarch64/aapcs64/va_arg_dfp-1.c | 60 ++++++++++ .../gcc.target/aarch64/aapcs64/va_arg_dfp-10.c | 29 +++++ .../gcc.target/aarch64/aapcs64/va_arg_dfp-11.c | 32 +++++ .../gcc.target/aarch64/aapcs64/va_arg_dfp-12.c | 64 ++++++++++ .../gcc.target/aarch64/aapcs64/va_arg_dfp-13.c | 59 +++++++++ .../gcc.target/aarch64/aapcs64/va_arg_dfp-14.c | 35 ++++++ .../gcc.target/aarch64/aapcs64/va_arg_dfp-16.c | 28 +++++ .../gcc.target/aarch64/aapcs64/va_arg_dfp-2.c | 75 ++++++++++++ .../gcc.target/aarch64/aapcs64/va_arg_dfp-3.c | 94 +++++++++++++++ .../gcc.target/aarch64/aapcs64/va_arg_dfp-4.c | 90 ++++++++++++++ .../gcc.target/aarch64/aapcs64/va_arg_dfp-5.c | 47 ++++++++ .../gcc.target/aarch64/aapcs64/va_arg_dfp-6.c | 40 +++++++ .../gcc.target/aarch64/aapcs64/va_arg_dfp-8.c | 25 ++++ .../gcc.target/aarch64/aapcs64/va_arg_dfp-9.c | 31 +++++ 49 files changed, 1982 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/dfp-1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/ice_dfp_5.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_align_dfp-1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_align_dfp-4.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_10.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_11.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_12.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_13.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_14.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_15.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_16.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_17.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_18.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_19.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_20.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_21.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_22.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_23.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_24.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_25.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_26.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_27.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_3.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_5.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_6.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_7.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_8.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_9.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/test_quad_double_dfp.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-10.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-11.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-12.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-13.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-14.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-16.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-3.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-4.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-5.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-6.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-8.c create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-9.c (limited to 'gcc') diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp b/gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp index 3e652c4..caa6e5b 100644 --- a/gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/aapcs64.exp @@ -88,4 +88,12 @@ foreach src [lsort [glob -nocomplain $srcdir/$subdir/ice_*.c]] { } } +# Test DFP support +foreach src [lsort [glob -nocomplain $srcdir/$subdir/dfp*.c]] { + if {[runtest_file_p $runtests $src]} { + c-torture [list $src] \ + $additional_flags + } +} + torture-finish diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/dfp-1.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/dfp-1.c new file mode 100644 index 0000000..9586810 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/dfp-1.c @@ -0,0 +1,24 @@ +/* Test loading DFP values from memory. */ + +/* { dg-do compile { target aarch64*-*-* } } */ + +_Decimal32 var32 = 1.2df; + +int foo32(_Decimal32 param32) +{ + return param32 == var32; +} + +_Decimal64 var64 = 1.2df; + +int foo64(_Decimal64 param64) +{ + return param64 == var64; +} + +_Decimal128 var128 = 1.2df; + +int foo128(_Decimal128 param128) +{ + return param128 == var128; +} diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/func-ret-1.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/func-ret-1.c index 29a1ca6..5405e1e 100644 --- a/gcc/testsuite/gcc.target/aarch64/aapcs64/func-ret-1.c +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/func-ret-1.c @@ -14,6 +14,8 @@ vf2_t vf2 = (vf2_t){ 17.f, 18.f }; vi4_t vi4 = (vi4_t){ 0xdeadbabe, 0xbabecafe, 0xcafebeef, 0xbeefdead }; vlf1_t vlf1 = (vlf1_t) { 17.0 }; +vldf1_t vldf1 = (vldf1_t) { 17.0dl }; + union int128_t qword; int *int_ptr = (int *)0xabcdef0123456789ULL; @@ -45,4 +47,9 @@ FUNC_VAL_CHECK (13, vi4_t, vi4, Q0, i32in128) FUNC_VAL_CHECK (14, int *, int_ptr, X0, flat) FUNC_VAL_CHECK (15, vlf1_t, vlf1, Q0, flat) FUNC_VAL_CHECK (16, __fp16, 0xabcd, H0, flat) + +FUNC_VAL_CHECK (17, _Decimal32, 65432.12345df, S0, flat) +FUNC_VAL_CHECK (18, _Decimal64, 9876543.212345dd, D0, flat) +FUNC_VAL_CHECK (19, _Decimal128, 98765432123456789.987654321dl, Q0, flat) +FUNC_VAL_CHECK (20, vldf1_t, vldf1, Q0, flat) #endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/func-ret-3.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/func-ret-3.c index ff9b7e6..ad312b6 100644 --- a/gcc/testsuite/gcc.target/aarch64/aapcs64/func-ret-3.c +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/func-ret-3.c @@ -30,6 +30,23 @@ struct non_hfa_fffd_t non_hfa_fffd = {33.f, 34.f, 35.f, 36.0}; union hfa_union_t hfa_union; union non_hfa_union_t non_hfa_union; +/* Decimal Floating-point. */ +struct hfa_dfx1_t hfa_dfx1 = {12.345df}; +struct hfa_dfx2_t hfa_dfx2 = {123.456df, 234.456df}; +struct hfa_ddx2_t hfa_ddx2 = {234.567dd, 345.678dd}; +struct hfa_ddx4_t hfa_ddx4 = {1234.123dd, 2345.234dd, 3456.345dd, 4567.456dd}; +struct hfa_dldx3_t hfa_dldx3 = {123456.7890dl, 234567.8901dl, 345678.9012dl}; +struct non_hfa_dfx5_t non_hfa_dfx5 = {456.789df, 567.890df, 678.901df, 789.012df, 890.123df}; +struct hfa_dffs_t hfa_dffs; +struct non_hfa_dffs_t non_hfa_dffs; +struct non_hfa_dffs_2_t non_hfa_dffs_2; +struct hva_vdf2x1_t hva_vdf2x1; +struct non_hfa_dffd_t non_hfa_dffd = {23.df, 24.df, 25.0dd}; +struct non_hfa_dffvf2_t non_hfa_dffvf2; +struct non_hfa_dfffd_t non_hfa_dfffd = {33.df, 34.df, 35.df, 36.0dd}; +union hfa_dunion_t hfa_dunion; +union non_hfa_dunion_t non_hfa_dunion; + #define HAS_DATA_INIT_FUNC void init_data () { @@ -61,6 +78,36 @@ void init_data () non_hfa_ffs_2.s.b = 51; non_hfa_ffs_2.c = 52.f; non_hfa_ffs_2.d = 53.f; + + /* Decimal floating-point. */ + hva_vdf2x1.a = (vdf2_t){17.df, 18.df}; + + non_hfa_dffvf2.a = 29.df; + non_hfa_dffvf2.b = 30.df; + non_hfa_dffvf2.c = (vdf2_t){31.df, 32.df}; + + hfa_dunion.s.a = 37.df; + hfa_dunion.s.b = 38.df; + hfa_dunion.c = 39.df; + + non_hfa_dunion.a = 40.0dd; + non_hfa_dunion.b = 41.df; + + hfa_dffs.a = 42.df; + hfa_dffs.b = 43.df; + hfa_dffs.c.a = 44.df; + hfa_dffs.c.b = 45.df; + + non_hfa_dffs.a = 46.df; + non_hfa_dffs.b = 47.df; + non_hfa_dffs.c.a = 48.0dd; + non_hfa_dffs.c.b = 49.0dd; + + non_hfa_dffs_2.s.a = 50; + non_hfa_dffs_2.s.b = 51; + non_hfa_dffs_2.c = 52.df; + non_hfa_dffs_2.d = 53.df; + } #include "abitest-2.h" @@ -90,4 +137,24 @@ FUNC_VAL_CHECK (18, struct non_hfa_ffs_t , non_hfa_ffs , X8, flat) FUNC_VAL_CHECK (19, struct non_hfa_ffs_2_t, non_hfa_ffs_2, X0, flat) FUNC_VAL_CHECK (20, union non_hfa_union_t, non_hfa_union, X0, flat) +/* Decimal floating-point. */ +FUNC_VAL_CHECK (21, struct hfa_dfx1_t , hfa_dfx1 , S0, flat) +FUNC_VAL_CHECK (22, struct hfa_dfx2_t , hfa_dfx2 , S0, flat) +FUNC_VAL_CHECK (23, struct hfa_ddx2_t , hfa_ddx2 , D0, flat) + +FUNC_VAL_CHECK (24, struct hfa_ddx4_t , hfa_ddx4 , D0, flat) +FUNC_VAL_CHECK (25, struct hfa_dldx3_t, hfa_dldx3 , Q0, flat) +FUNC_VAL_CHECK (26, struct hfa_dffs_t , hfa_dffs , S0, flat) +FUNC_VAL_CHECK (27, union hfa_dunion_t, hfa_dunion, S0, flat) + +FUNC_VAL_CHECK (28, struct hva_vdf2x1_t, hva_vdf2x1, D0, flat) + +FUNC_VAL_CHECK (29, struct non_hfa_dfx5_t , non_hfa_dfx5 , X8, flat) +FUNC_VAL_CHECK (30, struct non_hfa_dffd_t , non_hfa_dffd , X0, flat) +FUNC_VAL_CHECK (31, struct non_hfa_dffvf2_t, non_hfa_dffvf2, X0, flat) +FUNC_VAL_CHECK (32, struct non_hfa_dfffd_t , non_hfa_dfffd , X8, flat) +FUNC_VAL_CHECK (33, struct non_hfa_dffs_t , non_hfa_dffs , X8, flat) +FUNC_VAL_CHECK (34, struct non_hfa_dffs_2_t, non_hfa_dffs_2, X0, flat) +FUNC_VAL_CHECK (35, union non_hfa_dunion_t, non_hfa_dunion, X0, flat) + #endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/ice_dfp_5.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/ice_dfp_5.c new file mode 100644 index 0000000..4d0fdd9 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/ice_dfp_5.c @@ -0,0 +1,20 @@ +/* { dg-do compile { target aarch64*-*-* } } */ + +struct S +{ + union + { + _Decimal128 b; + } a; +}; + +struct S s; + +extern struct S a[5]; +extern struct S check (struct S, struct S *, struct S); +extern void checkx (struct S); + +void test (void) +{ + checkx (check (s, &a[1], a[2])); +} diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align_dfp-1.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align_dfp-1.c new file mode 100644 index 0000000..35913e9 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align_dfp-1.c @@ -0,0 +1,126 @@ +/* Test AAPCS64 layout. + + Test the comformance to the alignment and padding requirements. + + B.4 If the argument type is a Composite Type then the size of the + argument is rounded up to the nearest multiple of 8 bytes. + C.4 If the argument is an HFA, a Quad-precision Floating-point or Short + Vector Type then the NSAA is rounded up to the larger of 8 or the + Natural Alignment of the argument's type. + C.12 The NSAA is rounded up to the larger of 8 or the Natural Alignment + of the argument's type. + C.14 If the size of the argument is less than 8 bytes then the size of + the argument is set ot 8 bytes. The effect is as if the argument + was copied to the least significant bits of a 64-bit register and + the remaining bits filled with unspecified values. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define TESTFILE "test_align-1.c" +#include "type-def.h" + +struct y +{ + int p; + int q; + int r; + int s; +}; + +struct y v1 = { 1, 2, 3, 4 }; +struct y v2 = { 5, 6, 7, 8 }; +struct y v3 = { 9, 10, 11, 12 }; +struct y v4 = { 13, 14, 15, 16 }; + +struct z +{ + _Decimal64 x[4]; +}; + +struct z a = { 5.0dd, 6.0dd, 7.0dd, 8.0dd }; +struct z b = { 9.0dd, 10.0dd, 11.0dd, 12.0dd }; + +vf4_t c = { 13.f, 14.f, 15.f, 16.f }; + +struct x +{ + vf4_t v; +} w; + +char ch='a'; +short sh=13; +int i=14; +long long ll=15; + +struct s1 +{ + short sh[3]; +} s1; + +struct s2 +{ + int i[2]; + char c; +} s2; + +struct ldx2_t +{ + _Decimal128 ld[2]; +} ldx2 = { 12345.67890dl, 23456.78901dl }; + +union u_t +{ + _Decimal128 ld; + _Decimal64 d[2]; +} u; + +#define HAS_DATA_INIT_FUNC +void init_data () +{ + w.v = (vf4_t){ 17.f, 18.f, 19.f, 20.f }; + s1.sh[0] = 16; + s1.sh[1] = 17; + s1.sh[2] = 18; + s2.i[0] = 19; + s2.i[1] = 20; + s2.c = 21; + u.ld = 34567.89012L; +} + +#include "abitest.h" +#else + + ARG(struct y, v1, X0) + ARG(struct y, v2, X2) + ARG(struct y, v3, X4) + ARG(struct y, v4, X6) + ARG(struct z, a, D0) + ARG(struct z, b, D4) + ARG(_Decimal64, 12.5, STACK) + ARG(vf4_t, c, STACK+16) /* [C.4] 16-byte aligned short vector */ + ARG(_Decimal64, 17.0dd, STACK+32) + ARG(struct x, w, STACK+48) /* [C.12] 16-byte aligned small struct */ +#ifndef __AAPCS64_BIG_ENDIAN__ + ARG(char, ch, STACK+64) /* [C.14] char padded to the size of 8 bytes */ + ARG(short, sh, STACK+72) /* [C.14] short padded to the size of 8 bytes */ + ARG(int, i, STACK+80) /* [C.14] int padded to the size of 8 bytes */ +#else + ARG(char, ch, STACK+71) + ARG(short, sh, STACK+78) + ARG(int, i, STACK+84) +#endif + ARG(long long, ll, STACK+88) + ARG(struct s1, s1, STACK+96) /* [B.4] small struct padded to the size of 8 bytes */ + ARG(_Decimal64, 18.0dd, STACK+104) + ARG(struct s2, s2, STACK+112) /* [B.4] small struct padded to the size of 16 bytes */ + ARG(_Decimal64, 19.0dd, STACK+128) + ARG(_Decimal128, 30.0dl, STACK+144) /* [C.4] 16-byte aligned quad-precision */ + ARG(_Decimal64, 31.0dd, STACK+160) + ARG(struct ldx2_t, ldx2, STACK+176) /* [C.4] 16-byte aligned HFA */ + ARG(_Decimal64, 32.0dd, STACK+208) + ARG(__int128, 33, STACK+224) /* [C.12] 16-byte aligned 128-bit integer */ + ARG(_Decimal64, 34.0dd, STACK+240) + ARG(union u_t, u, STACK+256) /* [C.12] 16-byte aligned small composite (union in this case) */ + LAST_ARG_NONFLAT (int, 35.0, STACK+272, i32in64) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align_dfp-4.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align_dfp-4.c new file mode 100644 index 0000000..50ee7c0 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_align_dfp-4.c @@ -0,0 +1,42 @@ +/* Test AAPCS64 layout. + + C.3 If the argument is an HFA then the NSRN is set to 8 and the size + of the argument is rounded up to the nearest multiple of 8 bytes. + + TODO: add the check of an HFA containing half-precision floating-point + when __f16 is supported in A64 GCC. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define TESTFILE "test_align_dfp-4.c" + +struct z1 +{ + _Decimal64 x[4]; +}; + +struct z1 a = { 5.0dd, 6.0dd, 7.0dd, 8.0dd }; + +struct z2 +{ + _Decimal32 x[3]; +}; + +struct z2 b = { 13.df, 14.df, 15.df }; +struct z2 c = { 16.df, 17.df, 18.df }; + +#include "abitest.h" +#else + + ARG(struct z1, a, D0) + ARG(_Decimal64, 9.0dd, D4) + ARG(_Decimal64, 10.0dd, D5) + ARG(struct z2, b, STACK) /* [C.3] on stack and size padded to 16 bytes */ +#ifndef __AAPCS64_BIG_ENDIAN__ + ARG(_Decimal32, 15.5df, STACK+16) /* [C.3] NSRN has been set to 8 */ +#else + ARG(_Decimal32, 15.5df, STACK+20) +#endif + LAST_ARG(struct z2, c, STACK+24) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_1.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_1.c new file mode 100644 index 0000000..3435261 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_1.c @@ -0,0 +1,31 @@ +/* Test AAPCS64 layout */ + +/* C.7 If the argument is an Integral Type, the size of the argument is + less than or equal to 8 bytes and the NGRN is less than 8, the + argument is copied to the least significant bits in x[NGRN]. The + NGRN is incremented by one. The argument has now been allocated. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define TESTFILE "test_dfp_1.c" +/* TODO: review if we need this */ +#define RUNTIME_ENDIANNESS_CHECK +#include "abitest.h" +#else + ARG(int, 4, W0) + ARG(_Decimal64, 4.0dd, D0) + ARG(int, 3, W1) + /* TODO: review the way of memcpy char, short, etc. */ +#ifndef __AAPCS64_BIG_ENDIAN__ + ARG(char, 0xEF, X2) + ARG(short, 0xBEEF, X3) + ARG(int, 0xDEADBEEF, X4) +#else + /* TODO: need the model/qemu to be big-endian as well */ + ARG(char, 0xEF, X2+7) + ARG(short, 0xBEEF, X3+6) + ARG(int, 0xDEADBEEF, X4+4) +#endif + LAST_ARG(long long, 0xDEADBEEFCAFEBABELL, X5) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_10.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_10.c new file mode 100644 index 0000000..8c1ccd1 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_10.c @@ -0,0 +1,26 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "test_dfp_10.c" + +struct z +{ + _Decimal64 x[4]; +}; + +struct z a = { 5.0dd, 6.0dd, 7.0dd, 8.0dd }; +struct z b = { 9.0dd, 10.0dd, 11.0dd, 12.0dd }; + +#include "abitest.h" +#else + + ARG(int, 7, W0) + DOTS + ANON(struct z, a, D0) + ANON(struct z, b, D4) + ANON(_Decimal64, 0.5dd, STACK) + LAST_ANON(_Decimal64, 1.5dd, STACK+8) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_11.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_11.c new file mode 100644 index 0000000..d06de66 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_11.c @@ -0,0 +1,34 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "test_dfp_11.c" + +__complex__ x = 1.0+2.0i; + +struct y +{ + int p; + int q; + int r; + int s; +} v = { 1, 2, 3, 4 }; + +struct z +{ + _Decimal64 x[4]; +}; + +struct z a = { 5.0dd, 6.0dd, 7.0dd, 8.0dd }; +struct z b = { 9.0dd, 10.0dd, 11.0dd, 12.0dd }; + +#include "abitest.h" +#else + ARG(_Decimal64, 11.0dd, D0) + DOTS + ANON(struct z, a, D1) + ANON(struct z, b, STACK) + LAST_ANON(_Decimal64, 0.5dd, STACK+32) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_12.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_12.c new file mode 100644 index 0000000..491bfd9 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_12.c @@ -0,0 +1,44 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "test_dfp_12.c" + + +struct y +{ + long p; + long q; + long r; + long s; +} v = { 1, 2, 3, 4 }; + +struct y1 +{ + int p; + int q; + int r; + int s; +} v1 = { 1, 2, 3, 4 }; + + +struct z +{ + _Decimal64 x[4]; +}; + +struct z a = { 5.0dd, 6.0dd, 7.0dd, 8.0dd }; +struct z b = { 9.0dd, 10.0dd, 11.0dd, 12.0dd }; + +#define MYFUNCTYPE struct y + +#include "abitest.h" +#else + ARG(int, 7, W0) + ARG(struct y1, v1, X1) + ARG(struct z, a, D0) + ARG(struct z, b, D4) + LAST_ARG(_Decimal64, 0.5dd, STACK) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_13.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_13.c new file mode 100644 index 0000000..6012185 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_13.c @@ -0,0 +1,34 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK + +#define TESTFILE "test_dfp_13.c" + + +struct y +{ + int p; + int q; + int r; + int s; +} v = { 1, 2, 3, 4 }; + +struct z +{ + _Decimal64 x[4]; +}; + +struct z a = { 5.0dd, 6.0dd, 7.0dd, 8.0dd }; +struct z b = { 9.0dd, 10.0dd, 11.0dd, 12.0dd }; + +#include "abitest.h" +#else + ARG(int, 7, W0) + ARG(struct y, v, X1) + ARG(struct z, a, D0) + ARG(_Decimal64, 1.0dd, D4) + ARG(struct z, b, STACK) + LAST_ARG(_Decimal64, 0.5dd, STACK+32) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_14.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_14.c new file mode 100644 index 0000000..9d1cf2d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_14.c @@ -0,0 +1,35 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "test_dfp_14.c" + + +struct y +{ + int p; + int q; + int r; + int s; +} v = { 1, 2, 3, 4 }; + +struct z +{ + _Decimal64 x[4]; +}; + +struct z a = { 5.0dd, 6.0dd, 7.0dd, 8.0dd }; +struct z b = { 9.0dd, 10.0dd, 11.0dd, 12.0dd }; + +#include "abitest.h" +#else + ARG(int, 7, W0) + ARG(int, 9, W1) + ARG(struct z, a, D0) + ARG(_Decimal64, 1.0dd, D4) + ARG(struct z, b, STACK) + ARG(int, 4, W2) + LAST_ARG(_Decimal64, 0.5dd, STACK+32) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_15.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_15.c new file mode 100644 index 0000000..8ec7b46 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_15.c @@ -0,0 +1,21 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "test_dfp_15.c" + +#include "abitest.h" +#else + ARG(_Decimal64, 1.0dd, D0) + ARG(_Decimal64, 2.0dd, D1) + ARG(_Decimal64, 3.0dd, D2) + ARG(_Decimal64, 4.0dd, D3) + ARG(_Decimal64, 5.0dd, D4) + ARG(_Decimal64, 6.0dd, D5) + ARG(_Decimal64, 7.0dd, D6) + ARG(_Decimal64, 8.0dd, D7) + ARG(_Decimal64, 9.0dd, STACK) + LAST_ARG(_Decimal64, 10.0dd, STACK+8) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_16.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_16.c new file mode 100644 index 0000000..cdbfd96 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_16.c @@ -0,0 +1,32 @@ +/* Test AAPCS layout */ +/* C.5 If the argument is a Half- or Single- precision Floating-point type, + then the size of the argument is set to 8 bytes. The effect is as if + the argument had been copied to the least significant bits of a 64-bit + register and the remaining bits filled with unspecified values. */ +/* TODO: add the check of half-precision floating-point when it is supported + by the A64 GCC. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "test_dfp_16.c" + +#include "abitest.h" +#else + ARG(_Decimal32, 1.0df, S0) + ARG(_Decimal32, 2.0df, S1) + ARG(_Decimal32, 3.0df, S2) + ARG(_Decimal32, 4.0df, S3) + ARG(_Decimal32, 5.0df, S4) + ARG(_Decimal32, 6.0df, S5) + ARG(_Decimal32, 7.0df, S6) + ARG(_Decimal32, 8.0df, S7) +#ifndef __AAPCS64_BIG_ENDIAN__ + ARG(_Decimal32, 9.0df, STACK) + LAST_ARG(_Decimal32, 10.0df, STACK+8) +#else + ARG(_Decimal32, 9.0df, STACK+4) + LAST_ARG(_Decimal32, 10.0df, STACK+12) +#endif +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_17.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_17.c new file mode 100644 index 0000000..22dc462 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_17.c @@ -0,0 +1,37 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "test_dfp_17.c" + +__complex__ x = 1.0+2.0i; + +struct y +{ + int p; + int q; + int r; + int s; +} v = { 1, 2, 3, 4 }; + +struct z +{ + _Decimal64 x[4]; +}; + +_Decimal32 f1 = 25.0df; +struct z a = { 5.0dd, 6.0dd, 7.0dd, 8.0dd }; +struct z b = { 9.0dd, 10.0dd, 11.0dd, 12.0dd }; + +#include "abitest.h" +#else + ARG(_Decimal64, 11.0dd, D0) + DOTS + ANON(struct z, a, D1) + ANON(struct z, b, STACK) + ANON(int , 5, W0) + ANON(_Decimal32, f1, STACK+32) /* Note: no promotion to _Decimal64. */ + LAST_ANON(_Decimal64, 0.5dd, STACK+40) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_18.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_18.c new file mode 100644 index 0000000..bb90b0c --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_18.c @@ -0,0 +1,34 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK + +#define TESTFILE "test_dfp_18.c" + + +struct y +{ + long long p; + long long q; + long long r; + long long s; +} v = { 1, 2, 3, 4 }; + +struct z +{ + _Decimal64 x[4]; +}; + +struct z a = { 5.0dd, 6.0dd, 7.0dd, 8.0dd }; +struct z b = { 9.0dd, 10.0dd, 11.0dd, 12.0dd }; + +#include "abitest.h" +#else + ARG(int, 7, W0) + PTR(struct y, v, X1) + ARG(struct z, a, D0) + ARG(_Decimal64, 1.0dd, D4) + ARG(struct z, b, STACK) + LAST_ARG(_Decimal64, 0.5dd, STACK+32) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_19.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_19.c new file mode 100644 index 0000000..e8210ec --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_19.c @@ -0,0 +1,35 @@ +/* Test AAPCS64 layout. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define TESTFILE "test_dfp_19.c" + +struct y +{ + int p1; + int p2; + _Decimal32 q; + int r1; + int r2; + char x; +} v = { -1, 1, 2.0df, 3, 18, 19, 20}; + +struct z +{ + _Decimal64 x[4]; +}; + +struct z a = { 5.0dd, 6.0dd, 7.0dd, 8.0dd }; +struct z b = { 9.0dd, 10.0dd, 11.0dd, 12.0dd }; + +#include "abitest.h" +#else + ARG(int, 7, W0) + DOTS + ANON(_Decimal64, 4.0dd, D0) + ANON(struct z, a, D1) + ANON(struct z, b, STACK) + PTR_ANON(struct y, v, X1) + LAST_ANON(int, 10, W2) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_2.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_2.c new file mode 100644 index 0000000..5e9716c --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_2.c @@ -0,0 +1,17 @@ +/* Test AAPCS64 layout */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "test_dfp_2.c" +#include "abitest.h" + +#else + ARG(_Decimal32, 1.0df, S0) + ARG(_Decimal64, 4.0dd, D1) + ARG(_Decimal32, 2.0df, S2) + ARG(_Decimal64, 5.0dd, D3) + ARG(__fp16, 8.0f, H4) + LAST_ARG(int, 3, W0) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_20.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_20.c new file mode 100644 index 0000000..4c524b1 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_20.c @@ -0,0 +1,22 @@ +/* Test AAPCS64 layout */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define TESTFILE "test_dfp_20.c" + +#include "abitest.h" + +#else + ARG(int, 8, W0) + ARG(_Decimal64, 1.0dd, D0) + ARG(_Decimal64, 2.0dd, D1) + ARG(_Decimal64, 3.0dd, D2) + ARG(_Decimal64, 4.0dd, D3) + ARG(_Decimal64, 5.0dd, D4) + ARG(_Decimal64, 6.0dd, D5) + ARG(_Decimal64, 7.0dd, D6) + DOTS + ANON(_Complex double, 1234.0 + 567.0i, STACK) + LAST_ANON(_Decimal64, -987.0dd, STACK+16) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_21.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_21.c new file mode 100644 index 0000000..37c4177 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_21.c @@ -0,0 +1,21 @@ +/* Test AAPCS64 layout */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define TESTFILE "test_dfp_21.c" + +#include "abitest.h" + +#else + ARG(int, 8, W0) + ARG(_Decimal64, 1.0dd, D0) + ARG(_Decimal64, 2.0dd, D1) + ARG(_Decimal64, 3.0dd, D2) + ARG(_Decimal64, 4.0dd, D3) + ARG(_Decimal64, 5.0dd, D4) + ARG(_Decimal64, 6.0dd, D5) + ARG(_Decimal64, 7.0dd, D6) + ARG(_Complex double, 1234.0 + 567.0i, STACK) + LAST_ARG(_Decimal64, -987.0dd, STACK+16) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_22.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_22.c new file mode 100644 index 0000000..4975668 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_22.c @@ -0,0 +1,19 @@ +/* Test AAPCS64 layout */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define TESTFILE "test_dfp_22.c" + +struct y +{ + _Decimal32 p; + _Decimal32 q; +} v = { 345.0df, 678.0df }; + +#include "abitest.h" +#else + ARG(_Decimal32, 123.0df, S0) + ARG(struct y, v, S1) + LAST_ARG(_Decimal32, 901.0df, S3) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_23.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_23.c new file mode 100644 index 0000000..82e7219 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_23.c @@ -0,0 +1,42 @@ +/* Test AAPCS64 layout. + + Larger than machine-supported vector size. The behavior is unspecified by + the AAPCS64 document; the implementation opts for pass by reference. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define TESTFILE "test_dfp_23.c" + +typedef char A __attribute__ ((vector_size (64))); + +struct y +{ + _Decimal64 df[8]; +}; + +union u +{ + struct y x; + A a; +} u; + +#define HAS_DATA_INIT_FUNC +void init_data () +{ + u.x.df[0] = 1.0dd; + u.x.df[1] = 2.0dd; + u.x.df[2] = 3.0dd; + u.x.df[3] = 4.0dd; + u.x.df[4] = 5.0dd; + u.x.df[5] = 6.0dd; + u.x.df[6] = 7.0dd; + u.x.df[7] = 8.0dd; +} + +#include "abitest.h" +#else +ARG (_Decimal32, 123.0df, S0) +PTR (A, u.a, X0) +LAST_ARG_NONFLAT (int, 0xdeadbeef, X1, i32in64) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_24.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_24.c new file mode 100644 index 0000000..0b76c9d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_24.c @@ -0,0 +1,22 @@ +/* Test AAPCS64 layout. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define TESTFILE "test_dfp_24.c" + +typedef _Decimal128 TDtype; + +#include "abitest.h" +#else + ARG(TDtype, 1.0dl, Q0) + ARG(TDtype, 2.0dl, Q1) + ARG(TDtype, 3.0dl, Q2) + ARG(TDtype, 4.0dl, Q3) + ARG(TDtype, 5.0dl, Q4) + ARG(TDtype, 6.0dl, Q5) + ARG(TDtype, 7.0dl, Q6) + ARG(TDtype, 8.0dl, Q7) + ARG(_Decimal64, 9.0dd, STACK) + LAST_ARG(TDtype, 10.0dl, STACK+16) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_25.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_25.c new file mode 100644 index 0000000..04372ad --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_25.c @@ -0,0 +1,61 @@ +/* Test AAPCS64 layout + + Test homogeneous floating-point aggregates and homogeneous short-vector + aggregates, which should be passed in SIMD/FP registers or via the + stack. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define TESTFILE "test_dfp_25.c" + +typedef _Decimal32 vf2_t __attribute__((vector_size (8))); +struct x0 +{ + vf2_t v; +} s0; +struct x3 +{ + vf2_t v[2]; +} s3; +struct x4 +{ + vf2_t v[3]; +} s4; + +typedef _Decimal32 vf4_t __attribute__((vector_size(16))); +struct x1 +{ + vf4_t v; +} s1; + +struct x2 +{ + _Decimal64 df[3]; +} s2; + +#define HAS_DATA_INIT_FUNC +void init_data () +{ + s0.v = (vf2_t){ 17.df, 18.df }; + s1.v = (vf4_t){ 567.890df, 678.901df, 789.012df, 890.123df }; + s2.df[0] = 123.456dd; + s2.df[1] = 234.567dd; + s2.df[2] = 345.678dd; + s3.v[0] = (vf2_t){ 19.df, 20.df }; + s3.v[1] = (vf2_t){ 23.df, 24.df }; + s4.v[0] = (vf2_t){ 27.df, 28.df }; + s4.v[1] = (vf2_t){ 31.df, 32.df }; + s4.v[2] = (vf2_t){ 35.df, 36.df }; +} + +#include "abitest.h" +#else +ARG (struct x0, s0, D0) +ARG (struct x2, s2, D1) +ARG (struct x1, s1, Q4) +ARG (struct x3, s3, D5) +ARG (struct x4, s4, STACK) +ARG (int, 0xdeadbeef, W0) +LAST_ARG (_Decimal64, 456.789dd, STACK+24) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_26.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_26.c new file mode 100644 index 0000000..e95175b --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_26.c @@ -0,0 +1,54 @@ +/* Test AAPCS64 layout. + + Test some small structures that should be passed in GPRs. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define TESTFILE "test_dfp_26.c" + +struct y0 +{ + char ch; +} c0 = { 'A' }; + +struct y2 +{ + long long ll[2]; +} c2 = { 0xDEADBEEF, 0xCAFEBABE }; + +struct y3 +{ + int i[3]; +} c3 = { 56789, 67890, 78901 }; + +typedef _Decimal32 vf2_t __attribute__((vector_size (8))); +struct x0 +{ + vf2_t v; +} s0; + +typedef short vh4_t __attribute__((vector_size (8))); + +struct x1 +{ + vh4_t v[2]; +} s1; + +#define HAS_DATA_INIT_FUNC +void init_data () +{ + s0.v = (vf2_t){ 17.df, 18.df }; + s1.v[0] = (vh4_t){ 345, 456, 567, 678 }; + s1.v[1] = (vh4_t){ 789, 890, 901, 123 }; +} + +#include "abitest.h" +#else +ARG (struct y0, c0, X0) +ARG (struct y2, c2, X1) +ARG (struct y3, c3, X3) +ARG_NONFLAT (struct x0, s0, D0, f32in64) +ARG (struct x1, s1, D1) +LAST_ARG_NONFLAT (int, 89012, X5, i32in64) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_27.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_27.c new file mode 100644 index 0000000..12dfe7e --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_27.c @@ -0,0 +1,46 @@ +/* Test AAPCS64 layout + + Test named homogeneous floating-point aggregates of __fp16 data, + which should be passed in SIMD/FP registers or via the stack. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define TESTFILE "test_dfp_27.c" + +struct x0 +{ + __fp16 v[1]; +} f16x1; + +struct x1 +{ + __fp16 v[2]; +} f16x2; + +struct x2 +{ + __fp16 v[3]; +} f16x3; + +#define HAS_DATA_INIT_FUNC +void init_data () +{ + f16x1.v[0] = 2.0f; + f16x2.v[0] = 4.0f; + f16x2.v[1] = 8.0f; + f16x3.v[0] = 16.0f; + f16x3.v[1] = 32.0f; + f16x3.v[2] = 64.0f; +} + +#include "abitest.h" +#else +ARG (struct x0, f16x1, H0) +ARG (struct x1, f16x2, H1) +ARG (struct x2, f16x3, H3) +ARG (struct x1, f16x2, H6) +ARG (struct x0, f16x1, STACK) +ARG (int, 0xdeadbeef, W0) +LAST_ARG (_Decimal64, 456.789dd, STACK+8) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_3.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_3.c new file mode 100644 index 0000000..c92cb14 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_3.c @@ -0,0 +1,18 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "test_dfp_3.c" + +__complex__ x = 1.0+2.0i; + +#include "abitest.h" +#else +ARG (_Decimal32, 1.0df, S0) +ARG (__complex__ double, x, D1) +ARG (_Decimal32, 2.0df, S3) +ARG (_Decimal64, 5.0dd, D4) +LAST_ARG_NONFLAT (int, 3, X0, i32in64) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_5.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_5.c new file mode 100644 index 0000000..90b3031 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_5.c @@ -0,0 +1,24 @@ +/* Test AAPCS64 layout */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "test_dfp_5.c" + +__complex__ float x = 1.0+2.0i; + +struct y +{ + long p; + long q; +} v = { 1, 2}; + +#include "abitest.h" +#else + ARG(_Decimal32, 1.0df, S0) + ARG(__complex__ float, x, S1) + ARG(_Decimal32, 2.0df, S3) + ARG(_Decimal64, 5.0dd, D4) + LAST_ARG(struct y, v, X0) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_6.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_6.c new file mode 100644 index 0000000..7c720c6 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_6.c @@ -0,0 +1,26 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define TESTFILE "test_dfp_6.c" + +__complex__ double x = 1.0+2.0i; + +struct y +{ + int p; + int q; + int r; + int s; +} v = { 1, 2, 3, 4 }; + +#include "abitest.h" +#else + ARG(struct y, v, X0) + ARG(_Decimal32, 1.0df, S0) + ARG(__complex__ double, x, D1) + ARG(_Decimal32, 2.0df, S3) + ARG(_Decimal64, 5.0dd, D4) + LAST_ARG(int, 3, W2) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_7.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_7.c new file mode 100644 index 0000000..c53e192 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_7.c @@ -0,0 +1,30 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define TESTFILE "test_dfp_7.c" + +__complex__ float x = 1.0f + 2.0i; + +struct y +{ + int p; + int q; + int r; + int s; +} v = { 1, 2, 3, 4 }, v1 = {5, 6, 7, 8}, v2 = {9, 10, 11, 12}; + +#include "abitest.h" +#else +ARG (struct y, v, X0) +ARG (struct y, v1, X2) +ARG (struct y, v2, X4) +ARG (int, 4, W6) +ARG (_Decimal32, 1.0df, S0) +ARG (__complex__ float, x, S1) +ARG (_Decimal32, 2.0df, S3) +ARG (_Decimal64, 5.0dd, D4) +ARG (int, 3, W7) +LAST_ARG_NONFLAT (int, 5, STACK, i32in64) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_8.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_8.c new file mode 100644 index 0000000..2f48918 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_8.c @@ -0,0 +1,24 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "test_dfp_8.c" + +struct z +{ + _Decimal64 x[4]; +}; + +struct z a = { 5.0dd, 6.0dd, 7.0dd, 8.0dd }; +struct z b = { 9.0dd, 10.0dd, 11.0dd, 12.0dd }; + +#include "abitest.h" +#else + ARG(struct z, a, D0) + ARG(struct z, b, D4) + ARG(_Decimal64, 0.5dd, STACK) + ARG(int, 7, W0) + LAST_ARG(int, 8, W1) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_9.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_9.c new file mode 100644 index 0000000..cf08027 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_dfp_9.c @@ -0,0 +1,32 @@ +/* Test AAPCS layout (VFP variant) */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define VFP +#define TESTFILE "test_dfp_9.c" + +struct y +{ + int p; + int q; + int r; + int s; +} v = { 1, 2, 3, 4 }; + +struct z +{ + _Decimal64 x[4]; +}; + +struct z a = { 5.0dd, 6.0dd, 7.0dd, 8.0dd }; +struct z b = { 9.0dd, 10.0dd, 11.0dd, 12.0dd }; + +#include "abitest.h" +#else + ARG(int, 7, W0) + ARG(struct y, v, X1) + ARG(struct z, a, D0) + ARG(struct z, b, D4) + LAST_ARG(_Decimal64, 0.5dd, STACK) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/test_quad_double_dfp.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_quad_double_dfp.c new file mode 100644 index 0000000..08d540d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/test_quad_double_dfp.c @@ -0,0 +1,26 @@ +/* Test AAPCS64 layout. + + Test parameter passing of floating-point quad precision types. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define TESTFILE "test_quad_double_dfp.c" + +typedef _Decimal128 TDtype; +typedef _Complex long double CTFtype; + +TDtype x = 1.0dl; +TDtype y = 2.0dl; + +CTFtype cx = 3.0 + 4.0i; +CTFtype cy = 5.0 + 6.0i; + +#include "abitest.h" +#else + ARG ( TDtype, x, Q0) + ARG (CTFtype, cx, Q1) + DOTS + ANON (CTFtype, cy, Q3) + LAST_ANON ( TDtype, y, Q5) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h b/gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h index ca1fa58..6452b91 100644 --- a/gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/type-def.h @@ -13,6 +13,15 @@ typedef int vi4_t __attribute__((vector_size (16))); /* 128-bit vector of 1 quad precision float. */ typedef long double vlf1_t __attribute__((vector_size (16))); +/* 64-bit vector of 2 decimal floats. */ +typedef _Decimal32 vdf2_t __attribute__((vector_size (8))); + +/* 128-bit vector of 4 decimal floats. */ +typedef _Decimal32 vdf4_t __attribute__((vector_size (16))); + +/* 128-bit vector of 1 quad precision decimal float. */ +typedef _Decimal128 vldf1_t __attribute__((vector_size (16))); + /* signed quad-word (in an union for the convenience of initialization). */ union int128_t { @@ -183,3 +192,126 @@ union non_hfa_union_t double a; float b; }; + +/* Same, with decimal floating-point types. */ +struct hfa_dfx1_t +{ + _Decimal32 a; +}; + +struct hfa_dfx2_t +{ + _Decimal32 a; + _Decimal32 b; +}; + +struct hfa_dfx3_t +{ + _Decimal32 a; + _Decimal32 b; + _Decimal32 c; +}; + +struct hfa_ddx2_t +{ + _Decimal64 a; + _Decimal64 b; +}; + +struct hfa_ddx4_t +{ + _Decimal64 a; + _Decimal64 b; + _Decimal64 c; + _Decimal64 d; +}; + +struct hfa_dldx3_t +{ + _Decimal128 a; + _Decimal128 b; + _Decimal128 c; +}; + +struct hfa_dffs_t +{ + _Decimal32 a; + _Decimal32 b; + struct hfa_dfx2_t c; +}; + +union hfa_dunion_t +{ + struct + { + _Decimal32 a; + _Decimal32 b; + } s; + _Decimal32 c; +}; + +struct non_hfa_dfx5_t +{ + _Decimal32 a; + _Decimal32 b; + _Decimal32 c; + _Decimal32 d; + _Decimal32 e; +}; + +struct non_hfa_dffs_t +{ + _Decimal32 a; + _Decimal32 b; + struct hfa_ddx2_t c; +}; + +struct non_hfa_dffs_2_t +{ + struct + { + int a; + int b; + } s; + _Decimal32 c; + _Decimal32 d; +}; + +struct hva_vdf2x1_t +{ + vdf2_t a; +}; + +struct hva_vdf2x2_t +{ + vdf2_t a; + vdf2_t b; +}; + +struct non_hfa_dffd_t +{ + _Decimal32 a; + _Decimal32 b; + _Decimal64 c; +}; + +struct non_hfa_dffvf2_t +{ + _Decimal32 a; + _Decimal32 b; + vdf2_t c; +}; + +struct non_hfa_dfffd_t +{ + _Decimal32 a; + _Decimal32 b; + _Decimal32 c; + _Decimal64 d; +}; + +union non_hfa_dunion_t +{ + _Decimal64 a; + _Decimal32 b; +}; diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-1.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-1.c new file mode 100644 index 0000000..81e78c1 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-1.c @@ -0,0 +1,60 @@ +/* Test AAPCS64 layout and __builtin_va_arg. + + This test covers fundamental data types as specified in AAPCS64 \S 4.1. + It is focused on unnamed parameter passed in registers. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define AAPCS64_TEST_STDARG +#define TESTFILE "va_arg_dfp-1.c" +#include "type-def.h" + +vf2_t vf2 = (vf2_t){ 17.f, 18.f }; +vi4_t vi4 = (vi4_t){ 0xdeadbabe, 0xbabecafe, 0xcafebeef, 0xbeefdead }; +union int128_t qword; +signed char sc = 0xed; +signed int sc_promoted = 0xffffffed; +signed short ss = 0xcba9; +signed int ss_promoted = 0xffffcba9; +_Decimal32 fp = 65432.12345df; +_Decimal64 fp_promoted = (_Decimal64)65432.12345df; +__fp16 fp16 = 2.0f; +__fp16 fp16_promoted = (double)2.0f; + +#define HAS_DATA_INIT_FUNC +void init_data () +{ + /* Init signed quad-word integer. */ + qword.l64 = 0xfdb9753102468aceLL; + qword.h64 = 0xeca8642013579bdfLL; +} + +#include "abitest.h" +#else + ARG ( int , 0xff , W0, LAST_NAMED_ARG_ID) + DOTS + ANON_PROMOTED(unsigned char , 0xfe , unsigned int, 0xfe , W1, 1) + ANON_PROMOTED( signed char , sc , signed int, sc_promoted, W2, 2) + ANON_PROMOTED(unsigned short , 0xdcba, unsigned int, 0xdcba , W3, 3) + ANON_PROMOTED( signed short , ss , signed int, ss_promoted, W4, 4) + ANON (unsigned int , 0xdeadbeef, W5, 5) + ANON ( signed int , 0xcafebabe, W6, 6) + ANON (unsigned long long, 0xba98765432101234ULL, X7, 7) + ANON ( signed long long, 0xa987654321012345LL , STACK, 8) + ANON ( __int128, qword.i , STACK+16, 9) + ANON_PROMOTED( _Decimal32 , fp , _Decimal64, fp_promoted, D0, 10) + ANON ( _Decimal64 , 9876543.212345dd, D1, 11) + ANON ( _Decimal128 , 98765432123456789.987654321dl, Q2, 12) + ANON ( vf2_t, vf2 , D3, 13) + ANON ( vi4_t, vi4 , Q4, 14) + /* 7.2: For unprototyped (i.e. pre- ANSI or K&R C) and variadic functions, + in addition to the normal conversions and promotions, arguments of + type __fp16 are converted to type double. */ + ANON_PROMOTED( __fp16, fp16 , double, fp16_promoted, D5, 15) +#ifndef __AAPCS64_BIG_ENDIAN__ + LAST_ANON ( int , 0xeeee, STACK+32,16) +#else + LAST_ANON ( int , 0xeeee, STACK+36,16) +#endif +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-10.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-10.c new file mode 100644 index 0000000..c94f1ce --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-10.c @@ -0,0 +1,29 @@ +/* Test AAPCS64 layout and __builtin_va_arg. + + Miscellaneous test: Anonymous arguments passed on the stack. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define AAPCS64_TEST_STDARG +#define TESTFILE "va_arg_dfp-10.c" + +struct z +{ + _Decimal64 x[4]; +}; + +_Decimal64 d1 = 25.0dd; +_Decimal64 d2 = 103.0dd; +struct z a = { 5.0dd, 6.0dd, 7.0dd, 8.0dd }; +struct z b = { 9.0dd, 10.0dd, 11.0dd, 12.0dd }; + +#include "abitest.h" +#else + ARG(struct z, a, D0, 0) + ARG(struct z, b, D4, LAST_NAMED_ARG_ID) + DOTS + ANON(_Decimal64, d1, STACK, 2) + LAST_ANON(_Decimal64, d2, STACK+8, 3) + +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-11.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-11.c new file mode 100644 index 0000000..9ca9911 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-11.c @@ -0,0 +1,32 @@ +/* Test AAPCS64 layout and __builtin_va_arg. + + Miscellaneous test: Anonymous arguments passed on the stack. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define AAPCS64_TEST_STDARG +#define TESTFILE "va_arg_dfp-11.c" + +struct z +{ + _Decimal64 x[2]; +}; + +_Decimal64 d1 = 25.0dd; +struct z a = { 5.0dd, 6.0dd }; + +#include "abitest.h" +#else + ARG(_Decimal64, 1.0dd, D0, 0) + ARG(_Decimal64, 2.0dd, D1, 1) + ARG(_Decimal64, 3.0dd, D2, 2) + ARG(_Decimal64, 4.0dd, D3, 3) + ARG(_Decimal64, 5.0dd, D4, 4) + ARG(_Decimal64, 6.0dd, D5, 5) + ARG(_Decimal64, 7.0dd, D6, LAST_NAMED_ARG_ID) + DOTS + ANON(struct z, a, STACK, 8) + LAST_ANON(_Decimal64, d1, STACK+16, 9) + +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-12.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-12.c new file mode 100644 index 0000000..8e7942f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-12.c @@ -0,0 +1,64 @@ +/* Test AAPCS64 layout and __builtin_va_arg. + + Pass by reference. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define AAPCS64_TEST_STDARG +#define TESTFILE "va_arg_dfp-12.c" + +struct z +{ + char c; + short s; + int ia[4]; +}; + +struct z a, b, c; + +#define HAS_DATA_INIT_FUNC +void init_data () +{ + a.c = 0x11; + a.s = 0x2222; + a.ia[0] = 0x33333333; + a.ia[1] = 0x44444444; + a.ia[2] = 0x55555555; + a.ia[3] = 0x66666666; + + b.c = 0x77; + b.s = 0x8888; + b.ia[0] = 0x99999999; + b.ia[1] = 0xaaaaaaaa; + b.ia[2] = 0xbbbbbbbb; + b.ia[3] = 0xcccccccc; + + c.c = 0xdd; + c.s = 0xeeee; + c.ia[0] = 0xffffffff; + c.ia[1] = 0x12121212; + c.ia[2] = 0x23232323; + c.ia[3] = 0x34343434; +} + +#include "abitest.h" +#else + PTR(struct z, a, X0, 0) + ARG(int, 0xdeadbeef, W1, 1) + ARG(int, 0xcafebabe, W2, 2) + ARG(int, 0xdeadbabe, W3, 3) + ARG(int, 0xcafebeef, W4, 4) + ARG(int, 0xbeefdead, W5, 5) + ARG(int, 0xbabecafe, W6, LAST_NAMED_ARG_ID) + DOTS + PTR_ANON(struct z, b, X7, 7) + PTR_ANON(struct z, c, STACK, 8) +#ifndef __AAPCS64_BIG_ENDIAN__ + ANON(int, 0xbabedead, STACK+8, 9) +#else + ANON(int, 0xbabedead, STACK+12, 9) +#endif + LAST_ANON(_Decimal64, 123.45dd, D0, 10) + +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-13.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-13.c new file mode 100644 index 0000000..59d5d5e --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-13.c @@ -0,0 +1,59 @@ +/* Test AAPCS64 layout and __builtin_va_start. + + Pass named HFA/HVA argument on stack. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define AAPCS64_TEST_STDARG +#define TESTFILE "va_arg_dfp-13.c" + +struct float_float_t +{ + _Decimal32 a; + _Decimal32 b; +} float_float; + +union float_int_t +{ + _Decimal32 b8; + int b5; +} float_int; + +#define HAS_DATA_INIT_FUNC +void +init_data () +{ + float_float.a = 1.2df; + float_float.b = 2.2df; + + float_int.b8 = 4983.80df; +} + +#include "abitest.h" +#else + ARG (_Decimal32, 1.0df, S0, 0) + ARG (_Decimal32, 2.0df, S1, 1) + ARG (_Decimal32, 3.0df, S2, 2) + ARG (_Decimal32, 4.0df, S3, 3) + ARG (_Decimal32, 5.0df, S4, 4) + ARG (_Decimal32, 6.0df, S5, 5) + ARG (_Decimal32, 7.0df, S6, 6) + ARG (struct float_float_t, float_float, STACK, 7) + ARG (int, 9, W0, 8) + ARG (int, 10, W1, 9) + ARG (int, 11, W2, 10) + ARG (int, 12, W3, 11) + ARG (int, 13, W4, 12) + ARG (int, 14, W5, 13) + ARG (int, 15, W6, LAST_NAMED_ARG_ID) + DOTS + /* Note on the reason of using 'X7' instead of 'W7' here: + Using 'X7' makes sure the test works in the big-endian mode. + According to PCS rules B.4 and C.10, the size of float_int is rounded + to 8 bytes and prepared in the register X7 as if loaded via LDR from + the memory, with the content of the other 4 bytes unspecified. The + test framework will only compare the 4 relavent bytes. */ + ANON (union float_int_t, float_int, X7, 15) + LAST_ANON (long long, 12683143434LL, STACK + 8, 16) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-14.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-14.c new file mode 100644 index 0000000..b54c66f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-14.c @@ -0,0 +1,35 @@ +/* Test AAPCS64 layout and __builtin_va_start. + + Pass named HFA/HVA argument on stack. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define AAPCS64_TEST_STDARG +#define TESTFILE "va_arg_dfp-14.c" +#include "type-def.h" + +struct hfa_dfx2_t hfa_dfx2 = {1.2df, 2.2df}; +struct hfa_dfx3_t hfa_dfx3 = {3.2df, 4.2df, 5.2df}; +vf4_t float32x4 = {6.2f, 7.2f, 8.2f, 9.2f}; +vf4_t float32x4_2 = {10.2f, 11.2f, 12.2f, 13.2f}; + +#include "abitest.h" +#else + ARG (_Decimal32, 1.0df, S0, 0) + ARG (_Decimal32, 2.0df, S1, 1) + ARG (_Decimal32, 3.0df, S2, 2) + ARG (_Decimal32, 4.0df, S3, 3) + ARG (_Decimal32, 5.0df, S4, 4) + ARG (_Decimal32, 6.0df, S5, 5) + ARG (_Decimal32, 7.0df, S6, 6) + ARG (struct hfa_dfx3_t, hfa_dfx3, STACK, 7) + /* Previous argument size has been rounded up to the nearest multiple of + 8 bytes. */ + ARG (struct hfa_dfx2_t, hfa_dfx2, STACK + 16, 8) + /* NSAA is rounded up to the nearest natural alignment of float32x4. */ + ARG (vf4_t, float32x4, STACK + 32, 9) + ARG (vf4_t, float32x4_2, STACK + 48, LAST_NAMED_ARG_ID) + DOTS + LAST_ANON (_Decimal64, 123456789.987dd, STACK + 64, 11) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-16.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-16.c new file mode 100644 index 0000000..5e17e6d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-16.c @@ -0,0 +1,28 @@ +/* Test AAPCS64 layout and __builtin_va_arg. + + This test is focused particularly on __fp16 unnamed homogeneous + floating-point aggregate types which should be passed in fp/simd + registers until we run out of those, then the stack. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define AAPCS64_TEST_STDARG +#define TESTFILE "va_arg_dfp-16.c" +#include "type-def.h" + +struct hfa_f16x1_t hfa_f16x1 = {2.0f}; +struct hfa_f16x2_t hfa_f16x2 = {4.0f, 8.0f}; +struct hfa_f16x3_t hfa_f16x3 = {16.0f, 32.0f, 64.0f}; + +#include "abitest.h" +#else + ARG (int, 1, W0, LAST_NAMED_ARG_ID) + DOTS + ANON (struct hfa_f16x1_t, hfa_f16x1, H0 , 0) + ANON (struct hfa_f16x2_t, hfa_f16x2, H1 , 1) + ANON (struct hfa_f16x3_t, hfa_f16x3, H3 , 2) + ANON (struct hfa_f16x2_t, hfa_f16x2, H6 , 3) + ANON (struct hfa_f16x1_t, hfa_f16x1, STACK , 4) + LAST_ANON(_Decimal64 , 1.0dd , STACK+8, 5) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-2.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-2.c new file mode 100644 index 0000000..d14bfb3 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-2.c @@ -0,0 +1,75 @@ +/* Test AAPCS64 layout and __builtin_va_arg. + + This test covers fundamental data types as specified in AAPCS64 \S 4.1. + It is focus on unnamed parameter passed on stack. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define AAPCS64_TEST_STDARG +#define TESTFILE "va_arg_dfp-2.c" +#include "type-def.h" + +vf2_t vf2 = (vf2_t){ 17.f, 18.f }; +vi4_t vi4 = (vi4_t){ 0xdeadbabe, 0xbabecafe, 0xcafebeef, 0xbeefdead }; +union int128_t qword; +signed char sc = 0xed; +signed int sc_promoted = 0xffffffed; +signed short ss = 0xcba9; +signed int ss_promoted = 0xffffcba9; +_Decimal32 fp = 65432.12345df; +_Decimal64 fp_promoted = (_Decimal64)65432.12345df; +__fp16 fp16 = 2.0f; +__fp16 fp16_promoted = (double)2.0f; + +#define HAS_DATA_INIT_FUNC +void init_data () +{ + /* Init signed quad-word integer. */ + qword.l64 = 0xfdb9753102468aceLL; + qword.h64 = 0xeca8642013579bdfLL; +} + +#include "abitest.h" +#else + ARG ( int , 0xff , W0, 0) + ARG ( _Decimal32 , 1.0df , S0, 1) + ARG ( _Decimal32 , 1.0df , S1, 2) + ARG ( _Decimal32 , 1.0df , S2, 3) + ARG ( _Decimal32 , 1.0df , S3, 4) + ARG ( _Decimal32 , 1.0df , S4, 5) + ARG ( _Decimal32 , 1.0df , S5, 6) + ARG ( _Decimal32 , 1.0df , S6, 7) + ARG ( _Decimal32 , 1.0df , S7, LAST_NAMED_ARG_ID) + DOTS + ANON ( __int128, qword.i , X2, 8) + ANON ( signed long long, 0xa987654321012345LL , X4, 9) + ANON ( __int128, qword.i , X6, 10) +#ifndef __AAPCS64_BIG_ENDIAN__ + ANON_PROMOTED(unsigned char , 0xfe , unsigned int, 0xfe , STACK, 11) + ANON_PROMOTED( signed char , sc , signed int, sc_promoted, STACK+8, 12) + ANON_PROMOTED(unsigned short , 0xdcba, unsigned int, 0xdcba , STACK+16, 13) + ANON_PROMOTED( signed short , ss , signed int, ss_promoted, STACK+24, 14) + ANON (unsigned int , 0xdeadbeef, STACK+32, 15) + ANON ( signed int , 0xcafebabe, STACK+40, 16) +#else + ANON_PROMOTED(unsigned char , 0xfe , unsigned int, 0xfe , STACK+4, 11) + ANON_PROMOTED( signed char , sc , signed int, sc_promoted, STACK+12, 12) + ANON_PROMOTED(unsigned short , 0xdcba, unsigned int, 0xdcba , STACK+20, 13) + ANON_PROMOTED( signed short , ss , signed int, ss_promoted, STACK+28, 14) + ANON (unsigned int , 0xdeadbeef, STACK+36, 15) + ANON ( signed int , 0xcafebabe, STACK+44, 16) +#endif + ANON (unsigned long long, 0xba98765432101234ULL, STACK+48, 17) + ANON_PROMOTED( _Decimal32 , fp , _Decimal64, fp_promoted, STACK+56, 18) + ANON ( _Decimal64 , 9876543.212345dd, STACK+64, 19) + ANON ( _Decimal128 , 98765432123456789.987654321dl, STACK+80, 20) + ANON ( vf2_t, vf2 , STACK+96, 21) + ANON ( vi4_t, vi4 , STACK+112,22) + ANON_PROMOTED( __fp16 , fp16 , double, fp16_promoted, STACK+128,23) +#ifndef __AAPCS64_BIG_ENDIAN__ + LAST_ANON ( int , 0xeeee, STACK+136,24) +#else + LAST_ANON ( int , 0xeeee, STACK+140,24) +#endif +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-3.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-3.c new file mode 100644 index 0000000..9ab386f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-3.c @@ -0,0 +1,94 @@ +/* Test AAPCS64 layout and __builtin_va_arg. + + This test covers most composite types as described in AAPCS64 \S 4.3. + Homogeneous floating-point aggregate types are covered in other tests. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define AAPCS64_TEST_STDARG +#define TESTFILE "va_arg-3.c" +#include "type-def.h" + +struct x0 +{ + char ch; + int i; +} y0 = { 'a', 12345 }; + +struct x1 +{ + int a; + int b; + int c; + int d; +} y1 = { 0xdeadbeef, 0xcafebabe, 0x87654321, 0xabcedf975 }; + +struct x2 +{ + long long a; + long long b; + char ch; +} y2 = { 0x12, 0x34, 0x56 }; + +union x3 +{ + char ch; + int i; + long long ll; +} y3; + +union x4 +{ + int i; + struct x2 y2; +} y4; + +struct x5 +{ + union int128_t qword; +} y5; + +#define HAS_DATA_INIT_FUNC +void init_data () +{ + /* Init small union. */ + y3.ll = 0xfedcba98LL; + + /* Init big union. */ + y4.y2.a = 0x78; + y4.y2.b = 0x89; + y4.y2.ch= 0x9a; + + /* Init signed quad-word integer. */ + y5.qword.l64 = 0xfdb9753102468aceLL; + y5.qword.h64 = 0xeca8642013579bdfLL; +} + +#include "abitest.h" +#else + ARG (_Decimal32 ,1.0df, S0, LAST_NAMED_ARG_ID) + DOTS + ANON (struct x0, y0, X0, 1) + ANON (struct x1, y1, X1, 2) + PTR_ANON (struct x2, y2, X3, 3) + ANON (union x3, y3, X4, 4) + PTR_ANON (union x4, y4, X5, 5) + ANON (struct x5, y5, X6, 6) + ANON (struct x0, y0, STACK, 7) + ANON (struct x1, y1, STACK+8, 8) + PTR_ANON (struct x2, y2, STACK+24, 9) + ANON (union x3, y3, STACK+32, 10) + PTR_ANON (union x4, y4, STACK+40, 11) +#ifndef __AAPCS64_BIG_ENDIAN__ + ANON (int , 1, STACK+48, 12) +#else + ANON (int , 1, STACK+52, 12) +#endif + ANON (struct x5, y5, STACK+64, 13) +#ifndef __AAPCS64_BIG_ENDIAN__ + LAST_ANON(int , 2, STACK+80, 14) +#else + LAST_ANON(int , 2, STACK+84, 14) +#endif +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-4.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-4.c new file mode 100644 index 0000000..cf79aaa --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-4.c @@ -0,0 +1,90 @@ +/* Test AAPCS64 layout and __builtin_va_arg. + + This test covers homogeneous floating-point aggregate types and homogeneous + short-vector aggregate types as described in AAPCS64 \S 4.3.5. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define AAPCS64_TEST_STDARG +#define TESTFILE "va_arg-4.c" +#include "type-def.h" + +struct hfa_dfx1_t hfa_dfx1 = {12.345df}; +struct hfa_dfx2_t hfa_dfx2 = {123.456df, 234.456df}; +struct hfa_ddx2_t hfa_ddx2 = {234.567dd, 345.678dd}; +struct hfa_ddx4_t hfa_ddx4 = {1234.123dd, 2345.234dd, 3456.345dd, 4567.456dd}; +struct hfa_dldx3_t hfa_dldx3 = {123456.7890dl, 234567.8901dl, 345678.9012dl}; +struct non_hfa_dfx5_t non_hfa_dfx5 = {456.789df, 567.890df, 678.901df, 789.012df, 890.123df}; +struct hfa_dffs_t hfa_dffs; +struct non_hfa_dffs_t non_hfa_dffs; +struct non_hfa_dffs_2_t non_hfa_dffs_2; +struct hva_vdf2x1_t hva_vdf2x1; +struct hva_vdf2x2_t hva_vdf2x2; +struct non_hfa_dffd_t non_hfa_dffd = {23.df, 24.df, 25.0dd}; +struct non_hfa_dffvf2_t non_hfa_dffvf2; +struct non_hfa_dfffd_t non_hfa_dfffd = {33.df, 34.df, 35.df, 36.0dd}; +union hfa_dunion_t hfa_dunion; +union non_hfa_union_t non_hfa_union; + +#define HAS_DATA_INIT_FUNC +void init_data () +{ + hva_vdf2x1.a = (vdf2_t){17.df, 18.df}; + hva_vdf2x2.a = (vdf2_t){19.df, 20.df}; + hva_vdf2x2.b = (vdf2_t){21.df, 22.df}; + + non_hfa_dffvf2.a = 29.df; + non_hfa_dffvf2.b = 30.df; + non_hfa_dffvf2.c = (vdf2_t){31.df, 32.df}; + + hfa_dunion.s.a = 37.df; + hfa_dunion.s.b = 38.df; + hfa_dunion.c = 39.df; + + non_hfa_dunion.a = 40.0dd; + non_hfa_dunion.b = 41.df; + + hfa_dffs.a = 42.df; + hfa_dffs.b = 43.df; + hfa_dffs.c.a = 44.df; + hfa_dffs.c.b = 45.df; + + non_hfa_dffs.a = 46.df; + non_hfa_dffs.b = 47.df; + non_hfa_dffs.c.a = 48.0dd; + non_hfa_dffs.c.b = 49.0dd; + + non_hfa_dffs_2.s.a = 50; + non_hfa_dffs_2.s.b = 51; + non_hfa_dffs_2.c = 52.df; + non_hfa_dffs_2.d = 53.df; +} + +#include "abitest.h" +#else + ARG (int , 1, W0, LAST_NAMED_ARG_ID) + DOTS + /* HFA or HVA passed in fp/simd registers or on stack. */ + ANON (struct hfa_dfx1_t , hfa_dfx1, S0 , 0) + ANON (struct hfa_dfx2_t , hfa_dfx2, S1 , 1) + ANON (struct hfa_ddx2_t , hfa_ddx2, D3 , 2) + ANON (struct hva_vdf2x1_t, hva_vdf2x1, D5 , 11) + ANON (struct hfa_ddx4_t , hfa_ddx4, STACK , 3) + ANON (struct hfa_dffs_t , hfa_dffs , STACK+32, 4) + ANON (union hfa_dunion_t, hfa_dunion, STACK+48, 5) + ANON (struct hfa_dldx3_t, hfa_dldx3, STACK+64, 6) + /* Non-H[FV]A passed in general registers or on stack or via reference. */ + PTR_ANON (struct non_hfa_dfx5_t , non_hfa_dfx5 , X1 , 10) + ANON (struct non_hfa_dffd_t , non_hfa_dffd , X2 , 13) + ANON (struct non_hfa_dffvf2_t, non_hfa_dffvf2, X6 , 16) + PTR_ANON (struct non_hfa_dfffd_t, non_hfa_dfffd, STACK+112, 17) + PTR_ANON (struct non_hfa_dffs_t , non_hfa_dffs , STACK+120, 18) + ANON (struct non_hfa_dffs_2_t, non_hfa_dffs_2, STACK+128, 19) + ANON (union non_hfa_dunion_t, non_hfa_dunion, STACK+144, 20) +#ifndef __AAPCS64_BIG_ENDIAN__ + LAST_ANON(int , 2 , STACK+152, 30) +#else + LAST_ANON(int , 2 , STACK+156, 30) +#endif +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-5.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-5.c new file mode 100644 index 0000000..57ea87a --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-5.c @@ -0,0 +1,47 @@ +/* Test AAPCS64 layout and __builtin_va_arg. + + This test is focus on certain unnamed homogeneous floating-point aggregate + types passed in fp/simd registers. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define AAPCS64_TEST_STDARG +#define TESTFILE "va_arg_dfp-5.c" +#include "type-def.h" + +struct hfa_dfx1_t hfa_dfx1 = {12.345df}; +struct hfa_dfx2_t hfa_dfx2 = {123.456df, 234.456df}; +struct hfa_ddx2_t hfa_ddx2 = {234.567dd, 345.678dd}; +struct hfa_ddx4_t hfa_ddx4 = {1234.123dd, 2345.234dd, 3456.345dd, 4567.456dd}; +struct hfa_dldx3_t hfa_dldx3 = {123456.7890dl, 234567.8901dl, 345678.9012dl}; +struct hfa_dffs_t hfa_dffs; +union hfa_dunion_t hfa_dunion; + +#define HAS_DATA_INIT_FUNC +void init_data () +{ + hfa_dunion.s.a = 37.df; + hfa_dunion.s.b = 38.df; + hfa_dunion.c = 39.df; + + hfa_dffs.a = 42.df; + hfa_dffs.b = 43.df; + hfa_dffs.c.a = 44.df; + hfa_dffs.c.b = 45.df; +} + +#include "abitest.h" +#else + ARG (int, 1, W0, LAST_NAMED_ARG_ID) + DOTS + /* HFA passed in fp/simd registers or on stack. */ + ANON (struct hfa_ddx4_t , hfa_ddx4 , D0 , 0) + ANON (struct hfa_dldx3_t, hfa_dldx3, Q4 , 1) + ANON (struct hfa_dffs_t , hfa_dffs , STACK , 2) + ANON (union hfa_dunion_t, hfa_dunion, STACK+16, 3) + ANON (struct hfa_dfx1_t , hfa_dfx1 , STACK+24, 4) + ANON (struct hfa_dfx2_t , hfa_dfx2 , STACK+32, 5) + ANON (struct hfa_ddx2_t , hfa_ddx2 , STACK+40, 6) + LAST_ANON(_Decimal64 , 1.0dd , STACK+56, 9) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-6.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-6.c new file mode 100644 index 0000000..c4144be --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-6.c @@ -0,0 +1,40 @@ +/* Test AAPCS64 layout and __builtin_va_arg. + + This test is focus on certain unnamed homogeneous floating-point aggregate + types passed in fp/simd registers. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define AAPCS64_TEST_STDARG +#define TESTFILE "va_arg_dfp-6.c" +#include "type-def.h" + +struct hfa_dfx1_t hfa_dfx1 = {12.345df}; +struct hfa_ddx2_t hfa_ddx2 = {234.567dd, 345.678dd}; +struct hfa_dffs_t hfa_dffs; +union hfa_dunion_t hfa_dunion; + +#define HAS_DATA_INIT_FUNC +void init_data () +{ + hfa_dunion.s.a = 37.df; + hfa_dunion.s.b = 38.df; + hfa_dunion.c = 39.df; + + hfa_ffs.a = 42.f; + hfa_ffs.b = 43.f; + hfa_ffs.c.a = 44.f; + hfa_ffs.c.b = 45.f; +} + +#include "abitest.h" +#else + ARG (int, 1, W0, LAST_NAMED_ARG_ID) + DOTS + ANON (struct hfa_dffs_t , hfa_dffs , S0 , 0) + ANON (union hfa_dunion_t, hfa_dunion, S4 , 1) + ANON (struct hfa_ddx2_t , hfa_ddx2 , D6 , 2) + ANON (struct hfa_dfx1_t , hfa_dfx1 , STACK , 3) + LAST_ANON(_Decimal64 , 1.0dd , STACK+8, 4) +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-8.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-8.c new file mode 100644 index 0000000..bd4562f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-8.c @@ -0,0 +1,25 @@ +/* Test AAPCS64 layout and __builtin_va_arg. + + Miscellaneous test: HFA anonymous parameter passed in SIMD/FP regs. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define AAPCS64_TEST_STDARG +#define TESTFILE "va_arg_dfp-8.c" + +struct z +{ + _Decimal64 x[4]; +}; + +struct z a = { 5.0dd, 6.0dd, 7.0dd, 8.0dd }; + +#include "abitest.h" +#else + ARG(int, 0xdeadbeef, W0, LAST_NAMED_ARG_ID) + DOTS + ANON(_Decimal64, 4.0dd, D0, 1) + LAST_ANON(struct z, a, D1, 2) + +#endif diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-9.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-9.c new file mode 100644 index 0000000..d1f95c4 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg_dfp-9.c @@ -0,0 +1,31 @@ +/* Test AAPCS64 layout and __builtin_va_arg. + + Miscellaneous test: HFA anonymous parameter passed in SIMD/FP regs. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define AAPCS64_TEST_STDARG +#define TESTFILE "va_arg_dfp-9.c" + +struct z +{ + _Decimal64 x[4]; +}; + +_Decimal64 d1 = 25.0dd; +struct z a = { 5.0dd, 6.0dd, 7.0dd, 8.0dd }; +struct z b = { 9.0dd, 10.0dd, 11.0dd, 12.0dd }; + +#include "abitest.h" +#else + ARG(_Decimal64, 11.0dd, D0, LAST_NAMED_ARG_ID) + DOTS + ANON(int, 8, W0, 1) + ANON(struct z, a, D1, 2) + ANON(struct z, b, STACK, 3) + ANON(int, 5, W1, 4) + ANON(_Decimal64, d1, STACK+32, 5) + LAST_ANON(_Decimal64, 0.5dd, STACK+40, 6) + +#endif -- cgit v1.1 From 096eaeac38fa4acc50a4784f3242db5ae8a08262 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Fri, 22 Apr 2022 17:14:56 +0100 Subject: testsuite: enable more BID DFP tests for AArch64 Some tests for the BID format are currently restricted to i?86 and x86_64, but they also pass on AArch64, so this patch enables them. Since all these tests are related to the BID format, it seems useful to introduce a new effective-target (dfp_bid) instead of adding aarch64 to the current target list. 2022-04-28 Christophe Lyon gcc/ * doc/sourcebuild.texi (Decimal floating point attributes): Document dfp_bid effective-target. gcc/testsuite/ * lib/target-supports.exp (check_effective_target_dfp_bid): New. * gcc.dg/dfp/bid-non-canonical-d128-1.c: Use dfp_bid effective-target. * gcc.dg/dfp/bid-non-canonical-d128-2.c: Likewise. * gcc.dg/dfp/bid-non-canonical-d128-3.c: Likewise. * gcc.dg/dfp/bid-non-canonical-d128-4.c: Likewise. * gcc.dg/dfp/bid-non-canonical-d32-1.c: Likewise. * gcc.dg/dfp/bid-non-canonical-d32-2.c: Likewise. * gcc.dg/dfp/bid-non-canonical-d64-1.c: Likewise. * gcc.dg/dfp/bid-non-canonical-d64-2.c: Likewise. --- gcc/doc/sourcebuild.texi | 3 +++ gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d128-1.c | 3 ++- gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d128-2.c | 3 ++- gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d128-3.c | 3 ++- gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d128-4.c | 3 ++- gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d32-1.c | 3 ++- gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d32-2.c | 3 ++- gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d64-1.c | 3 ++- gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d64-2.c | 3 ++- gcc/testsuite/lib/target-supports.exp | 11 +++++++++++ 10 files changed, 30 insertions(+), 8 deletions(-) (limited to 'gcc') diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 71c0484..d465b04 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1937,6 +1937,9 @@ test system can execute decimal floating point tests. @item hard_dfp Target generates decimal floating point instructions with current options. + +@item dfp_bid +Target uses the BID format for decimal floating point. @end table @subsubsection ARM-specific attributes diff --git a/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d128-1.c b/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d128-1.c index eee5471..f8da702 100644 --- a/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d128-1.c +++ b/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d128-1.c @@ -1,5 +1,6 @@ /* Test non-canonical BID significands: _Decimal128. Bug 91226. */ -/* { dg-do run { target { { i?86-*-* x86_64-*-* } && lp64 } } } */ +/* { dg-do run { target lp64 } } */ +/* { dg-require-effective-target dfp_bid } */ /* { dg-options "-std=gnu2x -O2" } */ extern void abort (void); diff --git a/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d128-2.c b/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d128-2.c index 6267121..dade48f 100644 --- a/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d128-2.c +++ b/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d128-2.c @@ -1,6 +1,7 @@ /* Test non-canonical BID significands: _Decimal128, case where combination field starts 11. Bug 91226. */ -/* { dg-do run { target { { i?86-*-* x86_64-*-* } && lp64 } } } */ +/* { dg-do run { target lp64 } } */ +/* { dg-require-effective-target dfp_bid } */ /* { dg-options "-std=gnu2x -O2" } */ extern void abort (void); diff --git a/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d128-3.c b/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d128-3.c index 9190dae..77c0941 100644 --- a/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d128-3.c +++ b/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d128-3.c @@ -1,5 +1,6 @@ /* Test non-canonical BID significands: _Decimal128. Bug 91226. */ -/* { dg-do run { target { { i?86-*-* x86_64-*-* } && lp64 } } } */ +/* { dg-do run { target lp64 } } */ +/* { dg-require-effective-target dfp_bid } */ /* { dg-options "-std=gnu2x -O0" } */ #include "bid-non-canonical-d128-1.c" diff --git a/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d128-4.c b/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d128-4.c index b148ce4..93ff0fc 100644 --- a/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d128-4.c +++ b/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d128-4.c @@ -1,6 +1,7 @@ /* Test non-canonical BID significands: _Decimal128, case where combination field starts 11. Bug 91226. */ -/* { dg-do run { target { { i?86-*-* x86_64-*-* } && lp64 } } } */ +/* { dg-do run { target lp64 } } */ +/* { dg-require-effective-target dfp_bid } */ /* { dg-options "-std=gnu2x -O0" } */ #include "bid-non-canonical-d128-2.c" diff --git a/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d32-1.c b/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d32-1.c index b46b71c..69d014f 100644 --- a/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d32-1.c +++ b/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d32-1.c @@ -1,5 +1,6 @@ /* Test non-canonical BID significands: _Decimal32. Bug 91226. */ -/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-do run } */ +/* { dg-require-effective-target dfp_bid } */ /* { dg-options "-std=gnu2x -O2" } */ extern void abort (void); diff --git a/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d32-2.c b/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d32-2.c index 11d64dc..874b2fb 100644 --- a/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d32-2.c +++ b/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d32-2.c @@ -1,5 +1,6 @@ /* Test non-canonical BID significands: _Decimal32. Bug 91226. */ -/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-do run } */ +/* { dg-require-effective-target dfp_bid } */ /* { dg-options "-std=gnu2x -O0" } */ #include "bid-non-canonical-d32-1.c" diff --git a/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d64-1.c b/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d64-1.c index 87b1069..4602d34 100644 --- a/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d64-1.c +++ b/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d64-1.c @@ -1,5 +1,6 @@ /* Test non-canonical BID significands: _Decimal64. Bug 91226. */ -/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-do run } */ +/* { dg-require-effective-target dfp_bid } */ /* { dg-options "-std=gnu2x -O2" } */ extern void abort (void); diff --git a/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d64-2.c b/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d64-2.c index 3c10145..c2993b6 100644 --- a/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d64-2.c +++ b/gcc/testsuite/gcc.dg/dfp/bid-non-canonical-d64-2.c @@ -1,5 +1,6 @@ /* Test non-canonical BID significands: _Decimal64. Bug 91226. */ -/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-do run } */ +/* { dg-require-effective-target dfp_bid } */ /* { dg-options "-std=gnu2x -O0" } */ #include "bid-non-canonical-d64-1.c" diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 244fe23..d1f4eb7 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -3427,6 +3427,17 @@ proc check_effective_target_dfprt { } { }] } +# Return 1 if the target uses the BID format for Decimal Floating +# Point, 0 otherwise. + +proc check_effective_target_dfp_bid { } { + if { [istarget aarch64*-*-*] + || [istarget i?86-*-*] || [istarget x86_64-*-*]} { + return 1 + } + return 0 +} + # Return 1 iff target has unsigned plain 'char' by default. proc check_effective_target_unsigned_char {} { -- cgit v1.1 From 46c6976da146fbd52c088c1530f25e8b8f56c648 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Tue, 3 May 2022 17:14:25 +0100 Subject: testsuite: Add C++ unwinding tests with Decimal Floating-Point These tests exercise exception handling with Decimal Floating-Point type. dfp-1.C and dfp-2.C check that thrown objects of such types are properly caught, whether when using C++ classes (decimalXX) or via GCC mode attributes. dfp-saves-aarch64.C checks that such objects are properly restored, and has to use the mode attribute trick because objects of decimalXX class type cannot be assigned to a register variable. 2022-05-03 Christophe Lyon gcc/testsuite/ * g++.dg/eh/dfp-1.C: New test. * g++.dg/eh/dfp-2.C: New test. * g++.dg/eh/dfp-saves-aarch64.C: New test. --- gcc/testsuite/g++.dg/eh/dfp-1.C | 54 +++++++++++++++++++++++++++++ gcc/testsuite/g++.dg/eh/dfp-2.C | 54 +++++++++++++++++++++++++++++ gcc/testsuite/g++.dg/eh/dfp-saves-aarch64.C | 49 ++++++++++++++++++++++++++ 3 files changed, 157 insertions(+) create mode 100644 gcc/testsuite/g++.dg/eh/dfp-1.C create mode 100644 gcc/testsuite/g++.dg/eh/dfp-2.C create mode 100644 gcc/testsuite/g++.dg/eh/dfp-saves-aarch64.C (limited to 'gcc') diff --git a/gcc/testsuite/g++.dg/eh/dfp-1.C b/gcc/testsuite/g++.dg/eh/dfp-1.C new file mode 100644 index 0000000..b0da13a --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/dfp-1.C @@ -0,0 +1,54 @@ +// { dg-do run } +// { dg-require-effective-target dfp } + +extern "C" void abort (); + +#include + +using namespace std::decimal; + +int +foo (double fp) +{ + if (fp < 32.0) + throw (decimal32)32; + if (fp < 64.0) + throw (decimal64)64; + if (fp < 128.0) + throw (decimal128)128; + return 0; +} + +int bar (double fp) +{ + try + { + foo (fp); + abort (); + } + catch (decimal32 df) + { + if (df != (decimal32)32) + abort (); + } + catch (decimal64 dd) + { + if (dd != (decimal64)64) + abort (); + } + catch (decimal128 dl) + { + if (dl != (decimal128)128) + abort (); + } + return 0; +} + +int +main () +{ + bar (10.0); + bar (20.0); + bar (100.0); + return 0; +} diff --git a/gcc/testsuite/g++.dg/eh/dfp-2.C b/gcc/testsuite/g++.dg/eh/dfp-2.C new file mode 100644 index 0000000..aff0e03 --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/dfp-2.C @@ -0,0 +1,54 @@ +// { dg-do run } +// { dg-require-effective-target dfp } + +extern "C" void abort (); + +typedef float dec32 __attribute__((mode(SD))); +typedef float dec64 __attribute__((mode(DD))); +typedef float dec128 __attribute__((mode(TD))); + +int +foo (double fp) +{ + if (fp < 32.0) + throw (dec32)32; + if (fp < 64.0) + throw (dec64)64; + if (fp < 128.0) + throw (dec128)128; + return 0; +} + +int bar (double fp) +{ + try + { + foo (fp); + abort (); + } + catch (dec32 df) + { + if (df != (dec32)32) + abort (); + } + catch (dec64 dd) + { + if (dd != (dec64)64) + abort (); + } + catch (dec128 dl) + { + if (dl != (dec128)128) + abort (); + } + return 0; +} + +int +main () +{ + bar (10.0); + bar (20.0); + bar (100.0); + return 0; +} diff --git a/gcc/testsuite/g++.dg/eh/dfp-saves-aarch64.C b/gcc/testsuite/g++.dg/eh/dfp-saves-aarch64.C new file mode 100644 index 0000000..06203410 --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/dfp-saves-aarch64.C @@ -0,0 +1,49 @@ +// { dg-do run { target aarch64*-*-* } } +// { dg-require-effective-target dfp } + +/* Test unwinding of AArch64 register saves. */ +/* We cannot use #include because it defines + decimal* types as classes, which cannot be assigned to register + variables. Hence the use the mode attribute trick. */ + +#ifdef __aarch64__ + +typedef float dec64 __attribute__((mode(DD))); + +extern "C" void abort (void); +extern "C" void exit (int); + +void +foo (void) +{ + register dec64 v10 asm("v10") = 0; + register dec64 v11 asm("v11") = 1; + register dec64 v12 asm("v12") = 2; + register dec64 v13 asm("v13") = 3; + asm volatile ("" : "+w" (v10), "+w" (v11), "+w" (v12), "+w" (v13)); + throw ""; +} + +int +main (void) +{ + register dec64 v10 asm("v10") = 10; + register dec64 v11 asm("v11") = 11; + register dec64 v12 asm("v12") = 12; + register dec64 v13 asm("v13") = 13; + asm volatile ("" : "+w" (v10), "+w" (v11), "+w" (v12), "+w" (v13)); + try { + foo (); + } catch (...) { + asm volatile ("" : "+w" (v10), "+w" (v11), "+w" (v12), "+w" (v13)); + if (v10 != 10 || v11 != 11 || v12 != 12 || v13 != 13) + abort (); + } + exit (0); +} +#else +int +main (void) +{ +} +#endif -- cgit v1.1 From 308a0af4f913243023ee52332f7cc513745c9203 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Wed, 4 May 2022 16:13:35 +0100 Subject: libgcc: Add support for HF mode (aka _Float16) in libbid This patch adds support for trunc and extend operations between HF mode (_Float16) and Decimal Floating Point formats (_Decimal32, _Decimal64 and _Decimal128). For simplicity we rely on the implicit conversions inserted by the compiler between HF and SD/DF/TF modes. The existing bid*_to_binary* and binary*_to_bid* functions are non-trivial and at this stage it is not clear if there is a performance-critical use case involving _Float16 and _Decimal* formats. The patch also adds two executable tests, to make sure the right functions are called, available (link phase) and functional. Tested on aarch64 and x86_64. The number of symbol matches in the testcases includes the .global XXX to avoid having to match different call instructions for different targets. 2022-05-04 Christophe Lyon libgcc/ChangeLog: * Makefile.in (D32PBIT_FUNCS): Add _hf_to_sd and _sd_to_hf. (D64PBIT_FUNCS): Add _hf_to_dd and _dd_to_hf. (D128PBIT_FUNCS): Add _hf_to_td _td_to_hf. libgcc/config/libbid/ChangeLog: * bid_gcc_intrinsics.h (LIBGCC2_HAS_HF_MODE): Define according to __LIBGCC_HAS_HF_MODE__. (BID_HAS_HF_MODE): Define. (HFtype): Define. (__bid_extendhfsd): New prototype. (__bid_extendhfdd): Likewise. (__bid_extendhftd): Likewise. (__bid_truncsdhf): Likewise. (__bid_truncddhf): Likewise. (__bid_trunctdhf): Likewise. * _dd_to_hf.c: New file. * _hf_to_dd.c: New file. * _hf_to_sd.c: New file. * _hf_to_td.c: New file. * _sd_to_hf.c: New file. * _td_to_hf.c: New file. gcc/testsuite/ChangeLog: * gcc.dg/torture/convert-dfp-2.c: New test. * gcc.dg/torture/convert-dfp.c: New test. --- gcc/testsuite/gcc.dg/torture/convert-dfp-2.c | 45 ++++++++++++++++++++ gcc/testsuite/gcc.dg/torture/convert-dfp.c | 63 ++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/convert-dfp-2.c create mode 100644 gcc/testsuite/gcc.dg/torture/convert-dfp.c (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/torture/convert-dfp-2.c b/gcc/testsuite/gcc.dg/torture/convert-dfp-2.c new file mode 100644 index 0000000..3e4ecb5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/convert-dfp-2.c @@ -0,0 +1,45 @@ +/* { dg-do run } */ +/* { dg-require-effective-target float16_runtime } */ +/* { dg-require-effective-target dfprt } */ +/* { dg-options "-save-temps" } */ +/* { dg-add-options float16 } */ + +/* Test conversions from DFP to smaller types. */ + +_Decimal32 var32; +_Decimal64 var64; +_Decimal128 var128; +_Float16 var16; + +void __attribute__ ((__noinline__)) foo32 (_Decimal32 param32) +{ + var16 = param32; +} + +void __attribute__ ((__noinline__)) foo64 (_Decimal64 param64) +{ + var16 = param64; + var32 = param64; +} + +void __attribute__ ((__noinline__)) foo128 (_Decimal128 param128) +{ + var16 = param128; + var32 = param128; + var64 = param128; +} + +int main () +{ + foo32 (var32); + foo64 (var64); + foo128 (var128); + 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 } } } } */ diff --git a/gcc/testsuite/gcc.dg/torture/convert-dfp.c b/gcc/testsuite/gcc.dg/torture/convert-dfp.c new file mode 100644 index 0000000..ec13689 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/convert-dfp.c @@ -0,0 +1,63 @@ +/* { dg-do run } */ +/* { dg-require-effective-target float16_runtime } */ +/* { dg-require-effective-target dfprt } */ +/* { dg-options "-save-temps" } */ +/* { dg-add-options float16 } */ + +/* Test conversions to/from DFP values. */ + +extern void abort (); + +_Decimal32 var32 = 1.2df; + +int __attribute__ ((__noinline__)) foo32 (_Decimal32 param32, _Decimal64 param64, _Decimal128 param128, _Float16 param16) +{ + return (param32 == var32) + + (param64 == var32) + + (param128 == var32) + /* Small enough relative difference? */ + + ((((_Decimal32)param16 - var32) / var32) < 0.002df); +} + +_Decimal64 var64 = 1.2dd; + +int __attribute__ ((__noinline__)) foo64 (_Decimal32 param32, _Decimal64 param64, _Decimal128 param128, _Float16 param16) +{ + return (param32 == var64) + + (param64 == var64) + + (param128 == var64) + /* Small enough relative difference? */ + + ((((_Decimal64)param16 - var64) / var64) < 0.002dd); +} + +_Decimal128 var128 = 1.2dl; + +int __attribute__ ((__noinline__)) foo128 (_Decimal32 param32, _Decimal64 param64, _Decimal128 param128, _Float16 param16) +{ + return (param32 == var128) + + (param64 == var128) + + (param128 == var128) + /* Small enough relative difference? */ + + ((((_Decimal128)param16 - var128) / var128) < 0.002dl); +} + +int main() +{ + if (foo32 (1.2df, 1.2dd, 1.2dl, (_Float16)1.2) != 4) + abort (); + + if (foo64 (1.2df, 1.2dd, 1.2dl, (_Float16)1.2) != 4) + abort (); + + if (foo128 (1.2df, 1.2dd, 1.2dl, (_Float16)1.2) != 4) + abort (); + + 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 } } } } */ -- cgit v1.1 From 6c420193e86b39a09304b2845335571eefe24d5d Mon Sep 17 00:00:00 2001 From: Marcel Vollweiler Date: Fri, 20 May 2022 02:08:36 -0700 Subject: libgomp: Add new runtime routines omp_target_memcpy_async and omp_target_memcpy_rect_async This patch adds two new OpenMP runtime routines: omp_target_memcpy_async and omp_target_memcpy_rect_async. Both functions are introduced in OpenMP 5.1 as asynchronous variants of omp_target_memcpy and omp_target_memcpy_rect. In contrast to the synchronous variants, the asynchronous functions have two additional function parameters to allow the specification of task dependences: int depobj_count omp_depend_t *depobj_list integer(c_int), value :: depobj_count integer(omp_depend_kind), optional :: depobj_list(*) The implementation splits the synchronous functions into two parts: (a) check and (b) copy. Then (a) is used in the asynchronous functions for the sequential part, and the actual copy process (b) is executed in a new created task. The sequential part (a) takes into account the requirements for the return values: "The routine returns zero if successful. Otherwise, it returns a non-zero value." (omp_target_memcpy_async, OpenMP 5.1 spec, section 3.8.7) "An application can determine the number of inclusive dimensions supported by an implementation by passing NULL pointers (or C_NULL_PTR, for Fortran) for both dst and src. The routine returns the number of dimensions supported by the implementation for the specified device numbers. No copy operation is performed." (omp_target_memcpy_rect_async, OpenMP 5.1 spec, section 3.8.8) Due to asynchronicity an error is thrown if the asynchronous memcpy is not successful (in contrast to the synchronous functions which use a return value unequal to zero). gcc/ChangeLog: * omp-low.cc (omp_runtime_api_call): Added target_memcpy_async and target_memcpy_rect_async to omp_runtime_apis array. libgomp/ChangeLog: * libgomp.map: Added omp_target_memcpy_async and omp_target_memcpy_rect_async. * libgomp.texi: Both functions are now supported. * omp.h.in: Added omp_target_memcpy_async and omp_target_memcpy_rect_async. * omp_lib.f90.in: Added interfaces for both new functions. * omp_lib.h.in: Likewise. * target.c (ialias_redirect): Added for GOMP_task. (omp_target_memcpy): Restructured into check and copy part. (omp_target_memcpy_check): New helper function for omp_target_memcpy and omp_target_memcpy_async that checks requirements. (omp_target_memcpy_copy): New helper function for omp_target_memcpy and omp_target_memcpy_async that performs the memcpy. (omp_target_memcpy_async_helper): New helper function that is used in omp_target_memcpy_async for the asynchronous task. (omp_target_memcpy_async): Added. (omp_target_memcpy_rect): Restructured into check and copy part. (omp_target_memcpy_rect_check): New helper function for omp_target_memcpy_rect and omp_target_memcpy_rect_async that checks requirements. (omp_target_memcpy_rect_copy): New helper function for omp_target_memcpy_rect and omp_target_memcpy_rect_async that performs the memcpy. (omp_target_memcpy_rect_async_helper): New helper function that is used in omp_target_memcpy_rect_async for the asynchronous task. (omp_target_memcpy_rect_async): Added. * task.c (ialias): Added for GOMP_task. * testsuite/libgomp.c-c++-common/target-memcpy-async-1.c: New test. * testsuite/libgomp.c-c++-common/target-memcpy-async-2.c: New test. * testsuite/libgomp.c-c++-common/target-memcpy-rect-async-1.c: New test. * testsuite/libgomp.c-c++-common/target-memcpy-rect-async-2.c: New test. * testsuite/libgomp.fortran/target-memcpy-async-1.f90: New test. * testsuite/libgomp.fortran/target-memcpy-async-2.f90: New test. * testsuite/libgomp.fortran/target-memcpy-rect-async-1.f90: New test. * testsuite/libgomp.fortran/target-memcpy-rect-async-2.f90: New test. --- gcc/omp-low.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc') diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc index c83af6c..b037938 100644 --- a/gcc/omp-low.cc +++ b/gcc/omp-low.cc @@ -4011,7 +4011,9 @@ omp_runtime_api_call (const_tree fndecl) "target_is_accessible", "target_is_present", "target_memcpy", + "target_memcpy_async", "target_memcpy_rect", + "target_memcpy_rect_async", NULL, /* Now omp_* calls that are available as omp_* and omp_*_; however, the DECL_NAME is always omp_* without tailing underscore. */ -- cgit v1.1 From ff171cb13df671a2a0647a68da0fdc1f9a78b8c9 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Fri, 20 May 2022 10:05:54 -0400 Subject: Use "final" and "override" directly, rather than via macros As of GCC 11 onwards we have required a C++11 compiler, such as GCC 4.8 or later. On the assumption that any such compiler correctly implements "final" and "override", this patch updates the source tree to stop using the FINAL and OVERRIDE macros from ansidecl.h, in favor of simply using "final" and "override" directly. libcpp/ChangeLog: * lex.cc: Replace uses of "FINAL" and "OVERRIDE" with "final" and "override". gcc/analyzer/ChangeLog: * analyzer-pass.cc: Replace uses of "FINAL" and "OVERRIDE" with "final" and "override". * call-info.h: Likewise. * checker-path.h: Likewise. * constraint-manager.cc: Likewise. * diagnostic-manager.cc: Likewise. * engine.cc: Likewise. * exploded-graph.h: Likewise. * feasible-graph.h: Likewise. * pending-diagnostic.h: Likewise. * region-model-impl-calls.cc: Likewise. * region-model.cc: Likewise. * region-model.h: Likewise. * region.h: Likewise. * sm-file.cc: Likewise. * sm-malloc.cc: Likewise. * sm-pattern-test.cc: Likewise. * sm-sensitive.cc: Likewise. * sm-signal.cc: Likewise. * sm-taint.cc: Likewise. * state-purge.h: Likewise. * store.cc: Likewise. * store.h: Likewise. * supergraph.h: Likewise. * svalue.h: Likewise. * trimmed-graph.h: Likewise. * varargs.cc: Likewise. gcc/c-family/ChangeLog: * c-format.cc: Replace uses of "FINAL" and "OVERRIDE" with "final" and "override". * c-pretty-print.h: Likewise. gcc/cp/ChangeLog: * cxx-pretty-print.h: Replace uses of "FINAL" and "OVERRIDE" with "final" and "override". * error.cc: Likewise. gcc/jit/ChangeLog: * jit-playback.h: Replace uses of "FINAL" and "OVERRIDE" with "final" and "override". * jit-recording.cc: Likewise. * jit-recording.h: Likewise. gcc/ChangeLog: * config/aarch64/aarch64-sve-builtins-base.cc: Replace uses of "FINAL" and "OVERRIDE" with "final" and "override". * config/aarch64/aarch64-sve-builtins-functions.h: Likewise. * config/aarch64/aarch64-sve-builtins-shapes.cc: Likewise. * config/aarch64/aarch64-sve-builtins-sve2.cc: Likewise. * diagnostic-path.h: Likewise. * digraph.cc: Likewise. * gcc-rich-location.h: Likewise. * gimple-array-bounds.cc: Likewise. * gimple-loop-versioning.cc: Likewise. * gimple-range-cache.cc: Likewise. * gimple-range-cache.h: Likewise. * gimple-range-fold.cc: Likewise. * gimple-range-fold.h: Likewise. * gimple-range-tests.cc: Likewise. * gimple-range.h: Likewise. * gimple-ssa-evrp.cc: Likewise. * input.cc: Likewise. * json.h: Likewise. * read-rtl-function.cc: Likewise. * tree-complex.cc: Likewise. * tree-diagnostic-path.cc: Likewise. * tree-ssa-ccp.cc: Likewise. * tree-ssa-copy.cc: Likewise. * tree-vrp.cc: Likewise. * value-query.h: Likewise. * vr-values.h: Likewise. Signed-off-by: David Malcolm --- gcc/analyzer/analyzer-pass.cc | 4 +- gcc/analyzer/call-info.h | 8 +- gcc/analyzer/checker-path.h | 52 +- gcc/analyzer/constraint-manager.cc | 4 +- gcc/analyzer/diagnostic-manager.cc | 36 +- gcc/analyzer/engine.cc | 90 ++-- gcc/analyzer/exploded-graph.h | 52 +- gcc/analyzer/feasible-graph.h | 6 +- gcc/analyzer/pending-diagnostic.h | 4 +- gcc/analyzer/region-model-impl-calls.cc | 14 +- gcc/analyzer/region-model.cc | 54 +- gcc/analyzer/region-model.h | 84 +-- gcc/analyzer/region.h | 142 ++--- gcc/analyzer/sm-file.cc | 36 +- gcc/analyzer/sm-malloc.cc | 130 ++--- gcc/analyzer/sm-pattern-test.cc | 14 +- gcc/analyzer/sm-sensitive.cc | 20 +- gcc/analyzer/sm-signal.cc | 24 +- gcc/analyzer/sm-taint.cc | 60 +-- gcc/analyzer/state-purge.h | 4 +- gcc/analyzer/store.cc | 2 +- gcc/analyzer/store.h | 12 +- gcc/analyzer/supergraph.h | 26 +- gcc/analyzer/svalue.h | 178 +++---- gcc/analyzer/trimmed-graph.h | 4 +- gcc/analyzer/varargs.cc | 54 +- gcc/c-family/c-format.cc | 2 +- gcc/c-family/c-pretty-print.h | 2 +- gcc/config/aarch64/aarch64-sve-builtins-base.cc | 260 ++++----- .../aarch64/aarch64-sve-builtins-functions.h | 48 +- gcc/config/aarch64/aarch64-sve-builtins-shapes.cc | 416 +++++++-------- gcc/config/aarch64/aarch64-sve-builtins-sve2.cc | 44 +- gcc/cp/cxx-pretty-print.h | 2 +- gcc/cp/error.cc | 4 +- gcc/diagnostic-path.h | 12 +- gcc/digraph.cc | 4 +- gcc/gcc-rich-location.h | 6 +- gcc/gimple-array-bounds.cc | 2 +- gcc/gimple-loop-versioning.cc | 4 +- gcc/gimple-range-cache.cc | 12 +- gcc/gimple-range-cache.h | 2 +- gcc/gimple-range-fold.cc | 8 +- gcc/gimple-range-fold.h | 10 +- gcc/gimple-range-tests.cc | 2 +- gcc/gimple-range.h | 8 +- gcc/gimple-ssa-evrp.cc | 26 +- gcc/input.cc | 4 +- gcc/jit/jit-playback.h | 12 +- gcc/jit/jit-recording.cc | 2 +- gcc/jit/jit-recording.h | 586 ++++++++++----------- gcc/json.h | 24 +- gcc/read-rtl-function.cc | 10 +- gcc/tree-complex.cc | 4 +- gcc/tree-diagnostic-path.cc | 2 +- gcc/tree-ssa-ccp.cc | 8 +- gcc/tree-ssa-copy.cc | 6 +- gcc/tree-vrp.cc | 22 +- gcc/value-query.h | 8 +- gcc/vr-values.h | 12 +- 59 files changed, 1344 insertions(+), 1344 deletions(-) (limited to 'gcc') diff --git a/gcc/analyzer/analyzer-pass.cc b/gcc/analyzer/analyzer-pass.cc index 0bf131b..f6cef58 100644 --- a/gcc/analyzer/analyzer-pass.cc +++ b/gcc/analyzer/analyzer-pass.cc @@ -66,8 +66,8 @@ public: {} /* opt_pass methods: */ - bool gate (function *) FINAL OVERRIDE; - unsigned int execute (function *) FINAL OVERRIDE; + bool gate (function *) final override; + unsigned int execute (function *) final override; }; // class pass_analyzer /* Only run the analyzer if -fanalyzer. */ diff --git a/gcc/analyzer/call-info.h b/gcc/analyzer/call-info.h index bdcfff7..4bb7dd7 100644 --- a/gcc/analyzer/call-info.h +++ b/gcc/analyzer/call-info.h @@ -30,9 +30,9 @@ namespace ana { class call_info : public custom_edge_info { public: - void print (pretty_printer *pp) const FINAL OVERRIDE; + void print (pretty_printer *pp) const final override; void add_events_to_path (checker_path *emission_path, - const exploded_edge &eedge) const FINAL OVERRIDE; + const exploded_edge &eedge) const final override; const gcall *get_call_stmt () const { return m_call_stmt; } tree get_fndecl () const { return m_fndecl; } @@ -58,7 +58,7 @@ private: class success_call_info : public call_info { public: - label_text get_desc (bool can_colorize) const FINAL OVERRIDE; + label_text get_desc (bool can_colorize) const final override; protected: success_call_info (const call_details &cd) : call_info (cd) {} @@ -72,7 +72,7 @@ protected: class failed_call_info : public call_info { public: - label_text get_desc (bool can_colorize) const FINAL OVERRIDE; + label_text get_desc (bool can_colorize) const final override; protected: failed_call_info (const call_details &cd) : call_info (cd) {} diff --git a/gcc/analyzer/checker-path.h b/gcc/analyzer/checker-path.h index 545d7db..fd274e5 100644 --- a/gcc/analyzer/checker-path.h +++ b/gcc/analyzer/checker-path.h @@ -91,9 +91,9 @@ public: /* Implementation of diagnostic_event. */ - location_t get_location () const FINAL OVERRIDE { return m_loc; } - tree get_fndecl () const FINAL OVERRIDE { return m_fndecl; } - int get_stack_depth () const FINAL OVERRIDE { return m_depth; } + location_t get_location () const final override { return m_loc; } + tree get_fndecl () const final override { return m_fndecl; } + int get_stack_depth () const final override { return m_depth; } /* Additional functionality. */ @@ -141,7 +141,7 @@ public: free (m_desc); } - label_text get_desc (bool) const FINAL OVERRIDE; + label_text get_desc (bool) const final override; private: char *m_desc; @@ -175,7 +175,7 @@ public: free (m_desc); } - label_text get_desc (bool) const FINAL OVERRIDE; + label_text get_desc (bool) const final override; private: char *m_desc; @@ -190,7 +190,7 @@ public: statement_event (const gimple *stmt, tree fndecl, int depth, const program_state &dst_state); - label_text get_desc (bool) const FINAL OVERRIDE; + label_text get_desc (bool) const final override; const gimple * const m_stmt; const program_state m_dst_state; @@ -205,7 +205,7 @@ public: region_creation_event (const region *reg, location_t loc, tree fndecl, int depth); - label_text get_desc (bool) const FINAL OVERRIDE; + label_text get_desc (bool) const final override; private: const region *m_reg; @@ -221,9 +221,9 @@ public: { } - label_text get_desc (bool can_colorize) const FINAL OVERRIDE; + label_text get_desc (bool can_colorize) const final override; - bool is_function_entry_p () const FINAL OVERRIDE { return true; } + bool is_function_entry_p () const final override { return true; } }; /* Subclass of checker_event describing a state change. */ @@ -240,7 +240,7 @@ public: const svalue *origin, const program_state &dst_state); - label_text get_desc (bool can_colorize) const FINAL OVERRIDE; + label_text get_desc (bool can_colorize) const final override; function *get_dest_function () const { @@ -314,7 +314,7 @@ public: { } - label_text get_desc (bool can_colorize) const FINAL OVERRIDE; + label_text get_desc (bool can_colorize) const final override; private: label_text maybe_describe_condition (bool can_colorize) const; @@ -338,7 +338,7 @@ public: { } - label_text get_desc (bool /*can_colorize*/) const FINAL OVERRIDE + label_text get_desc (bool /*can_colorize*/) const final override { return label_text::borrow ("...to here"); } @@ -352,9 +352,9 @@ public: call_event (const exploded_edge &eedge, location_t loc, tree fndecl, int depth); - label_text get_desc (bool can_colorize) const OVERRIDE; + label_text get_desc (bool can_colorize) const override; - bool is_call_p () const FINAL OVERRIDE; + bool is_call_p () const final override; protected: tree get_caller_fndecl () const; @@ -372,9 +372,9 @@ public: return_event (const exploded_edge &eedge, location_t loc, tree fndecl, int depth); - label_text get_desc (bool can_colorize) const FINAL OVERRIDE; + label_text get_desc (bool can_colorize) const final override; - bool is_return_p () const FINAL OVERRIDE; + bool is_return_p () const final override; const supernode *m_src_snode; const supernode *m_dest_snode; @@ -393,7 +393,7 @@ public: { } - label_text get_desc (bool can_colorize) const FINAL OVERRIDE; + label_text get_desc (bool can_colorize) const final override; private: bool m_edge_sense; @@ -410,7 +410,7 @@ public: { } - label_text get_desc (bool /*can_colorize*/) const FINAL OVERRIDE + label_text get_desc (bool /*can_colorize*/) const final override { return label_text::borrow ("...to here"); } @@ -428,11 +428,11 @@ public: { } - label_text get_desc (bool can_colorize) const FINAL OVERRIDE; + label_text get_desc (bool can_colorize) const final override; void prepare_for_emission (checker_path *path, pending_diagnostic *pd, - diagnostic_event_id_t emission_id) FINAL OVERRIDE; + diagnostic_event_id_t emission_id) final override; private: const exploded_node *m_enode; @@ -477,7 +477,7 @@ public: { } - label_text get_desc (bool can_colorize) const FINAL OVERRIDE; + label_text get_desc (bool can_colorize) const final override; }; /* A concrete event subclass for rewinding from a longjmp to a setjmp, @@ -494,11 +494,11 @@ public: { } - label_text get_desc (bool can_colorize) const FINAL OVERRIDE; + label_text get_desc (bool can_colorize) const final override; void prepare_for_emission (checker_path *path, pending_diagnostic *pd, - diagnostic_event_id_t emission_id) FINAL OVERRIDE; + diagnostic_event_id_t emission_id) final override; private: diagnostic_event_id_t m_original_setjmp_event_id; @@ -520,7 +520,7 @@ public: { } - label_text get_desc (bool can_colorize) const FINAL OVERRIDE; + label_text get_desc (bool can_colorize) const final override; private: const state_machine *m_sm; @@ -537,12 +537,12 @@ public: /* Implementation of diagnostic_path vfuncs. */ - unsigned num_events () const FINAL OVERRIDE + unsigned num_events () const final override { return m_events.length (); } - const diagnostic_event & get_event (int idx) const FINAL OVERRIDE + const diagnostic_event & get_event (int idx) const final override { return *m_events[idx]; } diff --git a/gcc/analyzer/constraint-manager.cc b/gcc/analyzer/constraint-manager.cc index 9c8c604..02e8ce9 100644 --- a/gcc/analyzer/constraint-manager.cc +++ b/gcc/analyzer/constraint-manager.cc @@ -2905,7 +2905,7 @@ public: {} void on_fact (const svalue *lhs, enum tree_code code, const svalue *rhs) - FINAL OVERRIDE + final override { /* Special-case for widening. */ if (lhs->get_kind () == SK_WIDENING) @@ -2933,7 +2933,7 @@ public: } void on_ranges (const svalue *lhs_sval, - const bounded_ranges *ranges) FINAL OVERRIDE + const bounded_ranges *ranges) final override { for (const auto &iter : m_cm_b->m_bounded_ranges_constraints) { diff --git a/gcc/analyzer/diagnostic-manager.cc b/gcc/analyzer/diagnostic-manager.cc index e8a828d..e90cd00 100644 --- a/gcc/analyzer/diagnostic-manager.cc +++ b/gcc/analyzer/diagnostic-manager.cc @@ -565,7 +565,7 @@ public: } void dump_extra_info (const exploded_node *enode, - pretty_printer *pp) const FINAL OVERRIDE + pretty_printer *pp) const final override { pp_printf (pp, "sp: %i", m_sep.get_shortest_path (enode).length ()); pp_newline (pp); @@ -1430,7 +1430,7 @@ public: bool on_global_state_change (const state_machine &sm, state_machine::state_t src_sm_val, state_machine::state_t dst_sm_val) - FINAL OVERRIDE + final override { if (&sm != m_pb.get_sm ()) return false; @@ -1460,7 +1460,7 @@ public: state_machine::state_t src_sm_val, state_machine::state_t dst_sm_val, const svalue *sval, - const svalue *dst_origin_sval) FINAL OVERRIDE + const svalue *dst_origin_sval) final override { if (&sm != m_pb.get_sm ()) return false; @@ -1588,13 +1588,13 @@ struct null_assignment_sm_context : public sm_context { } - tree get_fndecl_for_call (const gcall */*call*/) FINAL OVERRIDE + tree get_fndecl_for_call (const gcall */*call*/) final override { return NULL_TREE; } state_machine::state_t get_state (const gimple *stmt ATTRIBUTE_UNUSED, - tree var) FINAL OVERRIDE + tree var) final override { const svalue *var_old_sval = m_old_state->m_region_model->get_rvalue (var, NULL); @@ -1607,7 +1607,7 @@ struct null_assignment_sm_context : public sm_context } state_machine::state_t get_state (const gimple *stmt ATTRIBUTE_UNUSED, - const svalue *sval) FINAL OVERRIDE + const svalue *sval) final override { const sm_state_map *old_smap = m_old_state->m_checker_states[m_sm_idx]; state_machine::state_t current = old_smap->get_state (sval, m_ext_state); @@ -1617,7 +1617,7 @@ struct null_assignment_sm_context : public sm_context void set_next_state (const gimple *stmt, tree var, state_machine::state_t to, - tree origin ATTRIBUTE_UNUSED) FINAL OVERRIDE + tree origin ATTRIBUTE_UNUSED) final override { state_machine::state_t from = get_state (stmt, var); if (from != m_sm.get_start_state ()) @@ -1641,7 +1641,7 @@ struct null_assignment_sm_context : public sm_context void set_next_state (const gimple *stmt, const svalue *sval, state_machine::state_t to, - tree origin ATTRIBUTE_UNUSED) FINAL OVERRIDE + tree origin ATTRIBUTE_UNUSED) final override { state_machine::state_t from = get_state (stmt, sval); if (from != m_sm.get_start_state ()) @@ -1661,41 +1661,41 @@ struct null_assignment_sm_context : public sm_context } void warn (const supernode *, const gimple *, - tree, pending_diagnostic *d) FINAL OVERRIDE + tree, pending_diagnostic *d) final override { delete d; } void warn (const supernode *, const gimple *, - const svalue *, pending_diagnostic *d) FINAL OVERRIDE + const svalue *, pending_diagnostic *d) final override { delete d; } - tree get_diagnostic_tree (tree expr) FINAL OVERRIDE + tree get_diagnostic_tree (tree expr) final override { return expr; } - tree get_diagnostic_tree (const svalue *sval) FINAL OVERRIDE + tree get_diagnostic_tree (const svalue *sval) final override { return m_new_state->m_region_model->get_representative_tree (sval); } - state_machine::state_t get_global_state () const FINAL OVERRIDE + state_machine::state_t get_global_state () const final override { return 0; } - void set_global_state (state_machine::state_t) FINAL OVERRIDE + void set_global_state (state_machine::state_t) final override { /* No-op. */ } - void on_custom_transition (custom_transition *) FINAL OVERRIDE + void on_custom_transition (custom_transition *) final override { } - tree is_zero_assignment (const gimple *stmt) FINAL OVERRIDE + tree is_zero_assignment (const gimple *stmt) final override { const gassign *assign_stmt = dyn_cast (stmt); if (!assign_stmt) @@ -1708,11 +1708,11 @@ struct null_assignment_sm_context : public sm_context return NULL_TREE; } - const program_state *get_old_program_state () const FINAL OVERRIDE + const program_state *get_old_program_state () const final override { return m_old_state; } - const program_state *get_new_program_state () const FINAL OVERRIDE + const program_state *get_new_program_state () const final override { return m_new_state; } diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc index 1638662..c59374b 100644 --- a/gcc/analyzer/engine.cc +++ b/gcc/analyzer/engine.cc @@ -318,7 +318,7 @@ public: logger *get_logger () const { return m_logger.get_logger (); } - tree get_fndecl_for_call (const gcall *call) FINAL OVERRIDE + tree get_fndecl_for_call (const gcall *call) final override { impl_region_model_context old_ctxt (m_eg, m_enode_for_diag, NULL, NULL, NULL/*m_enode->get_state ()*/, @@ -417,7 +417,7 @@ public: } void warn (const supernode *snode, const gimple *stmt, - tree var, pending_diagnostic *d) FINAL OVERRIDE + tree var, pending_diagnostic *d) final override { LOG_FUNC (get_logger ()); gcc_assert (d); // take ownership @@ -436,7 +436,7 @@ public: } void warn (const supernode *snode, const gimple *stmt, - const svalue *sval, pending_diagnostic *d) FINAL OVERRIDE + const svalue *sval, pending_diagnostic *d) final override { LOG_FUNC (get_logger ()); gcc_assert (d); // take ownership @@ -458,7 +458,7 @@ public: we can print: "double-free of 'inbuf.data'". */ - tree get_diagnostic_tree (tree expr) FINAL OVERRIDE + tree get_diagnostic_tree (tree expr) final override { /* Only for SSA_NAMEs of temporaries; otherwise, return EXPR, as it's likely to be the least surprising tree to report. */ @@ -476,29 +476,29 @@ public: return expr; } - tree get_diagnostic_tree (const svalue *sval) FINAL OVERRIDE + tree get_diagnostic_tree (const svalue *sval) final override { return m_new_state->m_region_model->get_representative_tree (sval); } - state_machine::state_t get_global_state () const FINAL OVERRIDE + state_machine::state_t get_global_state () const final override { return m_old_state->m_checker_states[m_sm_idx]->get_global_state (); } - void set_global_state (state_machine::state_t state) FINAL OVERRIDE + void set_global_state (state_machine::state_t state) final override { m_new_state->m_checker_states[m_sm_idx]->set_global_state (state); } - void on_custom_transition (custom_transition *transition) FINAL OVERRIDE + void on_custom_transition (custom_transition *transition) final override { transition->impl_transition (&m_eg, const_cast (m_enode_for_diag), m_sm_idx); } - tree is_zero_assignment (const gimple *stmt) FINAL OVERRIDE + tree is_zero_assignment (const gimple *stmt) final override { const gassign *assign_stmt = dyn_cast (stmt); if (!assign_stmt) @@ -514,22 +514,22 @@ public: return NULL_TREE; } - path_context *get_path_context () const FINAL OVERRIDE + path_context *get_path_context () const final override { return m_path_ctxt; } - bool unknown_side_effects_p () const FINAL OVERRIDE + bool unknown_side_effects_p () const final override { return m_unknown_side_effects; } - const program_state *get_old_program_state () const FINAL OVERRIDE + const program_state *get_old_program_state () const final override { return m_old_state; } - const program_state *get_new_program_state () const FINAL OVERRIDE + const program_state *get_new_program_state () const final override { return m_new_state; } @@ -557,13 +557,13 @@ public: leak_stmt_finder (const exploded_graph &eg, tree var) : m_eg (eg), m_var (var) {} - stmt_finder *clone () const FINAL OVERRIDE + stmt_finder *clone () const final override { return new leak_stmt_finder (m_eg, m_var); } const gimple *find_stmt (const exploded_path &epath) - FINAL OVERRIDE + final override { logger * const logger = m_eg.get_logger (); LOG_FUNC (logger); @@ -1545,12 +1545,12 @@ public: m_setjmp_point (setjmp_point), m_stack_pop_event (NULL) {} - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_stale_setjmp_buffer; } - bool emit (rich_location *richloc) FINAL OVERRIDE + bool emit (rich_location *richloc) final override { return warning_at (richloc, get_controlling_option (), @@ -1559,7 +1559,7 @@ public: get_user_facing_name (m_setjmp_call)); } - const char *get_kind () const FINAL OVERRIDE + const char *get_kind () const final override { return "stale_jmp_buf"; } bool operator== (const stale_jmp_buf &other) const @@ -1571,7 +1571,7 @@ public: bool maybe_add_custom_events_for_superedge (const exploded_edge &eedge, checker_path *emission_path) - FINAL OVERRIDE + final override { /* Detect exactly when the stack first becomes invalid, and issue an event then. */ @@ -2435,7 +2435,7 @@ public: { } - label_text get_desc (bool can_colorize) const FINAL OVERRIDE + label_text get_desc (bool can_colorize) const final override { return make_label_text (can_colorize, @@ -2457,21 +2457,21 @@ public: : m_fndecl (fndecl) {} - void print (pretty_printer *pp) const FINAL OVERRIDE + void print (pretty_printer *pp) const final override { pp_string (pp, "call to tainted_args function"); }; bool update_model (region_model *, const exploded_edge *, - region_model_context *) const FINAL OVERRIDE + region_model_context *) const final override { /* No-op. */ return true; } void add_events_to_path (checker_path *emission_path, - const exploded_edge &) const FINAL OVERRIDE + const exploded_edge &) const final override { emission_path->add_event (new tainted_args_function_custom_event @@ -2852,7 +2852,7 @@ public: { } - label_text get_desc (bool can_colorize) const FINAL OVERRIDE + label_text get_desc (bool can_colorize) const final override { return make_label_text (can_colorize, "field %qE of %qT" @@ -2878,7 +2878,7 @@ public: { } - label_text get_desc (bool can_colorize) const FINAL OVERRIDE + label_text get_desc (bool can_colorize) const final override { return make_label_text (can_colorize, "function %qE used as initializer for field %qE" @@ -2900,21 +2900,21 @@ public: : m_field (field), m_fndecl (fndecl), m_loc (loc) {} - void print (pretty_printer *pp) const FINAL OVERRIDE + void print (pretty_printer *pp) const final override { pp_string (pp, "call to tainted field"); }; bool update_model (region_model *, const exploded_edge *, - region_model_context *) const FINAL OVERRIDE + region_model_context *) const final override { /* No-op. */ return true; } void add_events_to_path (checker_path *emission_path, - const exploded_edge &) const FINAL OVERRIDE + const exploded_edge &) const final override { /* Show the field in the struct declaration, e.g. "(1) field 'store' is marked with '__attribute__((tainted_args))'" */ @@ -3611,7 +3611,7 @@ public: } void - bifurcate (custom_edge_info *info) FINAL OVERRIDE + bifurcate (custom_edge_info *info) final override { if (m_state_at_bifurcation) /* Verify that the state at bifurcation is consistent when we @@ -3627,12 +3627,12 @@ public: m_custom_eedge_infos.safe_push (info); } - void terminate_path () FINAL OVERRIDE + void terminate_path () final override { m_terminate_path = true; } - bool terminate_path_p () const FINAL OVERRIDE + bool terminate_path_p () const final override { return m_terminate_path; } @@ -4668,7 +4668,7 @@ public: // TODO: dtor? - void dump_dot (graphviz_out *gv, const dump_args_t &args) const FINAL OVERRIDE + void dump_dot (graphviz_out *gv, const dump_args_t &args) const final override { gv->println ("subgraph \"cluster_supernode_%i\" {", m_supernode->m_index); gv->indent (); @@ -4687,7 +4687,7 @@ public: gv->println ("}"); } - void add_node (exploded_node *en) FINAL OVERRIDE + void add_node (exploded_node *en) final override { m_enodes.safe_push (en); } @@ -4725,7 +4725,7 @@ public: delete (*iter).second; } - void dump_dot (graphviz_out *gv, const dump_args_t &args) const FINAL OVERRIDE + void dump_dot (graphviz_out *gv, const dump_args_t &args) const final override { const char *funcname = function_name (m_fun); @@ -4757,7 +4757,7 @@ public: gv->println ("}"); } - void add_node (exploded_node *en) FINAL OVERRIDE + void add_node (exploded_node *en) final override { const supernode *supernode = en->get_supernode (); gcc_assert (supernode); @@ -4872,7 +4872,7 @@ public: delete (*iter).second; } - void dump_dot (graphviz_out *gv, const dump_args_t &args) const FINAL OVERRIDE + void dump_dot (graphviz_out *gv, const dump_args_t &args) const final override { int i; exploded_node *enode; @@ -4893,7 +4893,7 @@ public: child_cluster->dump_dot (gv, args); } - void add_node (exploded_node *en) FINAL OVERRIDE + void add_node (exploded_node *en) final override { function *fun = en->get_function (); if (!fun) @@ -4941,7 +4941,7 @@ class enode_label : public range_label exploded_node *enode) : m_ext_state (ext_state), m_enode (enode) {} - label_text get_text (unsigned) const FINAL OVERRIDE + label_text get_text (unsigned) const final override { pretty_printer pp; pp_format_decoder (&pp) = default_tree_printer; @@ -5243,7 +5243,7 @@ public: gcc_assert (fun); } - void dump_dot (graphviz_out *gv, const dump_args_t &args) const FINAL OVERRIDE + void dump_dot (graphviz_out *gv, const dump_args_t &args) const final override { pretty_printer *pp = gv->get_pp (); @@ -5348,7 +5348,7 @@ public: {} void dump_dot (graphviz_out *gv, const dump_args_t &) const - FINAL OVERRIDE + final override { pretty_printer *pp = gv->get_pp (); @@ -5491,7 +5491,7 @@ public: /* Show exploded nodes for BEFORE_SUPERNODE points before N. */ bool add_node_annotations (graphviz_out *gv, const supernode &n, bool within_table) - const FINAL OVERRIDE + const final override { if (!within_table) return false; @@ -5525,7 +5525,7 @@ public: /* Show exploded nodes for STMT. */ void add_stmt_annotations (graphviz_out *gv, const gimple *stmt, bool within_row) - const FINAL OVERRIDE + const final override { if (!within_row) return; @@ -5556,7 +5556,7 @@ public: /* Show exploded nodes for AFTER_SUPERNODE points after N. */ bool add_after_node_annotations (graphviz_out *gv, const supernode &n) - const FINAL OVERRIDE + const final override { gv->begin_tr (); pretty_printer *pp = gv->get_pp (); @@ -5717,12 +5717,12 @@ public: m_logger (logger) {} - void register_state_machine (state_machine *sm) FINAL OVERRIDE + void register_state_machine (state_machine *sm) final override { m_checkers->safe_push (sm); } - logger *get_logger () const FINAL OVERRIDE + logger *get_logger () const final override { return m_logger; } diff --git a/gcc/analyzer/exploded-graph.h b/gcc/analyzer/exploded-graph.h index 2dcdcc5..101f4f9 100644 --- a/gcc/analyzer/exploded-graph.h +++ b/gcc/analyzer/exploded-graph.h @@ -47,12 +47,12 @@ class impl_region_model_context : public region_model_context uncertainty_t *uncertainty, logger *logger = NULL); - bool warn (pending_diagnostic *d) FINAL OVERRIDE; - void add_note (pending_note *pn) FINAL OVERRIDE; - void on_svalue_leak (const svalue *) OVERRIDE; + bool warn (pending_diagnostic *d) final override; + void add_note (pending_note *pn) final override; + void on_svalue_leak (const svalue *) override; void on_liveness_change (const svalue_set &live_svalues, - const region_model *model) FINAL OVERRIDE; - logger *get_logger () FINAL OVERRIDE + const region_model *model) final override; + logger *get_logger () final override { return m_logger.get_logger (); } @@ -63,35 +63,35 @@ class impl_region_model_context : public region_model_context void on_condition (const svalue *lhs, enum tree_code op, - const svalue *rhs) FINAL OVERRIDE; + const svalue *rhs) final override; - void on_unknown_change (const svalue *sval, bool is_mutable) FINAL OVERRIDE; + void on_unknown_change (const svalue *sval, bool is_mutable) final override; - void on_phi (const gphi *phi, tree rhs) FINAL OVERRIDE; + void on_phi (const gphi *phi, tree rhs) final override; void on_unexpected_tree_code (tree t, - const dump_location_t &loc) FINAL OVERRIDE; + const dump_location_t &loc) final override; - void on_escaped_function (tree fndecl) FINAL OVERRIDE; + void on_escaped_function (tree fndecl) final override; - uncertainty_t *get_uncertainty () FINAL OVERRIDE; + uncertainty_t *get_uncertainty () final override; - void purge_state_involving (const svalue *sval) FINAL OVERRIDE; + void purge_state_involving (const svalue *sval) final override; - void bifurcate (custom_edge_info *info) FINAL OVERRIDE; - void terminate_path () FINAL OVERRIDE; - const extrinsic_state *get_ext_state () const FINAL OVERRIDE + void bifurcate (custom_edge_info *info) final override; + void terminate_path () final override; + const extrinsic_state *get_ext_state () const final override { return &m_ext_state; } bool get_malloc_map (sm_state_map **out_smap, const state_machine **out_sm, - unsigned *out_sm_idx) FINAL OVERRIDE; + unsigned *out_sm_idx) final override; bool get_taint_map (sm_state_map **out_smap, const state_machine **out_sm, - unsigned *out_sm_idx) FINAL OVERRIDE; + unsigned *out_sm_idx) final override; - const gimple *get_stmt () const OVERRIDE { return m_stmt; } + const gimple *get_stmt () const override { return m_stmt; } exploded_graph *m_eg; log_user m_logger; @@ -205,7 +205,7 @@ class exploded_node : public dnode const char * get_dot_fillcolor () const; void dump_dot (graphviz_out *gv, const dump_args_t &args) - const FINAL OVERRIDE; + const final override; void dump_dot_id (pretty_printer *pp) const; void dump_to_pp (pretty_printer *pp, const extrinsic_state &ext_state) const; @@ -343,7 +343,7 @@ class exploded_edge : public dedge custom_edge_info *custom_info); ~exploded_edge (); void dump_dot (graphviz_out *gv, const dump_args_t &args) - const FINAL OVERRIDE; + const final override; void dump_dot_label (pretty_printer *pp) const; json::object *to_json () const; @@ -374,7 +374,7 @@ public: m_is_returning_call (is_returning_call) {} - void print (pretty_printer *pp) const FINAL OVERRIDE + void print (pretty_printer *pp) const final override { if (m_is_returning_call) pp_string (pp, "dynamic_return"); @@ -384,10 +384,10 @@ public: bool update_model (region_model *model, const exploded_edge *eedge, - region_model_context *ctxt) const FINAL OVERRIDE; + region_model_context *ctxt) const final override; void add_events_to_path (checker_path *emission_path, - const exploded_edge &eedge) const FINAL OVERRIDE; + const exploded_edge &eedge) const final override; private: const gcall *m_dynamic_call; const bool m_is_returning_call; @@ -406,17 +406,17 @@ public: m_longjmp_call (longjmp_call) {} - void print (pretty_printer *pp) const FINAL OVERRIDE + void print (pretty_printer *pp) const final override { pp_string (pp, "rewind"); } bool update_model (region_model *model, const exploded_edge *eedge, - region_model_context *ctxt) const FINAL OVERRIDE; + region_model_context *ctxt) const final override; void add_events_to_path (checker_path *emission_path, - const exploded_edge &eedge) const FINAL OVERRIDE; + const exploded_edge &eedge) const final override; const program_point &get_setjmp_point () const { diff --git a/gcc/analyzer/feasible-graph.h b/gcc/analyzer/feasible-graph.h index f1868af..2530119 100644 --- a/gcc/analyzer/feasible-graph.h +++ b/gcc/analyzer/feasible-graph.h @@ -91,7 +91,7 @@ public: } void dump_dot (graphviz_out *gv, - const dump_args_t &args) const FINAL OVERRIDE; + const dump_args_t &args) const final override; const feasibility_state &get_state () const { return m_state; } const region_model &get_model () const { return m_state.get_model (); } @@ -123,7 +123,7 @@ public: ~infeasible_node () { delete m_rc; } void dump_dot (graphviz_out *gv, - const dump_args_t &args) const FINAL OVERRIDE; + const dump_args_t &args) const final override; private: rejected_constraint *m_rc; @@ -135,7 +135,7 @@ class base_feasible_edge : public dedge { public: void dump_dot (graphviz_out *gv, - const dump_args_t &args) const FINAL OVERRIDE; + const dump_args_t &args) const final override; const exploded_edge *get_inner_edge () const { return m_inner_edge; } diff --git a/gcc/analyzer/pending-diagnostic.h b/gcc/analyzer/pending-diagnostic.h index 17db9fe..a273f89 100644 --- a/gcc/analyzer/pending-diagnostic.h +++ b/gcc/analyzer/pending-diagnostic.h @@ -331,7 +331,7 @@ class pending_diagnostic_subclass : public pending_diagnostic { public: bool subclass_equal_p (const pending_diagnostic &base_other) const - FINAL OVERRIDE + final override { const Subclass &other = (const Subclass &)base_other; return *(const Subclass*)this == other; @@ -374,7 +374,7 @@ class pending_note_subclass : public pending_note { public: bool subclass_equal_p (const pending_note &base_other) const - FINAL OVERRIDE + final override { const Subclass &other = (const Subclass &)base_other; return *(const Subclass*)this == other; diff --git a/gcc/analyzer/region-model-impl-calls.cc b/gcc/analyzer/region-model-impl-calls.cc index a76caf7..55d6fa7 100644 --- a/gcc/analyzer/region-model-impl-calls.cc +++ b/gcc/analyzer/region-model-impl-calls.cc @@ -621,7 +621,7 @@ region_model::impl_call_realloc (const call_details &cd) bool update_model (region_model *model, const exploded_edge *, - region_model_context *ctxt) const FINAL OVERRIDE + region_model_context *ctxt) const final override { /* Return NULL; everything else is unchanged. */ const call_details cd (get_call_details (model, ctxt)); @@ -647,7 +647,7 @@ region_model::impl_call_realloc (const call_details &cd) { } - label_text get_desc (bool can_colorize) const FINAL OVERRIDE + label_text get_desc (bool can_colorize) const final override { return make_label_text (can_colorize, "when %qE succeeds, without moving buffer", @@ -656,7 +656,7 @@ region_model::impl_call_realloc (const call_details &cd) bool update_model (region_model *model, const exploded_edge *, - region_model_context *ctxt) const FINAL OVERRIDE + region_model_context *ctxt) const final override { /* Update size of buffer and return the ptr unchanged. */ const call_details cd (get_call_details (model, ctxt)); @@ -699,7 +699,7 @@ region_model::impl_call_realloc (const call_details &cd) { } - label_text get_desc (bool can_colorize) const FINAL OVERRIDE + label_text get_desc (bool can_colorize) const final override { return make_label_text (can_colorize, "when %qE succeeds, moving buffer", @@ -707,7 +707,7 @@ region_model::impl_call_realloc (const call_details &cd) } bool update_model (region_model *model, const exploded_edge *, - region_model_context *ctxt) const FINAL OVERRIDE + region_model_context *ctxt) const final override { const call_details cd (get_call_details (model, ctxt)); const svalue *old_ptr_sval = cd.get_arg_svalue (0); @@ -800,7 +800,7 @@ region_model::impl_call_strchr (const call_details &cd) { } - label_text get_desc (bool can_colorize) const FINAL OVERRIDE + label_text get_desc (bool can_colorize) const final override { if (m_found) return make_label_text (can_colorize, @@ -814,7 +814,7 @@ region_model::impl_call_strchr (const call_details &cd) bool update_model (region_model *model, const exploded_edge *, - region_model_context *ctxt) const FINAL OVERRIDE + region_model_context *ctxt) const final override { const call_details cd (get_call_details (model, ctxt)); if (tree lhs_type = cd.get_lhs_type ()) diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc index de221c3..6f6a061 100644 --- a/gcc/analyzer/region-model.cc +++ b/gcc/analyzer/region-model.cc @@ -465,9 +465,9 @@ public: m_src_region (src_region) {} - const char *get_kind () const FINAL OVERRIDE { return "poisoned_value_diagnostic"; } + const char *get_kind () const final override { return "poisoned_value_diagnostic"; } - bool use_of_uninit_p () const FINAL OVERRIDE + bool use_of_uninit_p () const final override { return m_pkind == POISON_KIND_UNINIT; } @@ -479,7 +479,7 @@ public: && m_src_region == other.m_src_region); } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { switch (m_pkind) { @@ -494,7 +494,7 @@ public: } } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { switch (m_pkind) { @@ -530,7 +530,7 @@ public: } } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { switch (m_pkind) { @@ -549,7 +549,7 @@ public: } } - void mark_interesting_stuff (interesting_t *interest) FINAL OVERRIDE + void mark_interesting_stuff (interesting_t *interest) final override { if (m_src_region) interest->add_region_creation (m_src_region); @@ -572,7 +572,7 @@ public: : m_assign (assign), m_count_cst (count_cst) {} - const char *get_kind () const FINAL OVERRIDE + const char *get_kind () const final override { return "shift_count_negative_diagnostic"; } @@ -583,18 +583,18 @@ public: && same_tree_p (m_count_cst, other.m_count_cst)); } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_shift_count_negative; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { return warning_at (rich_loc, get_controlling_option (), "shift by negative count (%qE)", m_count_cst); } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { return ev.formatted_print ("shift by negative amount here (%qE)", m_count_cst); } @@ -618,7 +618,7 @@ public: m_count_cst (count_cst) {} - const char *get_kind () const FINAL OVERRIDE + const char *get_kind () const final override { return "shift_count_overflow_diagnostic"; } @@ -630,19 +630,19 @@ public: && same_tree_p (m_count_cst, other.m_count_cst)); } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_shift_count_overflow; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { return warning_at (rich_loc, get_controlling_option (), "shift by count (%qE) >= precision of type (%qi)", m_count_cst, m_operand_precision); } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { return ev.formatted_print ("shift by count %qE here", m_count_cst); } @@ -1117,18 +1117,18 @@ class dump_path_diagnostic : public pending_diagnostic_subclass { public: - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return 0; } - bool emit (rich_location *richloc) FINAL OVERRIDE + bool emit (rich_location *richloc) final override { inform (richloc, "path"); return true; } - const char *get_kind () const FINAL OVERRIDE { return "dump_path_diagnostic"; } + const char *get_kind () const final override { return "dump_path_diagnostic"; } bool operator== (const dump_path_diagnostic &) const { @@ -1638,7 +1638,7 @@ public: { } - const char *get_kind () const FINAL OVERRIDE { return "reason_attr_access"; } + const char *get_kind () const final override { return "reason_attr_access"; } void emit () const { @@ -1719,7 +1719,7 @@ check_external_function_for_access_attr (const gcall *call, m_access (access) { } - pending_note *make_note () FINAL OVERRIDE + pending_note *make_note () final override { return new reason_attr_access (m_callee_fndecl, m_access); } @@ -2566,7 +2566,7 @@ public: : m_reg (reg), m_decl (decl) {} - const char *get_kind () const FINAL OVERRIDE + const char *get_kind () const final override { return "write_to_const_diagnostic"; } @@ -2577,12 +2577,12 @@ public: && m_decl == other.m_decl); } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_write_to_const; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { auto_diagnostic_group d; bool warned; @@ -2606,7 +2606,7 @@ public: return warned; } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { switch (m_reg->get_kind ()) { @@ -2635,7 +2635,7 @@ public: : m_reg (reg) {} - const char *get_kind () const FINAL OVERRIDE + const char *get_kind () const final override { return "write_to_string_literal_diagnostic"; } @@ -2645,12 +2645,12 @@ public: return m_reg == other.m_reg; } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_write_to_string_literal; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { return warning_at (rich_loc, get_controlling_option (), "write to string literal"); @@ -2658,7 +2658,7 @@ public: but it is not available at this point. */ } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { return ev.formatted_print ("write to string literal here"); } diff --git a/gcc/analyzer/region-model.h b/gcc/analyzer/region-model.h index 4e5cb46..1bfa56a 100644 --- a/gcc/analyzer/region-model.h +++ b/gcc/analyzer/region-model.h @@ -970,52 +970,52 @@ class region_model_context class noop_region_model_context : public region_model_context { public: - bool warn (pending_diagnostic *) OVERRIDE { return false; } - void add_note (pending_note *pn) OVERRIDE; - void on_svalue_leak (const svalue *) OVERRIDE {} + bool warn (pending_diagnostic *) override { return false; } + void add_note (pending_note *pn) override; + void on_svalue_leak (const svalue *) override {} void on_liveness_change (const svalue_set &, - const region_model *) OVERRIDE {} - logger *get_logger () OVERRIDE { return NULL; } + const region_model *) override {} + logger *get_logger () override { return NULL; } void on_condition (const svalue *lhs ATTRIBUTE_UNUSED, enum tree_code op ATTRIBUTE_UNUSED, - const svalue *rhs ATTRIBUTE_UNUSED) OVERRIDE + const svalue *rhs ATTRIBUTE_UNUSED) override { } void on_unknown_change (const svalue *sval ATTRIBUTE_UNUSED, - bool is_mutable ATTRIBUTE_UNUSED) OVERRIDE + bool is_mutable ATTRIBUTE_UNUSED) override { } void on_phi (const gphi *phi ATTRIBUTE_UNUSED, - tree rhs ATTRIBUTE_UNUSED) OVERRIDE + tree rhs ATTRIBUTE_UNUSED) override { } - void on_unexpected_tree_code (tree, const dump_location_t &) OVERRIDE {} + void on_unexpected_tree_code (tree, const dump_location_t &) override {} - void on_escaped_function (tree) OVERRIDE {} + void on_escaped_function (tree) override {} - uncertainty_t *get_uncertainty () OVERRIDE { return NULL; } + uncertainty_t *get_uncertainty () override { return NULL; } - void purge_state_involving (const svalue *sval ATTRIBUTE_UNUSED) OVERRIDE {} + void purge_state_involving (const svalue *sval ATTRIBUTE_UNUSED) override {} - void bifurcate (custom_edge_info *info) OVERRIDE; - void terminate_path () OVERRIDE; + void bifurcate (custom_edge_info *info) override; + void terminate_path () override; - const extrinsic_state *get_ext_state () const OVERRIDE { return NULL; } + const extrinsic_state *get_ext_state () const override { return NULL; } bool get_malloc_map (sm_state_map **, const state_machine **, - unsigned *) OVERRIDE + unsigned *) override { return false; } bool get_taint_map (sm_state_map **, const state_machine **, - unsigned *) OVERRIDE + unsigned *) override { return false; } - const gimple *get_stmt () const OVERRIDE { return NULL; } + const gimple *get_stmt () const override { return NULL; } }; /* A subclass of region_model_context for determining if operations fail @@ -1027,7 +1027,7 @@ public: tentative_region_model_context () : m_num_unexpected_codes (0) {} void on_unexpected_tree_code (tree, const dump_location_t &) - FINAL OVERRIDE + final override { m_num_unexpected_codes++; } @@ -1044,100 +1044,100 @@ private: class region_model_context_decorator : public region_model_context { public: - bool warn (pending_diagnostic *d) OVERRIDE + bool warn (pending_diagnostic *d) override { return m_inner->warn (d); } - void add_note (pending_note *pn) OVERRIDE + void add_note (pending_note *pn) override { m_inner->add_note (pn); } - void on_svalue_leak (const svalue *sval) OVERRIDE + void on_svalue_leak (const svalue *sval) override { m_inner->on_svalue_leak (sval); } void on_liveness_change (const svalue_set &live_svalues, - const region_model *model) OVERRIDE + const region_model *model) override { m_inner->on_liveness_change (live_svalues, model); } - logger *get_logger () OVERRIDE + logger *get_logger () override { return m_inner->get_logger (); } void on_condition (const svalue *lhs, enum tree_code op, - const svalue *rhs) OVERRIDE + const svalue *rhs) override { m_inner->on_condition (lhs, op, rhs); } - void on_unknown_change (const svalue *sval, bool is_mutable) OVERRIDE + void on_unknown_change (const svalue *sval, bool is_mutable) override { m_inner->on_unknown_change (sval, is_mutable); } - void on_phi (const gphi *phi, tree rhs) OVERRIDE + void on_phi (const gphi *phi, tree rhs) override { m_inner->on_phi (phi, rhs); } void on_unexpected_tree_code (tree t, - const dump_location_t &loc) OVERRIDE + const dump_location_t &loc) override { m_inner->on_unexpected_tree_code (t, loc); } - void on_escaped_function (tree fndecl) OVERRIDE + void on_escaped_function (tree fndecl) override { m_inner->on_escaped_function (fndecl); } - uncertainty_t *get_uncertainty () OVERRIDE + uncertainty_t *get_uncertainty () override { return m_inner->get_uncertainty (); } - void purge_state_involving (const svalue *sval) OVERRIDE + void purge_state_involving (const svalue *sval) override { m_inner->purge_state_involving (sval); } - void bifurcate (custom_edge_info *info) OVERRIDE + void bifurcate (custom_edge_info *info) override { m_inner->bifurcate (info); } - void terminate_path () OVERRIDE + void terminate_path () override { m_inner->terminate_path (); } - const extrinsic_state *get_ext_state () const OVERRIDE + const extrinsic_state *get_ext_state () const override { return m_inner->get_ext_state (); } bool get_malloc_map (sm_state_map **out_smap, const state_machine **out_sm, - unsigned *out_sm_idx) OVERRIDE + unsigned *out_sm_idx) override { return m_inner->get_malloc_map (out_smap, out_sm, out_sm_idx); } bool get_taint_map (sm_state_map **out_smap, const state_machine **out_sm, - unsigned *out_sm_idx) OVERRIDE + unsigned *out_sm_idx) override { return m_inner->get_taint_map (out_smap, out_sm, out_sm_idx); } - const gimple *get_stmt () const OVERRIDE + const gimple *get_stmt () const override { return m_inner->get_stmt (); } @@ -1158,7 +1158,7 @@ protected: class note_adding_context : public region_model_context_decorator { public: - bool warn (pending_diagnostic *d) OVERRIDE + bool warn (pending_diagnostic *d) override { if (m_inner->warn (d)) { @@ -1248,7 +1248,7 @@ public: m_lhs (lhs), m_op (op), m_rhs (rhs) {} - void dump_to_pp (pretty_printer *pp) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp) const final override; tree m_lhs; enum tree_code m_op; @@ -1264,7 +1264,7 @@ public: m_expr (expr), m_ranges (ranges) {} - void dump_to_pp (pretty_printer *pp) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp) const final override; private: tree m_expr; @@ -1305,7 +1305,7 @@ using namespace ::selftest; class test_region_model_context : public noop_region_model_context { public: - bool warn (pending_diagnostic *d) FINAL OVERRIDE + bool warn (pending_diagnostic *d) final override { m_diagnostics.safe_push (d); return true; @@ -1314,7 +1314,7 @@ public: unsigned get_num_diagnostics () const { return m_diagnostics.length (); } void on_unexpected_tree_code (tree t, const dump_location_t &) - FINAL OVERRIDE + final override { internal_error ("unhandled tree code: %qs", get_tree_code_name (TREE_CODE (t))); diff --git a/gcc/analyzer/region.h b/gcc/analyzer/region.h index d32110b..60d8149 100644 --- a/gcc/analyzer/region.h +++ b/gcc/analyzer/region.h @@ -306,13 +306,13 @@ public: ~frame_region (); /* region vfuncs. */ - enum region_kind get_kind () const FINAL OVERRIDE { return RK_FRAME; } - const frame_region * dyn_cast_frame_region () const FINAL OVERRIDE + enum region_kind get_kind () const final override { return RK_FRAME; } + const frame_region * dyn_cast_frame_region () const final override { return this; } - void accept (visitor *v) const FINAL OVERRIDE; - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; + void accept (visitor *v) const final override; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; /* Accessors. */ const frame_region *get_calling_frame () const { return m_calling_frame; } @@ -371,8 +371,8 @@ class globals_region : public space_region {} /* region vfuncs. */ - enum region_kind get_kind () const FINAL OVERRIDE { return RK_GLOBALS; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; + enum region_kind get_kind () const final override { return RK_GLOBALS; } + void dump_to_pp (pretty_printer *pp, bool simple) const final override; }; } // namespace ana @@ -398,8 +398,8 @@ public: {} /* region vfuncs. */ - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; - enum region_kind get_kind () const FINAL OVERRIDE { return RK_CODE; } + void dump_to_pp (pretty_printer *pp, bool simple) const final override; + enum region_kind get_kind () const final override { return RK_CODE; } const region *get_element (region_model *model, const svalue *index, @@ -432,10 +432,10 @@ public: } /* region vfuncs. */ - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; - enum region_kind get_kind () const FINAL OVERRIDE { return RK_FUNCTION; } + void dump_to_pp (pretty_printer *pp, bool simple) const final override; + enum region_kind get_kind () const final override { return RK_FUNCTION; } const function_region * - dyn_cast_function_region () const FINAL OVERRIDE{ return this; } + dyn_cast_function_region () const final override{ return this; } tree get_fndecl () const { return m_fndecl; } @@ -472,8 +472,8 @@ public: } /* region vfuncs. */ - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; - enum region_kind get_kind () const FINAL OVERRIDE { return RK_LABEL; } + void dump_to_pp (pretty_printer *pp, bool simple) const final override; + enum region_kind get_kind () const final override { return RK_LABEL; } tree get_label () const { return m_label; } @@ -503,9 +503,9 @@ public: : space_region (id, parent) {} - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; - enum region_kind get_kind () const FINAL OVERRIDE { return RK_STACK; } + enum region_kind get_kind () const final override { return RK_STACK; } }; } // namespace ana @@ -530,8 +530,8 @@ public: : space_region (id, parent) {} - enum region_kind get_kind () const FINAL OVERRIDE { return RK_HEAP; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; + enum region_kind get_kind () const final override { return RK_HEAP; } + void dump_to_pp (pretty_printer *pp, bool simple) const final override; }; } // namespace ana @@ -555,8 +555,8 @@ class root_region : public region public: root_region (unsigned id); - enum region_kind get_kind () const FINAL OVERRIDE { return RK_ROOT; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; + enum region_kind get_kind () const final override { return RK_ROOT; } + void dump_to_pp (pretty_printer *pp, bool simple) const final override; }; } // namespace ana @@ -614,11 +614,11 @@ public: symbolic_region (unsigned id, region *parent, const svalue *sval_ptr); const symbolic_region * - dyn_cast_symbolic_region () const FINAL OVERRIDE { return this; } + dyn_cast_symbolic_region () const final override { return this; } - enum region_kind get_kind () const FINAL OVERRIDE { return RK_SYMBOLIC; } - void accept (visitor *v) const FINAL OVERRIDE; - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; + enum region_kind get_kind () const final override { return RK_SYMBOLIC; } + void accept (visitor *v) const final override; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; const svalue *get_pointer () const { return m_sval_ptr; } @@ -656,13 +656,13 @@ public: m_tracked (calc_tracked_p (decl)) {} - enum region_kind get_kind () const FINAL OVERRIDE { return RK_DECL; } + enum region_kind get_kind () const final override { return RK_DECL; } const decl_region * - dyn_cast_decl_region () const FINAL OVERRIDE { return this; } + dyn_cast_decl_region () const final override { return this; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; - bool tracked_p () const FINAL OVERRIDE { return m_tracked; } + bool tracked_p () const final override { return m_tracked; } tree get_decl () const { return m_decl; } int get_stack_depth () const; @@ -738,15 +738,15 @@ public: m_field (field) {} - enum region_kind get_kind () const FINAL OVERRIDE { return RK_FIELD; } + enum region_kind get_kind () const final override { return RK_FIELD; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; const field_region * - dyn_cast_field_region () const FINAL OVERRIDE { return this; } + dyn_cast_field_region () const final override { return this; } tree get_field () const { return m_field; } - bool get_relative_concrete_offset (bit_offset_t *out) const FINAL OVERRIDE; + bool get_relative_concrete_offset (bit_offset_t *out) const final override; private: tree m_field; @@ -819,18 +819,18 @@ public: m_index (index) {} - enum region_kind get_kind () const FINAL OVERRIDE { return RK_ELEMENT; } + enum region_kind get_kind () const final override { return RK_ELEMENT; } const element_region * - dyn_cast_element_region () const FINAL OVERRIDE { return this; } + dyn_cast_element_region () const final override { return this; } - void accept (visitor *v) const FINAL OVERRIDE; + void accept (visitor *v) const final override; - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; const svalue *get_index () const { return m_index; } virtual bool - get_relative_concrete_offset (bit_offset_t *out) const FINAL OVERRIDE; + get_relative_concrete_offset (bit_offset_t *out) const final override; private: const svalue *m_index; @@ -904,17 +904,17 @@ public: m_byte_offset (byte_offset) {} - enum region_kind get_kind () const FINAL OVERRIDE { return RK_OFFSET; } + enum region_kind get_kind () const final override { return RK_OFFSET; } const offset_region * - dyn_cast_offset_region () const FINAL OVERRIDE { return this; } + dyn_cast_offset_region () const final override { return this; } - void accept (visitor *v) const FINAL OVERRIDE; + void accept (visitor *v) const final override; - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; const svalue *get_byte_offset () const { return m_byte_offset; } - bool get_relative_concrete_offset (bit_offset_t *out) const FINAL OVERRIDE; + bool get_relative_concrete_offset (bit_offset_t *out) const final override; private: const svalue *m_byte_offset; @@ -992,19 +992,19 @@ public: m_byte_size_sval (byte_size_sval) {} - enum region_kind get_kind () const FINAL OVERRIDE { return RK_SIZED; } + enum region_kind get_kind () const final override { return RK_SIZED; } const sized_region * - dyn_cast_sized_region () const FINAL OVERRIDE { return this; } + dyn_cast_sized_region () const final override { return this; } - void accept (visitor *v) const FINAL OVERRIDE; + void accept (visitor *v) const final override; - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; - bool get_byte_size (byte_size_t *out) const FINAL OVERRIDE; - bool get_bit_size (bit_size_t *out) const FINAL OVERRIDE; + bool get_byte_size (byte_size_t *out) const final override; + bool get_bit_size (bit_size_t *out) const final override; const svalue * - get_byte_size_sval (region_model_manager *) const FINAL OVERRIDE + get_byte_size_sval (region_model_manager *) const final override { return m_byte_size_sval; } @@ -1074,11 +1074,11 @@ public: m_original_region (original_region) {} - enum region_kind get_kind () const FINAL OVERRIDE { return RK_CAST; } + enum region_kind get_kind () const final override { return RK_CAST; } const cast_region * - dyn_cast_cast_region () const FINAL OVERRIDE { return this; } - void accept (visitor *v) const FINAL OVERRIDE; - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; + dyn_cast_cast_region () const final override { return this; } + void accept (visitor *v) const final override; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; const region *get_original_region () const { return m_original_region; } @@ -1115,9 +1115,9 @@ public: {} enum region_kind - get_kind () const FINAL OVERRIDE { return RK_HEAP_ALLOCATED; } + get_kind () const final override { return RK_HEAP_ALLOCATED; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; }; /* An untyped region dynamically allocated on the stack via "alloca". */ @@ -1129,9 +1129,9 @@ public: : region (complexity (parent), id, parent, NULL_TREE) {} - enum region_kind get_kind () const FINAL OVERRIDE { return RK_ALLOCA; } + enum region_kind get_kind () const final override { return RK_ALLOCA; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; }; /* A region for a STRING_CST. */ @@ -1145,11 +1145,11 @@ public: {} const string_region * - dyn_cast_string_region () const FINAL OVERRIDE { return this; } + dyn_cast_string_region () const final override { return this; } - enum region_kind get_kind () const FINAL OVERRIDE { return RK_STRING; } + enum region_kind get_kind () const final override { return RK_STRING; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; tree get_string_cst () const { return m_string_cst; } @@ -1220,18 +1220,18 @@ public: {} const bit_range_region * - dyn_cast_bit_range_region () const FINAL OVERRIDE { return this; } + dyn_cast_bit_range_region () const final override { return this; } - enum region_kind get_kind () const FINAL OVERRIDE { return RK_BIT_RANGE; } + enum region_kind get_kind () const final override { return RK_BIT_RANGE; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; const bit_range &get_bits () const { return m_bits; } - bool get_byte_size (byte_size_t *out) const FINAL OVERRIDE; - bool get_bit_size (bit_size_t *out) const FINAL OVERRIDE; - const svalue *get_byte_size_sval (region_model_manager *mgr) const FINAL OVERRIDE; - bool get_relative_concrete_offset (bit_offset_t *out) const FINAL OVERRIDE; + bool get_byte_size (byte_size_t *out) const final override; + bool get_bit_size (bit_size_t *out) const final override; + const svalue *get_byte_size_sval (region_model_manager *mgr) const final override; + bool get_relative_concrete_offset (bit_offset_t *out) const final override; private: bit_range m_bits; @@ -1305,11 +1305,11 @@ public: {} const var_arg_region * - dyn_cast_var_arg_region () const FINAL OVERRIDE { return this; } + dyn_cast_var_arg_region () const final override { return this; } - enum region_kind get_kind () const FINAL OVERRIDE { return RK_VAR_ARG; } + enum region_kind get_kind () const final override { return RK_VAR_ARG; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; const frame_region *get_frame_region () const; unsigned get_index () const { return m_idx; } @@ -1345,9 +1345,9 @@ public: : region (complexity (parent), id, parent, type) {} - enum region_kind get_kind () const FINAL OVERRIDE { return RK_UNKNOWN; } + enum region_kind get_kind () const final override { return RK_UNKNOWN; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; }; } // namespace ana diff --git a/gcc/analyzer/sm-file.cc b/gcc/analyzer/sm-file.cc index 3a45e62..e9b5b8b 100644 --- a/gcc/analyzer/sm-file.cc +++ b/gcc/analyzer/sm-file.cc @@ -57,10 +57,10 @@ class fileptr_state_machine : public state_machine public: fileptr_state_machine (logger *logger); - bool inherited_state_p () const FINAL OVERRIDE { return false; } + bool inherited_state_p () const final override { return false; } state_machine::state_t - get_default_state (const svalue *sval) const FINAL OVERRIDE + get_default_state (const svalue *sval) const final override { if (tree cst = sval->maybe_get_constant ()) { @@ -72,17 +72,17 @@ public: bool on_stmt (sm_context *sm_ctxt, const supernode *node, - const gimple *stmt) const FINAL OVERRIDE; + const gimple *stmt) const final override; void on_condition (sm_context *sm_ctxt, const supernode *node, const gimple *stmt, const svalue *lhs, enum tree_code op, - const svalue *rhs) const FINAL OVERRIDE; + const svalue *rhs) const final override; - bool can_purge_p (state_t s) const FINAL OVERRIDE; - pending_diagnostic *on_leak (tree var) const FINAL OVERRIDE; + bool can_purge_p (state_t s) const final override; + pending_diagnostic *on_leak (tree var) const final override; /* State for a FILE * returned from fopen that hasn't been checked for NULL. @@ -111,13 +111,13 @@ public: : m_sm (sm), m_arg (arg) {} - bool subclass_equal_p (const pending_diagnostic &base_other) const OVERRIDE + bool subclass_equal_p (const pending_diagnostic &base_other) const override { return same_tree_p (m_arg, ((const file_diagnostic &)base_other).m_arg); } label_text describe_state_change (const evdesc::state_change &change) - OVERRIDE + override { if (change.m_old_state == m_sm.get_start_state () && change.m_new_state == m_sm.m_unchecked) @@ -155,14 +155,14 @@ public: : file_diagnostic (sm, arg) {} - const char *get_kind () const FINAL OVERRIDE { return "double_fclose"; } + const char *get_kind () const final override { return "double_fclose"; } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_double_fclose; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { return warning_at (rich_loc, get_controlling_option (), "double % of FILE %qE", @@ -170,7 +170,7 @@ public: } label_text describe_state_change (const evdesc::state_change &change) - OVERRIDE + override { if (change.m_new_state == m_sm.m_closed) { @@ -180,7 +180,7 @@ public: return file_diagnostic::describe_state_change (change); } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { if (m_first_fclose_event.known_p ()) return ev.formatted_print ("second %qs here; first %qs was at %@", @@ -200,14 +200,14 @@ public: : file_diagnostic (sm, arg) {} - const char *get_kind () const FINAL OVERRIDE { return "file_leak"; } + const char *get_kind () const final override { return "file_leak"; } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_file_leak; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { diagnostic_metadata m; /* CWE-775: "Missing Release of File Descriptor or Handle after @@ -223,7 +223,7 @@ public: } label_text describe_state_change (const evdesc::state_change &change) - FINAL OVERRIDE + final override { if (change.m_new_state == m_sm.m_unchecked) { @@ -233,7 +233,7 @@ public: return file_diagnostic::describe_state_change (change); } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { if (m_fopen_event.known_p ()) { diff --git a/gcc/analyzer/sm-malloc.cc b/gcc/analyzer/sm-malloc.cc index 20c1677..abdce6b 100644 --- a/gcc/analyzer/sm-malloc.cc +++ b/gcc/analyzer/sm-malloc.cc @@ -128,7 +128,7 @@ struct allocation_state : public state_machine::state m_deallocator (deallocator) {} - void dump_to_pp (pretty_printer *pp) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp) const final override; const allocation_state *get_nonnull () const; @@ -243,9 +243,9 @@ struct custom_deallocator_set : public deallocator_set //unsigned arg_idx, enum wording wording); - bool contains_p (const deallocator *d) const FINAL OVERRIDE; - const deallocator *maybe_get_single () const FINAL OVERRIDE; - void dump_to_pp (pretty_printer *pp) const FINAL OVERRIDE; + bool contains_p (const deallocator *d) const final override; + const deallocator *maybe_get_single () const final override; + void dump_to_pp (pretty_printer *pp) const final override; auto_vec m_deallocator_vec; }; @@ -259,9 +259,9 @@ struct standard_deallocator_set : public deallocator_set const char *name, enum wording wording); - bool contains_p (const deallocator *d) const FINAL OVERRIDE; - const deallocator *maybe_get_single () const FINAL OVERRIDE; - void dump_to_pp (pretty_printer *pp) const FINAL OVERRIDE; + bool contains_p (const deallocator *d) const final override; + const deallocator *maybe_get_single () const final override; + void dump_to_pp (pretty_printer *pp) const final override; standard_deallocator m_deallocator; }; @@ -343,10 +343,10 @@ public: const deallocator_set *deallocators, const deallocator *deallocator); - bool inherited_state_p () const FINAL OVERRIDE { return false; } + bool inherited_state_p () const final override { return false; } state_machine::state_t - get_default_state (const svalue *sval) const FINAL OVERRIDE + get_default_state (const svalue *sval) const final override { if (tree cst = sval->maybe_get_constant ()) { @@ -372,25 +372,25 @@ public: bool on_stmt (sm_context *sm_ctxt, const supernode *node, - const gimple *stmt) const FINAL OVERRIDE; + const gimple *stmt) const final override; void on_phi (sm_context *sm_ctxt, const supernode *node, const gphi *phi, - tree rhs) const FINAL OVERRIDE; + tree rhs) const final override; void on_condition (sm_context *sm_ctxt, const supernode *node, const gimple *stmt, const svalue *lhs, enum tree_code op, - const svalue *rhs) const FINAL OVERRIDE; + const svalue *rhs) const final override; - bool can_purge_p (state_t s) const FINAL OVERRIDE; - pending_diagnostic *on_leak (tree var) const FINAL OVERRIDE; + bool can_purge_p (state_t s) const final override; + pending_diagnostic *on_leak (tree var) const final override; bool reset_when_passed_to_unknown_fn_p (state_t s, - bool is_mutable) const FINAL OVERRIDE; + bool is_mutable) const final override; static bool unaffected_by_call_p (tree fndecl); @@ -689,13 +689,13 @@ public: : m_sm (sm), m_arg (arg) {} - bool subclass_equal_p (const pending_diagnostic &base_other) const OVERRIDE + bool subclass_equal_p (const pending_diagnostic &base_other) const override { return same_tree_p (m_arg, ((const malloc_diagnostic &)base_other).m_arg); } label_text describe_state_change (const evdesc::state_change &change) - OVERRIDE + override { if (change.m_old_state == m_sm.get_start_state () && unchecked_p (change.m_new_state)) @@ -755,17 +755,17 @@ public: m_actual_dealloc (actual_dealloc) {} - const char *get_kind () const FINAL OVERRIDE + const char *get_kind () const final override { return "mismatching_deallocation"; } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_mismatching_deallocation; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { auto_diagnostic_group d; diagnostic_metadata m; @@ -785,7 +785,7 @@ public: } label_text describe_state_change (const evdesc::state_change &change) - FINAL OVERRIDE + final override { if (unchecked_p (change.m_new_state)) { @@ -801,7 +801,7 @@ public: return malloc_diagnostic::describe_state_change (change); } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { if (m_alloc_event.known_p ()) { @@ -837,14 +837,14 @@ public: : malloc_diagnostic (sm, arg), m_funcname (funcname) {} - const char *get_kind () const FINAL OVERRIDE { return "double_free"; } + const char *get_kind () const final override { return "double_free"; } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_double_free; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { auto_diagnostic_group d; diagnostic_metadata m; @@ -854,7 +854,7 @@ public: } label_text describe_state_change (const evdesc::state_change &change) - FINAL OVERRIDE + final override { if (freed_p (change.m_new_state)) { @@ -865,7 +865,7 @@ public: } label_text describe_call_with_state (const evdesc::call_with_state &info) - FINAL OVERRIDE + final override { if (freed_p (info.m_state)) return info.formatted_print @@ -874,7 +874,7 @@ public: return label_text (); } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { if (m_first_free_event.known_p ()) return ev.formatted_print ("second %qs here; first %qs was at %@", @@ -899,7 +899,7 @@ public: {} label_text describe_state_change (const evdesc::state_change &change) - FINAL OVERRIDE + final override { if (change.m_old_state == m_sm.get_start_state () && unchecked_p (change.m_new_state)) @@ -911,7 +911,7 @@ public: } label_text describe_return_of_state (const evdesc::return_of_state &info) - FINAL OVERRIDE + final override { if (unchecked_p (info.m_state)) return info.formatted_print ("possible return of NULL to %qE from %qE", @@ -933,14 +933,14 @@ public: : possible_null (sm, arg) {} - const char *get_kind () const FINAL OVERRIDE { return "possible_null_deref"; } + const char *get_kind () const final override { return "possible_null_deref"; } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_possible_null_dereference; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { /* CWE-690: Unchecked Return Value to NULL Pointer Dereference. */ diagnostic_metadata m; @@ -949,7 +949,7 @@ public: "dereference of possibly-NULL %qE", m_arg); } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { if (m_origin_of_unchecked_event.known_p ()) return ev.formatted_print ("%qE could be NULL: unchecked value from %@", @@ -1013,7 +1013,7 @@ public: m_fndecl (fndecl), m_arg_idx (arg_idx) {} - const char *get_kind () const FINAL OVERRIDE { return "possible_null_arg"; } + const char *get_kind () const final override { return "possible_null_arg"; } bool subclass_equal_p (const pending_diagnostic &base_other) const { @@ -1024,12 +1024,12 @@ public: && m_arg_idx == sub_other.m_arg_idx); } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_possible_null_argument; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { /* CWE-690: Unchecked Return Value to NULL Pointer Dereference. */ auto_diagnostic_group d; @@ -1044,7 +1044,7 @@ public: return warned; } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { label_text arg_desc = describe_argument_index (m_fndecl, m_arg_idx); label_text result; @@ -1074,14 +1074,14 @@ public: null_deref (const malloc_state_machine &sm, tree arg) : malloc_diagnostic (sm, arg) {} - const char *get_kind () const FINAL OVERRIDE { return "null_deref"; } + const char *get_kind () const final override { return "null_deref"; } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_null_dereference; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { /* CWE-476: NULL Pointer Dereference. */ diagnostic_metadata m; @@ -1091,7 +1091,7 @@ public: } label_text describe_return_of_state (const evdesc::return_of_state &info) - FINAL OVERRIDE + final override { if (info.m_state == m_sm.m_null) return info.formatted_print ("return of NULL to %qE from %qE", @@ -1099,7 +1099,7 @@ public: return label_text (); } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { return ev.formatted_print ("dereference of NULL %qE", ev.m_expr); } @@ -1117,7 +1117,7 @@ public: m_fndecl (fndecl), m_arg_idx (arg_idx) {} - const char *get_kind () const FINAL OVERRIDE { return "null_arg"; } + const char *get_kind () const final override { return "null_arg"; } bool subclass_equal_p (const pending_diagnostic &base_other) const { @@ -1128,12 +1128,12 @@ public: && m_arg_idx == sub_other.m_arg_idx); } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_null_argument; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { /* CWE-476: NULL Pointer Dereference. */ auto_diagnostic_group d; @@ -1153,7 +1153,7 @@ public: return warned; } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { label_text arg_desc = describe_argument_index (m_fndecl, m_arg_idx); label_text result; @@ -1184,14 +1184,14 @@ public: gcc_assert (deallocator); } - const char *get_kind () const FINAL OVERRIDE { return "use_after_free"; } + const char *get_kind () const final override { return "use_after_free"; } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_use_after_free; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { /* CWE-416: Use After Free. */ diagnostic_metadata m; @@ -1202,7 +1202,7 @@ public: } label_text describe_state_change (const evdesc::state_change &change) - FINAL OVERRIDE + final override { if (freed_p (change.m_new_state)) { @@ -1223,7 +1223,7 @@ public: return malloc_diagnostic::describe_state_change (change); } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { const char *funcname = m_deallocator->m_name; if (m_free_event.known_p ()) @@ -1259,7 +1259,7 @@ public: that if they are accessed after the free, it looks like they are uninitialized). */ - bool supercedes_p (const pending_diagnostic &other) const FINAL OVERRIDE + bool supercedes_p (const pending_diagnostic &other) const final override { if (other.use_of_uninit_p ()) return true; @@ -1278,14 +1278,14 @@ public: malloc_leak (const malloc_state_machine &sm, tree arg) : malloc_diagnostic (sm, arg) {} - const char *get_kind () const FINAL OVERRIDE { return "malloc_leak"; } + const char *get_kind () const final override { return "malloc_leak"; } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_malloc_leak; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { diagnostic_metadata m; m.add_cwe (401); @@ -1298,7 +1298,7 @@ public: } label_text describe_state_change (const evdesc::state_change &change) - FINAL OVERRIDE + final override { if (unchecked_p (change.m_new_state) || (start_p (change.m_old_state) && nonnull_p (change.m_new_state))) @@ -1309,7 +1309,7 @@ public: return malloc_diagnostic::describe_state_change (change); } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { if (ev.m_expr) { @@ -1343,22 +1343,22 @@ public: { } - const char *get_kind () const FINAL OVERRIDE { return "free_of_non_heap"; } + const char *get_kind () const final override { return "free_of_non_heap"; } bool subclass_equal_p (const pending_diagnostic &base_other) const - FINAL OVERRIDE + final override { const free_of_non_heap &other = (const free_of_non_heap &)base_other; return (same_tree_p (m_arg, other.m_arg) && m_freed_reg == other.m_freed_reg); } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_free_of_non_heap; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { auto_diagnostic_group d; diagnostic_metadata m; @@ -1387,17 +1387,17 @@ public: } label_text describe_state_change (const evdesc::state_change &) - FINAL OVERRIDE + final override { return label_text::borrow ("pointer is from here"); } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { return ev.formatted_print ("call to %qs here", m_funcname); } - void mark_interesting_stuff (interesting_t *interest) FINAL OVERRIDE + void mark_interesting_stuff (interesting_t *interest) final override { if (m_freed_reg) interest->add_region_creation (m_freed_reg); diff --git a/gcc/analyzer/sm-pattern-test.cc b/gcc/analyzer/sm-pattern-test.cc index 68b976a..9b2ad68 100644 --- a/gcc/analyzer/sm-pattern-test.cc +++ b/gcc/analyzer/sm-pattern-test.cc @@ -58,20 +58,20 @@ class pattern_test_state_machine : public state_machine public: pattern_test_state_machine (logger *logger); - bool inherited_state_p () const FINAL OVERRIDE { return false; } + bool inherited_state_p () const final override { return false; } bool on_stmt (sm_context *sm_ctxt, const supernode *node, - const gimple *stmt) const FINAL OVERRIDE; + const gimple *stmt) const final override; void on_condition (sm_context *sm_ctxt, const supernode *node, const gimple *stmt, const svalue *lhs, enum tree_code op, - const svalue *rhs) const FINAL OVERRIDE; + const svalue *rhs) const final override; - bool can_purge_p (state_t s) const FINAL OVERRIDE; + bool can_purge_p (state_t s) const final override; }; class pattern_match : public pending_diagnostic_subclass @@ -80,7 +80,7 @@ public: pattern_match (tree lhs, enum tree_code op, tree rhs) : m_lhs (lhs), m_op (op), m_rhs (rhs) {} - const char *get_kind () const FINAL OVERRIDE { return "pattern_match"; } + const char *get_kind () const final override { return "pattern_match"; } bool operator== (const pattern_match &other) const { @@ -89,12 +89,12 @@ public: && same_tree_p (m_rhs, other.m_rhs)); } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return 0; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { return warning_at (rich_loc, get_controlling_option (), "pattern match on %<%E %s %E%>", diff --git a/gcc/analyzer/sm-sensitive.cc b/gcc/analyzer/sm-sensitive.cc index f40f3e8..20809dd 100644 --- a/gcc/analyzer/sm-sensitive.cc +++ b/gcc/analyzer/sm-sensitive.cc @@ -52,13 +52,13 @@ class sensitive_state_machine : public state_machine public: sensitive_state_machine (logger *logger); - bool inherited_state_p () const FINAL OVERRIDE { return true; } + bool inherited_state_p () const final override { return true; } bool on_stmt (sm_context *sm_ctxt, const supernode *node, - const gimple *stmt) const FINAL OVERRIDE; + const gimple *stmt) const final override; - bool can_purge_p (state_t s) const FINAL OVERRIDE; + bool can_purge_p (state_t s) const final override; /* State for "sensitive" data, such as a password. */ state_t m_sensitive; @@ -81,7 +81,7 @@ public: : m_sm (sm), m_arg (arg) {} - const char *get_kind () const FINAL OVERRIDE + const char *get_kind () const final override { return "exposure_through_output_file"; } @@ -91,12 +91,12 @@ public: return same_tree_p (m_arg, other.m_arg); } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_exposure_through_output_file; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { diagnostic_metadata m; /* CWE-532: Information Exposure Through Log Files */ @@ -107,7 +107,7 @@ public: } label_text describe_state_change (const evdesc::state_change &change) - FINAL OVERRIDE + final override { if (change.m_new_state == m_sm.m_sensitive) { @@ -118,7 +118,7 @@ public: } label_text describe_call_with_state (const evdesc::call_with_state &info) - FINAL OVERRIDE + final override { if (info.m_state == m_sm.m_sensitive) return info.formatted_print @@ -128,7 +128,7 @@ public: } label_text describe_return_of_state (const evdesc::return_of_state &info) - FINAL OVERRIDE + final override { if (info.m_state == m_sm.m_sensitive) return info.formatted_print ("returning sensitive value to %qE from %qE", @@ -136,7 +136,7 @@ public: return label_text (); } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { if (m_first_sensitive_event.known_p ()) return ev.formatted_print ("sensitive value %qE written to output file" diff --git a/gcc/analyzer/sm-signal.cc b/gcc/analyzer/sm-signal.cc index 9b0213e..1f48a09 100644 --- a/gcc/analyzer/sm-signal.cc +++ b/gcc/analyzer/sm-signal.cc @@ -75,13 +75,13 @@ class signal_state_machine : public state_machine public: signal_state_machine (logger *logger); - bool inherited_state_p () const FINAL OVERRIDE { return false; } + bool inherited_state_p () const final override { return false; } bool on_stmt (sm_context *sm_ctxt, const supernode *node, - const gimple *stmt) const FINAL OVERRIDE; + const gimple *stmt) const final override; - bool can_purge_p (state_t s) const FINAL OVERRIDE; + bool can_purge_p (state_t s) const final override; /* These states are "global", rather than per-expression. */ @@ -106,19 +106,19 @@ public: gcc_assert (m_unsafe_fndecl); } - const char *get_kind () const FINAL OVERRIDE { return "signal_unsafe_call"; } + const char *get_kind () const final override { return "signal_unsafe_call"; } bool operator== (const signal_unsafe_call &other) const { return m_unsafe_call == other.m_unsafe_call; } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_unsafe_call_within_signal_handler; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { auto_diagnostic_group d; diagnostic_metadata m; @@ -148,7 +148,7 @@ public: } label_text describe_state_change (const evdesc::state_change &change) - FINAL OVERRIDE + final override { if (change.is_global_p () && change.m_new_state == m_sm.m_in_signal_handler) @@ -160,7 +160,7 @@ public: return label_text (); } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { return ev.formatted_print ("call to %qD from within signal handler", m_unsafe_fndecl); @@ -213,7 +213,7 @@ update_model_for_signal_handler (region_model *model, class signal_delivery_edge_info_t : public custom_edge_info { public: - void print (pretty_printer *pp) const FINAL OVERRIDE + void print (pretty_printer *pp) const final override { pp_string (pp, "signal delivered"); } @@ -226,7 +226,7 @@ public: bool update_model (region_model *model, const exploded_edge *eedge, - region_model_context *) const FINAL OVERRIDE + region_model_context *) const final override { gcc_assert (eedge); update_model_for_signal_handler (model, eedge->m_dest->get_function ()); @@ -235,7 +235,7 @@ public: void add_events_to_path (checker_path *emission_path, const exploded_edge &eedge ATTRIBUTE_UNUSED) - const FINAL OVERRIDE + const final override { emission_path->add_event (new precanned_custom_event @@ -261,7 +261,7 @@ public: on the node. */ void impl_transition (exploded_graph *eg, exploded_node *src_enode, - int sm_idx) FINAL OVERRIDE + int sm_idx) final override { function *handler_fun = DECL_STRUCT_FUNCTION (m_fndecl); if (!handler_fun) diff --git a/gcc/analyzer/sm-taint.cc b/gcc/analyzer/sm-taint.cc index 17669ae..3aaa69a 100644 --- a/gcc/analyzer/sm-taint.cc +++ b/gcc/analyzer/sm-taint.cc @@ -80,25 +80,25 @@ class taint_state_machine : public state_machine public: taint_state_machine (logger *logger); - bool inherited_state_p () const FINAL OVERRIDE { return true; } + bool inherited_state_p () const final override { return true; } state_t alt_get_inherited_state (const sm_state_map &map, const svalue *sval, const extrinsic_state &ext_state) - const FINAL OVERRIDE; + const final override; bool on_stmt (sm_context *sm_ctxt, const supernode *node, - const gimple *stmt) const FINAL OVERRIDE; + const gimple *stmt) const final override; void on_condition (sm_context *sm_ctxt, const supernode *node, const gimple *stmt, const svalue *lhs, enum tree_code op, - const svalue *rhs) const FINAL OVERRIDE; + const svalue *rhs) const final override; - bool can_purge_p (state_t s) const FINAL OVERRIDE; + bool can_purge_p (state_t s) const final override; bool get_taint (state_t s, tree type, enum bounds *out) const; @@ -135,7 +135,7 @@ public: : m_sm (sm), m_arg (arg), m_has_bounds (has_bounds) {} - bool subclass_equal_p (const pending_diagnostic &base_other) const OVERRIDE + bool subclass_equal_p (const pending_diagnostic &base_other) const override { const taint_diagnostic &other = (const taint_diagnostic &)base_other; return (same_tree_p (m_arg, other.m_arg) @@ -143,7 +143,7 @@ public: } label_text describe_state_change (const evdesc::state_change &change) - FINAL OVERRIDE + final override { if (change.m_new_state == m_sm.m_tainted) { @@ -180,14 +180,14 @@ public: : taint_diagnostic (sm, arg, has_bounds) {} - const char *get_kind () const FINAL OVERRIDE { return "tainted_array_index"; } + const char *get_kind () const final override { return "tainted_array_index"; } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_tainted_array_index; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { diagnostic_metadata m; /* CWE-129: "Improper Validation of Array Index". */ @@ -217,7 +217,7 @@ public: } } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { switch (m_has_bounds) { @@ -253,14 +253,14 @@ public: : taint_diagnostic (sm, arg, has_bounds) {} - const char *get_kind () const FINAL OVERRIDE { return "tainted_offset"; } + const char *get_kind () const final override { return "tainted_offset"; } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_tainted_offset; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { diagnostic_metadata m; /* CWE-823: "Use of Out-of-range Pointer Offset". */ @@ -312,7 +312,7 @@ public: } } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { if (m_arg) switch (m_has_bounds) @@ -363,14 +363,14 @@ public: : taint_diagnostic (sm, arg, has_bounds) {} - const char *get_kind () const OVERRIDE { return "tainted_size"; } + const char *get_kind () const override { return "tainted_size"; } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_tainted_size; } - bool emit (rich_location *rich_loc) OVERRIDE + bool emit (rich_location *rich_loc) override { diagnostic_metadata m; m.add_cwe (129); @@ -399,7 +399,7 @@ public: } } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { switch (m_has_bounds) { @@ -436,12 +436,12 @@ public: { } - const char *get_kind () const OVERRIDE + const char *get_kind () const override { return "tainted_access_attrib_size"; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { bool warned = tainted_size::emit (rich_loc); if (warned) @@ -470,14 +470,14 @@ public: : taint_diagnostic (sm, arg, has_bounds) {} - const char *get_kind () const FINAL OVERRIDE { return "tainted_divisor"; } + const char *get_kind () const final override { return "tainted_divisor"; } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_tainted_divisor; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { diagnostic_metadata m; /* CWE-369: "Divide By Zero". */ @@ -493,7 +493,7 @@ public: " without checking for zero"); } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { if (m_arg) return ev.formatted_print @@ -520,12 +520,12 @@ public: { } - const char *get_kind () const FINAL OVERRIDE + const char *get_kind () const final override { return "tainted_allocation_size"; } - bool subclass_equal_p (const pending_diagnostic &base_other) const OVERRIDE + bool subclass_equal_p (const pending_diagnostic &base_other) const override { if (!taint_diagnostic::subclass_equal_p (base_other)) return false; @@ -534,12 +534,12 @@ public: return m_mem_space == other.m_mem_space; } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_tainted_allocation_size; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { diagnostic_metadata m; /* "CWE-789: Memory Allocation with Excessive Size Value". */ @@ -614,7 +614,7 @@ public: return warned; } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { if (m_arg) switch (m_has_bounds) diff --git a/gcc/analyzer/state-purge.h b/gcc/analyzer/state-purge.h index 3c51b48..53fd4a2 100644 --- a/gcc/analyzer/state-purge.h +++ b/gcc/analyzer/state-purge.h @@ -236,11 +236,11 @@ public: state_purge_annotator (const state_purge_map *map) : m_map (map) {} bool add_node_annotations (graphviz_out *gv, const supernode &n, bool) - const FINAL OVERRIDE; + const final override; void add_stmt_annotations (graphviz_out *gv, const gimple *stmt, bool within_row) - const FINAL OVERRIDE; + const final override; private: void print_needed (graphviz_out *gv, diff --git a/gcc/analyzer/store.cc b/gcc/analyzer/store.cc index f5f8fe0..1b7c818 100644 --- a/gcc/analyzer/store.cc +++ b/gcc/analyzer/store.cc @@ -2933,7 +2933,7 @@ store::remove_overlapping_bindings (store_manager *mgr, const region *reg, struct region_finder : public visitor { - void visit_region (const region *reg) FINAL OVERRIDE + void visit_region (const region *reg) final override { m_regs.add (reg); } diff --git a/gcc/analyzer/store.h b/gcc/analyzer/store.h index 17485b7..368b299 100644 --- a/gcc/analyzer/store.h +++ b/gcc/analyzer/store.h @@ -347,7 +347,7 @@ public: concrete_binding (bit_offset_t start_bit_offset, bit_size_t size_in_bits) : m_bit_range (start_bit_offset, size_in_bits) {} - bool concrete_p () const FINAL OVERRIDE { return true; } + bool concrete_p () const final override { return true; } hashval_t hash () const { @@ -361,9 +361,9 @@ public: return m_bit_range == other.m_bit_range; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; - const concrete_binding *dyn_cast_concrete_binding () const FINAL OVERRIDE + const concrete_binding *dyn_cast_concrete_binding () const final override { return this; } const bit_range &get_bit_range () const { return m_bit_range; } @@ -415,7 +415,7 @@ public: typedef symbolic_binding key_t; symbolic_binding (const region *region) : m_region (region) {} - bool concrete_p () const FINAL OVERRIDE { return false; } + bool concrete_p () const final override { return false; } hashval_t hash () const { @@ -426,9 +426,9 @@ public: return m_region == other.m_region; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; - const symbolic_binding *dyn_cast_symbolic_binding () const FINAL OVERRIDE + const symbolic_binding *dyn_cast_symbolic_binding () const final override { return this; } const region *get_region () const { return m_region; } diff --git a/gcc/analyzer/supergraph.h b/gcc/analyzer/supergraph.h index 235de79..cc53fcb 100644 --- a/gcc/analyzer/supergraph.h +++ b/gcc/analyzer/supergraph.h @@ -245,7 +245,7 @@ class supernode : public dnode return m_bb == EXIT_BLOCK_PTR_FOR_FN (m_fun); } - void dump_dot (graphviz_out *gv, const dump_args_t &args) const OVERRIDE; + void dump_dot (graphviz_out *gv, const dump_args_t &args) const override; void dump_dot_id (pretty_printer *pp) const; json::object *to_json () const; @@ -389,14 +389,14 @@ class callgraph_superedge : public superedge {} void dump_label_to_pp (pretty_printer *pp, bool user_facing) const - FINAL OVERRIDE; + final override; - callgraph_superedge *dyn_cast_callgraph_superedge () FINAL OVERRIDE + callgraph_superedge *dyn_cast_callgraph_superedge () final override { return this; } const callgraph_superedge *dyn_cast_callgraph_superedge () const - FINAL OVERRIDE + final override { return this; } @@ -439,11 +439,11 @@ class call_superedge : public callgraph_superedge : callgraph_superedge (src, dst, SUPEREDGE_CALL, cedge) {} - call_superedge *dyn_cast_call_superedge () FINAL OVERRIDE + call_superedge *dyn_cast_call_superedge () final override { return this; } - const call_superedge *dyn_cast_call_superedge () const FINAL OVERRIDE + const call_superedge *dyn_cast_call_superedge () const final override { return this; } @@ -475,8 +475,8 @@ class return_superedge : public callgraph_superedge : callgraph_superedge (src, dst, SUPEREDGE_RETURN, cedge) {} - return_superedge *dyn_cast_return_superedge () FINAL OVERRIDE { return this; } - const return_superedge *dyn_cast_return_superedge () const FINAL OVERRIDE + return_superedge *dyn_cast_return_superedge () final override { return this; } + const return_superedge *dyn_cast_return_superedge () const final override { return this; } @@ -509,9 +509,9 @@ class cfg_superedge : public superedge m_cfg_edge (e) {} - void dump_label_to_pp (pretty_printer *pp, bool user_facing) const OVERRIDE; - cfg_superedge *dyn_cast_cfg_superedge () FINAL OVERRIDE { return this; } - const cfg_superedge *dyn_cast_cfg_superedge () const FINAL OVERRIDE { return this; } + void dump_label_to_pp (pretty_printer *pp, bool user_facing) const override; + cfg_superedge *dyn_cast_cfg_superedge () final override { return this; } + const cfg_superedge *dyn_cast_cfg_superedge () const final override { return this; } ::edge get_cfg_edge () const { return m_cfg_edge; } int get_flags () const { return m_cfg_edge->flags; } @@ -547,13 +547,13 @@ class switch_cfg_superedge : public cfg_superedge { switch_cfg_superedge (supernode *src, supernode *dst, ::edge e); const switch_cfg_superedge *dyn_cast_switch_cfg_superedge () const - FINAL OVERRIDE + final override { return this; } void dump_label_to_pp (pretty_printer *pp, bool user_facing) const - FINAL OVERRIDE; + final override; gswitch *get_switch_stmt () const { diff --git a/gcc/analyzer/svalue.h b/gcc/analyzer/svalue.h index 29ea2ee..f4cab0d 100644 --- a/gcc/analyzer/svalue.h +++ b/gcc/analyzer/svalue.h @@ -229,14 +229,14 @@ public: gcc_assert (m_reg != NULL); } - enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_REGION; } + enum svalue_kind get_kind () const final override { return SK_REGION; } const region_svalue * - dyn_cast_region_svalue () const FINAL OVERRIDE { return this; } + dyn_cast_region_svalue () const final override { return this; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; - void accept (visitor *v) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; + void accept (visitor *v) const final override; bool implicitly_live_p (const svalue_set *, - const region_model *) const FINAL OVERRIDE; + const region_model *) const final override; const region * get_pointee () const { return m_reg; } @@ -278,14 +278,14 @@ public: gcc_assert (CONSTANT_CLASS_P (cst_expr)); } - enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_CONSTANT; } + enum svalue_kind get_kind () const final override { return SK_CONSTANT; } const constant_svalue * - dyn_cast_constant_svalue () const FINAL OVERRIDE { return this; } + dyn_cast_constant_svalue () const final override { return this; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; - void accept (visitor *v) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; + void accept (visitor *v) const final override; bool implicitly_live_p (const svalue_set *, - const region_model *) const FINAL OVERRIDE; + const region_model *) const final override; tree get_constant () const { return m_cst_expr; } static tristate eval_condition (const constant_svalue *lhs, @@ -295,9 +295,9 @@ public: const svalue * maybe_fold_bits_within (tree type, const bit_range &subrange, - region_model_manager *mgr) const FINAL OVERRIDE; + region_model_manager *mgr) const final override; - bool all_zeroes_p () const FINAL OVERRIDE; + bool all_zeroes_p () const final override; private: tree m_cst_expr; @@ -327,18 +327,18 @@ public: : svalue (complexity (1, 1), type) {} - enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_UNKNOWN; } + enum svalue_kind get_kind () const final override { return SK_UNKNOWN; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; - void accept (visitor *v) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; + void accept (visitor *v) const final override; const svalue * maybe_fold_bits_within (tree type, const bit_range &subrange, - region_model_manager *mgr) const FINAL OVERRIDE; + region_model_manager *mgr) const final override; /* Unknown values are singletons per-type, so can't have state. */ - bool can_have_associated_state_p () const FINAL OVERRIDE { return false; } + bool can_have_associated_state_p () const final override { return false; } }; /* An enum describing a particular kind of "poisoned" value. */ @@ -395,22 +395,22 @@ public: poisoned_svalue (enum poison_kind kind, tree type) : svalue (complexity (1, 1), type), m_kind (kind) {} - enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_POISONED; } + enum svalue_kind get_kind () const final override { return SK_POISONED; } const poisoned_svalue * - dyn_cast_poisoned_svalue () const FINAL OVERRIDE { return this; } + dyn_cast_poisoned_svalue () const final override { return this; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; - void accept (visitor *v) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; + void accept (visitor *v) const final override; const svalue * maybe_fold_bits_within (tree type, const bit_range &subrange, - region_model_manager *mgr) const FINAL OVERRIDE; + region_model_manager *mgr) const final override; enum poison_kind get_poison_kind () const { return m_kind; } /* Poisoned svalues are singletons per-type, so can't have state. */ - bool can_have_associated_state_p () const FINAL OVERRIDE { return false; } + bool can_have_associated_state_p () const final override { return false; } private: enum poison_kind m_kind; @@ -504,12 +504,12 @@ public: : svalue (complexity (1, 1), type), m_setjmp_record (setjmp_record) {} - enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_SETJMP; } + enum svalue_kind get_kind () const final override { return SK_SETJMP; } const setjmp_svalue * - dyn_cast_setjmp_svalue () const FINAL OVERRIDE { return this; } + dyn_cast_setjmp_svalue () const final override { return this; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; - void accept (visitor *v) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; + void accept (visitor *v) const final override; int get_enode_index () const; @@ -554,14 +554,14 @@ public: gcc_assert (m_reg != NULL); } - enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_INITIAL; } + enum svalue_kind get_kind () const final override { return SK_INITIAL; } const initial_svalue * - dyn_cast_initial_svalue () const FINAL OVERRIDE { return this; } + dyn_cast_initial_svalue () const final override { return this; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; - void accept (visitor *v) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; + void accept (visitor *v) const final override; bool implicitly_live_p (const svalue_set *, - const region_model *) const FINAL OVERRIDE; + const region_model *) const final override; bool initial_value_of_param_p () const; @@ -628,14 +628,14 @@ public: gcc_assert (arg->can_have_associated_state_p ()); } - enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_UNARYOP; } + enum svalue_kind get_kind () const final override { return SK_UNARYOP; } const unaryop_svalue * - dyn_cast_unaryop_svalue () const FINAL OVERRIDE { return this; } + dyn_cast_unaryop_svalue () const final override { return this; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; - void accept (visitor *v) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; + void accept (visitor *v) const final override; bool implicitly_live_p (const svalue_set *, - const region_model *) const FINAL OVERRIDE; + const region_model *) const final override; enum tree_code get_op () const { return m_op; } const svalue *get_arg () const { return m_arg; } @@ -643,7 +643,7 @@ public: const svalue * maybe_fold_bits_within (tree type, const bit_range &subrange, - region_model_manager *mgr) const FINAL OVERRIDE; + region_model_manager *mgr) const final override; private: enum tree_code m_op; @@ -722,16 +722,16 @@ public: gcc_assert (arg1->can_have_associated_state_p ()); } - enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_BINOP; } - const binop_svalue *dyn_cast_binop_svalue () const FINAL OVERRIDE + enum svalue_kind get_kind () const final override { return SK_BINOP; } + const binop_svalue *dyn_cast_binop_svalue () const final override { return this; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; - void accept (visitor *v) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; + void accept (visitor *v) const final override; bool implicitly_live_p (const svalue_set *, - const region_model *) const FINAL OVERRIDE; + const region_model *) const final override; enum tree_code get_op () const { return m_op; } const svalue *get_arg0 () const { return m_arg0; } @@ -803,16 +803,16 @@ public: sub_svalue (tree type, const svalue *parent_svalue, const region *subregion); - enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_SUB; } - const sub_svalue *dyn_cast_sub_svalue () const FINAL OVERRIDE + enum svalue_kind get_kind () const final override { return SK_SUB; } + const sub_svalue *dyn_cast_sub_svalue () const final override { return this; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; - void accept (visitor *v) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; + void accept (visitor *v) const final override; bool implicitly_live_p (const svalue_set *, - const region_model *) const FINAL OVERRIDE; + const region_model *) const final override; const svalue *get_parent () const { return m_parent_svalue; } const region *get_subregion () const { return m_subregion; } @@ -885,24 +885,24 @@ public: const svalue *outer_size, const svalue *inner_svalue); - enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_REPEATED; } - const repeated_svalue *dyn_cast_repeated_svalue () const FINAL OVERRIDE + enum svalue_kind get_kind () const final override { return SK_REPEATED; } + const repeated_svalue *dyn_cast_repeated_svalue () const final override { return this; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; - void accept (visitor *v) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; + void accept (visitor *v) const final override; const svalue *get_outer_size () const { return m_outer_size; } const svalue *get_inner_svalue () const { return m_inner_svalue; } - bool all_zeroes_p () const FINAL OVERRIDE; + bool all_zeroes_p () const final override; const svalue * maybe_fold_bits_within (tree type, const bit_range &subrange, - region_model_manager *mgr) const FINAL OVERRIDE; + region_model_manager *mgr) const final override; private: const svalue *m_outer_size; @@ -972,17 +972,17 @@ public: const bit_range &bits, const svalue *inner_svalue); - enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_BITS_WITHIN; } + enum svalue_kind get_kind () const final override { return SK_BITS_WITHIN; } const bits_within_svalue * - dyn_cast_bits_within_svalue () const FINAL OVERRIDE + dyn_cast_bits_within_svalue () const final override { return this; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; - void accept (visitor *v) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; + void accept (visitor *v) const final override; bool implicitly_live_p (const svalue_set *, - const region_model *) const FINAL OVERRIDE; + const region_model *) const final override; const bit_range &get_bits () const { return m_bits; } const svalue *get_inner_svalue () const { return m_inner_svalue; } @@ -990,7 +990,7 @@ public: const svalue * maybe_fold_bits_within (tree type, const bit_range &subrange, - region_model_manager *mgr) const FINAL OVERRIDE; + region_model_manager *mgr) const final override; private: const bit_range m_bits; @@ -1034,14 +1034,14 @@ public: { } - enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_UNMERGEABLE; } + enum svalue_kind get_kind () const final override { return SK_UNMERGEABLE; } const unmergeable_svalue * - dyn_cast_unmergeable_svalue () const FINAL OVERRIDE { return this; } + dyn_cast_unmergeable_svalue () const final override { return this; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; - void accept (visitor *v) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; + void accept (visitor *v) const final override; bool implicitly_live_p (const svalue_set *, - const region_model *) const FINAL OVERRIDE; + const region_model *) const final override; const svalue *get_arg () const { return m_arg; } @@ -1074,10 +1074,10 @@ public: { } - enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_PLACEHOLDER; } + enum svalue_kind get_kind () const final override { return SK_PLACEHOLDER; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; - void accept (visitor *v) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; + void accept (visitor *v) const final override; const char *get_name () const { return m_name; } @@ -1165,14 +1165,14 @@ public: gcc_assert (iter_sval->can_have_associated_state_p ()); } - enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_WIDENING; } - const widening_svalue *dyn_cast_widening_svalue () const FINAL OVERRIDE + enum svalue_kind get_kind () const final override { return SK_WIDENING; } + const widening_svalue *dyn_cast_widening_svalue () const final override { return this; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; - void accept (visitor *v) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; + void accept (visitor *v) const final override; const function_point &get_point () const { return m_point; } const svalue *get_base_svalue () const { return m_base_sval; } @@ -1260,14 +1260,14 @@ public: compound_svalue (tree type, const binding_map &map); - enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_COMPOUND; } - const compound_svalue *dyn_cast_compound_svalue () const FINAL OVERRIDE + enum svalue_kind get_kind () const final override { return SK_COMPOUND; } + const compound_svalue *dyn_cast_compound_svalue () const final override { return this; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; - void accept (visitor *v) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; + void accept (visitor *v) const final override; const binding_map &get_map () const { return m_map; } @@ -1282,7 +1282,7 @@ public: const svalue * maybe_fold_bits_within (tree type, const bit_range &subrange, - region_model_manager *mgr) const FINAL OVERRIDE; + region_model_manager *mgr) const final override; private: static complexity calc_complexity (const binding_map &map); @@ -1394,14 +1394,14 @@ public: gcc_assert (m_stmt != NULL); } - enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_CONJURED; } - const conjured_svalue *dyn_cast_conjured_svalue () const FINAL OVERRIDE + enum svalue_kind get_kind () const final override { return SK_CONJURED; } + const conjured_svalue *dyn_cast_conjured_svalue () const final override { return this; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; - void accept (visitor *v) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; + void accept (visitor *v) const final override; const gimple *get_stmt () const { return m_stmt; } const region *get_id_region () const { return m_id_reg; } @@ -1515,15 +1515,15 @@ public: m_input_arr[i] = inputs[i]; } - enum svalue_kind get_kind () const FINAL OVERRIDE { return SK_ASM_OUTPUT; } + enum svalue_kind get_kind () const final override { return SK_ASM_OUTPUT; } const asm_output_svalue * - dyn_cast_asm_output_svalue () const FINAL OVERRIDE + dyn_cast_asm_output_svalue () const final override { return this; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; - void accept (visitor *v) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; + void accept (visitor *v) const final override; const char *get_asm_string () const { return m_asm_string; } unsigned get_output_idx () const { return m_output_idx; } @@ -1643,18 +1643,18 @@ public: m_input_arr[i] = inputs[i]; } - enum svalue_kind get_kind () const FINAL OVERRIDE + enum svalue_kind get_kind () const final override { return SK_CONST_FN_RESULT; } const const_fn_result_svalue * - dyn_cast_const_fn_result_svalue () const FINAL OVERRIDE + dyn_cast_const_fn_result_svalue () const final override { return this; } - void dump_to_pp (pretty_printer *pp, bool simple) const FINAL OVERRIDE; - void accept (visitor *v) const FINAL OVERRIDE; + void dump_to_pp (pretty_printer *pp, bool simple) const final override; + void accept (visitor *v) const final override; tree get_fndecl () const { return m_fndecl; } unsigned get_num_inputs () const { return m_num_inputs; } diff --git a/gcc/analyzer/trimmed-graph.h b/gcc/analyzer/trimmed-graph.h index 0b78843..89f36a5 100644 --- a/gcc/analyzer/trimmed-graph.h +++ b/gcc/analyzer/trimmed-graph.h @@ -61,7 +61,7 @@ public: : m_inner_node (inner_node) {} void dump_dot (graphviz_out *gv, - const dump_args_t &args) const FINAL OVERRIDE; + const dump_args_t &args) const final override; private: const exploded_node *m_inner_node; @@ -77,7 +77,7 @@ class trimmed_edge : public dedge const exploded_edge *inner_edge); void dump_dot (graphviz_out *gv, - const dump_args_t &args) const FINAL OVERRIDE; + const dump_args_t &args) const final override; private: const exploded_edge *m_inner_edge; diff --git a/gcc/analyzer/varargs.cc b/gcc/analyzer/varargs.cc index de77fe5d3..3f15ada 100644 --- a/gcc/analyzer/varargs.cc +++ b/gcc/analyzer/varargs.cc @@ -206,17 +206,17 @@ class va_list_state_machine : public state_machine public: va_list_state_machine (logger *logger); - bool inherited_state_p () const FINAL OVERRIDE { return false; } + bool inherited_state_p () const final override { return false; } bool on_stmt (sm_context *sm_ctxt, const supernode *node, - const gimple *stmt) const FINAL OVERRIDE; + const gimple *stmt) const final override; - bool can_purge_p (state_t s) const FINAL OVERRIDE + bool can_purge_p (state_t s) const final override { return s != m_started; } - pending_diagnostic *on_leak (tree var) const FINAL OVERRIDE; + pending_diagnostic *on_leak (tree var) const final override; /* State for a va_list that the result of a va_start or va_copy. */ state_t m_started; @@ -319,7 +319,7 @@ get_stateful_arg (sm_context *sm_ctxt, const gcall *call, unsigned arg_idx) class va_list_sm_diagnostic : public pending_diagnostic { public: - bool subclass_equal_p (const pending_diagnostic &base_other) const OVERRIDE + bool subclass_equal_p (const pending_diagnostic &base_other) const override { const va_list_sm_diagnostic &other = (const va_list_sm_diagnostic &)base_other; @@ -328,7 +328,7 @@ public: } label_text describe_state_change (const evdesc::state_change &change) - OVERRIDE + override { if (const char *fnname = maybe_get_fnname (change)) return change.formatted_print ("%qs called here", fnname); @@ -380,7 +380,7 @@ public: { } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_va_list_use_after_va_end; } @@ -391,27 +391,27 @@ public: && 0 == strcmp (m_usage_fnname, other.m_usage_fnname)); } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { auto_diagnostic_group d; return warning_at (rich_loc, get_controlling_option (), "%qs after %qs", m_usage_fnname, "va_end"); } - const char *get_kind () const FINAL OVERRIDE + const char *get_kind () const final override { return "va_list_use_after_va_end"; } label_text describe_state_change (const evdesc::state_change &change) - FINAL OVERRIDE + final override { if (change.m_new_state == m_sm.m_ended) m_va_end_event = change.m_event_id; return va_list_sm_diagnostic::describe_state_change (change); } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { if (ev.m_expr) { @@ -456,7 +456,7 @@ public: { } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_va_list_leak; } @@ -473,10 +473,10 @@ public: "missing call to %qs", "va_end"); } - const char *get_kind () const FINAL OVERRIDE { return "va_list_leak"; } + const char *get_kind () const final override { return "va_list_leak"; } label_text describe_state_change (const evdesc::state_change &change) - FINAL OVERRIDE + final override { if (change.m_new_state == m_sm.m_started) { @@ -486,7 +486,7 @@ public: return va_list_sm_diagnostic::describe_state_change (change); } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { if (ev.m_expr) { @@ -718,7 +718,7 @@ public: /* Override of pending_diagnostic::add_call_event, adding a custom call_event subclass. */ void add_call_event (const exploded_edge &eedge, - checker_path *emission_path) OVERRIDE + checker_path *emission_path) override { /* As per call_event, but show the number of variadic arguments in the call. */ @@ -733,7 +733,7 @@ public: { } - label_text get_desc (bool can_colorize) const OVERRIDE + label_text get_desc (bool can_colorize) const override { return make_label_text_n (can_colorize, m_num_variadic_arguments, @@ -778,7 +778,7 @@ protected: : m_va_list_tree (va_list_tree), m_var_arg_reg (var_arg_reg) {} - bool subclass_equal_p (const pending_diagnostic &base_other) const OVERRIDE + bool subclass_equal_p (const pending_diagnostic &base_other) const override { const va_arg_diagnostic &other = (const va_arg_diagnostic &)base_other; return (same_tree_p (m_va_list_tree, other.m_va_list_tree) @@ -819,13 +819,13 @@ public: m_expected_type (expected_type), m_actual_type (actual_type) {} - const char *get_kind () const FINAL OVERRIDE + const char *get_kind () const final override { return "va_arg_type_mismatch"; } bool subclass_equal_p (const pending_diagnostic &base_other) - const FINAL OVERRIDE + const final override { if (!va_arg_diagnostic::subclass_equal_p (base_other)) return false; @@ -835,12 +835,12 @@ public: && same_tree_p (m_actual_type, other.m_actual_type)); } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_va_arg_type_mismatch; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { auto_diagnostic_group d; bool warned @@ -852,7 +852,7 @@ public: return warned; } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { return ev.formatted_print ("% expected %qT but received %qT" " for variadic argument %i of %qE", @@ -877,17 +877,17 @@ public: : va_arg_diagnostic (va_list_tree, var_arg_reg) {} - const char *get_kind () const FINAL OVERRIDE + const char *get_kind () const final override { return "va_list_exhausted"; } - int get_controlling_option () const FINAL OVERRIDE + int get_controlling_option () const final override { return OPT_Wanalyzer_va_list_exhausted; } - bool emit (rich_location *rich_loc) FINAL OVERRIDE + bool emit (rich_location *rich_loc) final override { auto_diagnostic_group d; bool warned = warning_at (rich_loc, get_controlling_option (), @@ -896,7 +896,7 @@ public: return warned; } - label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE + label_text describe_final_event (const evdesc::final_event &ev) final override { return ev.formatted_print ("%qE has no more arguments (%i consumed)", m_va_list_tree, get_num_consumed ()); diff --git a/gcc/c-family/c-format.cc b/gcc/c-family/c-format.cc index 25b1c1d..4559ca3 100644 --- a/gcc/c-family/c-format.cc +++ b/gcc/c-family/c-format.cc @@ -4613,7 +4613,7 @@ class range_label_for_format_type_mismatch { } - label_text get_text (unsigned range_idx) const FINAL OVERRIDE + label_text get_text (unsigned range_idx) const final override { label_text text = range_label_for_type_mismatch::get_text (range_idx); if (text.m_buffer == NULL) diff --git a/gcc/c-family/c-pretty-print.h b/gcc/c-family/c-pretty-print.h index ba7624d..be86bed 100644 --- a/gcc/c-family/c-pretty-print.h +++ b/gcc/c-family/c-pretty-print.h @@ -51,7 +51,7 @@ class c_pretty_printer : public pretty_printer { public: c_pretty_printer (); - pretty_printer *clone () const OVERRIDE; + pretty_printer *clone () const override; // Format string, possibly translated. void translate_string (const char *); diff --git a/gcc/config/aarch64/aarch64-sve-builtins-base.cc b/gcc/config/aarch64/aarch64-sve-builtins-base.cc index c24c054..bee4109 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins-base.cc +++ b/gcc/config/aarch64/aarch64-sve-builtins-base.cc @@ -148,7 +148,7 @@ class svabd_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* The integer operations are represented as the subtraction of the minimum from the maximum, with the signedness of the instruction @@ -179,7 +179,7 @@ public: CONSTEXPR svac_impl (int unspec) : m_unspec (unspec) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { e.add_ptrue_hint (0, e.gp_mode (0)); insn_code icode = code_for_aarch64_pred_fac (m_unspec, e.vector_mode (0)); @@ -194,7 +194,7 @@ class svadda_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* Put the predicate last, as required by mask_fold_left_plus_optab. */ e.rotate_inputs_left (0, 3); @@ -211,7 +211,7 @@ public: CONSTEXPR svadr_bhwd_impl (unsigned int shift) : m_shift (shift) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { machine_mode mode = GET_MODE (e.args[0]); if (m_shift == 0) @@ -231,7 +231,7 @@ class svbic_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* Convert svbic of a constant into svand of its inverse. */ if (CONST_INT_P (e.args[2])) @@ -261,7 +261,7 @@ public: CONSTEXPR svbrk_binary_impl (int unspec) : m_unspec (unspec) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { return e.use_exact_insn (code_for_aarch64_brk (m_unspec)); } @@ -277,7 +277,7 @@ public: CONSTEXPR svbrk_unary_impl (int unspec) : m_unspec (unspec) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { return e.use_cond_insn (code_for_aarch64_brk (m_unspec)); } @@ -290,7 +290,7 @@ class svcadd_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* Convert the rotation amount into a specific unspec. */ int rot = INTVAL (e.args.pop ()); @@ -311,7 +311,7 @@ public: CONSTEXPR svclast_impl (int unspec) : m_unspec (unspec) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* Match the fold_extract_optab order. */ std::swap (e.args[0], e.args[1]); @@ -332,7 +332,7 @@ class svcmla_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* Convert the rotation amount into a specific unspec. */ int rot = INTVAL (e.args.pop ()); @@ -355,7 +355,7 @@ class svcmla_lane_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* Convert the rotation amount into a specific unspec. */ int rot = INTVAL (e.args.pop ()); @@ -384,7 +384,7 @@ public: : m_code (code), m_unspec_for_fp (unspec_for_fp) {} gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { tree pg = gimple_call_arg (f.call, 0); tree rhs1 = gimple_call_arg (f.call, 1); @@ -406,7 +406,7 @@ public: } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { machine_mode mode = e.vector_mode (0); @@ -442,7 +442,7 @@ public: m_unspec_for_uint (unspec_for_uint) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { machine_mode mode = e.vector_mode (0); bool unsigned_p = e.type_suffix (0).unsigned_p; @@ -480,7 +480,7 @@ class svcmpuo_impl : public quiet { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { e.add_ptrue_hint (0, e.gp_mode (0)); return e.use_exact_insn (code_for_aarch64_pred_fcmuo (e.vector_mode (0))); @@ -491,7 +491,7 @@ class svcnot_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { machine_mode mode = e.vector_mode (0); if (e.pred == PRED_x) @@ -514,7 +514,7 @@ public: CONSTEXPR svcnt_bhwd_impl (machine_mode ref_mode) : m_ref_mode (ref_mode) {} gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { tree count = build_int_cstu (TREE_TYPE (f.lhs), GET_MODE_NUNITS (m_ref_mode)); @@ -522,7 +522,7 @@ public: } rtx - expand (function_expander &) const OVERRIDE + expand (function_expander &) const override { return gen_int_mode (GET_MODE_NUNITS (m_ref_mode), DImode); } @@ -539,7 +539,7 @@ public: : svcnt_bhwd_impl (ref_mode) {} gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { tree pattern_arg = gimple_call_arg (f.call, 0); aarch64_svpattern pattern = (aarch64_svpattern) tree_to_shwi (pattern_arg); @@ -562,7 +562,7 @@ public: } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { unsigned int elements_per_vq = 128 / GET_MODE_UNIT_BITSIZE (m_ref_mode); e.args.quick_push (gen_int_mode (elements_per_vq, DImode)); @@ -575,7 +575,7 @@ class svcntp_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { machine_mode mode = e.vector_mode (0); e.add_ptrue_hint (0, mode); @@ -591,7 +591,7 @@ public: : quiet (vectors_per_tuple) {} gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { unsigned int nargs = gimple_call_num_args (f.call); tree lhs_type = TREE_TYPE (f.lhs); @@ -621,7 +621,7 @@ public: } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { rtx lhs_tuple = e.get_nonoverlapping_reg_target (); @@ -643,7 +643,7 @@ class svcvt_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { machine_mode mode0 = e.vector_mode (0); machine_mode mode1 = e.vector_mode (1); @@ -706,7 +706,7 @@ class svdot_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* In the optab, the multiplication operands come before the accumulator operand. The optab is keyed off the multiplication mode. */ @@ -729,7 +729,7 @@ public: unspec_for_float) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* Use the same ordering as the dot_prod_optab, with the accumulator last. */ @@ -744,7 +744,7 @@ class svdup_impl : public quiet { public: gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { tree vec_type = TREE_TYPE (f.lhs); tree rhs = gimple_call_arg (f.call, f.pred == PRED_none ? 0 : 1); @@ -784,7 +784,7 @@ public: } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { if (e.pred == PRED_none || e.pred == PRED_x) /* There's no benefit to using predicated instructions for _x here. */ @@ -812,7 +812,7 @@ class svdup_lane_impl : public quiet { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* The native DUP lane has an index range of 64 bytes. */ machine_mode mode = e.vector_mode (0); @@ -829,7 +829,7 @@ class svdupq_impl : public quiet { public: gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { tree vec_type = TREE_TYPE (f.lhs); unsigned int nargs = gimple_call_num_args (f.call); @@ -851,7 +851,7 @@ public: } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { machine_mode mode = e.vector_mode (0); unsigned int elements_per_vq = e.args.length (); @@ -900,7 +900,7 @@ class svdupq_lane_impl : public quiet { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { machine_mode mode = e.vector_mode (0); rtx index = e.args[1]; @@ -964,7 +964,7 @@ public: : m_from_mode (from_mode) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { if (e.type_suffix (0).unsigned_p) { @@ -1006,7 +1006,7 @@ public: : quiet (vectors_per_tuple) {} gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { /* Fold into a normal gimple component access. */ tree rhs_tuple = gimple_call_arg (f.call, 0); @@ -1020,7 +1020,7 @@ public: } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* Fold the access into a subreg rvalue. */ return simplify_gen_subreg (e.vector_mode (0), e.args[0], @@ -1033,7 +1033,7 @@ class svindex_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { return e.use_exact_insn (e.direct_optab_handler (vec_series_optab)); } @@ -1043,7 +1043,7 @@ class svinsr_impl : public quiet { public: gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { gcall *new_call = gimple_build_call_internal (IFN_VEC_SHL_INSERT, 2, gimple_call_arg (f.call, 0), @@ -1053,7 +1053,7 @@ public: } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { insn_code icode = direct_optab_handler (vec_shl_insert_optab, e.vector_mode (0)); @@ -1068,7 +1068,7 @@ public: CONSTEXPR svlast_impl (int unspec) : m_unspec (unspec) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { return e.use_exact_insn (code_for_extract (m_unspec, e.vector_mode (0))); } @@ -1081,13 +1081,13 @@ class svld1_impl : public full_width_access { public: unsigned int - call_properties (const function_instance &) const OVERRIDE + call_properties (const function_instance &) const override { return CP_READ_MEMORY; } gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { tree vectype = f.vector_type (0); @@ -1105,7 +1105,7 @@ public: } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { insn_code icode = convert_optab_handler (maskload_optab, e.vector_mode (0), e.gp_mode (0)); @@ -1121,7 +1121,7 @@ public: : extending_load (memory_type) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { insn_code icode = code_for_aarch64_load (UNSPEC_LD1_SVE, extend_rtx_code (), e.vector_mode (0), @@ -1134,13 +1134,13 @@ class svld1_gather_impl : public full_width_access { public: unsigned int - call_properties (const function_instance &) const OVERRIDE + call_properties (const function_instance &) const override { return CP_READ_MEMORY; } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { e.prepare_gather_address_operands (1); /* Put the predicate last, as required by mask_gather_load_optab. */ @@ -1161,7 +1161,7 @@ public: : extending_load (memory_type) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { e.prepare_gather_address_operands (1); /* Put the predicate last, since the extending gathers use the same @@ -1180,13 +1180,13 @@ class load_replicate : public function_base { public: unsigned int - call_properties (const function_instance &) const OVERRIDE + call_properties (const function_instance &) const override { return CP_READ_MEMORY; } tree - memory_scalar_type (const function_instance &fi) const OVERRIDE + memory_scalar_type (const function_instance &fi) const override { return fi.scalar_type (0); } @@ -1196,13 +1196,13 @@ class svld1rq_impl : public load_replicate { public: machine_mode - memory_vector_mode (const function_instance &fi) const OVERRIDE + memory_vector_mode (const function_instance &fi) const override { return aarch64_vq_mode (GET_MODE_INNER (fi.vector_mode (0))).require (); } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { insn_code icode = code_for_aarch64_sve_ld1rq (e.vector_mode (0)); return e.use_contiguous_load_insn (icode); @@ -1213,13 +1213,13 @@ class svld1ro_impl : public load_replicate { public: machine_mode - memory_vector_mode (const function_instance &) const OVERRIDE + memory_vector_mode (const function_instance &) const override { return OImode; } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { insn_code icode = code_for_aarch64_sve_ld1ro (e.vector_mode (0)); return e.use_contiguous_load_insn (icode); @@ -1234,13 +1234,13 @@ public: : full_width_access (vectors_per_tuple) {} unsigned int - call_properties (const function_instance &) const OVERRIDE + call_properties (const function_instance &) const override { return CP_READ_MEMORY; } gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { tree tuple_type = TREE_TYPE (f.lhs); tree vectype = f.vector_type (0); @@ -1275,7 +1275,7 @@ public: } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { machine_mode tuple_mode = TYPE_MODE (TREE_TYPE (e.call_expr)); insn_code icode = convert_optab_handler (vec_mask_load_lanes_optab, @@ -1288,13 +1288,13 @@ class svldff1_gather_impl : public full_width_access { public: unsigned int - call_properties (const function_instance &) const OVERRIDE + call_properties (const function_instance &) const override { return CP_READ_MEMORY | CP_READ_FFR | CP_WRITE_FFR; } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* See the block comment in aarch64-sve.md for details about the FFR handling. */ @@ -1317,7 +1317,7 @@ public: : extending_load (memory_type) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* See the block comment in aarch64-sve.md for details about the FFR handling. */ @@ -1340,13 +1340,13 @@ class svldnt1_impl : public full_width_access { public: unsigned int - call_properties (const function_instance &) const OVERRIDE + call_properties (const function_instance &) const override { return CP_READ_MEMORY; } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { insn_code icode = code_for_aarch64_ldnt1 (e.vector_mode (0)); return e.use_contiguous_load_insn (icode); @@ -1360,13 +1360,13 @@ public: CONSTEXPR svldxf1_impl (int unspec) : m_unspec (unspec) {} unsigned int - call_properties (const function_instance &) const OVERRIDE + call_properties (const function_instance &) const override { return CP_READ_MEMORY | CP_READ_FFR | CP_WRITE_FFR; } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* See the block comment in aarch64-sve.md for details about the FFR handling. */ @@ -1388,13 +1388,13 @@ public: : extending_load (memory_type), m_unspec (unspec) {} unsigned int - call_properties (const function_instance &) const OVERRIDE + call_properties (const function_instance &) const override { return CP_READ_MEMORY | CP_READ_FFR | CP_WRITE_FFR; } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* See the block comment in aarch64-sve.md for details about the FFR handling. */ @@ -1414,7 +1414,7 @@ class svlen_impl : public quiet { public: gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { /* The argument only exists for its type. */ tree rhs_type = TREE_TYPE (gimple_call_arg (f.call, 0)); @@ -1424,7 +1424,7 @@ public: } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* The argument only exists for its type. */ return gen_int_mode (GET_MODE_NUNITS (e.vector_mode (0)), DImode); @@ -1435,7 +1435,7 @@ class svmad_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { return expand_mad (e); } @@ -1445,7 +1445,7 @@ class svmla_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* Put the accumulator at the end (argument 3), but keep it as the merge input for _m functions. */ @@ -1458,7 +1458,7 @@ class svmla_lane_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { if (e.type_suffix (0).integer_p) { @@ -1473,7 +1473,7 @@ class svmls_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* Put the accumulator at the end (argument 3), but keep it as the merge input for _m functions. */ @@ -1486,7 +1486,7 @@ class svmov_impl : public function_base { public: gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { return gimple_build_assign (f.lhs, BIT_AND_EXPR, gimple_call_arg (f.call, 0), @@ -1494,7 +1494,7 @@ public: } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* The canonical form for the assembler alias "MOV Pa.B, Pb/Z, Pc.B" is "AND Pa.B, Pb/Z, Pc.B, Pc.B". */ @@ -1508,7 +1508,7 @@ class svmls_lane_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { if (e.type_suffix (0).integer_p) { @@ -1523,7 +1523,7 @@ class svmmla_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { insn_code icode; if (e.type_suffix (0).integer_p) @@ -1543,7 +1543,7 @@ class svmsb_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { return expand_msb (e); } @@ -1553,7 +1553,7 @@ class svnand_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { gcc_assert (e.pred == PRED_z); return e.use_exact_insn (CODE_FOR_aarch64_pred_nandvnx16bi_z); @@ -1564,7 +1564,7 @@ class svnor_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { gcc_assert (e.pred == PRED_z); return e.use_exact_insn (CODE_FOR_aarch64_pred_norvnx16bi_z); @@ -1577,7 +1577,7 @@ public: CONSTEXPR svnot_impl () : rtx_code_function (NOT, NOT, -1) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { if (e.type_suffix_ids[0] == TYPE_SUFFIX_b) { @@ -1595,7 +1595,7 @@ class svorn_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { gcc_assert (e.pred == PRED_z); return e.use_exact_insn (CODE_FOR_aarch64_pred_ornvnx16bi_z); @@ -1606,13 +1606,13 @@ class svpfalse_impl : public function_base { public: gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { return f.fold_to_pfalse (); } rtx - expand (function_expander &) const OVERRIDE + expand (function_expander &) const override { return CONST0_RTX (VNx16BImode); } @@ -1625,7 +1625,7 @@ public: CONSTEXPR svpfirst_svpnext_impl (int unspec) : m_unspec (unspec) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { machine_mode mode = e.vector_mode (0); e.add_ptrue_hint (0, mode); @@ -1643,13 +1643,13 @@ public: CONSTEXPR svprf_bhwd_impl (machine_mode mode) : m_mode (mode) {} unsigned int - call_properties (const function_instance &) const OVERRIDE + call_properties (const function_instance &) const override { return CP_PREFETCH_MEMORY; } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { e.prepare_prefetch_operands (); insn_code icode = code_for_aarch64_sve_prefetch (m_mode); @@ -1667,19 +1667,19 @@ public: CONSTEXPR svprf_bhwd_gather_impl (machine_mode mode) : m_mode (mode) {} unsigned int - call_properties (const function_instance &) const OVERRIDE + call_properties (const function_instance &) const override { return CP_PREFETCH_MEMORY; } machine_mode - memory_vector_mode (const function_instance &) const OVERRIDE + memory_vector_mode (const function_instance &) const override { return m_mode; } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { e.prepare_prefetch_operands (); e.prepare_gather_address_operands (1); @@ -1705,7 +1705,7 @@ public: CONSTEXPR svptest_impl (rtx_code compare) : m_compare (compare) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* See whether GP is an exact ptrue for some predicate mode; i.e. whether converting the GP to that mode will not drop @@ -1751,13 +1751,13 @@ class svptrue_impl : public function_base { public: gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { return f.fold_to_ptrue (); } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { return aarch64_ptrue_all (e.type_suffix (0).element_bytes); } @@ -1767,7 +1767,7 @@ class svptrue_pat_impl : public function_base { public: gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { tree pattern_arg = gimple_call_arg (f.call, 0); aarch64_svpattern pattern = (aarch64_svpattern) tree_to_shwi (pattern_arg); @@ -1788,7 +1788,7 @@ public: } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* In rtl, the predicate is represented as the constant: @@ -1816,7 +1816,7 @@ public: {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* Treat non-_pat functions in the same way as _pat functions with an SV_ALL argument. */ @@ -1877,7 +1877,7 @@ public: {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { rtx_code code = (e.type_suffix (0).unsigned_p ? m_code_for_uint @@ -1908,13 +1908,13 @@ class svrdffr_impl : public function_base { public: unsigned int - call_properties (const function_instance &) const OVERRIDE + call_properties (const function_instance &) const override { return CP_READ_FFR; } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* See the block comment in aarch64-sve.md for details about the FFR handling. */ @@ -1931,7 +1931,7 @@ class svreinterpret_impl : public quiet { public: gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { /* Punt to rtl if the effect of the reinterpret on registers does not conform to GCC's endianness model. */ @@ -1947,7 +1947,7 @@ public: } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { machine_mode mode = e.vector_mode (0); return e.use_exact_insn (code_for_aarch64_sve_reinterpret (mode)); @@ -1958,7 +1958,7 @@ class svrev_impl : public permute { public: gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { /* Punt for now on _b16 and wider; we'd need more complex evpc logic to rerecognize the result. */ @@ -1974,7 +1974,7 @@ public: } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { return e.use_exact_insn (code_for_aarch64_sve_rev (e.vector_mode (0))); } @@ -1984,7 +1984,7 @@ class svsel_impl : public quiet { public: gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { /* svsel corresponds exactly to VEC_COND_EXPR. */ gimple_seq stmts = NULL; @@ -1996,7 +1996,7 @@ public: } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* svsel (cond, truev, falsev) is vcond_mask (truev, falsev, cond). */ e.rotate_inputs_left (0, 3); @@ -2015,7 +2015,7 @@ public: : quiet (vectors_per_tuple) {} gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { tree rhs_tuple = gimple_call_arg (f.call, 0); tree index = gimple_call_arg (f.call, 1); @@ -2042,7 +2042,7 @@ public: } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { rtx rhs_tuple = e.args[0]; unsigned int index = INTVAL (e.args[1]); @@ -2065,13 +2065,13 @@ class svsetffr_impl : public function_base { public: unsigned int - call_properties (const function_instance &) const OVERRIDE + call_properties (const function_instance &) const override { return CP_WRITE_FFR; } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { e.args.quick_push (CONSTM1_RTX (VNx16BImode)); return e.use_exact_insn (CODE_FOR_aarch64_wrffr); @@ -2082,13 +2082,13 @@ class svst1_impl : public full_width_access { public: unsigned int - call_properties (const function_instance &) const OVERRIDE + call_properties (const function_instance &) const override { return CP_WRITE_MEMORY; } gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { tree vectype = f.vector_type (0); @@ -2105,7 +2105,7 @@ public: } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { insn_code icode = convert_optab_handler (maskstore_optab, e.vector_mode (0), e.gp_mode (0)); @@ -2117,13 +2117,13 @@ class svst1_scatter_impl : public full_width_access { public: unsigned int - call_properties (const function_instance &) const OVERRIDE + call_properties (const function_instance &) const override { return CP_WRITE_MEMORY; } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { e.prepare_gather_address_operands (1); /* Put the predicate last, as required by mask_scatter_store_optab. */ @@ -2144,7 +2144,7 @@ public: : truncating_store (to_mode) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { e.prepare_gather_address_operands (1); /* Put the predicate last, since the truncating scatters use the same @@ -2164,7 +2164,7 @@ public: : truncating_store (to_mode) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { insn_code icode = code_for_aarch64_store_trunc (e.memory_vector_mode (), e.vector_mode (0)); @@ -2180,13 +2180,13 @@ public: : full_width_access (vectors_per_tuple) {} unsigned int - call_properties (const function_instance &) const OVERRIDE + call_properties (const function_instance &) const override { return CP_WRITE_MEMORY; } gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { tree vectype = f.vector_type (0); @@ -2208,7 +2208,7 @@ public: } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { machine_mode tuple_mode = GET_MODE (e.args.last ()); insn_code icode = convert_optab_handler (vec_mask_store_lanes_optab, @@ -2221,13 +2221,13 @@ class svstnt1_impl : public full_width_access { public: unsigned int - call_properties (const function_instance &) const OVERRIDE + call_properties (const function_instance &) const override { return CP_WRITE_MEMORY; } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { insn_code icode = code_for_aarch64_stnt1 (e.vector_mode (0)); return e.use_contiguous_store_insn (icode); @@ -2241,7 +2241,7 @@ public: : rtx_code_function (MINUS, MINUS, UNSPEC_COND_FSUB) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* Canonicalize subtractions of constants to additions. */ machine_mode mode = e.vector_mode (0); @@ -2256,7 +2256,7 @@ class svtbl_impl : public permute { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { return e.use_exact_insn (code_for_aarch64_sve_tbl (e.vector_mode (0))); } @@ -2270,7 +2270,7 @@ public: : binary_permute (base ? UNSPEC_TRN2 : UNSPEC_TRN1), m_base (base) {} gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { /* svtrn1: { 0, nelts, 2, nelts + 2, 4, nelts + 4, ... } svtrn2: as for svtrn1, but with 1 added to each index. */ @@ -2296,7 +2296,7 @@ public: : quiet (vectors_per_tuple) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { rtx target = e.get_reg_target (); emit_clobber (copy_rtx (target)); @@ -2311,7 +2311,7 @@ public: CONSTEXPR svunpk_impl (bool high_p) : m_high_p (high_p) {} gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { /* Don't fold the predicate ops, since every bit of the svbool_t result is significant. */ @@ -2326,7 +2326,7 @@ public: } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { machine_mode mode = GET_MODE (e.args[0]); unsigned int unpacku = m_high_p ? UNSPEC_UNPACKUHI : UNSPEC_UNPACKULO; @@ -2353,7 +2353,7 @@ public: CONSTEXPR svusdot_impl (bool su) : m_su (su) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* The implementation of the ACLE function svsudot (for the non-lane version) is through the USDOT instruction but with the second and third @@ -2382,7 +2382,7 @@ public: : binary_permute (base ? UNSPEC_UZP2 : UNSPEC_UZP1), m_base (base) {} gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { /* svuzp1: { 0, 2, 4, 6, ... } svuzp2: { 1, 3, 5, 7, ... }. */ @@ -2456,7 +2456,7 @@ public: } gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { if (f.type_suffix (1).unsigned_p) return fold_type (f); @@ -2472,13 +2472,13 @@ class svwrffr_impl : public function_base { public: unsigned int - call_properties (const function_instance &) const OVERRIDE + call_properties (const function_instance &) const override { return CP_WRITE_FFR; } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { return e.use_exact_insn (CODE_FOR_aarch64_wrffr); } @@ -2492,7 +2492,7 @@ public: : binary_permute (base ? UNSPEC_ZIP2 : UNSPEC_ZIP1), m_base (base) {} gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { /* svzip1: { 0, nelts, 1, nelts + 1, 2, nelts + 2, ... } svzip2: as for svzip1, but with nelts / 2 added to each index. */ diff --git a/gcc/config/aarch64/aarch64-sve-builtins-functions.h b/gcc/config/aarch64/aarch64-sve-builtins-functions.h index 9d346b6..b8a86e3 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins-functions.h +++ b/gcc/config/aarch64/aarch64-sve-builtins-functions.h @@ -44,7 +44,7 @@ public: : T (t1, t2, t3) {} unsigned int - call_properties (const function_instance &) const OVERRIDE + call_properties (const function_instance &) const override { return 0; } @@ -59,7 +59,7 @@ public: : m_vectors_per_tuple (vectors_per_tuple) {} unsigned int - vectors_per_tuple () const OVERRIDE + vectors_per_tuple () const override { return m_vectors_per_tuple; } @@ -78,13 +78,13 @@ public: : multi_vector_function (vectors_per_tuple) {} tree - memory_scalar_type (const function_instance &fi) const OVERRIDE + memory_scalar_type (const function_instance &fi) const override { return fi.scalar_type (0); } machine_mode - memory_vector_mode (const function_instance &fi) const OVERRIDE + memory_vector_mode (const function_instance &fi) const override { machine_mode mode = fi.vector_mode (0); if (m_vectors_per_tuple != 1) @@ -103,19 +103,19 @@ public: : m_memory_type (memory_type) {} unsigned int - call_properties (const function_instance &) const OVERRIDE + call_properties (const function_instance &) const override { return CP_READ_MEMORY; } tree - memory_scalar_type (const function_instance &) const OVERRIDE + memory_scalar_type (const function_instance &) const override { return scalar_types[type_suffixes[m_memory_type].vector_type]; } machine_mode - memory_vector_mode (const function_instance &fi) const OVERRIDE + memory_vector_mode (const function_instance &fi) const override { machine_mode mem_mode = type_suffixes[m_memory_type].vector_mode; machine_mode reg_mode = fi.vector_mode (0); @@ -145,13 +145,13 @@ public: CONSTEXPR truncating_store (scalar_int_mode to_mode) : m_to_mode (to_mode) {} unsigned int - call_properties (const function_instance &) const OVERRIDE + call_properties (const function_instance &) const override { return CP_WRITE_MEMORY; } tree - memory_scalar_type (const function_instance &fi) const OVERRIDE + memory_scalar_type (const function_instance &fi) const override { /* In truncating stores, the signedness of the memory element is defined to be the same as the signedness of the vector element. The signedness @@ -163,7 +163,7 @@ public: } machine_mode - memory_vector_mode (const function_instance &fi) const OVERRIDE + memory_vector_mode (const function_instance &fi) const override { poly_uint64 nunits = GET_MODE_NUNITS (fi.vector_mode (0)); return aarch64_sve_data_mode (m_to_mode, nunits).require (); @@ -205,7 +205,7 @@ public: : rtx_code_function_base (code_for_sint, code_for_uint, unspec_for_fp) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { return e.map_to_rtx_codes (m_code_for_sint, m_code_for_uint, m_unspec_for_fp); @@ -225,7 +225,7 @@ public: : rtx_code_function_base (code_for_sint, code_for_uint, unspec_for_fp) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* Rotate the inputs into their normal order, but continue to make _m functions merge with what was originally the first vector argument. */ @@ -279,7 +279,7 @@ public: {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { return e.map_to_unspecs (m_unspec_for_sint, m_unspec_for_uint, m_unspec_for_fp); @@ -301,7 +301,7 @@ public: {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* Rotate the inputs into their normal order, but continue to make _m functions merge with what was originally the first vector argument. */ @@ -329,7 +329,7 @@ public: {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { return e.use_exact_insn (CODE (unspec_for (e), e.vector_mode (0))); } @@ -386,7 +386,7 @@ public: {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { int unspec = unspec_for (e); insn_code icode; @@ -421,7 +421,7 @@ public: {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { int unspec = unspec_for (e); insn_code icode; @@ -451,7 +451,7 @@ class code_for_mode_function : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { return e.use_exact_insn (CODE_FOR_MODE (e.vector_mode (N))); } @@ -477,7 +477,7 @@ public: CONSTEXPR fixed_insn_function (insn_code code) : m_code (code) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { return e.use_exact_insn (m_code); } @@ -519,7 +519,7 @@ public: CONSTEXPR binary_permute (int unspec) : m_unspec (unspec) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { insn_code icode = code_for_aarch64_sve (m_unspec, e.vector_mode (0)); return e.use_exact_insn (icode); @@ -547,7 +547,7 @@ public: {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { machine_mode mode = e.vector_mode (0); int unspec = (!e.type_suffix (0).integer_p ? m_unspec_for_fp @@ -576,7 +576,7 @@ public: : m_code (code), m_wide_unspec (wide_unspec) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { machine_mode mode = e.vector_mode (0); machine_mode elem_mode = GET_MODE_INNER (mode); @@ -610,7 +610,7 @@ public: CONSTEXPR unary_count (rtx_code code) : m_code (code) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* The md patterns treat the operand as an integer. */ machine_mode mode = aarch64_sve_int_mode (e.vector_mode (0)); @@ -636,7 +636,7 @@ public: {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* Suffix 0 determines the predicate mode, suffix 1 determines the scalar mode and signedness. */ diff --git a/gcc/config/aarch64/aarch64-sve-builtins-shapes.cc b/gcc/config/aarch64/aarch64-sve-builtins-shapes.cc index f57f926..8e26bd8 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins-shapes.cc +++ b/gcc/config/aarch64/aarch64-sve-builtins-shapes.cc @@ -454,13 +454,13 @@ long_type_suffix (function_resolver &r, type_suffix_index type) struct nonoverloaded_base : public function_shape { bool - explicit_type_suffix_p (unsigned int) const OVERRIDE + explicit_type_suffix_p (unsigned int) const override { return true; } tree - resolve (function_resolver &) const OVERRIDE + resolve (function_resolver &) const override { gcc_unreachable (); } @@ -472,7 +472,7 @@ template struct overloaded_base : public function_shape { bool - explicit_type_suffix_p (unsigned int i) const OVERRIDE + explicit_type_suffix_p (unsigned int i) const override { return (EXPLICIT_MASK >> i) & 1; } @@ -484,7 +484,7 @@ struct adr_base : public overloaded_base<0> /* The function takes two arguments: a vector base and a vector displacement (either an index or an offset). Resolve based on them both. */ tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; mode_suffix_index mode; @@ -503,7 +503,7 @@ template struct binary_imm_narrowb_base : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_n); STATIC_ASSERT (CLASS == function_resolver::SAME_TYPE_CLASS @@ -515,7 +515,7 @@ struct binary_imm_narrowb_base : public overloaded_base<0> } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_uniform (1, 1); } @@ -528,7 +528,7 @@ template struct binary_imm_narrowt_base : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_n); STATIC_ASSERT (CLASS == function_resolver::SAME_TYPE_CLASS @@ -540,7 +540,7 @@ struct binary_imm_narrowt_base : public overloaded_base<0> } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -560,14 +560,14 @@ struct binary_imm_narrowt_base : public overloaded_base<0> struct binary_imm_long_base : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_n); build_all (b, "v0,vh0,su64", group, MODE_n); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type, result_type; @@ -623,7 +623,7 @@ struct inc_dec_base : public overloaded_base<0> } bool - check (function_checker &c) const OVERRIDE + check (function_checker &c) const override { return c.require_immediate_range (m_pat_p ? 2 : 1, 1, 16); } @@ -637,7 +637,7 @@ struct load_contiguous_base : public overloaded_base<0> /* Resolve a call based purely on a pointer argument. The other arguments are a governing predicate and (for MODE_vnum) a vnum offset. */ tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { bool vnum_p = r.mode_suffix_id == MODE_vnum; gcc_assert (r.mode_suffix_id == MODE_none || vnum_p); @@ -658,7 +658,7 @@ struct load_contiguous_base : public overloaded_base<0> struct load_gather_sv_base : public overloaded_base<0> { tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; mode_suffix_index mode; @@ -686,7 +686,7 @@ struct load_ext_gather_base : public overloaded_base<1> The function has an explicit type suffix that determines the type of the loaded data. */ tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { /* No resolution is needed for a vector base with no displacement; there's a one-to-one mapping between short and long names. */ @@ -713,7 +713,7 @@ struct load_ext_gather_base : public overloaded_base<1> struct mmla_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); /* svmmla is distributed over several extensions. Allow the common @@ -729,7 +729,7 @@ struct mmla_def : public overloaded_base<0> } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -769,7 +769,7 @@ struct prefetch_gather_base : public overloaded_base<0> The prefetch operation is the final argument. This is purely a mode-based resolution; there are no type suffixes. */ tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { bool has_displacement_p = r.displacement_units () != UNITS_none; @@ -791,7 +791,7 @@ template struct shift_right_imm_narrow_wrapper : public BASE { bool - check (function_checker &c) const OVERRIDE + check (function_checker &c) const override { unsigned int bits = c.type_suffix (0).element_bits / 2; return c.require_immediate_range (N, 1, bits); @@ -811,7 +811,7 @@ struct store_scatter_base : public overloaded_base<0> The stored data is the final argument, and it determines the type suffix. */ tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { bool has_displacement_p = r.displacement_units () != UNITS_none; @@ -832,14 +832,14 @@ struct store_scatter_base : public overloaded_base<0> struct ternary_shift_imm_base : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_n); build_all (b, "v0,v0,v0,su64", group, MODE_n); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_uniform (2, 1); } @@ -862,7 +862,7 @@ template { tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -884,7 +884,7 @@ template { tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -908,7 +908,7 @@ template { tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -932,14 +932,14 @@ struct ternary_bfloat_lane_base : public ternary_resize2_lane_base<16, TYPE_bfloat, TYPE_bfloat> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,vB,vB,su64", group, MODE_none); } bool - check (function_checker &c) const OVERRIDE + check (function_checker &c) const override { return c.require_immediate_lane_index (3, N); } @@ -954,7 +954,7 @@ struct ternary_qq_lane_base TYPE_CLASS2, TYPE_CLASS3> { bool - check (function_checker &c) const OVERRIDE + check (function_checker &c) const override { return c.require_immediate_lane_index (3, 4); } @@ -966,7 +966,7 @@ template struct unary_narrowb_base : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); STATIC_ASSERT (CLASS == function_resolver::SAME_TYPE_CLASS @@ -978,7 +978,7 @@ struct unary_narrowb_base : public overloaded_base<0> } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_unary (CLASS, r.HALF_SIZE); } @@ -991,7 +991,7 @@ template struct unary_narrowt_base : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); STATIC_ASSERT (CLASS == function_resolver::SAME_TYPE_CLASS @@ -1003,7 +1003,7 @@ struct unary_narrowt_base : public overloaded_base<0> } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -1023,7 +1023,7 @@ struct unary_narrowt_base : public overloaded_base<0> struct adr_index_def : public adr_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_index); build_all (b, "b,b,d", group, MODE_u32base_s32index); @@ -1041,7 +1041,7 @@ SHAPE (adr_index) struct adr_offset_def : public adr_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_offset); build_all (b, "b,b,d", group, MODE_u32base_s32offset); @@ -1058,14 +1058,14 @@ SHAPE (adr_offset) struct binary_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,v0", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_uniform (2); } @@ -1080,7 +1080,7 @@ SHAPE (binary) struct binary_int_opt_n_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,vs0", group, MODE_none); @@ -1088,7 +1088,7 @@ struct binary_int_opt_n_def : public overloaded_base<0> } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -1108,20 +1108,20 @@ SHAPE (binary_int_opt_n) struct binary_lane_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,v0,su64", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_uniform (2, 1); } bool - check (function_checker &c) const OVERRIDE + check (function_checker &c) const override { return c.require_immediate_lane_index (2); } @@ -1135,14 +1135,14 @@ SHAPE (binary_lane) struct binary_long_lane_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,vh0,vh0,su64", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type, result_type; @@ -1160,7 +1160,7 @@ struct binary_long_lane_def : public overloaded_base<0> } bool - check (function_checker &c) const OVERRIDE + check (function_checker &c) const override { return c.require_immediate_lane_index (2); } @@ -1172,7 +1172,7 @@ SHAPE (binary_long_lane) struct binary_long_opt_n_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,vh0,vh0", group, MODE_none); @@ -1180,7 +1180,7 @@ struct binary_long_opt_n_def : public overloaded_base<0> } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type, result_type; @@ -1202,14 +1202,14 @@ SHAPE (binary_long_opt_n) struct binary_n_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_n); build_all (b, "v0,v0,s0", group, MODE_n); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -1231,7 +1231,7 @@ SHAPE (binary_n) struct binary_narrowb_opt_n_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "vh0,v0,v0", group, MODE_none); @@ -1239,7 +1239,7 @@ struct binary_narrowb_opt_n_def : public overloaded_base<0> } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_uniform_opt_n (2); } @@ -1253,7 +1253,7 @@ SHAPE (binary_narrowb_opt_n) struct binary_narrowt_opt_n_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "vh0,vh0,v0,v0", group, MODE_none); @@ -1261,7 +1261,7 @@ struct binary_narrowt_opt_n_def : public overloaded_base<0> } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -1284,7 +1284,7 @@ SHAPE (binary_narrowt_opt_n) struct binary_opt_n_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,v0", group, MODE_none); @@ -1298,7 +1298,7 @@ struct binary_opt_n_def : public overloaded_base<0> } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_uniform_opt_n (2); } @@ -1309,7 +1309,7 @@ SHAPE (binary_opt_n) struct binary_pred_def : public nonoverloaded_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { build_all (b, "v0,v0,v0", group, MODE_none); } @@ -1322,20 +1322,20 @@ SHAPE (binary_pred) struct binary_rotate_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,v0,su64", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_uniform (2, 1); } bool - check (function_checker &c) const OVERRIDE + check (function_checker &c) const override { return c.require_immediate_either_or (2, 90, 270); } @@ -1349,7 +1349,7 @@ SHAPE (binary_rotate) struct binary_scalar_def : public nonoverloaded_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { build_all (b, "v0,s0,s0", group, MODE_none); } @@ -1362,14 +1362,14 @@ SHAPE (binary_scalar) struct binary_to_uint_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "vu0,v0,v0", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_uniform (2); } @@ -1383,14 +1383,14 @@ SHAPE (binary_to_uint) struct binary_uint_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,vu0", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -1411,14 +1411,14 @@ SHAPE (binary_uint) struct binary_uint_n_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,su0", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -1440,7 +1440,7 @@ SHAPE (binary_uint_n) struct binary_uint_opt_n_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,vu0", group, MODE_none); @@ -1448,7 +1448,7 @@ struct binary_uint_opt_n_def : public overloaded_base<0> } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -1468,14 +1468,14 @@ SHAPE (binary_uint_opt_n) struct binary_uint64_n_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,su64", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -1497,7 +1497,7 @@ SHAPE (binary_uint64_n) struct binary_uint64_opt_n_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,vu64", group, MODE_none); @@ -1505,7 +1505,7 @@ struct binary_uint64_opt_n_def : public overloaded_base<0> } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -1522,14 +1522,14 @@ SHAPE (binary_uint64_opt_n) struct binary_wide_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,vh0", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -1549,7 +1549,7 @@ SHAPE (binary_wide) struct binary_wide_opt_n_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,vh0", group, MODE_none); @@ -1557,7 +1557,7 @@ struct binary_wide_opt_n_def : public overloaded_base<0> } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -1576,7 +1576,7 @@ SHAPE (binary_wide_opt_n) struct clast_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,v0", group, MODE_none); @@ -1584,7 +1584,7 @@ struct clast_def : public overloaded_base<0> } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; if (!r.check_gp_argument (2, i, nargs) @@ -1615,14 +1615,14 @@ SHAPE (clast) struct compare_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "vp,v0,v0", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_uniform (2); } @@ -1636,7 +1636,7 @@ SHAPE (compare) struct compare_opt_n_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "vp,v0,v0", group, MODE_none); @@ -1644,7 +1644,7 @@ struct compare_opt_n_def : public overloaded_base<0> } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_uniform_opt_n (2); } @@ -1655,14 +1655,14 @@ SHAPE (compare_opt_n) struct compare_ptr_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "vp,al,al", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -1684,14 +1684,14 @@ SHAPE (compare_ptr) struct compare_scalar_def : public overloaded_base<1> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "vp,s1,s1", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -1714,7 +1714,7 @@ SHAPE (compare_scalar) struct compare_wide_opt_n_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "vp,v0,vw0", group, MODE_none); @@ -1722,7 +1722,7 @@ struct compare_wide_opt_n_def : public overloaded_base<0> } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -1739,7 +1739,7 @@ SHAPE (compare_wide_opt_n) struct count_inherent_def : public nonoverloaded_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { build_all (b, "su64", group, MODE_none); } @@ -1750,7 +1750,7 @@ SHAPE (count_inherent) struct count_pat_def : public nonoverloaded_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { build_all (b, "su64,epattern", group, MODE_none); } @@ -1761,7 +1761,7 @@ SHAPE (count_pat) struct count_pred_def : public nonoverloaded_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { build_all (b, "su64,vp", group, MODE_none); } @@ -1772,14 +1772,14 @@ SHAPE (count_pred) struct count_vector_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "su64,v0", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_uniform (1); } @@ -1792,14 +1792,14 @@ SHAPE (count_vector) struct create_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "t0,v0*t", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_uniform (r.vectors_per_tuple ()); } @@ -1813,7 +1813,7 @@ SHAPE (create) struct dupq_def : public overloaded_base<1> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { /* The "_n" suffix is optional; the full name has it, but the short name doesn't. */ @@ -1821,7 +1821,7 @@ struct dupq_def : public overloaded_base<1> } tree - resolve (function_resolver &) const OVERRIDE + resolve (function_resolver &) const override { /* The short forms just make "_n" implicit, so no resolution is needed. */ gcc_unreachable (); @@ -1836,20 +1836,20 @@ SHAPE (dupq) struct ext_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,v0,su64", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_uniform (2, 1); } bool - check (function_checker &c) const OVERRIDE + check (function_checker &c) const override { unsigned int bytes = c.type_suffix (0).element_bytes; return c.require_immediate_range (2, 0, 256 / bytes - 1); @@ -1861,14 +1861,14 @@ SHAPE (ext) struct fold_left_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "s0,s0,v0", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -1889,14 +1889,14 @@ SHAPE (fold_left) struct get_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,t0,su64", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -1909,7 +1909,7 @@ struct get_def : public overloaded_base<0> } bool - check (function_checker &c) const OVERRIDE + check (function_checker &c) const override { unsigned int nvectors = c.vectors_per_tuple (); return c.require_immediate_range (1, 0, nvectors - 1); @@ -1927,7 +1927,7 @@ struct inc_dec_def : public inc_dec_base CONSTEXPR inc_dec_def () : inc_dec_base (false) {} void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); /* These functions are unusual in that the type suffixes for @@ -1952,7 +1952,7 @@ struct inc_dec_pat_def : public inc_dec_base CONSTEXPR inc_dec_pat_def () : inc_dec_base (true) {} void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); /* These functions are unusual in that the type suffixes for @@ -1971,14 +1971,14 @@ SHAPE (inc_dec_pat) struct inc_dec_pred_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,vp", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -1998,14 +1998,14 @@ SHAPE (inc_dec_pred) struct inc_dec_pred_scalar_def : public overloaded_base<2> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_n); build_all (b, "s0,s0,vp", group, MODE_n); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -2023,7 +2023,7 @@ SHAPE (inc_dec_pred_scalar) struct inherent_def : public nonoverloaded_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { build_all (b, "t0", group, MODE_none); } @@ -2034,7 +2034,7 @@ SHAPE (inherent) struct inherent_b_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { /* The "_b" suffix is optional; the full name has it, but the short name doesn't. */ @@ -2042,7 +2042,7 @@ struct inherent_b_def : public overloaded_base<0> } tree - resolve (function_resolver &) const OVERRIDE + resolve (function_resolver &) const override { /* The short forms just make "_b" implicit, so no resolution is needed. */ gcc_unreachable (); @@ -2055,7 +2055,7 @@ SHAPE (inherent_b) struct load_def : public load_contiguous_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); b.add_overloaded_functions (group, MODE_vnum); @@ -2072,7 +2072,7 @@ SHAPE (load) struct load_ext_def : public nonoverloaded_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { build_all (b, "t0,al", group, MODE_none); build_all (b, "t0,al,ss64", group, MODE_vnum); @@ -2092,7 +2092,7 @@ SHAPE (load_ext) struct load_ext_gather_index_def : public load_ext_gather_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_index); build_sv_index (b, "t0,al,d", group); @@ -2112,7 +2112,7 @@ SHAPE (load_ext_gather_index) struct load_ext_gather_index_restricted_def : public load_ext_gather_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_index); build_sv_index64 (b, "t0,al,d", group); @@ -2136,7 +2136,7 @@ SHAPE (load_ext_gather_index_restricted) struct load_ext_gather_offset_def : public load_ext_gather_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_offset); build_sv_offset (b, "t0,al,d", group); @@ -2161,7 +2161,7 @@ SHAPE (load_ext_gather_offset) struct load_ext_gather_offset_restricted_def : public load_ext_gather_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_offset); build_sv_uint_offset (b, "t0,al,d", group); @@ -2183,7 +2183,7 @@ SHAPE (load_ext_gather_offset_restricted) struct load_gather_sv_def : public load_gather_sv_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_index); b.add_overloaded_functions (group, MODE_offset); @@ -2205,7 +2205,7 @@ SHAPE (load_gather_sv) struct load_gather_sv_restricted_def : public load_gather_sv_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_index); b.add_overloaded_functions (group, MODE_offset); @@ -2226,7 +2226,7 @@ SHAPE (load_gather_sv_restricted) struct load_gather_vs_def : public overloaded_base<1> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { /* The base vector mode is optional; the full name has it but the short name doesn't. There is no ambiguity with SHAPE_load_gather_sv @@ -2237,7 +2237,7 @@ struct load_gather_vs_def : public overloaded_base<1> } tree - resolve (function_resolver &) const OVERRIDE + resolve (function_resolver &) const override { /* The short name just makes the base vector mode implicit; no resolution is needed. */ @@ -2252,7 +2252,7 @@ SHAPE (load_gather_vs) struct load_replicate_def : public load_contiguous_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "t0,al", group, MODE_none); @@ -2264,7 +2264,7 @@ SHAPE (load_replicate) struct pattern_pred_def : public nonoverloaded_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { build_all (b, "vp,epattern", group, MODE_none); } @@ -2276,7 +2276,7 @@ SHAPE (pattern_pred) struct prefetch_def : public nonoverloaded_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { build_all (b, "_,ap,eprfop", group, MODE_none); build_all (b, "_,ap,ss64,eprfop", group, MODE_vnum); @@ -2297,7 +2297,7 @@ SHAPE (prefetch) struct prefetch_gather_index_def : public prefetch_gather_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); b.add_overloaded_functions (group, MODE_index); @@ -2321,7 +2321,7 @@ SHAPE (prefetch_gather_index) struct prefetch_gather_offset_def : public prefetch_gather_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); b.add_overloaded_functions (group, MODE_offset); @@ -2336,7 +2336,7 @@ SHAPE (prefetch_gather_offset) struct ptest_def : public nonoverloaded_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { build_all (b, "sp,vp", group, MODE_none); } @@ -2347,7 +2347,7 @@ SHAPE (ptest) struct rdffr_def : public nonoverloaded_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { build_all (b, "vp", group, MODE_none); } @@ -2358,14 +2358,14 @@ SHAPE (rdffr) struct reduction_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "s0,v0", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_uniform (1); } @@ -2381,14 +2381,14 @@ SHAPE (reduction) struct reduction_wide_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "sw0,v0", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_uniform (1); } @@ -2402,14 +2402,14 @@ SHAPE (reduction_wide) struct set_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "t0,t0,su64,v0", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -2423,7 +2423,7 @@ struct set_def : public overloaded_base<0> } bool - check (function_checker &c) const OVERRIDE + check (function_checker &c) const override { unsigned int nvectors = c.vectors_per_tuple (); return c.require_immediate_range (1, 0, nvectors - 1); @@ -2435,7 +2435,7 @@ SHAPE (set) struct setffr_def : public nonoverloaded_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { build_all (b, "_", group, MODE_none); } @@ -2449,20 +2449,20 @@ SHAPE (setffr) struct shift_left_imm_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_n); build_all (b, "v0,v0,su64", group, MODE_n); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_uniform (1, 1); } bool - check (function_checker &c) const OVERRIDE + check (function_checker &c) const override { unsigned int bits = c.type_suffix (0).element_bits; return c.require_immediate_range (1, 0, bits - 1); @@ -2477,7 +2477,7 @@ SHAPE (shift_left_imm) struct shift_left_imm_long_def : public binary_imm_long_base { bool - check (function_checker &c) const OVERRIDE + check (function_checker &c) const override { unsigned int bits = c.type_suffix (0).element_bits / 2; return c.require_immediate_range (1, 0, bits - 1); @@ -2492,7 +2492,7 @@ SHAPE (shift_left_imm_long) struct shift_left_imm_to_uint_def : public shift_left_imm_def { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_n); build_all (b, "vu0,v0,su64", group, MODE_n); @@ -2507,20 +2507,20 @@ SHAPE (shift_left_imm_to_uint) struct shift_right_imm_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_n); build_all (b, "v0,v0,su64", group, MODE_n); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_uniform (1, 1); } bool - check (function_checker &c) const OVERRIDE + check (function_checker &c) const override { unsigned int bits = c.type_suffix (0).element_bits; return c.require_immediate_range (1, 1, bits); @@ -2572,7 +2572,7 @@ SHAPE (shift_right_imm_narrowt_to_uint) struct store_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); b.add_overloaded_functions (group, MODE_vnum); @@ -2581,7 +2581,7 @@ struct store_def : public overloaded_base<0> } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { bool vnum_p = r.mode_suffix_id == MODE_vnum; gcc_assert (r.mode_suffix_id == MODE_none || vnum_p); @@ -2612,7 +2612,7 @@ SHAPE (store) struct store_scatter_index_def : public store_scatter_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_index); build_sv_index (b, "_,as,d,t0", group); @@ -2632,7 +2632,7 @@ SHAPE (store_scatter_index) struct store_scatter_index_restricted_def : public store_scatter_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_index); build_sv_index64 (b, "_,as,d,t0", group); @@ -2657,7 +2657,7 @@ SHAPE (store_scatter_index_restricted) struct store_scatter_offset_def : public store_scatter_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); b.add_overloaded_functions (group, MODE_offset); @@ -2683,7 +2683,7 @@ SHAPE (store_scatter_offset) struct store_scatter_offset_restricted_def : public store_scatter_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); b.add_overloaded_functions (group, MODE_offset); @@ -2698,14 +2698,14 @@ SHAPE (store_scatter_offset_restricted) struct tbl_tuple_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,t0,vu0", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -2724,7 +2724,7 @@ struct ternary_bfloat_def : public ternary_resize2_base<16, TYPE_bfloat, TYPE_bfloat> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,vB,vB", group, MODE_none); @@ -2752,7 +2752,7 @@ struct ternary_bfloat_opt_n_def : public ternary_resize2_opt_n_base<16, TYPE_bfloat, TYPE_bfloat> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,vB,vB", group, MODE_none); @@ -2770,7 +2770,7 @@ struct ternary_intq_uintq_lane_def : public ternary_qq_lane_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,vqs0,vqu0,su64", group, MODE_none); @@ -2786,7 +2786,7 @@ struct ternary_intq_uintq_opt_n_def TYPE_signed, TYPE_unsigned> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,vqs0,vqu0", group, MODE_none); @@ -2802,20 +2802,20 @@ SHAPE (ternary_intq_uintq_opt_n) struct ternary_lane_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,v0,v0,su64", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_uniform (3, 1); } bool - check (function_checker &c) const OVERRIDE + check (function_checker &c) const override { return c.require_immediate_lane_index (3); } @@ -2830,20 +2830,20 @@ SHAPE (ternary_lane) struct ternary_lane_rotate_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,v0,v0,su64,su64", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_uniform (3, 2); } bool - check (function_checker &c) const OVERRIDE + check (function_checker &c) const override { return (c.require_immediate_lane_index (3, 2) && c.require_immediate_one_of (4, 0, 90, 180, 270)); @@ -2859,14 +2859,14 @@ struct ternary_long_lane_def : public ternary_resize2_lane_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,vh0,vh0,su64", group, MODE_none); } bool - check (function_checker &c) const OVERRIDE + check (function_checker &c) const override { return c.require_immediate_lane_index (3); } @@ -2883,7 +2883,7 @@ struct ternary_long_opt_n_def : public ternary_resize2_opt_n_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,vh0,vh0", group, MODE_none); @@ -2900,7 +2900,7 @@ SHAPE (ternary_long_opt_n) struct ternary_opt_n_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,v0,v0", group, MODE_none); @@ -2908,7 +2908,7 @@ struct ternary_opt_n_def : public overloaded_base<0> } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_uniform_opt_n (3); } @@ -2922,7 +2922,7 @@ SHAPE (ternary_opt_n) struct ternary_qq_lane_def : public ternary_qq_lane_base<> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,vq0,vq0,su64", group, MODE_none); @@ -2938,14 +2938,14 @@ SHAPE (ternary_qq_lane) struct ternary_qq_lane_rotate_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,vq0,vq0,su64,su64", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -2963,7 +2963,7 @@ struct ternary_qq_lane_rotate_def : public overloaded_base<0> } bool - check (function_checker &c) const OVERRIDE + check (function_checker &c) const override { return (c.require_immediate_lane_index (3, 4) && c.require_immediate_one_of (4, 0, 90, 180, 270)); @@ -2981,7 +2981,7 @@ struct ternary_qq_opt_n_def : public ternary_resize2_opt_n_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,vq0,vq0", group, MODE_none); @@ -2998,14 +2998,14 @@ SHAPE (ternary_qq_opt_n) struct ternary_qq_rotate_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,vq0,vq0,su64", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -3022,7 +3022,7 @@ struct ternary_qq_rotate_def : public overloaded_base<0> } bool - check (function_checker &c) const OVERRIDE + check (function_checker &c) const override { return c.require_immediate_one_of (3, 0, 90, 180, 270); } @@ -3036,20 +3036,20 @@ SHAPE (ternary_qq_rotate) struct ternary_rotate_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,v0,v0,su64", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_uniform (3, 1); } bool - check (function_checker &c) const OVERRIDE + check (function_checker &c) const override { return c.require_immediate_one_of (3, 0, 90, 180, 270); } @@ -3063,7 +3063,7 @@ SHAPE (ternary_rotate) struct ternary_shift_left_imm_def : public ternary_shift_imm_base { bool - check (function_checker &c) const OVERRIDE + check (function_checker &c) const override { unsigned int bits = c.type_suffix (0).element_bits; return c.require_immediate_range (2, 0, bits - 1); @@ -3078,7 +3078,7 @@ SHAPE (ternary_shift_left_imm) struct ternary_shift_right_imm_def : public ternary_shift_imm_base { bool - check (function_checker &c) const OVERRIDE + check (function_checker &c) const override { unsigned int bits = c.type_suffix (0).element_bits; return c.require_immediate_range (2, 1, bits); @@ -3090,14 +3090,14 @@ SHAPE (ternary_shift_right_imm) struct ternary_uint_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,v0,vu0", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -3119,7 +3119,7 @@ struct ternary_uintq_intq_def TYPE_unsigned, TYPE_signed> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,vqu0,vqs0", group, MODE_none); @@ -3136,7 +3136,7 @@ struct ternary_uintq_intq_lane_def : public ternary_qq_lane_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,vqu0,vqs0,su64", group, MODE_none); @@ -3152,7 +3152,7 @@ struct ternary_uintq_intq_opt_n_def TYPE_unsigned, TYPE_signed> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,vqu0,vqs0", group, MODE_none); @@ -3168,20 +3168,20 @@ SHAPE (ternary_uintq_intq_opt_n) struct tmad_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0,v0,su64", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_uniform (2, 1); } bool - check (function_checker &c) const OVERRIDE + check (function_checker &c) const override { return c.require_immediate_range (2, 0, 7); } @@ -3195,14 +3195,14 @@ SHAPE (tmad) struct unary_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v0", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_unary (); } @@ -3216,14 +3216,14 @@ SHAPE (unary) struct unary_convert_def : public overloaded_base<1> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v1", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_unary (r.type_suffix (0).tclass, r.type_suffix (0).element_bits); @@ -3239,14 +3239,14 @@ SHAPE (unary_convert) struct unary_convert_narrowt_def : public overloaded_base<1> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,v1", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_unary (r.type_suffix (0).tclass, r.type_suffix (0).element_bits, true); @@ -3258,14 +3258,14 @@ SHAPE (unary_convert_narrowt) struct unary_long_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,vh0", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type, result_type; @@ -3286,7 +3286,7 @@ SHAPE (unary_long) struct unary_n_def : public overloaded_base<1> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { /* The "_n" suffix is optional; the full name has it, but the short name doesn't. */ @@ -3294,7 +3294,7 @@ struct unary_n_def : public overloaded_base<1> } tree - resolve (function_resolver &) const OVERRIDE + resolve (function_resolver &) const override { /* The short forms just make "_n" implicit, so no resolution is needed. */ gcc_unreachable (); @@ -3322,7 +3322,7 @@ SHAPE (unary_narrowt_to_uint) struct unary_pred_def : public nonoverloaded_base { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { build_all (b, "v0,v0", group, MODE_none); } @@ -3336,14 +3336,14 @@ SHAPE (unary_pred) struct unary_to_int_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "vs0,v0", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_unary (TYPE_signed); } @@ -3357,14 +3357,14 @@ SHAPE (unary_to_int) struct unary_to_uint_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "vu0,v0", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { return r.resolve_unary (TYPE_unsigned); } @@ -3378,14 +3378,14 @@ SHAPE (unary_to_uint) struct unary_uint_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,vu0", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; @@ -3414,14 +3414,14 @@ SHAPE (unary_uint) struct unary_widen_def : public overloaded_base<0> { void - build (function_builder &b, const function_group_info &group) const OVERRIDE + build (function_builder &b, const function_group_info &group) const override { b.add_overloaded_functions (group, MODE_none); build_all (b, "v0,vh0", group, MODE_none); } tree - resolve (function_resolver &r) const OVERRIDE + resolve (function_resolver &r) const override { unsigned int i, nargs; type_suffix_index type; diff --git a/gcc/config/aarch64/aarch64-sve-builtins-sve2.cc b/gcc/config/aarch64/aarch64-sve-builtins-sve2.cc index e066f09..c010437 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins-sve2.cc +++ b/gcc/config/aarch64/aarch64-sve-builtins-sve2.cc @@ -82,7 +82,7 @@ class svaba_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { rtx_code max_code = e.type_suffix (0).unsigned_p ? UMAX : SMAX; machine_mode mode = e.vector_mode (0); @@ -94,7 +94,7 @@ class svcdot_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* Convert the rotation amount into a specific unspec. */ int rot = INTVAL (e.args.pop ()); @@ -107,7 +107,7 @@ class svcdot_lane_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* Convert the rotation amount into a specific unspec. */ int rot = INTVAL (e.args.pop ()); @@ -120,13 +120,13 @@ class svldnt1_gather_impl : public full_width_access { public: unsigned int - call_properties (const function_instance &) const OVERRIDE + call_properties (const function_instance &) const override { return CP_READ_MEMORY; } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { e.prepare_gather_address_operands (1, false); machine_mode mem_mode = e.memory_vector_mode (); @@ -142,7 +142,7 @@ public: : extending_load (memory_type) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { e.prepare_gather_address_operands (1, false); /* Add a constant predicate for the extension rtx. */ @@ -162,7 +162,7 @@ public: CONSTEXPR svmatch_svnmatch_impl (int unspec) : m_unspec (unspec) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* These are UNSPEC_PRED_Z operations and so need a hint operand. */ e.add_ptrue_hint (0, e.gp_mode (0)); @@ -185,7 +185,7 @@ public: {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { e.args.quick_push (const0_rtx); return e.map_to_unspecs (m_unspec_for_sint, m_unspec_for_uint, @@ -197,7 +197,7 @@ class svqcadd_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* Convert the rotation amount into a specific unspec. */ int rot = INTVAL (e.args.pop ()); @@ -213,7 +213,7 @@ class svqrdcmlah_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* Convert the rotation amount into a specific unspec. */ int rot = INTVAL (e.args.pop ()); @@ -226,7 +226,7 @@ class svqrdcmlah_lane_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { /* Convert the rotation amount into a specific unspec. */ int rot = INTVAL (e.args.pop ()); @@ -242,7 +242,7 @@ public: : unspec_based_function (UNSPEC_SQRSHL, UNSPEC_UQRSHL, -1) {} gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { if (tree amount = uniform_integer_cst_p (gimple_call_arg (f.call, 2))) { @@ -276,7 +276,7 @@ public: : unspec_based_function (UNSPEC_SQSHL, UNSPEC_UQSHL, -1) {} gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { if (tree amount = uniform_integer_cst_p (gimple_call_arg (f.call, 2))) { @@ -312,7 +312,7 @@ public: : unspec_based_function (UNSPEC_SRSHL, UNSPEC_URSHL, -1) {} gimple * - fold (gimple_folder &f) const OVERRIDE + fold (gimple_folder &f) const override { if (tree amount = uniform_integer_cst_p (gimple_call_arg (f.call, 2))) { @@ -349,7 +349,7 @@ class svsqadd_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { machine_mode mode = e.vector_mode (0); if (e.pred == PRED_x @@ -363,7 +363,7 @@ class svsra_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { rtx_code shift_code = e.type_suffix (0).unsigned_p ? LSHIFTRT : ASHIFTRT; machine_mode mode = e.vector_mode (0); @@ -375,13 +375,13 @@ class svstnt1_scatter_impl : public full_width_access { public: unsigned int - call_properties (const function_instance &) const OVERRIDE + call_properties (const function_instance &) const override { return CP_WRITE_MEMORY; } rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { e.prepare_gather_address_operands (1, false); machine_mode mem_mode = e.memory_vector_mode (); @@ -397,7 +397,7 @@ public: : truncating_store (to_mode) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { e.prepare_gather_address_operands (1, false); insn_code icode = code_for_aarch64_scatter_stnt (e.vector_mode (0), @@ -412,7 +412,7 @@ public: CONSTEXPR svtbl2_impl () : quiet (2) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { return e.use_exact_insn (code_for_aarch64_sve2_tbl2 (e.vector_mode (0))); } @@ -422,7 +422,7 @@ class svuqadd_impl : public function_base { public: rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { machine_mode mode = e.vector_mode (0); if (e.pred == PRED_x @@ -440,7 +440,7 @@ public: CONSTEXPR svwhilerw_svwhilewr_impl (int unspec) : m_unspec (unspec) {} rtx - expand (function_expander &e) const OVERRIDE + expand (function_expander &e) const override { for (unsigned int i = 0; i < 2; ++i) e.args[i] = e.convert_to_pmode (e.args[i]); diff --git a/gcc/cp/cxx-pretty-print.h b/gcc/cp/cxx-pretty-print.h index 920af64..5080f70 100644 --- a/gcc/cp/cxx-pretty-print.h +++ b/gcc/cp/cxx-pretty-print.h @@ -34,7 +34,7 @@ class cxx_pretty_printer : public c_pretty_printer public: cxx_pretty_printer (); - pretty_printer *clone () const OVERRIDE; + pretty_printer *clone () const override; void constant (tree); void id_expression (tree); diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc index 250e012..94181e7 100644 --- a/gcc/cp/error.cc +++ b/gcc/cp/error.cc @@ -144,12 +144,12 @@ class cxx_format_postprocessor : public format_postprocessor : m_type_a (), m_type_b () {} - format_postprocessor *clone() const FINAL OVERRIDE + format_postprocessor *clone() const final override { return new cxx_format_postprocessor (); } - void handle (pretty_printer *pp) FINAL OVERRIDE; + void handle (pretty_printer *pp) final override; deferred_printed_type m_type_a; deferred_printed_type m_type_b; diff --git a/gcc/diagnostic-path.h b/gcc/diagnostic-path.h index 3bd89d6..6c1190d 100644 --- a/gcc/diagnostic-path.h +++ b/gcc/diagnostic-path.h @@ -106,10 +106,10 @@ class simple_diagnostic_event : public diagnostic_event const char *desc); ~simple_diagnostic_event (); - location_t get_location () const FINAL OVERRIDE { return m_loc; } - tree get_fndecl () const FINAL OVERRIDE { return m_fndecl; } - int get_stack_depth () const FINAL OVERRIDE { return m_depth; } - label_text get_desc (bool) const FINAL OVERRIDE + location_t get_location () const final override { return m_loc; } + tree get_fndecl () const final override { return m_fndecl; } + int get_stack_depth () const final override { return m_depth; } + label_text get_desc (bool) const final override { return label_text::borrow (m_desc); } @@ -130,8 +130,8 @@ class simple_diagnostic_path : public diagnostic_path simple_diagnostic_path (pretty_printer *event_pp) : m_event_pp (event_pp) {} - unsigned num_events () const FINAL OVERRIDE; - const diagnostic_event & get_event (int idx) const FINAL OVERRIDE; + unsigned num_events () const final override; + const diagnostic_event & get_event (int idx) const final override; diagnostic_event_id_t add_event (location_t loc, tree fndecl, int depth, const char *fmt, ...) diff --git a/gcc/digraph.cc b/gcc/digraph.cc index 06fd70b..6a1cb1b 100644 --- a/gcc/digraph.cc +++ b/gcc/digraph.cc @@ -51,7 +51,7 @@ struct test_graph_traits struct test_node : public dnode { test_node (const char *name, int index) : m_name (name), m_index (index) {} - void dump_dot (graphviz_out *, const dump_args_t &) const OVERRIDE + void dump_dot (graphviz_out *, const dump_args_t &) const override { } @@ -65,7 +65,7 @@ struct test_edge : public dedge : dedge (src, dest) {} - void dump_dot (graphviz_out *gv, const dump_args_t &) const OVERRIDE + void dump_dot (graphviz_out *gv, const dump_args_t &) const override { gv->println ("%s %s %s%c", m_src->m_name, "->", m_dest->m_name, ';'); } diff --git a/gcc/gcc-rich-location.h b/gcc/gcc-rich-location.h index a43fe38..789ce0e 100644 --- a/gcc/gcc-rich-location.h +++ b/gcc/gcc-rich-location.h @@ -113,7 +113,7 @@ class text_range_label : public range_label public: text_range_label (const char *text) : m_text (text) {} - label_text get_text (unsigned /*range_idx*/) const FINAL OVERRIDE + label_text get_text (unsigned /*range_idx*/) const final override { return label_text::borrow (m_text); } @@ -159,7 +159,7 @@ class range_label_for_type_mismatch : public range_label { } - label_text get_text (unsigned range_idx) const OVERRIDE; + label_text get_text (unsigned range_idx) const override; protected: tree m_labelled_type; @@ -178,7 +178,7 @@ class maybe_range_label_for_tree_type_mismatch : public range_label { } - label_text get_text (unsigned range_idx) const FINAL OVERRIDE; + label_text get_text (unsigned range_idx) const final override; private: tree m_expr; diff --git a/gcc/gimple-array-bounds.cc b/gcc/gimple-array-bounds.cc index 7ec8b08..0b48bdb 100644 --- a/gcc/gimple-array-bounds.cc +++ b/gcc/gimple-array-bounds.cc @@ -761,7 +761,7 @@ public: checker (checker) { } ~check_array_bounds_dom_walker () {} - edge before_dom_children (basic_block) FINAL OVERRIDE; + edge before_dom_children (basic_block) final override; private: array_bounds_checker *checker; diff --git a/gcc/gimple-loop-versioning.cc b/gcc/gimple-loop-versioning.cc index 5838ce7..ab02bdd 100644 --- a/gcc/gimple-loop-versioning.cc +++ b/gcc/gimple-loop-versioning.cc @@ -258,7 +258,7 @@ private: public: lv_dom_walker (loop_versioning &); - edge before_dom_children (basic_block) FINAL OVERRIDE; + edge before_dom_children (basic_block) final override; private: /* The parent pass. */ @@ -271,7 +271,7 @@ private: { public: name_prop (loop_info &li) : m_li (li) {} - tree value_of_expr (tree name, gimple *) FINAL OVERRIDE; + tree value_of_expr (tree name, gimple *) final override; private: /* Information about the versioning we've performed on the loop. */ diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc index 56f4577..c726393 100644 --- a/gcc/gimple-range-cache.cc +++ b/gcc/gimple-range-cache.cc @@ -77,9 +77,9 @@ class sbr_vector : public ssa_block_ranges public: sbr_vector (tree t, irange_allocator *allocator); - virtual bool set_bb_range (const_basic_block bb, const irange &r) OVERRIDE; - virtual bool get_bb_range (irange &r, const_basic_block bb) OVERRIDE; - virtual bool bb_range_p (const_basic_block bb) OVERRIDE; + virtual bool set_bb_range (const_basic_block bb, const irange &r) override; + virtual bool get_bb_range (irange &r, const_basic_block bb) override; + virtual bool bb_range_p (const_basic_block bb) override; protected: irange **m_tab; // Non growing vector. int m_tab_size; @@ -192,9 +192,9 @@ class sbr_sparse_bitmap : public ssa_block_ranges { public: sbr_sparse_bitmap (tree t, irange_allocator *allocator, bitmap_obstack *bm); - virtual bool set_bb_range (const_basic_block bb, const irange &r) OVERRIDE; - virtual bool get_bb_range (irange &r, const_basic_block bb) OVERRIDE; - virtual bool bb_range_p (const_basic_block bb) OVERRIDE; + virtual bool set_bb_range (const_basic_block bb, const irange &r) override; + virtual bool get_bb_range (irange &r, const_basic_block bb) override; + virtual bool bb_range_p (const_basic_block bb) override; private: void bitmap_set_quad (bitmap head, int quad, int quad_value); int bitmap_get_quad (const_bitmap head, int quad); diff --git a/gcc/gimple-range-cache.h b/gcc/gimple-range-cache.h index 42aa41b..555fe32 100644 --- a/gcc/gimple-range-cache.h +++ b/gcc/gimple-range-cache.h @@ -92,7 +92,7 @@ public: side_effect_manager m_exit; void dump_bb (FILE *f, basic_block bb); - virtual void dump (FILE *f) OVERRIDE; + virtual void dump (FILE *f) override; private: ssa_global_cache m_globals; block_range_cache m_on_entry; diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc index 5f1b3b9..0a947c1 100644 --- a/gcc/gimple-range-fold.cc +++ b/gcc/gimple-range-fold.cc @@ -109,8 +109,8 @@ class fur_edge : public fur_source { public: fur_edge (edge e, range_query *q = NULL); - virtual bool get_operand (irange &r, tree expr) OVERRIDE; - virtual bool get_phi_operand (irange &r, tree expr, edge e) OVERRIDE; + virtual bool get_operand (irange &r, tree expr) override; + virtual bool get_phi_operand (irange &r, tree expr, edge e) override; private: edge m_edge; }; @@ -217,8 +217,8 @@ public: fur_list (irange &r1); fur_list (irange &r1, irange &r2); fur_list (unsigned num, irange *list); - virtual bool get_operand (irange &r, tree expr) OVERRIDE; - virtual bool get_phi_operand (irange &r, tree expr, edge e) OVERRIDE; + virtual bool get_operand (irange &r, tree expr) override; + virtual bool get_phi_operand (irange &r, tree expr, edge e) override; private: int_range_max m_local[2]; irange *m_list; diff --git a/gcc/gimple-range-fold.h b/gcc/gimple-range-fold.h index 4fe8d06..53a5bf8 100644 --- a/gcc/gimple-range-fold.h +++ b/gcc/gimple-range-fold.h @@ -143,9 +143,9 @@ class fur_stmt : public fur_source { public: fur_stmt (gimple *s, range_query *q = NULL); - virtual bool get_operand (irange &r, tree expr) OVERRIDE; - virtual bool get_phi_operand (irange &r, tree expr, edge e) OVERRIDE; - virtual relation_kind query_relation (tree op1, tree op2) OVERRIDE; + virtual bool get_operand (irange &r, tree expr) override; + virtual bool get_phi_operand (irange &r, tree expr, edge e) override; + virtual relation_kind query_relation (tree op1, tree op2) override; private: gimple *m_stmt; }; @@ -158,9 +158,9 @@ class fur_depend : public fur_stmt public: fur_depend (gimple *s, gori_compute *gori, range_query *q = NULL); virtual void register_relation (gimple *stmt, relation_kind k, tree op1, - tree op2) OVERRIDE; + tree op2) override; virtual void register_relation (edge e, relation_kind k, tree op1, - tree op2) OVERRIDE; + tree op2) override; protected: relation_oracle *m_oracle; }; diff --git a/gcc/gimple-range-tests.cc b/gcc/gimple-range-tests.cc index fae888d..572acd3 100644 --- a/gcc/gimple-range-tests.cc +++ b/gcc/gimple-range-tests.cc @@ -42,7 +42,7 @@ public: ASSERT_TRUE (r == expect); } - virtual bool range_of_expr (irange &r, tree expr, gimple * = NULL) OVERRIDE + virtual bool range_of_expr (irange &r, tree expr, gimple * = NULL) override { if (expr == op0) { diff --git a/gcc/gimple-range.h b/gcc/gimple-range.h index ae6c402..13d4c77 100644 --- a/gcc/gimple-range.h +++ b/gcc/gimple-range.h @@ -48,14 +48,14 @@ class gimple_ranger : public range_query public: gimple_ranger (bool use_imm_uses = true); ~gimple_ranger (); - virtual bool range_of_stmt (irange &r, gimple *, tree name = NULL) OVERRIDE; - virtual bool range_of_expr (irange &r, tree name, gimple * = NULL) OVERRIDE; - virtual bool range_on_edge (irange &r, edge e, tree name) OVERRIDE; + virtual bool range_of_stmt (irange &r, gimple *, tree name = NULL) override; + virtual bool range_of_expr (irange &r, tree name, gimple * = NULL) override; + virtual bool range_on_edge (irange &r, edge e, tree name) override; void range_on_entry (irange &r, basic_block bb, tree name); void range_on_exit (irange &r, basic_block bb, tree name); void export_global_ranges (); inline gori_compute &gori () { return m_cache.m_gori; } - virtual void dump (FILE *f) OVERRIDE; + virtual void dump (FILE *f) override; void debug (); void dump_bb (FILE *f, basic_block bb); auto_edge_flag non_executable_edge_flag; diff --git a/gcc/gimple-ssa-evrp.cc b/gcc/gimple-ssa-evrp.cc index 92dbdd5..20388ed 100644 --- a/gcc/gimple-ssa-evrp.cc +++ b/gcc/gimple-ssa-evrp.cc @@ -68,19 +68,19 @@ public: } } - tree value_of_expr (tree name, gimple *stmt) OVERRIDE + tree value_of_expr (tree name, gimple *stmt) override { return m_range_analyzer.value_of_expr (name, stmt); } - void pre_fold_bb (basic_block bb) OVERRIDE + void pre_fold_bb (basic_block bb) override { if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "evrp visiting BB%d\n", bb->index); m_range_analyzer.enter (bb); } - void pre_fold_stmt (gimple *stmt) OVERRIDE + void pre_fold_stmt (gimple *stmt) override { if (dump_file && (dump_flags & TDF_DETAILS)) { @@ -90,17 +90,17 @@ public: m_range_analyzer.record_ranges_from_stmt (stmt, false); } - bool fold_stmt (gimple_stmt_iterator *gsi) OVERRIDE + bool fold_stmt (gimple_stmt_iterator *gsi) override { return simplifier.simplify (gsi); } - void post_fold_bb (basic_block bb) OVERRIDE + void post_fold_bb (basic_block bb) override { m_range_analyzer.leave (bb); } - void post_new_stmt (gimple *stmt) OVERRIDE + void post_new_stmt (gimple *stmt) override { m_range_analyzer.set_defs_to_varying (stmt); } @@ -157,7 +157,7 @@ public: delete m_pta; } - bool fold_stmt (gimple_stmt_iterator *gsi) OVERRIDE + bool fold_stmt (gimple_stmt_iterator *gsi) override { simplifier.set_range_query (first, first_exec_flag); if (simplifier.simplify (gsi)) @@ -173,27 +173,27 @@ public: return false; } - void pre_fold_stmt (gimple *stmt) OVERRIDE + void pre_fold_stmt (gimple *stmt) override { evrp_folder::pre_fold_stmt (stmt); m_pta->visit_stmt (stmt); } - void pre_fold_bb (basic_block bb) OVERRIDE + void pre_fold_bb (basic_block bb) override { evrp_folder::pre_fold_bb (bb); m_pta->enter (bb); } - void post_fold_bb (basic_block bb) OVERRIDE + void post_fold_bb (basic_block bb) override { evrp_folder::post_fold_bb (bb); m_pta->leave (bb); } - tree value_of_expr (tree name, gimple *) OVERRIDE; - tree value_on_edge (edge, tree name) OVERRIDE; - tree value_of_stmt (gimple *, tree name) OVERRIDE; + tree value_of_expr (tree name, gimple *) override; + tree value_on_edge (edge, tree name) override; + tree value_of_stmt (gimple *, tree name) override; private: DISABLE_COPY_AND_ASSIGN (hybrid_folder); diff --git a/gcc/input.cc b/gcc/input.cc index 58beba0..2acbfde 100644 --- a/gcc/input.cc +++ b/gcc/input.cc @@ -2310,7 +2310,7 @@ class ebcdic_execution_charset : public lexer_test_options s_singleton = NULL; } - void apply (lexer_test &test) FINAL OVERRIDE + void apply (lexer_test &test) final override { cpp_options *cpp_opts = cpp_get_options (test.m_parser); cpp_opts->narrow_charset = "IBM1047"; @@ -2375,7 +2375,7 @@ class lexer_diagnostic_sink : public lexer_test_options free (str); } - void apply (lexer_test &test) FINAL OVERRIDE + void apply (lexer_test &test) final override { cpp_callbacks *callbacks = cpp_get_callbacks (test.m_parser); callbacks->diagnostic = on_diagnostic; diff --git a/gcc/jit/jit-playback.h b/gcc/jit/jit-playback.h index b18aa4d..3ba02a0 100644 --- a/gcc/jit/jit-playback.h +++ b/gcc/jit/jit-playback.h @@ -378,7 +378,7 @@ class compile_to_memory : public context { public: compile_to_memory (recording::context *ctxt); - void postprocess (const char *ctxt_progname) FINAL OVERRIDE; + void postprocess (const char *ctxt_progname) final override; result *get_result_obj () const { return m_result; } @@ -392,7 +392,7 @@ class compile_to_file : public context compile_to_file (recording::context *ctxt, enum gcc_jit_output_kind output_kind, const char *output_path); - void postprocess (const char *ctxt_progname) FINAL OVERRIDE; + void postprocess (const char *ctxt_progname) final override; private: void @@ -483,7 +483,7 @@ public: function(context *ctxt, tree fndecl, enum gcc_jit_function_kind kind); void gt_ggc_mx (); - void finalizer () FINAL OVERRIDE; + void finalizer () final override; tree get_return_type_as_tree () const; @@ -562,7 +562,7 @@ public: block (function *func, const char *name); - void finalizer () FINAL OVERRIDE; + void finalizer () final override; tree as_label_decl () const { return m_label_decl; } @@ -750,7 +750,7 @@ class source_file : public wrapper { public: source_file (tree filename); - void finalizer () FINAL OVERRIDE; + void finalizer () final override; source_line * get_source_line (int line_num); @@ -771,7 +771,7 @@ class source_line : public wrapper { public: source_line (source_file *file, int line_num); - void finalizer () FINAL OVERRIDE; + void finalizer () final override; location * get_location (recording::location *rloc, int column_num); diff --git a/gcc/jit/jit-recording.cc b/gcc/jit/jit-recording.cc index 4305a96..697dee6 100644 --- a/gcc/jit/jit-recording.cc +++ b/gcc/jit/jit-recording.cc @@ -3741,7 +3741,7 @@ class rvalue_usage_validator : public recording::rvalue_visitor recording::statement *stmt); void - visit (recording::rvalue *rvalue) FINAL OVERRIDE; + visit (recording::rvalue *rvalue) final override; private: const char *m_api_funcname; diff --git a/gcc/jit/jit-recording.h b/gcc/jit/jit-recording.h index 78ee364..2dd8a95 100644 --- a/gcc/jit/jit-recording.h +++ b/gcc/jit/jit-recording.h @@ -441,11 +441,11 @@ public: static string * from_printf (context *ctxt, const char *fmt, ...) GNU_PRINTF(2, 3); - void replay_into (replayer *) FINAL OVERRIDE {} + void replay_into (replayer *) final override {} private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; private: size_t m_len; @@ -469,7 +469,7 @@ public: m_created_by_user (created_by_user) {} - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; playback::location * playback_location (replayer *r) @@ -498,12 +498,12 @@ public: return static_cast (m_playback_obj); } - location *dyn_cast_location () FINAL OVERRIDE { return this; } + location *dyn_cast_location () final override { return this; } bool created_by_user () const { return m_created_by_user; } private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; private: string *m_filename; @@ -603,11 +603,11 @@ public: : type (ctxt), m_kind (kind) {} - type *dereference () FINAL OVERRIDE; + type *dereference () final override; - size_t get_size () FINAL OVERRIDE; + size_t get_size () final override; - bool accepts_writes_from (type *rtype) FINAL OVERRIDE + bool accepts_writes_from (type *rtype) final override { if (m_kind == GCC_JIT_TYPE_VOID_PTR) { @@ -629,20 +629,20 @@ public: return type::accepts_writes_from (rtype); } - bool is_int () const FINAL OVERRIDE; - bool is_float () const FINAL OVERRIDE; - bool is_bool () const FINAL OVERRIDE; - type *is_pointer () FINAL OVERRIDE { return dereference (); } - type *is_array () FINAL OVERRIDE { return NULL; } - bool is_void () const FINAL OVERRIDE { return m_kind == GCC_JIT_TYPE_VOID; } - bool is_signed () const FINAL OVERRIDE; + bool is_int () const final override; + bool is_float () const final override; + bool is_bool () const final override; + type *is_pointer () final override { return dereference (); } + type *is_array () final override { return NULL; } + bool is_void () const final override { return m_kind == GCC_JIT_TYPE_VOID; } + bool is_signed () const final override; public: - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; private: enum gcc_jit_types m_kind; @@ -656,24 +656,24 @@ public: : type (other_type->m_ctxt), m_other_type (other_type) {} - type *dereference () FINAL OVERRIDE { return m_other_type; } + type *dereference () final override { return m_other_type; } - size_t get_size () FINAL OVERRIDE; + size_t get_size () final override; - bool accepts_writes_from (type *rtype) FINAL OVERRIDE; + bool accepts_writes_from (type *rtype) final override; - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - bool is_int () const FINAL OVERRIDE { return false; } - bool is_float () const FINAL OVERRIDE { return false; } - bool is_bool () const FINAL OVERRIDE { return false; } - type *is_pointer () FINAL OVERRIDE { return m_other_type; } - type *is_array () FINAL OVERRIDE { return NULL; } - bool is_signed () const FINAL OVERRIDE { return false; } + bool is_int () const final override { return false; } + bool is_float () const final override { return false; } + bool is_bool () const final override { return false; } + type *is_pointer () final override { return m_other_type; } + type *is_array () final override { return NULL; } + bool is_signed () const final override { return false; } private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; private: type *m_other_type; @@ -689,17 +689,17 @@ public: : type (other_type->m_ctxt), m_other_type (other_type) {} - type *dereference () FINAL OVERRIDE { return m_other_type->dereference (); } + type *dereference () final override { return m_other_type->dereference (); } - size_t get_size () FINAL OVERRIDE { return m_other_type->get_size (); }; + size_t get_size () final override { return m_other_type->get_size (); }; - bool is_int () const FINAL OVERRIDE { return m_other_type->is_int (); } - bool is_float () const FINAL OVERRIDE { return m_other_type->is_float (); } - bool is_bool () const FINAL OVERRIDE { return m_other_type->is_bool (); } - type *is_pointer () FINAL OVERRIDE { return m_other_type->is_pointer (); } - type *is_array () FINAL OVERRIDE { return m_other_type->is_array (); } - struct_ *is_struct () FINAL OVERRIDE { return m_other_type->is_struct (); } - bool is_signed () const FINAL OVERRIDE { return m_other_type->is_signed (); } + bool is_int () const final override { return m_other_type->is_int (); } + bool is_float () const final override { return m_other_type->is_float (); } + bool is_bool () const final override { return m_other_type->is_bool (); } + type *is_pointer () final override { return m_other_type->is_pointer (); } + type *is_array () final override { return m_other_type->is_array (); } + struct_ *is_struct () final override { return m_other_type->is_struct (); } + bool is_signed () const final override { return m_other_type->is_signed (); } protected: type *m_other_type; @@ -712,14 +712,14 @@ public: memento_of_get_const (type *other_type) : decorated_type (other_type) {} - bool accepts_writes_from (type */*rtype*/) FINAL OVERRIDE + bool accepts_writes_from (type */*rtype*/) final override { /* Can't write to a "const". */ return false; } /* Strip off the "const", giving the underlying type. */ - type *unqualified () FINAL OVERRIDE { return m_other_type; } + type *unqualified () final override { return m_other_type; } virtual bool is_same_type_as (type *other) { @@ -730,11 +730,11 @@ public: virtual type *is_const () { return m_other_type; } - void replay_into (replayer *) FINAL OVERRIDE; + void replay_into (replayer *) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; }; /* Result of "gcc_jit_type_get_volatile". */ @@ -752,15 +752,15 @@ public: } /* Strip off the "volatile", giving the underlying type. */ - type *unqualified () FINAL OVERRIDE { return m_other_type; } + type *unqualified () final override { return m_other_type; } virtual type *is_volatile () { return m_other_type; } - void replay_into (replayer *) FINAL OVERRIDE; + void replay_into (replayer *) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; }; /* Result of "gcc_jit_type_get_aligned". */ @@ -772,13 +772,13 @@ public: m_alignment_in_bytes (alignment_in_bytes) {} /* Strip off the alignment, giving the underlying type. */ - type *unqualified () FINAL OVERRIDE { return m_other_type; } + type *unqualified () final override { return m_other_type; } - void replay_into (replayer *) FINAL OVERRIDE; + void replay_into (replayer *) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; private: size_t m_alignment_in_bytes; @@ -794,17 +794,17 @@ public: size_t get_num_units () const { return m_num_units; } - vector_type *dyn_cast_vector_type () FINAL OVERRIDE { return this; } + vector_type *dyn_cast_vector_type () final override { return this; } type *get_element_type () { return m_other_type; } - void replay_into (replayer *) FINAL OVERRIDE; + void replay_into (replayer *) final override; - vector_type *is_vector () FINAL OVERRIDE { return this; } + vector_type *is_vector () final override { return this; } private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; private: size_t m_num_units; @@ -823,21 +823,21 @@ class array_type : public type m_num_elements (num_elements) {} - type *dereference () FINAL OVERRIDE; + type *dereference () final override; - bool is_int () const FINAL OVERRIDE { return false; } - bool is_float () const FINAL OVERRIDE { return false; } - bool is_bool () const FINAL OVERRIDE { return false; } - type *is_pointer () FINAL OVERRIDE { return NULL; } - type *is_array () FINAL OVERRIDE { return m_element_type; } + bool is_int () const final override { return false; } + bool is_float () const final override { return false; } + bool is_bool () const final override { return false; } + type *is_pointer () final override { return NULL; } + type *is_array () final override { return m_element_type; } int num_elements () { return m_num_elements; } - bool is_signed () const FINAL OVERRIDE { return false; } + bool is_signed () const final override { return false; } - void replay_into (replayer *) FINAL OVERRIDE; + void replay_into (replayer *) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; private: location *m_loc; @@ -854,20 +854,20 @@ public: type **param_types, int is_variadic); - type *dereference () FINAL OVERRIDE; - function_type *dyn_cast_function_type () FINAL OVERRIDE { return this; } - function_type *as_a_function_type () FINAL OVERRIDE { return this; } + type *dereference () final override; + function_type *dyn_cast_function_type () final override { return this; } + function_type *as_a_function_type () final override { return this; } - bool is_same_type_as (type *other) FINAL OVERRIDE; + bool is_same_type_as (type *other) final override; - bool is_int () const FINAL OVERRIDE { return false; } - bool is_float () const FINAL OVERRIDE { return false; } - bool is_bool () const FINAL OVERRIDE { return false; } - type *is_pointer () FINAL OVERRIDE { return NULL; } - type *is_array () FINAL OVERRIDE { return NULL; } - bool is_signed () const FINAL OVERRIDE { return false; } + bool is_int () const final override { return false; } + bool is_float () const final override { return false; } + bool is_bool () const final override { return false; } + type *is_pointer () final override { return NULL; } + type *is_array () final override { return NULL; } + bool is_signed () const final override { return false; } - void replay_into (replayer *) FINAL OVERRIDE; + void replay_into (replayer *) final override; type * get_return_type () const { return m_return_type; } const vec &get_param_types () const { return m_param_types; } @@ -880,9 +880,9 @@ public: memento *ptr_type); private: - string * make_debug_string () FINAL OVERRIDE; + string * make_debug_string () final override; string * make_debug_string_with (const char *); - void write_reproducer (reproducer &r) FINAL OVERRIDE; + void write_reproducer (reproducer &r) final override; private: type *m_return_type; @@ -909,9 +909,9 @@ public: compound_type * get_container () const { return m_container; } void set_container (compound_type *c) { m_container = c; } - void replay_into (replayer *) OVERRIDE; + void replay_into (replayer *) override; - void write_to_dump (dump &d) OVERRIDE; + void write_to_dump (dump &d) override; playback::field * playback_field () const @@ -920,8 +920,8 @@ public: } private: - string * make_debug_string () OVERRIDE; - void write_reproducer (reproducer &r) OVERRIDE; + string * make_debug_string () override; + void write_reproducer (reproducer &r) override; protected: location *m_loc; @@ -943,13 +943,13 @@ public: m_width (width) {} - void replay_into (replayer *) FINAL OVERRIDE; + void replay_into (replayer *) final override; - void write_to_dump (dump &d) FINAL OVERRIDE; + void write_to_dump (dump &d) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; private: int m_width; @@ -972,16 +972,16 @@ public: int num_fields, field **fields); - type *dereference () FINAL OVERRIDE; + type *dereference () final override; - bool is_int () const FINAL OVERRIDE { return false; } - bool is_float () const FINAL OVERRIDE { return false; } - bool is_bool () const FINAL OVERRIDE { return false; } - type *is_pointer () FINAL OVERRIDE { return NULL; } - type *is_array () FINAL OVERRIDE { return NULL; } - bool is_signed () const FINAL OVERRIDE { return false; } + bool is_int () const final override { return false; } + bool is_float () const final override { return false; } + bool is_bool () const final override { return false; } + type *is_pointer () final override { return NULL; } + type *is_array () final override { return NULL; } + bool is_signed () const final override { return false; } - bool has_known_size () const FINAL OVERRIDE { return m_fields != NULL; } + bool has_known_size () const final override { return m_fields != NULL; } playback::compound_type * playback_compound_type () @@ -1002,20 +1002,20 @@ public: location *loc, string *name); - struct_ *dyn_cast_struct () FINAL OVERRIDE { return this; } + struct_ *dyn_cast_struct () final override { return this; } type * as_type () { return this; } - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - const char *access_as_type (reproducer &r) FINAL OVERRIDE; + const char *access_as_type (reproducer &r) final override; - struct_ *is_struct () FINAL OVERRIDE { return this; } + struct_ *is_struct () final override { return this; } private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; }; // memento of struct_::set_fields @@ -1026,16 +1026,16 @@ public: int num_fields, field **fields); - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - void write_to_dump (dump &d) FINAL OVERRIDE; + void write_to_dump (dump &d) final override; int length () const { return m_fields.length (); } field *get_field (int i) const { return m_fields[i]; } private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; private: compound_type *m_struct_or_union; @@ -1049,13 +1049,13 @@ public: location *loc, string *name); - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - virtual bool is_union () const FINAL OVERRIDE { return true; } + virtual bool is_union () const final override { return true; } private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; }; /* An abstract base class for operations that visit all rvalues within an @@ -1192,7 +1192,7 @@ public: rvalue * as_rvalue () { return this; } - const char *access_as_rvalue (reproducer &r) OVERRIDE; + const char *access_as_rvalue (reproducer &r) override; virtual const char *access_as_lvalue (reproducer &r); virtual bool is_global () const { return false; } void set_tls_model (enum gcc_jit_tls_model model); @@ -1221,9 +1221,9 @@ public: lvalue * as_lvalue () { return this; } - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - void visit_children (rvalue_visitor *) FINAL OVERRIDE {} + void visit_children (rvalue_visitor *) final override {} playback::param * playback_param () const @@ -1231,15 +1231,15 @@ public: return static_cast (m_playback_obj); } - param *dyn_cast_param () FINAL OVERRIDE { return this; } + param *dyn_cast_param () final override { return this; } - const char *access_as_rvalue (reproducer &r) FINAL OVERRIDE; - const char *access_as_lvalue (reproducer &r) FINAL OVERRIDE; + const char *access_as_rvalue (reproducer &r) final override; + const char *access_as_lvalue (reproducer &r) final override; private: - string * make_debug_string () FINAL OVERRIDE { return m_name; } - void write_reproducer (reproducer &r) FINAL OVERRIDE; - enum precedence get_precedence () const FINAL OVERRIDE + string * make_debug_string () final override { return m_name; } + void write_reproducer (reproducer &r) final override; + enum precedence get_precedence () const final override { return PRECEDENCE_PRIMARY; } @@ -1261,7 +1261,7 @@ public: int is_variadic, enum built_in_function builtin_id); - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; playback::function * playback_function () const @@ -1291,7 +1291,7 @@ public: bool is_variadic () const { return m_is_variadic; } - void write_to_dump (dump &d) FINAL OVERRIDE; + void write_to_dump (dump &d) final override; void validate (); @@ -1300,8 +1300,8 @@ public: rvalue *get_address (location *loc); private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; private: location *m_loc; @@ -1395,7 +1395,7 @@ public: return static_cast (m_playback_obj); } - void write_to_dump (dump &d) FINAL OVERRIDE; + void write_to_dump (dump &d) final override; bool validate (); @@ -1407,10 +1407,10 @@ public: vec get_successor_blocks () const; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; void dump_to_dot (pretty_printer *pp); void dump_edges_to_dot (pretty_printer *pp); @@ -1446,13 +1446,13 @@ public: free (m_initializer); } - void replay_into (replayer *) FINAL OVERRIDE; + void replay_into (replayer *) final override; - void visit_children (rvalue_visitor *) FINAL OVERRIDE {} + void visit_children (rvalue_visitor *) final override {} - void write_to_dump (dump &d) FINAL OVERRIDE; + void write_to_dump (dump &d) final override; - bool is_global () const FINAL OVERRIDE { return true; } + bool is_global () const final override { return true; } void set_initializer (const void *initializer, @@ -1483,11 +1483,11 @@ public: void set_rvalue_init (rvalue *val) { m_rvalue_init = val; } private: - string * make_debug_string () FINAL OVERRIDE { return m_name; } + string * make_debug_string () final override { return m_name; } template void write_initializer_reproducer (const char *id, reproducer &r); - void write_reproducer (reproducer &r) FINAL OVERRIDE; - enum precedence get_precedence () const FINAL OVERRIDE + void write_reproducer (reproducer &r) final override; + enum precedence get_precedence () const final override { return PRECEDENCE_PRIMARY; } @@ -1512,18 +1512,18 @@ public: : rvalue (ctxt, loc, type), m_value (value) {} - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - void visit_children (rvalue_visitor *) FINAL OVERRIDE {} + void visit_children (rvalue_visitor *) final override {} - bool is_constant () const FINAL OVERRIDE { return true; } + bool is_constant () const final override { return true; } - bool get_wide_int (wide_int *out) const FINAL OVERRIDE; + bool get_wide_int (wide_int *out) const final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; - enum precedence get_precedence () const FINAL OVERRIDE + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; + enum precedence get_precedence () const final override { return PRECEDENCE_PRIMARY; } @@ -1541,14 +1541,14 @@ public: : rvalue (ctxt, loc, ctxt->get_type (GCC_JIT_TYPE_CONST_CHAR_PTR)), m_value (value) {} - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - void visit_children (rvalue_visitor *) FINAL OVERRIDE {} + void visit_children (rvalue_visitor *) final override {} private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; - enum precedence get_precedence () const FINAL OVERRIDE + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; + enum precedence get_precedence () const final override { return PRECEDENCE_PRIMARY; } @@ -1565,14 +1565,14 @@ public: vector_type *type, rvalue **elements); - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - void visit_children (rvalue_visitor *) FINAL OVERRIDE; + void visit_children (rvalue_visitor *) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; - enum precedence get_precedence () const FINAL OVERRIDE + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; + enum precedence get_precedence () const final override { return PRECEDENCE_PRIMARY; } @@ -1591,14 +1591,14 @@ public: : rvalue (ctxt, loc, type) { } - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - void visit_children (rvalue_visitor *) FINAL OVERRIDE; + void visit_children (rvalue_visitor *) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; - enum precedence get_precedence () const FINAL OVERRIDE + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; + enum precedence get_precedence () const final override { return PRECEDENCE_PRIMARY; } @@ -1621,14 +1621,14 @@ public: m_a (a) {} - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - void visit_children (rvalue_visitor *v) FINAL OVERRIDE; + void visit_children (rvalue_visitor *v) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; - enum precedence get_precedence () const FINAL OVERRIDE + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; + enum precedence get_precedence () const final override { return PRECEDENCE_UNARY; } @@ -1651,14 +1651,14 @@ public: m_a (a), m_b (b) {} - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - void visit_children (rvalue_visitor *v) FINAL OVERRIDE; + void visit_children (rvalue_visitor *v) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; - enum precedence get_precedence () const FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; + enum precedence get_precedence () const final override; private: enum gcc_jit_binary_op m_op; @@ -1679,14 +1679,14 @@ public: m_b (b) {} - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - void visit_children (rvalue_visitor *v) FINAL OVERRIDE; + void visit_children (rvalue_visitor *v) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; - enum precedence get_precedence () const FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; + enum precedence get_precedence () const final override; private: enum gcc_jit_comparison m_op; @@ -1705,14 +1705,14 @@ public: m_rvalue (a) {} - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - void visit_children (rvalue_visitor *v) FINAL OVERRIDE; + void visit_children (rvalue_visitor *v) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; - enum precedence get_precedence () const FINAL OVERRIDE + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; + enum precedence get_precedence () const final override { return PRECEDENCE_CAST; } @@ -1732,14 +1732,14 @@ public: m_rvalue (a) {} - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - void visit_children (rvalue_visitor *v) FINAL OVERRIDE; + void visit_children (rvalue_visitor *v) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; - enum precedence get_precedence () const FINAL OVERRIDE + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; + enum precedence get_precedence () const final override { return PRECEDENCE_CAST; } @@ -1757,12 +1757,12 @@ class base_call : public rvalue int numargs, rvalue **args); - enum precedence get_precedence () const FINAL OVERRIDE + enum precedence get_precedence () const final override { return PRECEDENCE_POSTFIX; } - base_call *dyn_cast_base_call () FINAL OVERRIDE { return this; } + base_call *dyn_cast_base_call () final override { return this; } void set_require_tail_call (bool require_tail_call) { @@ -1786,13 +1786,13 @@ public: int numargs, rvalue **args); - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - void visit_children (rvalue_visitor *v) FINAL OVERRIDE; + void visit_children (rvalue_visitor *v) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; private: function *m_func; @@ -1807,13 +1807,13 @@ public: int numargs, rvalue **args); - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - void visit_children (rvalue_visitor *v) FINAL OVERRIDE; + void visit_children (rvalue_visitor *v) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; private: rvalue *m_fn_ptr; @@ -1831,14 +1831,14 @@ public: m_index (index) {} - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - void visit_children (rvalue_visitor *v) FINAL OVERRIDE; + void visit_children (rvalue_visitor *v) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; - enum precedence get_precedence () const FINAL OVERRIDE + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; + enum precedence get_precedence () const final override { return PRECEDENCE_POSTFIX; } @@ -1860,14 +1860,14 @@ public: m_field (field) {} - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - void visit_children (rvalue_visitor *v) FINAL OVERRIDE; + void visit_children (rvalue_visitor *v) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; - enum precedence get_precedence () const FINAL OVERRIDE + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; + enum precedence get_precedence () const final override { return PRECEDENCE_POSTFIX; } @@ -1889,14 +1889,14 @@ public: m_field (field) {} - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - void visit_children (rvalue_visitor *v) FINAL OVERRIDE; + void visit_children (rvalue_visitor *v) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; - enum precedence get_precedence () const FINAL OVERRIDE + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; + enum precedence get_precedence () const final override { return PRECEDENCE_POSTFIX; } @@ -1918,14 +1918,14 @@ public: m_field (field) {} - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - void visit_children (rvalue_visitor *v) FINAL OVERRIDE; + void visit_children (rvalue_visitor *v) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; - enum precedence get_precedence () const FINAL OVERRIDE + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; + enum precedence get_precedence () const final override { return PRECEDENCE_POSTFIX; } @@ -1944,14 +1944,14 @@ public: : lvalue (ctxt, loc, val->get_type ()->dereference ()), m_rvalue (val) {} - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - void visit_children (rvalue_visitor *v) FINAL OVERRIDE; + void visit_children (rvalue_visitor *v) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; - enum precedence get_precedence () const FINAL OVERRIDE + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; + enum precedence get_precedence () const final override { return PRECEDENCE_UNARY; } @@ -1970,14 +1970,14 @@ public: m_lvalue (val) {} - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - void visit_children (rvalue_visitor *v) FINAL OVERRIDE; + void visit_children (rvalue_visitor *v) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; - enum precedence get_precedence () const FINAL OVERRIDE + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; + enum precedence get_precedence () const final override { return PRECEDENCE_UNARY; } @@ -1996,14 +1996,14 @@ public: : rvalue (ctxt, loc, type), m_fn (fn) {} - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - void visit_children (rvalue_visitor *v) FINAL OVERRIDE; + void visit_children (rvalue_visitor *v) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; - enum precedence get_precedence () const FINAL OVERRIDE + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; + enum precedence get_precedence () const final override { return PRECEDENCE_UNARY; } @@ -2023,16 +2023,16 @@ public: set_scope (func); } - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - void visit_children (rvalue_visitor *) FINAL OVERRIDE {} + void visit_children (rvalue_visitor *) final override {} - void write_to_dump (dump &d) FINAL OVERRIDE; + void write_to_dump (dump &d) final override; private: - string * make_debug_string () FINAL OVERRIDE { return m_name; } - void write_reproducer (reproducer &r) FINAL OVERRIDE; - enum precedence get_precedence () const FINAL OVERRIDE + string * make_debug_string () final override { return m_name; } + void write_reproducer (reproducer &r) final override; + enum precedence get_precedence () const final override { return PRECEDENCE_PRIMARY; } @@ -2047,7 +2047,7 @@ class statement : public memento public: virtual vec get_successor_blocks () const; - void write_to_dump (dump &d) FINAL OVERRIDE; + void write_to_dump (dump &d) final override; block *get_block () const { return m_block; } location *get_loc () const { return m_loc; } @@ -2078,11 +2078,11 @@ public: : statement (b, loc), m_rvalue (rvalue) {} - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; private: rvalue *m_rvalue; @@ -2099,11 +2099,11 @@ public: m_lvalue (lvalue), m_rvalue (rvalue) {} - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; private: lvalue *m_lvalue; @@ -2123,11 +2123,11 @@ public: m_op (op), m_rvalue (rvalue) {} - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; private: lvalue *m_lvalue; @@ -2144,11 +2144,11 @@ public: : statement (b, loc), m_text (text) {} - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; private: string *m_text; @@ -2167,13 +2167,13 @@ public: m_on_true (on_true), m_on_false (on_false) {} - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - vec get_successor_blocks () const FINAL OVERRIDE; + vec get_successor_blocks () const final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; private: rvalue *m_boolval; @@ -2190,13 +2190,13 @@ public: : statement (b, loc), m_target (target) {} - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - vec get_successor_blocks () const FINAL OVERRIDE; + vec get_successor_blocks () const final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; private: block *m_target; @@ -2211,13 +2211,13 @@ public: : statement (b, loc), m_rvalue (rvalue) {} - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - vec get_successor_blocks () const FINAL OVERRIDE; + vec get_successor_blocks () const final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; private: rvalue *m_rvalue; @@ -2240,12 +2240,12 @@ class case_ : public memento rvalue *get_max_value () const { return m_max_value; } block *get_dest_block () const { return m_dest_block; } - void replay_into (replayer *) FINAL OVERRIDE { /* empty */ } + void replay_into (replayer *) final override { /* empty */ } - void write_reproducer (reproducer &r) FINAL OVERRIDE; + void write_reproducer (reproducer &r) final override; private: - string * make_debug_string () FINAL OVERRIDE; + string * make_debug_string () final override; private: rvalue *m_min_value; @@ -2263,13 +2263,13 @@ public: int num_cases, case_ **cases); - void replay_into (replayer *r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; - vec get_successor_blocks () const FINAL OVERRIDE; + vec get_successor_blocks () const final override; private: - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; private: rvalue *m_expr; @@ -2300,7 +2300,7 @@ public: virtual void print (pretty_printer *pp) const; private: - string * make_debug_string () FINAL OVERRIDE; + string * make_debug_string () final override; protected: extended_asm *m_ext_asm; @@ -2321,12 +2321,12 @@ public: lvalue *get_lvalue () const { return m_dest; } - void replay_into (replayer *) FINAL OVERRIDE {} + void replay_into (replayer *) final override {} - void print (pretty_printer *pp) const FINAL OVERRIDE; + void print (pretty_printer *pp) const final override; private: - void write_reproducer (reproducer &r) FINAL OVERRIDE; + void write_reproducer (reproducer &r) final override; private: lvalue *m_dest; @@ -2345,12 +2345,12 @@ public: rvalue *get_rvalue () const { return m_src; } - void replay_into (replayer *) FINAL OVERRIDE {} + void replay_into (replayer *) final override {} - void print (pretty_printer *pp) const FINAL OVERRIDE; + void print (pretty_printer *pp) const final override; private: - void write_reproducer (reproducer &r) FINAL OVERRIDE; + void write_reproducer (reproducer &r) final override; private: rvalue *m_src; @@ -2381,7 +2381,7 @@ public: rvalue *src); void add_clobber (const char *victim); - void replay_into (replayer *r) OVERRIDE; + void replay_into (replayer *r) override; string *get_asm_template () const { return m_asm_template; } @@ -2393,7 +2393,7 @@ protected: void write_clobbers (reproducer &r); private: - string * make_debug_string () FINAL OVERRIDE; + string * make_debug_string () final override; virtual void maybe_populate_playback_blocks (auto_vec *out) = 0; @@ -2418,13 +2418,13 @@ public: : extended_asm (b, loc, asm_template) {} - void write_reproducer (reproducer &r) OVERRIDE; - bool is_goto () const FINAL OVERRIDE { return false; } - void maybe_print_gotos (pretty_printer *) const FINAL OVERRIDE {} + void write_reproducer (reproducer &r) override; + bool is_goto () const final override { return false; } + void maybe_print_gotos (pretty_printer *) const final override {} private: void maybe_populate_playback_blocks - (auto_vec *) FINAL OVERRIDE + (auto_vec *) final override {} }; @@ -2441,17 +2441,17 @@ public: block **goto_blocks, block *fallthrough_block); - void replay_into (replayer *r) FINAL OVERRIDE; - void write_reproducer (reproducer &r) OVERRIDE; + void replay_into (replayer *r) final override; + void write_reproducer (reproducer &r) override; - vec get_successor_blocks () const FINAL OVERRIDE; + vec get_successor_blocks () const final override; - bool is_goto () const FINAL OVERRIDE { return true; } - void maybe_print_gotos (pretty_printer *) const FINAL OVERRIDE; + bool is_goto () const final override { return true; } + void maybe_print_gotos (pretty_printer *) const final override; private: void maybe_populate_playback_blocks - (auto_vec *out) FINAL OVERRIDE; + (auto_vec *out) final override; private: auto_vec m_goto_blocks; @@ -2466,12 +2466,12 @@ class top_level_asm : public memento public: top_level_asm (context *ctxt, location *loc, string *asm_stmts); - void write_to_dump (dump &d) FINAL OVERRIDE; + void write_to_dump (dump &d) final override; private: - void replay_into (replayer *r) FINAL OVERRIDE; - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; private: location *m_loc; @@ -2484,12 +2484,12 @@ public: global_init_rvalue (context *ctxt, lvalue *variable, rvalue *init) : memento (ctxt), m_variable (variable), m_init (init) {}; - void write_to_dump (dump &d) FINAL OVERRIDE; + void write_to_dump (dump &d) final override; private: - void replay_into (replayer *r) FINAL OVERRIDE; - string * make_debug_string () FINAL OVERRIDE; - void write_reproducer (reproducer &r) FINAL OVERRIDE; + void replay_into (replayer *r) final override; + string * make_debug_string () final override; + void write_reproducer (reproducer &r) final override; private: lvalue *m_variable; diff --git a/gcc/json.h b/gcc/json.h index 9ab6a5b..f272981 100644 --- a/gcc/json.h +++ b/gcc/json.h @@ -90,8 +90,8 @@ class object : public value public: ~object (); - enum kind get_kind () const FINAL OVERRIDE { return JSON_OBJECT; } - void print (pretty_printer *pp) const FINAL OVERRIDE; + enum kind get_kind () const final override { return JSON_OBJECT; } + void print (pretty_printer *pp) const final override; void set (const char *key, value *v); value *get (const char *key) const; @@ -109,8 +109,8 @@ class array : public value public: ~array (); - enum kind get_kind () const FINAL OVERRIDE { return JSON_ARRAY; } - void print (pretty_printer *pp) const FINAL OVERRIDE; + enum kind get_kind () const final override { return JSON_ARRAY; } + void print (pretty_printer *pp) const final override; void append (value *v); @@ -125,8 +125,8 @@ class float_number : public value public: float_number (double value) : m_value (value) {} - enum kind get_kind () const FINAL OVERRIDE { return JSON_FLOAT; } - void print (pretty_printer *pp) const FINAL OVERRIDE; + enum kind get_kind () const final override { return JSON_FLOAT; } + void print (pretty_printer *pp) const final override; double get () const { return m_value; } @@ -141,8 +141,8 @@ class integer_number : public value public: integer_number (long value) : m_value (value) {} - enum kind get_kind () const FINAL OVERRIDE { return JSON_INTEGER; } - void print (pretty_printer *pp) const FINAL OVERRIDE; + enum kind get_kind () const final override { return JSON_INTEGER; } + void print (pretty_printer *pp) const final override; long get () const { return m_value; } @@ -159,8 +159,8 @@ class string : public value string (const char *utf8); ~string () { free (m_utf8); } - enum kind get_kind () const FINAL OVERRIDE { return JSON_STRING; } - void print (pretty_printer *pp) const FINAL OVERRIDE; + enum kind get_kind () const final override { return JSON_STRING; } + void print (pretty_printer *pp) const final override; const char *get_string () const { return m_utf8; } @@ -179,8 +179,8 @@ class literal : public value /* Construct literal for a boolean value. */ literal (bool value): m_kind (value ? JSON_TRUE : JSON_FALSE) {} - enum kind get_kind () const FINAL OVERRIDE { return m_kind; } - void print (pretty_printer *pp) const FINAL OVERRIDE; + enum kind get_kind () const final override { return m_kind; } + void print (pretty_printer *pp) const final override; private: enum kind m_kind; diff --git a/gcc/read-rtl-function.cc b/gcc/read-rtl-function.cc index 49c8880..eacbe4c 100644 --- a/gcc/read-rtl-function.cc +++ b/gcc/read-rtl-function.cc @@ -77,13 +77,13 @@ class function_reader : public rtx_reader ~function_reader (); /* Overridden vfuncs of class md_reader. */ - void handle_unknown_directive (file_location, const char *) FINAL OVERRIDE; + void handle_unknown_directive (file_location, const char *) final override; /* Overridden vfuncs of class rtx_reader. */ - rtx read_rtx_operand (rtx x, int idx) FINAL OVERRIDE; - void handle_any_trailing_information (rtx x) FINAL OVERRIDE; - rtx postprocess (rtx) FINAL OVERRIDE; - const char *finalize_string (char *stringbuf) FINAL OVERRIDE; + rtx read_rtx_operand (rtx x, int idx) final override; + void handle_any_trailing_information (rtx x) final override; + rtx postprocess (rtx) final override; + const char *finalize_string (char *stringbuf) final override; rtx_insn **get_insn_by_uid (int uid); tree parse_mem_expr (const char *desc); diff --git a/gcc/tree-complex.cc b/gcc/tree-complex.cc index 42db96a..f722057 100644 --- a/gcc/tree-complex.cc +++ b/gcc/tree-complex.cc @@ -64,8 +64,8 @@ typedef int complex_lattice_t; class complex_propagate : public ssa_propagation_engine { - enum ssa_prop_result visit_stmt (gimple *, edge *, tree *) FINAL OVERRIDE; - enum ssa_prop_result visit_phi (gphi *) FINAL OVERRIDE; + enum ssa_prop_result visit_stmt (gimple *, edge *, tree *) final override; + enum ssa_prop_result visit_phi (gphi *) final override; }; static vec complex_lattice_values; diff --git a/gcc/tree-diagnostic-path.cc b/gcc/tree-diagnostic-path.cc index ea16bfa..4aa6944 100644 --- a/gcc/tree-diagnostic-path.cc +++ b/gcc/tree-diagnostic-path.cc @@ -51,7 +51,7 @@ class path_label : public range_label : m_path (path), m_start_idx (start_idx) {} - label_text get_text (unsigned range_idx) const FINAL OVERRIDE + label_text get_text (unsigned range_idx) const final override { unsigned event_idx = m_start_idx + range_idx; const diagnostic_event &event = m_path->get_event (event_idx); diff --git a/gcc/tree-ssa-ccp.cc b/gcc/tree-ssa-ccp.cc index 262a247e..81c9767 100644 --- a/gcc/tree-ssa-ccp.cc +++ b/gcc/tree-ssa-ccp.cc @@ -180,8 +180,8 @@ public: class ccp_propagate : public ssa_propagation_engine { public: - enum ssa_prop_result visit_stmt (gimple *, edge *, tree *) FINAL OVERRIDE; - enum ssa_prop_result visit_phi (gphi *) FINAL OVERRIDE; + enum ssa_prop_result visit_stmt (gimple *, edge *, tree *) final override; + enum ssa_prop_result visit_phi (gphi *) final override; }; /* Array of propagated constant values. After propagation, @@ -947,8 +947,8 @@ do_dbg_cnt (void) class ccp_folder : public substitute_and_fold_engine { public: - tree value_of_expr (tree, gimple *) FINAL OVERRIDE; - bool fold_stmt (gimple_stmt_iterator *) FINAL OVERRIDE; + tree value_of_expr (tree, gimple *) final override; + bool fold_stmt (gimple_stmt_iterator *) final override; }; /* This method just wraps GET_CONSTANT_VALUE for now. Over time diff --git a/gcc/tree-ssa-copy.cc b/gcc/tree-ssa-copy.cc index 7d636ec..050a6d1 100644 --- a/gcc/tree-ssa-copy.cc +++ b/gcc/tree-ssa-copy.cc @@ -71,8 +71,8 @@ struct prop_value_t { class copy_prop : public ssa_propagation_engine { public: - enum ssa_prop_result visit_stmt (gimple *, edge *, tree *) FINAL OVERRIDE; - enum ssa_prop_result visit_phi (gphi *) FINAL OVERRIDE; + enum ssa_prop_result visit_stmt (gimple *, edge *, tree *) final override; + enum ssa_prop_result visit_phi (gphi *) final override; }; static prop_value_t *copy_of; @@ -492,7 +492,7 @@ init_copy_prop (void) class copy_folder : public substitute_and_fold_engine { public: - tree value_of_expr (tree name, gimple *) FINAL OVERRIDE; + tree value_of_expr (tree name, gimple *) final override; }; /* Callback for substitute_and_fold to get at the final copy-of values. */ diff --git a/gcc/tree-vrp.cc b/gcc/tree-vrp.cc index 77c1912..0784d65 100644 --- a/gcc/tree-vrp.cc +++ b/gcc/tree-vrp.cc @@ -3795,8 +3795,8 @@ public: void finalize (); private: - enum ssa_prop_result visit_stmt (gimple *, edge *, tree *) FINAL OVERRIDE; - enum ssa_prop_result visit_phi (gphi *) FINAL OVERRIDE; + enum ssa_prop_result visit_stmt (gimple *, edge *, tree *) final override; + enum ssa_prop_result visit_phi (gphi *) final override; struct function *fun; vr_values *m_vr_values; @@ -4036,11 +4036,11 @@ class vrp_folder : public substitute_and_fold_engine void simplify_casted_conds (function *fun); private: - tree value_of_expr (tree name, gimple *stmt) OVERRIDE + tree value_of_expr (tree name, gimple *stmt) override { return m_vr_values->value_of_expr (name, stmt); } - bool fold_stmt (gimple_stmt_iterator *) FINAL OVERRIDE; + bool fold_stmt (gimple_stmt_iterator *) final override; bool fold_predicate_in (gimple_stmt_iterator *); vr_values *m_vr_values; @@ -4269,7 +4269,7 @@ public: delete m_pta; } - tree value_of_expr (tree name, gimple *s = NULL) OVERRIDE + tree value_of_expr (tree name, gimple *s = NULL) override { // Shortcircuit subst_and_fold callbacks for abnormal ssa_names. if (TREE_CODE (name) == SSA_NAME && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name)) @@ -4280,7 +4280,7 @@ public: return ret; } - tree value_on_edge (edge e, tree name) OVERRIDE + tree value_on_edge (edge e, tree name) override { // Shortcircuit subst_and_fold callbacks for abnormal ssa_names. if (TREE_CODE (name) == SSA_NAME && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name)) @@ -4291,7 +4291,7 @@ public: return ret; } - tree value_of_stmt (gimple *s, tree name = NULL) OVERRIDE + tree value_of_stmt (gimple *s, tree name = NULL) override { // Shortcircuit subst_and_fold callbacks for abnormal ssa_names. if (TREE_CODE (name) == SSA_NAME && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name)) @@ -4299,7 +4299,7 @@ public: return m_ranger->value_of_stmt (s, name); } - void pre_fold_bb (basic_block bb) OVERRIDE + void pre_fold_bb (basic_block bb) override { m_pta->enter (bb); for (gphi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi); @@ -4307,17 +4307,17 @@ public: m_ranger->register_side_effects (gsi.phi ()); } - void post_fold_bb (basic_block bb) OVERRIDE + void post_fold_bb (basic_block bb) override { m_pta->leave (bb); } - void pre_fold_stmt (gimple *stmt) OVERRIDE + void pre_fold_stmt (gimple *stmt) override { m_pta->visit_stmt (stmt); } - bool fold_stmt (gimple_stmt_iterator *gsi) OVERRIDE + bool fold_stmt (gimple_stmt_iterator *gsi) override { bool ret = m_simplifier.simplify (gsi); if (!ret) diff --git a/gcc/value-query.h b/gcc/value-query.h index 78e2d1b..cf1a1d7 100644 --- a/gcc/value-query.h +++ b/gcc/value-query.h @@ -79,9 +79,9 @@ public: range_query (); virtual ~range_query (); - virtual tree value_of_expr (tree expr, gimple * = NULL) OVERRIDE; - virtual tree value_on_edge (edge, tree expr) OVERRIDE; - virtual tree value_of_stmt (gimple *, tree name = NULL) OVERRIDE; + virtual tree value_of_expr (tree expr, gimple * = NULL) override; + virtual tree value_on_edge (edge, tree expr) override; + virtual tree value_of_stmt (gimple *, tree name = NULL) override; // These are the range equivalents of the value_* methods. Instead // of returning a singleton, they calculate a range and return it in @@ -123,7 +123,7 @@ private: class global_range_query : public range_query { public: - bool range_of_expr (irange &r, tree expr, gimple * = NULL) OVERRIDE; + bool range_of_expr (irange &r, tree expr, gimple * = NULL) override; }; extern global_range_query global_ranges; diff --git a/gcc/vr-values.h b/gcc/vr-values.h index f294417..7a377ce 100644 --- a/gcc/vr-values.h +++ b/gcc/vr-values.h @@ -109,12 +109,12 @@ class vr_values : public range_query vr_values (void); ~vr_values (void); - virtual bool range_of_expr (irange &r, tree expr, gimple *stmt) OVERRIDE; - virtual tree value_of_expr (tree, gimple * = NULL) OVERRIDE; - virtual tree value_on_edge (edge, tree) OVERRIDE; - virtual tree value_of_stmt (gimple *, tree = NULL_TREE) OVERRIDE; + virtual bool range_of_expr (irange &r, tree expr, gimple *stmt) override; + virtual tree value_of_expr (tree, gimple * = NULL) override; + virtual tree value_on_edge (edge, tree) override; + virtual tree value_of_stmt (gimple *, tree = NULL_TREE) override; virtual const value_range_equiv *get_value_range (const_tree, - gimple * = NULL) OVERRIDE; + gimple * = NULL) override; void set_vr_value (tree, value_range_equiv *); value_range_equiv *swap_vr_value (tree, value_range_equiv *); @@ -124,7 +124,7 @@ class vr_values : public range_query tree op_with_constant_singleton_value_range (tree); void adjust_range_with_scev (value_range_equiv *, class loop *, gimple *, tree); - virtual void dump (FILE *) OVERRIDE; + virtual void dump (FILE *) override; void extract_range_for_var_from_comparison_expr (tree, enum tree_code, tree, tree, -- cgit v1.1 From 1be715f31605976d8e4336973d3b81c5b7cea79f Mon Sep 17 00:00:00 2001 From: Wilco Dijkstra Date: Wed, 18 May 2022 16:02:12 +0100 Subject: AArch64: Cleanup CPU option processing code The --with-cpu/--with-arch configure option processing not only checks valid arguments but also sets TARGET_CPU_DEFAULT with a CPU and extension bitmask. This isn't used however since a --with-cpu is translated into a -mcpu option which is processed as if written on the command-line (so TARGET_CPU_DEFAULT is never accessed). So remove all the complex processing and bitmask, and just validate the option. Fix a bug that always reports valid architecture extensions as invalid. As a result the CPU processing in aarch64.c can be simplified. gcc/ * config.gcc (aarch64*-*-*): Simplify --with-cpu and --with-arch processing. Add support for architectural extensions. * config/aarch64/aarch64.h (TARGET_CPU_DEFAULT): Remove AARCH64_CPU_DEFAULT_FLAGS. (TARGET_CPU_NBITS): Remove. (TARGET_CPU_MASK): Remove. * config/aarch64/aarch64.cc (AARCH64_CPU_DEFAULT_FLAGS): Remove define. (get_tune_cpu): Assert CPU is always valid. (get_arch): Assert architecture is always valid. (aarch64_override_options): Cleanup CPU selection code and simplify logic. (aarch64_option_restore): Remove unnecessary checks on tune. --- gcc/config.gcc | 43 +--------------- gcc/config/aarch64/aarch64.cc | 115 +++++++++++------------------------------- gcc/config/aarch64/aarch64.h | 9 +--- 3 files changed, 32 insertions(+), 135 deletions(-) (limited to 'gcc') diff --git a/gcc/config.gcc b/gcc/config.gcc index c5064dd..b48d545 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -4178,8 +4178,6 @@ case "${target}" in pattern=AARCH64_CORE fi - ext_mask=AARCH64_CPU_DEFAULT_FLAGS - # Find the base CPU or ARCH id in aarch64-cores.def or # aarch64-arches.def if [ x"$base_val" = x ] \ @@ -4187,23 +4185,6 @@ case "${target}" in ${srcdir}/config/aarch64/$def \ > /dev/null; then - if [ $which = arch ]; then - base_id=`grep "^$pattern(\"$base_val\"," \ - ${srcdir}/config/aarch64/$def | \ - sed -e 's/^[^,]*,[ ]*//' | \ - sed -e 's/,.*$//'` - # Extract the architecture flags from aarch64-arches.def - ext_mask=`grep "^$pattern(\"$base_val\"," \ - ${srcdir}/config/aarch64/$def | \ - sed -e 's/)$//' | \ - sed -e 's/^.*,//'` - else - base_id=`grep "^$pattern(\"$base_val\"," \ - ${srcdir}/config/aarch64/$def | \ - sed -e 's/^[^,]*,[ ]*//' | \ - sed -e 's/,.*$//'` - fi - # Disallow extensions in --with-tune=cortex-a53+crc. if [ $which = tune ] && [ x"$ext_val" != x ]; then echo "Architecture extensions not supported in --with-$which=$val" 1>&2 @@ -4234,25 +4215,7 @@ case "${target}" in grep "^\"$base_ext\""` if [ x"$base_ext" = x ] \ - || [[ -n $opt_line ]]; then - - # These regexp extract the elements based on - # their group match index in the regexp. - ext_canon=`echo -e "$opt_line" | \ - sed -e "s/$sed_patt/\2/"` - ext_on=`echo -e "$opt_line" | \ - sed -e "s/$sed_patt/\3/"` - ext_off=`echo -e "$opt_line" | \ - sed -e "s/$sed_patt/\4/"` - - if [ $ext = $base_ext ]; then - # Adding extension - ext_mask="("$ext_mask") | ("$ext_on" | "$ext_canon")" - else - # Removing extension - ext_mask="("$ext_mask") & ~("$ext_off" | "$ext_canon")" - fi - + || [ x"$opt_line" != x ]; then true else echo "Unknown extension used in --with-$which=$val" 1>&2 @@ -4261,10 +4224,6 @@ case "${target}" in ext_val=`echo $ext_val | sed -e 's/[a-z0-9]\+//'` done - ext_mask="(("$ext_mask") << TARGET_CPU_NBITS)" - if [ x"$base_id" != x ]; then - target_cpu_cname="TARGET_CPU_$base_id | $ext_mask" - fi true else # Allow --with-$which=native. diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 4aad14c..ba5b6be 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -2760,8 +2760,6 @@ static const struct attribute_spec aarch64_attribute_table[] = { NULL, 0, 0, false, false, false, false, NULL, NULL } }; -#define AARCH64_CPU_DEFAULT_FLAGS ((selected_cpu) ? selected_cpu->flags : 0) - /* An ISA extension in the co-processor and main instruction set space. */ struct aarch64_option_extension { @@ -18067,39 +18065,24 @@ aarch64_validate_mtune (const char *str, const struct processor **res) return false; } -static_assert (TARGET_CPU_generic < TARGET_CPU_MASK, - "TARGET_CPU_NBITS is big enough"); - -/* Return the CPU corresponding to the enum CPU. - If it doesn't specify a cpu, return the default. */ +/* Return the CPU corresponding to the enum CPU. */ static const struct processor * aarch64_get_tune_cpu (enum aarch64_processor cpu) { - if (cpu != aarch64_none) - return &all_cores[cpu]; + gcc_assert (cpu != aarch64_none); - /* The & TARGET_CPU_MASK is to extract the bottom TARGET_CPU_NBITS bits that - encode the default cpu as selected by the --with-cpu GCC configure option - in config.gcc. - ???: The whole TARGET_CPU_DEFAULT and AARCH64_CPU_DEFAULT_FLAGS - flags mechanism should be reworked to make it more sane. */ - return &all_cores[TARGET_CPU_DEFAULT & TARGET_CPU_MASK]; + return &all_cores[cpu]; } -/* Return the architecture corresponding to the enum ARCH. - If it doesn't specify a valid architecture, return the default. */ +/* Return the architecture corresponding to the enum ARCH. */ static const struct processor * aarch64_get_arch (enum aarch64_arch arch) { - if (arch != aarch64_no_arch) - return &all_architectures[arch]; - - const struct processor *cpu - = &all_cores[TARGET_CPU_DEFAULT & TARGET_CPU_MASK]; + gcc_assert (arch != aarch64_no_arch); - return &all_architectures[cpu->arch]; + return &all_architectures[arch]; } /* Return the VG value associated with -msve-vector-bits= value VALUE. */ @@ -18137,10 +18120,6 @@ aarch64_override_options (void) uint64_t arch_isa = 0; aarch64_isa_flags = 0; - bool valid_cpu = true; - bool valid_tune = true; - bool valid_arch = true; - selected_cpu = NULL; selected_arch = NULL; selected_tune = NULL; @@ -18155,77 +18134,56 @@ aarch64_override_options (void) If either of -march or -mtune is given, they override their respective component of -mcpu. */ if (aarch64_cpu_string) - valid_cpu = aarch64_validate_mcpu (aarch64_cpu_string, &selected_cpu, - &cpu_isa); + aarch64_validate_mcpu (aarch64_cpu_string, &selected_cpu, &cpu_isa); if (aarch64_arch_string) - valid_arch = aarch64_validate_march (aarch64_arch_string, &selected_arch, - &arch_isa); + aarch64_validate_march (aarch64_arch_string, &selected_arch, &arch_isa); if (aarch64_tune_string) - valid_tune = aarch64_validate_mtune (aarch64_tune_string, &selected_tune); + aarch64_validate_mtune (aarch64_tune_string, &selected_tune); #ifdef SUBTARGET_OVERRIDE_OPTIONS SUBTARGET_OVERRIDE_OPTIONS; #endif - /* If the user did not specify a processor, choose the default - one for them. This will be the CPU set during configuration using - --with-cpu, otherwise it is "generic". */ - if (!selected_cpu) - { - if (selected_arch) - { - selected_cpu = &all_cores[selected_arch->ident]; - aarch64_isa_flags = arch_isa; - explicit_arch = selected_arch->arch; - } - else - { - /* Get default configure-time CPU. */ - selected_cpu = aarch64_get_tune_cpu (aarch64_none); - aarch64_isa_flags = TARGET_CPU_DEFAULT >> TARGET_CPU_NBITS; - } - - if (selected_tune) - explicit_tune_core = selected_tune->ident; - } - /* If both -mcpu and -march are specified check that they are architecturally - compatible, warn if they're not and prefer the -march ISA flags. */ - else if (selected_arch) + if (selected_cpu && selected_arch) { + /* If both -mcpu and -march are specified, warn if they are not + architecturally compatible and prefer the -march ISA flags. */ if (selected_arch->arch != selected_cpu->arch) { warning (0, "switch %<-mcpu=%s%> conflicts with %<-march=%s%> switch", aarch64_cpu_string, aarch64_arch_string); } + aarch64_isa_flags = arch_isa; - explicit_arch = selected_arch->arch; - explicit_tune_core = selected_tune ? selected_tune->ident - : selected_cpu->ident; } - else + else if (selected_cpu) { - /* -mcpu but no -march. */ - aarch64_isa_flags = cpu_isa; - explicit_tune_core = selected_tune ? selected_tune->ident - : selected_cpu->ident; - gcc_assert (selected_cpu); selected_arch = &all_architectures[selected_cpu->arch]; - explicit_arch = selected_arch->arch; + aarch64_isa_flags = cpu_isa; } - - /* Set the arch as well as we will need it when outputing - the .arch directive in assembly. */ - if (!selected_arch) + else if (selected_arch) { - gcc_assert (selected_cpu); + selected_cpu = &all_cores[selected_arch->ident]; + aarch64_isa_flags = arch_isa; + } + else + { + /* No -mcpu or -march specified, so use the default CPU. */ + selected_cpu = &all_cores[TARGET_CPU_DEFAULT]; selected_arch = &all_architectures[selected_cpu->arch]; + aarch64_isa_flags = selected_cpu->flags; } + explicit_arch = selected_arch->arch; if (!selected_tune) selected_tune = selected_cpu; + explicit_tune_core = selected_tune->ident; + + gcc_assert (explicit_tune_core != aarch64_none); + gcc_assert (explicit_arch != aarch64_no_arch); if (aarch64_enable_bti == 2) { @@ -18261,15 +18219,6 @@ aarch64_override_options (void) if (aarch64_ra_sign_scope != AARCH64_FUNCTION_NONE && TARGET_ILP32) sorry ("return address signing is only supported for %<-mabi=lp64%>"); - /* Make sure we properly set up the explicit options. */ - if ((aarch64_cpu_string && valid_cpu) - || (aarch64_tune_string && valid_tune)) - gcc_assert (explicit_tune_core != aarch64_none); - - if ((aarch64_cpu_string && valid_cpu) - || (aarch64_arch_string && valid_arch)) - gcc_assert (explicit_arch != aarch64_no_arch); - /* The pass to insert speculation tracking runs before shrink-wrapping and the latter does not know how to update the tracking status. So disable it in this case. */ @@ -18375,11 +18324,7 @@ aarch64_option_restore (struct gcc_options *opts, opts->x_explicit_arch = ptr->x_explicit_arch; selected_arch = aarch64_get_arch (ptr->x_explicit_arch); opts->x_explicit_tune_core = ptr->x_explicit_tune_core; - if (opts->x_explicit_tune_core == aarch64_none - && opts->x_explicit_arch != aarch64_no_arch) - selected_tune = &all_cores[selected_arch->ident]; - else - selected_tune = aarch64_get_tune_cpu (ptr->x_explicit_tune_core); + selected_tune = aarch64_get_tune_cpu (ptr->x_explicit_tune_core); opts->x_aarch64_override_tune_string = ptr->x_aarch64_override_tune_string; opts->x_aarch64_branch_protection_string = ptr->x_aarch64_branch_protection_string; diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h index 359b6e85..f835da3 100644 --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h @@ -813,16 +813,9 @@ enum target_cpus TARGET_CPU_generic }; -/* Define how many bits are used to represent the CPU in TARGET_CPU_DEFAULT. - This needs to be big enough to fit the value of TARGET_CPU_generic. - All bits after this are used to represent the AARCH64_CPU_DEFAULT_FLAGS. */ -#define TARGET_CPU_NBITS 8 -#define TARGET_CPU_MASK ((1 << TARGET_CPU_NBITS) - 1) - /* If there is no CPU defined at configure, use generic as default. */ #ifndef TARGET_CPU_DEFAULT -#define TARGET_CPU_DEFAULT \ - (TARGET_CPU_generic | (AARCH64_CPU_DEFAULT_FLAGS << TARGET_CPU_NBITS)) +# define TARGET_CPU_DEFAULT TARGET_CPU_generic #endif /* If inserting NOP before a mult-accumulate insn remember to adjust the -- cgit v1.1 From 48f3f27f607d3c145ed1e3ad652baac84aacdb91 Mon Sep 17 00:00:00 2001 From: Wilco Dijkstra Date: Wed, 18 May 2022 16:06:57 +0100 Subject: AArch64: Improve rotate patterns Improve and generalize rotate patterns. Rotates by more than half the bitwidth of a register are canonicalized to rotate left. Many existing shift patterns don't handle this case correctly, so add rotate left to the shift iterator and convert rotate left into ror during assembly output. Add missing zero_extend patterns for shifted BIC, ORN and EON. gcc/ * config/aarch64/aarch64.md (and_3_compare0): Support rotate left. (and_si3_compare0_uxtw): Likewise. (_3): Likewise. (_si3_uxtw): Likewise. (one_cmpl_2): Likewise. (_one_cmpl_3): Likewise. (_one_cmpl_sidi_uxtw): New pattern. (eor_one_cmpl_3_alt): Support rotate left. (eor_one_cmpl_sidi3_alt_ze): Likewise. (and_one_cmpl_3_compare0): Likewise. (and_one_cmpl_si3_compare0_uxtw): Likewise. (and_one_cmpl_3_compare0_no_reuse): Likewise. (and_3nr_compare0): Likewise. (*si3_insn_uxtw): Use SHIFT_no_rotate. (rolsi3_insn_uxtw): New pattern. * config/aarch64/iterators.md (SHIFT): Add rotate left. (SHIFT_no_rotate): Add new iterator. (SHIFT:shift): Print rotate left as ror. (is_rotl): Add test for left rotate. gcc/testsuite/ * gcc.target/aarch64/ror_2.c: New test. * gcc.target/aarch64/ror_3.c: New test. --- gcc/config/aarch64/aarch64.md | 179 +++++++++++++++++---------- gcc/config/aarch64/iterators.md | 11 +- gcc/testsuite/gcc.target/aarch64/ror_2.c | 205 +++++++++++++++++++++++++++++++ gcc/testsuite/gcc.target/aarch64/ror_3.c | 131 ++++++++++++++++++++ 4 files changed, 461 insertions(+), 65 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/ror_2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/ror_3.c (limited to 'gcc') diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 2ac8d56..acec8c1 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -4549,7 +4549,11 @@ (set (match_operand:GPI 0 "register_operand" "=r") (and:GPI (SHIFT:GPI (match_dup 1) (match_dup 2)) (match_dup 3)))] "" - "ands\\t%0, %3, %1, %2" +{ + if () + operands[2] = GEN_INT ( - UINTVAL (operands[2])); + return "ands\\t%0, %3, %1, %2"; +} [(set_attr "type" "logics_shift_imm")] ) @@ -4566,7 +4570,11 @@ (zero_extend:DI (and:SI (SHIFT:SI (match_dup 1) (match_dup 2)) (match_dup 3))))] "" - "ands\\t%w0, %w3, %w1, %2" +{ + if () + operands[2] = GEN_INT (32 - UINTVAL (operands[2])); + return "ands\\t%w0, %w3, %w1, %2"; +} [(set_attr "type" "logics_shift_imm")] ) @@ -4577,7 +4585,11 @@ (match_operand:QI 2 "aarch64_shift_imm_" "n")) (match_operand:GPI 3 "register_operand" "r")))] "" - "\\t%0, %3, %1, %2" +{ + if () + operands[2] = GEN_INT ( - UINTVAL (operands[2])); + return "\\t%0, %3, %1, %2"; +} [(set_attr "type" "logic_shift_imm")] ) @@ -4647,17 +4659,6 @@ "operands[3] = gen_reg_rtx (mode);" ) -(define_insn "*_rol3" - [(set (match_operand:GPI 0 "register_operand" "=r") - (LOGICAL:GPI (rotate:GPI - (match_operand:GPI 1 "register_operand" "r") - (match_operand:QI 2 "aarch64_shift_imm_" "n")) - (match_operand:GPI 3 "register_operand" "r")))] - "" - "\\t%0, %3, %1, ror #( - %2)" - [(set_attr "type" "logic_shift_imm")] -) - ;; zero_extend versions of above (define_insn "*_si3_uxtw" [(set (match_operand:DI 0 "register_operand" "=r") @@ -4667,19 +4668,11 @@ (match_operand:QI 2 "aarch64_shift_imm_si" "n")) (match_operand:SI 3 "register_operand" "r"))))] "" - "\\t%w0, %w3, %w1, %2" - [(set_attr "type" "logic_shift_imm")] -) - -(define_insn "*_rolsi3_uxtw" - [(set (match_operand:DI 0 "register_operand" "=r") - (zero_extend:DI - (LOGICAL:SI (rotate:SI - (match_operand:SI 1 "register_operand" "r") - (match_operand:QI 2 "aarch64_shift_imm_si" "n")) - (match_operand:SI 3 "register_operand" "r"))))] - "" - "\\t%w0, %w3, %w1, ror #(32 - %2)" +{ + if () + operands[2] = GEN_INT (32 - UINTVAL (operands[2])); + return "\\t%w0, %w3, %w1, %2"; +} [(set_attr "type" "logic_shift_imm")] ) @@ -4708,7 +4701,11 @@ (not:GPI (SHIFT:GPI (match_operand:GPI 1 "register_operand" "r") (match_operand:QI 2 "aarch64_shift_imm_" "n"))))] "" - "mvn\\t%0, %1, %2" +{ + if () + operands[2] = GEN_INT ( - UINTVAL (operands[2])); + return "mvn\\t%0, %1, %2"; +} [(set_attr "type" "logic_shift_imm")] ) @@ -4815,7 +4812,28 @@ (match_operand:QI 2 "aarch64_shift_imm_" "n"))) (match_operand:GPI 3 "register_operand" "r")))] "" - "\\t%0, %3, %1, %2" +{ + if () + operands[2] = GEN_INT ( - UINTVAL (operands[2])); + return "\\t%0, %3, %1, %2"; +} + [(set_attr "type" "logic_shift_imm")] +) + +;; Zero-extend version of the above. +(define_insn "_one_cmpl_sidi_uxtw" + [(set (match_operand:DI 0 "register_operand" "=r") + (zero_extend:DI (LOGICAL:SI (not:SI + (SHIFT:SI + (match_operand:SI 1 "register_operand" "r") + (match_operand:QI 2 "aarch64_shift_imm_si" "n"))) + (match_operand:SI 3 "register_operand" "r"))))] + "" +{ + if () + operands[2] = GEN_INT (32 - UINTVAL (operands[2])); + return "\\t%w0, %w3, %w1, %2"; +} [(set_attr "type" "logic_shift_imm")] ) @@ -4827,7 +4845,11 @@ (match_operand:QI 2 "aarch64_shift_imm_" "n")) (match_operand:GPI 3 "register_operand" "r"))))] "" - "eon\\t%0, %3, %1, %2" +{ + if () + operands[2] = GEN_INT ( - UINTVAL (operands[2])); + return "eon\\t%0, %3, %1, %2"; +} [(set_attr "type" "logic_shift_imm")] ) @@ -4841,7 +4863,11 @@ (match_operand:QI 2 "aarch64_shift_imm_si" "n")) (match_operand:SI 3 "register_operand" "r")))))] "" - "eon\\t%w0, %w3, %w1, %2" +{ + if () + operands[2] = GEN_INT (32 - UINTVAL (operands[2])); + return "eon\\t%w0, %w3, %w1, %2"; +} [(set_attr "type" "logic_shift_imm")] ) @@ -4859,7 +4885,11 @@ (SHIFT:GPI (match_dup 1) (match_dup 2))) (match_dup 3)))] "" - "bics\\t%0, %3, %1, %2" +{ + if () + operands[2] = GEN_INT ( - UINTVAL (operands[2])); + return "bics\\t%0, %3, %1, %2"; +} [(set_attr "type" "logics_shift_imm")] ) @@ -4878,7 +4908,11 @@ (not:SI (SHIFT:SI (match_dup 1) (match_dup 2))) (match_dup 3))))] "" - "bics\\t%w0, %w3, %w1, %2" +{ + if () + operands[2] = GEN_INT (32 - UINTVAL (operands[2])); + return "bics\\t%w0, %w3, %w1, %2"; +} [(set_attr "type" "logics_shift_imm")] ) @@ -4892,7 +4926,11 @@ (match_operand:GPI 2 "register_operand" "r")) (const_int 0)))] "" - "bics\\tzr, %2, %0, %1" +{ + if () + operands[1] = GEN_INT ( - UINTVAL (operands[1])); + return "bics\\tzr, %2, %0, %1"; +} [(set_attr "type" "logics_shift_imm")] ) @@ -5066,7 +5104,11 @@ (match_operand:GPI 2 "register_operand" "r")) (const_int 0)))] "" - "tst\\t%2, %0, %1" +{ + if () + operands[1] = GEN_INT ( - UINTVAL (operands[1])); + return "tst\\t%2, %0, %1"; +} [(set_attr "type" "logics_shift_imm")] ) @@ -5467,10 +5509,22 @@ [(set_attr "type" "rotate_imm,shift_reg")] ) -;; zero_extend version of above +(define_insn "*rol3_insn" + [(set (match_operand:GPI 0 "register_operand" "=r") + (rotate:GPI (match_operand:GPI 1 "register_operand" "r") + (match_operand 2 "const_int_operand" "n")))] + "UINTVAL (operands[2]) < GET_MODE_BITSIZE (mode)" +{ + operands[3] = GEN_INT ( - UINTVAL (operands[2])); + return "ror\\t%0, %1, %3"; +} + [(set_attr "type" "rotate_imm")] +) + +;; zero_extend version of shifts (define_insn "*si3_insn_uxtw" [(set (match_operand:DI 0 "register_operand" "=r,r") - (zero_extend:DI (SHIFT:SI + (zero_extend:DI (SHIFT_no_rotate:SI (match_operand:SI 1 "register_operand" "r,r") (match_operand:QI 2 "aarch64_reg_or_shift_imm_si" "Uss,r"))))] "" @@ -5480,6 +5534,31 @@ [(set_attr "type" "bfx,shift_reg")] ) +;; zero_extend version of rotate right +(define_insn "*rorsi3_insn_uxtw" + [(set (match_operand:DI 0 "register_operand" "=r") + (zero_extend:DI + (rotatert:SI (match_operand:SI 1 "register_operand" "r") + (match_operand 2 "const_int_operand" "n"))))] + "UINTVAL (operands[2]) < 32" + "ror\\t%w0, %w1, %2" + [(set_attr "type" "rotate_imm")] +) + +;; zero_extend version of rotate left +(define_insn "*rolsi3_insn_uxtw" + [(set (match_operand:DI 0 "register_operand" "=r") + (zero_extend:DI + (rotate:SI (match_operand:SI 1 "register_operand" "r") + (match_operand 2 "const_int_operand" "n"))))] + "UINTVAL (operands[2]) < 32" +{ + operands[2] = GEN_INT (32 - UINTVAL (operands[2])); + return "ror\\t%w0, %w1, %2"; +} + [(set_attr "type" "rotate_imm")] +) + (define_insn "*3_insn" [(set (match_operand:SHORT 0 "register_operand" "=r") (ASHIFT:SHORT (match_operand:SHORT 1 "register_operand" "r") @@ -5562,32 +5641,6 @@ [(set_attr "type" "rotate_imm")] ) -(define_insn "*ror3_insn" - [(set (match_operand:GPI 0 "register_operand" "=r") - (rotate:GPI (match_operand:GPI 1 "register_operand" "r") - (match_operand 2 "const_int_operand" "n")))] - "UINTVAL (operands[2]) < GET_MODE_BITSIZE (mode)" -{ - operands[3] = GEN_INT ( - UINTVAL (operands[2])); - return "ror\\t%0, %1, %3"; -} - [(set_attr "type" "rotate_imm")] -) - -;; zero_extend version of the above -(define_insn "*rorsi3_insn_uxtw" - [(set (match_operand:DI 0 "register_operand" "=r") - (zero_extend:DI - (rotate:SI (match_operand:SI 1 "register_operand" "r") - (match_operand 2 "const_int_operand" "n"))))] - "UINTVAL (operands[2]) < 32" -{ - operands[3] = GEN_INT (32 - UINTVAL (operands[2])); - return "ror\\t%w0, %w1, %3"; -} - [(set_attr "type" "rotate_imm")] -) - (define_insn "*_ashl" [(set (match_operand:GPI 0 "register_operand" "=r") (ANY_EXTEND:GPI diff --git a/gcc/config/aarch64/iterators.md b/gcc/config/aarch64/iterators.md index 1c10483..1be6a91 100644 --- a/gcc/config/aarch64/iterators.md +++ b/gcc/config/aarch64/iterators.md @@ -2119,7 +2119,10 @@ ;; ------------------------------------------------------------------- ;; This code iterator allows the various shifts supported on the core -(define_code_iterator SHIFT [ashift ashiftrt lshiftrt rotatert]) +(define_code_iterator SHIFT [ashift ashiftrt lshiftrt rotatert rotate]) + +;; This code iterator allows all shifts except for rotates. +(define_code_iterator SHIFT_no_rotate [ashift ashiftrt lshiftrt]) ;; This code iterator allows the shifts supported in arithmetic instructions (define_code_iterator ASHIFT [ashift ashiftrt lshiftrt]) @@ -2249,6 +2252,7 @@ (ashiftrt "ashr") (lshiftrt "lshr") (rotatert "rotr") + (rotate "rotl") (sign_extend "extend") (zero_extend "zero_extend") (sign_extract "extv") @@ -2338,7 +2342,10 @@ ;; Similar for the instruction mnemonics (define_code_attr shift [(ashift "lsl") (ashiftrt "asr") - (lshiftrt "lsr") (rotatert "ror")]) + (lshiftrt "lsr") (rotatert "ror") (rotate "ror")]) +;; True if shift is rotate left. +(define_code_attr is_rotl [(ashift "0") (ashiftrt "0") + (lshiftrt "0") (rotatert "0") (rotate "1")]) ;; Op prefix for shift right and accumulate. (define_code_attr sra_op [(ashiftrt "s") (lshiftrt "u")]) diff --git a/gcc/testsuite/gcc.target/aarch64/ror_2.c b/gcc/testsuite/gcc.target/aarch64/ror_2.c new file mode 100644 index 0000000..796c122 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/ror_2.c @@ -0,0 +1,205 @@ +/* { dg-options "-O2 --save-temps" } */ +/* { dg-do assemble } */ + + +#define ROR(X,Y) ((X >> Y) | (X << (32 - Y))) + +unsigned +ror1 (unsigned x) +{ + /* { dg-final { scan-assembler "ror\tw\[0-9\]+, w\[0-9\]+, 3\n" } } */ + return ROR (x, 3); +} + +unsigned +ror2 (unsigned x) +{ + /* { dg-final { scan-assembler "ror\tw\[0-9\]+, w\[0-9\]+, 17\n" } } */ + return ROR (x, 17); +} + +unsigned long +ror3 (unsigned x) +{ + /* { dg-final { scan-assembler "ror\tw\[0-9\]+, w\[0-9\]+, 2\n" } } */ + return (unsigned long) ROR (x, 2); +} + +unsigned long +ror4 (unsigned x) +{ + /* { dg-final { scan-assembler "ror\tw\[0-9\]+, w\[0-9\]+, 26\n" } } */ + return (unsigned long) ROR (x, 26); +} + +unsigned +and1 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "and\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, ror 13\n" } } */ + return x & ROR (y, 13); +} + +unsigned +and2 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "and\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, ror 23\n" } } */ + return x & ROR (y, 23); +} + +unsigned long +and3 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "and\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, ror 12\n" } } */ + return x & (unsigned long) ROR (y, 12); +} + +unsigned +bic1 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "bic\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, ror 11\n" } } */ + return x & ~ROR (y, 11); +} + +unsigned +bic2 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "bic\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, ror 17\n" } } */ + return x & ~ROR (y, 17); +} + +unsigned long +bic3 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "bic\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, ror 22\n" } } */ + return (unsigned long) x & ~ROR (y, 22); +} + +unsigned +orr1 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "orr\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, ror 5\n" } } */ + return x | ROR (y, 5); +} + +unsigned +orr2 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "orr\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, ror 25\n" } } */ + return x | ROR (y, 25); +} + +unsigned long +orr3 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "orr\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, ror 24\n" } } */ + return (unsigned long)x | ROR (y, 24); +} + +unsigned +orn1 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "orn\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, ror 3\n" } } */ + return x | ~ROR (y, 3); +} + +unsigned +orn2 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "orn\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, ror 30\n" } } */ + return x | ~ROR (y, 30); +} + +unsigned long +orn3 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "orn\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, ror 9\n" } } */ + return x | (unsigned long) ~ROR (y, 9); +} + +unsigned +eor1 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "eor\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, ror 9\n" } } */ + return x ^ ROR (y, 9); +} + +unsigned +eor2 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "eor\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, ror 31\n" } } */ + return x ^ ROR (y, 31); +} + +unsigned long +eor3 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "eor\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, ror 28\n" } } */ + return (unsigned long) x ^ ROR (y, 28); +} + +unsigned +eon1 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "eon\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, ror 1\n" } } */ + return x ^ ~ROR (y, 1); +} + +unsigned +eon2 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "eon\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, ror 18\n" } } */ + return x ^ ~ROR (y, 18); +} + +unsigned long +eon3 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "eon\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+, ror 19\n" } } */ + return x ^ (unsigned long) ~ROR (y, 19); +} + +int +tst1 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "tst\tw\[0-9\]+, w\[0-9\]+, ror 8\n" } } */ + return (x & ROR (y, 8)) == 0; +} + +int +tst2 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "tst\tw\[0-9\]+, w\[0-9\]+, ror 20\n" } } */ + return (x & ROR (y, 20)) == 0; +} + +int +tst3 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "tst\tw\[0-9\]+, w\[0-9\]+, ror 20\n" } } */ + return ((unsigned long)x & ROR (y, 20)) == 0; +} + +int +bics1 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "bics\twzr, w\[0-9\]+, w\[0-9\]+, ror 10\n" } } */ + return (x & ~ROR (y, 10)) == 0; +} + +int +bics2 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "bics\twzr, w\[0-9\]+, w\[0-9\]+, ror 21\n" } } */ + return (x & ~ROR (y, 21)) == 0; +} + +int +bics3 (unsigned x, unsigned y) +{ + /* { dg-final { scan-assembler "bics\twzr, w\[0-9\]+, w\[0-9\]+, ror 21\n" } } */ + return (x & (unsigned long)~ROR (y, 21)) == 0; +} + +/* { dg-final { scan-assembler-not "cmp" } } */ +/* { dg-final { scan-assembler-not "mvn" } } */ +/* { dg-final { scan-assembler-not "uxtw" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/ror_3.c b/gcc/testsuite/gcc.target/aarch64/ror_3.c new file mode 100644 index 0000000..484beec --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/ror_3.c @@ -0,0 +1,131 @@ +/* { dg-options "-O2 --save-temps" } */ +/* { dg-do assemble } */ + + +#define ROR(X,Y) ((X >> Y) | (X << (64 - Y))) + +unsigned long +ror1 (unsigned long x) +{ + /* { dg-final { scan-assembler "ror\tx\[0-9\]+, x\[0-9\]+, 3\n" } } */ + return ROR (x, 3); +} + +unsigned long +ror2 (unsigned long x) +{ + /* { dg-final { scan-assembler "ror\tx\[0-9\]+, x\[0-9\]+, 37\n" } } */ + return ROR (x, 37); +} + +unsigned long +and1 (unsigned long x, unsigned long y) +{ + /* { dg-final { scan-assembler "and\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+, ror 13\n" } } */ + return x & ROR (y, 13); +} + +unsigned long +and2 (unsigned long x, unsigned long y) +{ + /* { dg-final { scan-assembler "and\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+, ror 33\n" } } */ + return x & ROR (y, 33); +} + +unsigned long +bic1 (unsigned long x, unsigned long y) +{ + /* { dg-final { scan-assembler "bic\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+, ror 11\n" } } */ + return x & ~ROR (y, 11); +} + +unsigned long +bic2 (unsigned long x, unsigned long y) +{ + /* { dg-final { scan-assembler "bic\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+, ror 47\n" } } */ + return x & ~ROR (y, 47); +} + +unsigned long +orr1 (unsigned long x, unsigned long y) +{ + /* { dg-final { scan-assembler "orr\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+, ror 5\n" } } */ + return x | ROR (y, 5); +} + +unsigned long +orr2 (unsigned long x, unsigned long y) +{ + /* { dg-final { scan-assembler "orr\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+, ror 35\n" } } */ + return x | ROR (y, 35); +} + +unsigned long +orn1 (unsigned long x, unsigned long y) +{ + /* { dg-final { scan-assembler "orn\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+, ror 3\n" } } */ + return x | ~ROR (y, 3); +} + +unsigned long +orn2 (unsigned long x, unsigned long y) +{ + /* { dg-final { scan-assembler "orn\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+, ror 39\n" } } */ + return x | ~ROR (y, 39); +} + +unsigned long +eor1 (unsigned long x, unsigned long y) +{ + /* { dg-final { scan-assembler "eor\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+, ror 9\n" } } */ + return x ^ ROR (y, 9); +} + +unsigned long +eor2 (unsigned long x, unsigned long y) +{ + /* { dg-final { scan-assembler "eor\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+, ror 41\n" } } */ + return x ^ ROR (y, 41); +} + +unsigned long +eon1 (unsigned long x, unsigned long y) +{ + /* { dg-final { scan-assembler "eon\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+, ror 1\n" } } */ + return x ^ ~ROR (y, 1); +} + +unsigned long +eon2 (unsigned long x, unsigned long y) +{ + /* { dg-final { scan-assembler "eon\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+, ror 38\n" } } */ + return x ^ ~ROR (y, 38); +} + +unsigned long +tst1 (unsigned long x, unsigned long y) +{ + /* { dg-final { scan-assembler "tst\tx\[0-9\]+, x\[0-9\]+, ror 8\n" } } */ + return (x & ROR (y, 8)) == 0; +} + +unsigned long +tst2 (unsigned long x, unsigned long y) +{ + /* { dg-final { scan-assembler "tst\tx\[0-9\]+, x\[0-9\]+, ror 50\n" } } */ + return (x & ROR (y, 50)) == 0; +} + +unsigned long +bics1 (unsigned long x, unsigned long y) +{ + /* { dg-final { scan-assembler "bics\txzr, x\[0-9\]+, x\[0-9\]+, ror 10\n" } } */ + return (x & ~ROR (y, 10)) == 0; +} + +unsigned long +bics2 (unsigned long x, unsigned long y) +{ + /* { dg-final { scan-assembler "bics\txzr, x\[0-9\]+, x\[0-9\]+, ror 62\n" } } */ + return (x & ~ROR (y, 62)) == 0; +} -- cgit v1.1 From d5cf2a1f15ef6b46881f600dabf70636f531de2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= Date: Thu, 31 Mar 2022 13:50:35 +0000 Subject: testsuite: add missing dg-require-effective-target fpic Require effective target fpic for newly added test. gcc/testsuite/ * g++.dg/ext/visibility/visibility-local-extern1.C: Add missing dg-require-effective-target fpic. --- gcc/testsuite/g++.dg/ext/visibility/visibility-local-extern1.C | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc') diff --git a/gcc/testsuite/g++.dg/ext/visibility/visibility-local-extern1.C b/gcc/testsuite/g++.dg/ext/visibility/visibility-local-extern1.C index 40c2019..6fb1cc7 100644 --- a/gcc/testsuite/g++.dg/ext/visibility/visibility-local-extern1.C +++ b/gcc/testsuite/g++.dg/ext/visibility/visibility-local-extern1.C @@ -1,6 +1,7 @@ // PR c++/103291 // { dg-additional-options -fpic } // { dg-final { scan-assembler-not "@GOTPCREL" } } +// { dg-require-effective-target fpic } #pragma GCC visibility push(hidden) -- cgit v1.1 From 57f2ce6a87802906826501b8843013ff2b50713b Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sat, 21 May 2022 00:16:32 +0000 Subject: Daily bump. --- gcc/ChangeLog | 115 ++++++++++++++++++++++++++++++++++++++++++++++++ gcc/DATESTAMP | 2 +- gcc/analyzer/ChangeLog | 30 +++++++++++++ gcc/c-family/ChangeLog | 6 +++ gcc/cp/ChangeLog | 6 +++ gcc/jit/ChangeLog | 7 +++ gcc/testsuite/ChangeLog | 90 +++++++++++++++++++++++++++++++++++++ 7 files changed, 255 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bb3fd55..b91d393 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,118 @@ +2022-05-20 Wilco Dijkstra + + * config/aarch64/aarch64.md + (and_3_compare0): Support rotate left. + (and_si3_compare0_uxtw): Likewise. + (_3): Likewise. + (_si3_uxtw): Likewise. + (one_cmpl_2): Likewise. + (_one_cmpl_3): Likewise. + (_one_cmpl_sidi_uxtw): New pattern. + (eor_one_cmpl_3_alt): Support rotate left. + (eor_one_cmpl_sidi3_alt_ze): Likewise. + (and_one_cmpl_3_compare0): Likewise. + (and_one_cmpl_si3_compare0_uxtw): Likewise. + (and_one_cmpl_3_compare0_no_reuse): Likewise. + (and_3nr_compare0): Likewise. + (*si3_insn_uxtw): Use SHIFT_no_rotate. + (rolsi3_insn_uxtw): New pattern. + * config/aarch64/iterators.md (SHIFT): Add rotate left. + (SHIFT_no_rotate): Add new iterator. + (SHIFT:shift): Print rotate left as ror. + (is_rotl): Add test for left rotate. + +2022-05-20 Wilco Dijkstra + + * config.gcc (aarch64*-*-*): Simplify --with-cpu and --with-arch + processing. Add support for architectural extensions. + * config/aarch64/aarch64.h (TARGET_CPU_DEFAULT): Remove + AARCH64_CPU_DEFAULT_FLAGS. + (TARGET_CPU_NBITS): Remove. + (TARGET_CPU_MASK): Remove. + * config/aarch64/aarch64.cc (AARCH64_CPU_DEFAULT_FLAGS): Remove define. + (get_tune_cpu): Assert CPU is always valid. + (get_arch): Assert architecture is always valid. + (aarch64_override_options): Cleanup CPU selection code and simplify logic. + (aarch64_option_restore): Remove unnecessary checks on tune. + +2022-05-20 David Malcolm + + * config/aarch64/aarch64-sve-builtins-base.cc: Replace uses of + "FINAL" and "OVERRIDE" with "final" and "override". + * config/aarch64/aarch64-sve-builtins-functions.h: Likewise. + * config/aarch64/aarch64-sve-builtins-shapes.cc: Likewise. + * config/aarch64/aarch64-sve-builtins-sve2.cc: Likewise. + * diagnostic-path.h: Likewise. + * digraph.cc: Likewise. + * gcc-rich-location.h: Likewise. + * gimple-array-bounds.cc: Likewise. + * gimple-loop-versioning.cc: Likewise. + * gimple-range-cache.cc: Likewise. + * gimple-range-cache.h: Likewise. + * gimple-range-fold.cc: Likewise. + * gimple-range-fold.h: Likewise. + * gimple-range-tests.cc: Likewise. + * gimple-range.h: Likewise. + * gimple-ssa-evrp.cc: Likewise. + * input.cc: Likewise. + * json.h: Likewise. + * read-rtl-function.cc: Likewise. + * tree-complex.cc: Likewise. + * tree-diagnostic-path.cc: Likewise. + * tree-ssa-ccp.cc: Likewise. + * tree-ssa-copy.cc: Likewise. + * tree-vrp.cc: Likewise. + * value-query.h: Likewise. + * vr-values.h: Likewise. + +2022-05-20 Marcel Vollweiler + + * omp-low.cc (omp_runtime_api_call): Added target_memcpy_async and + target_memcpy_rect_async to omp_runtime_apis array. + +2022-05-20 Christophe Lyon + + * doc/sourcebuild.texi (Decimal floating point attributes): Document + dfp_bid effective-target. + +2022-05-20 Christophe Lyon + + * config/aarch64/aarch64.cc + (aarch64_split_128bit_move): Handle DFP modes. + (aarch64_mode_valid_for_sched_fusion_p): Likewise. + (aarch64_classify_address): Likewise. + (aarch64_legitimize_address_displacement): Likewise. + (aarch64_reinterpret_float_as_int): Likewise. + (aarch64_float_const_zero_rtx_p): Likewise. + (aarch64_can_const_movi_rtx_p): Likewise. + (aarch64_anchor_offset): Likewise. + (aarch64_secondary_reload): Likewise. + (aarch64_rtx_costs): Likewise. + (aarch64_legitimate_constant_p): Likewise. + (aarch64_gimplify_va_arg_expr): Likewise. + (aapcs_vfp_sub_candidate): Likewise. + (aarch64_vfp_is_call_or_return_candidate): Likewise. + (aarch64_output_scalar_simd_mov_immediate): Likewise. + (aarch64_gen_adjusted_ldpstp): Likewise. + (aarch64_scalar_mode_supported_p): Accept DFP modes if enabled. + * config/aarch64/aarch64.md + (movsf_aarch64): Use SFD iterator and rename into + mov_aarch64. + (movdf_aarch64): Use DFD iterator and rename into + mov_aarch64. + (movtf_aarch64): Use TFD iterator and rename into + mov_aarch64. + (split pattern for move TF mode): Use TFD iterator. + * config/aarch64/iterators.md + (GPF_TF_F16_MOV): Add DFP modes. + (SFD, DFD, TFD): New iterators. + (GPF_TF): Add DFP modes. + (TX, DX, DX2): Likewise. + +2022-05-20 Christophe Lyon + + * configure: Regenerate. + 2022-05-19 Roger Sayle PR middle-end/98865 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index dc35e22..3f0681b 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20220520 +20220521 diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog index e4f67fe..fa3c231 100644 --- a/gcc/analyzer/ChangeLog +++ b/gcc/analyzer/ChangeLog @@ -1,3 +1,33 @@ +2022-05-20 David Malcolm + + * analyzer-pass.cc: Replace uses of "FINAL" and "OVERRIDE" with + "final" and "override". + * call-info.h: Likewise. + * checker-path.h: Likewise. + * constraint-manager.cc: Likewise. + * diagnostic-manager.cc: Likewise. + * engine.cc: Likewise. + * exploded-graph.h: Likewise. + * feasible-graph.h: Likewise. + * pending-diagnostic.h: Likewise. + * region-model-impl-calls.cc: Likewise. + * region-model.cc: Likewise. + * region-model.h: Likewise. + * region.h: Likewise. + * sm-file.cc: Likewise. + * sm-malloc.cc: Likewise. + * sm-pattern-test.cc: Likewise. + * sm-sensitive.cc: Likewise. + * sm-signal.cc: Likewise. + * sm-taint.cc: Likewise. + * state-purge.h: Likewise. + * store.cc: Likewise. + * store.h: Likewise. + * supergraph.h: Likewise. + * svalue.h: Likewise. + * trimmed-graph.h: Likewise. + * varargs.cc: Likewise. + 2022-05-16 David Malcolm PR analyzer/105103 diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 2f69aeb..2f3071c 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2022-05-20 David Malcolm + + * c-format.cc: Replace uses of "FINAL" and "OVERRIDE" with "final" + and "override". + * c-pretty-print.h: Likewise. + 2022-05-18 Marek Polacek PR c/105131 diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 41a2615..e4788be 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2022-05-20 David Malcolm + + * cxx-pretty-print.h: Replace uses of "FINAL" and "OVERRIDE" with + "final" and "override". + * error.cc: Likewise. + 2022-05-18 Marek Polacek PR c++/105634 diff --git a/gcc/jit/ChangeLog b/gcc/jit/ChangeLog index 341766b..495901d 100644 --- a/gcc/jit/ChangeLog +++ b/gcc/jit/ChangeLog @@ -1,3 +1,10 @@ +2022-05-20 David Malcolm + + * jit-playback.h: Replace uses of "FINAL" and "OVERRIDE" with + "final" and "override". + * jit-recording.cc: Likewise. + * jit-recording.h: Likewise. + 2022-05-16 Martin Liska * jit-builtins.cc (find_builtin_by_name): Use ARRAY_SIZE. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 613dbbe..392e6ca 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,93 @@ +2022-05-20 Marc Poulhiès + + * g++.dg/ext/visibility/visibility-local-extern1.C: Add missing + dg-require-effective-target fpic. + +2022-05-20 Wilco Dijkstra + + * gcc.target/aarch64/ror_2.c: New test. + * gcc.target/aarch64/ror_3.c: New test. + +2022-05-20 Christophe Lyon + + * gcc.dg/torture/convert-dfp-2.c: New test. + * gcc.dg/torture/convert-dfp.c: New test. + +2022-05-20 Christophe Lyon + + * g++.dg/eh/dfp-1.C: New test. + * g++.dg/eh/dfp-2.C: New test. + * g++.dg/eh/dfp-saves-aarch64.C: New test. + +2022-05-20 Christophe Lyon + + * lib/target-supports.exp (check_effective_target_dfp_bid): New. + * gcc.dg/dfp/bid-non-canonical-d128-1.c: Use dfp_bid + effective-target. + * gcc.dg/dfp/bid-non-canonical-d128-2.c: Likewise. + * gcc.dg/dfp/bid-non-canonical-d128-3.c: Likewise. + * gcc.dg/dfp/bid-non-canonical-d128-4.c: Likewise. + * gcc.dg/dfp/bid-non-canonical-d32-1.c: Likewise. + * gcc.dg/dfp/bid-non-canonical-d32-2.c: Likewise. + * gcc.dg/dfp/bid-non-canonical-d64-1.c: Likewise. + * gcc.dg/dfp/bid-non-canonical-d64-2.c: Likewise. + +2022-05-20 Christophe Lyon + + * gcc.target/aarch64/aapcs64/aapcs64.exp: Support new dfp*.c tests. + * gcc.target/aarch64/aapcs64/func-ret-1.c: Add DFP tests. + * gcc.target/aarch64/aapcs64/func-ret-3.c: Add DFP tests. + * gcc.target/aarch64/aapcs64/type-def.h: Add DFP types. + * gcc.target/aarch64/aapcs64/dfp-1.c: New test. + * gcc.target/aarch64/aapcs64/ice_dfp_5.c: New test. + * gcc.target/aarch64/aapcs64/test_align_dfp-1.c: New test. + * gcc.target/aarch64/aapcs64/test_align_dfp-4.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_1.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_10.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_11.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_12.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_13.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_14.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_15.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_16.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_17.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_18.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_19.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_2.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_20.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_21.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_22.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_23.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_24.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_25.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_26.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_27.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_3.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_5.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_6.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_7.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_8.c: New test. + * gcc.target/aarch64/aapcs64/test_dfp_9.c: New test. + * gcc.target/aarch64/aapcs64/test_quad_double_dfp.c: New test. + * gcc.target/aarch64/aapcs64/va_arg_dfp-1.c: New test. + * gcc.target/aarch64/aapcs64/va_arg_dfp-10.c: New test. + * gcc.target/aarch64/aapcs64/va_arg_dfp-11.c: New test. + * gcc.target/aarch64/aapcs64/va_arg_dfp-12.c: New test. + * gcc.target/aarch64/aapcs64/va_arg_dfp-13.c: New test. + * gcc.target/aarch64/aapcs64/va_arg_dfp-14.c: New test. + * gcc.target/aarch64/aapcs64/va_arg_dfp-16.c: New test. + * gcc.target/aarch64/aapcs64/va_arg_dfp-2.c: New test. + * gcc.target/aarch64/aapcs64/va_arg_dfp-3.c: New test. + * gcc.target/aarch64/aapcs64/va_arg_dfp-4.c: New test. + * gcc.target/aarch64/aapcs64/va_arg_dfp-5.c: New test. + * gcc.target/aarch64/aapcs64/va_arg_dfp-6.c: New test. + * gcc.target/aarch64/aapcs64/va_arg_dfp-8.c: New test. + * gcc.target/aarch64/aapcs64/va_arg_dfp-9.c: New test. + +2022-05-20 Christophe Lyon + + * c-c++-common/dfp/pr39986.c: Accept .word directive. + 2022-05-19 Jonathan Wakely * g++.dg/cpp0x/variadic-tuple.C: Qualify function to avoid ADL -- cgit v1.1 From bad2999ab2b910c2e6b4494c772163de2b7e90e5 Mon Sep 17 00:00:00 2001 From: Dimitar Dimitrov Date: Sat, 14 May 2022 21:40:11 +0300 Subject: testsuite: Mark extra warnings for default_packed If the target uses packed structs by default, there are no trailing padding bytes allocated. Hence extra warnings are emitted. gcc/testsuite/ChangeLog: * gcc.dg/Warray-bounds-48-novec.c: Add expected warnings if target packs the structs by default. Signed-off-by: Dimitar Dimitrov --- gcc/testsuite/gcc.dg/Warray-bounds-48-novec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-48-novec.c b/gcc/testsuite/gcc.dg/Warray-bounds-48-novec.c index da179a2..5cae856 100644 --- a/gcc/testsuite/gcc.dg/Warray-bounds-48-novec.c +++ b/gcc/testsuite/gcc.dg/Warray-bounds-48-novec.c @@ -238,15 +238,17 @@ static void warn_a1_init (struct A1 *p) static void warn_a1_local_buf (struct A1 *p) { - p->a1[0] = 0; p->a1[1] = 1; p->a1[2] = 2; p->a1[3] = 3; + p->a1[0] = 0; p->a1[1] = 1; p->a1[2] = 2; + p->a1[3] = 3; // { dg-warning "\\\[-Warray-bounds" "" { target default_packed } } p->a1[4] = 4; // { dg-warning "\\\[-Warray-bounds" } } static void warn_a1_extern_buf (struct A1 *p) { - p->a1[0] = 0; p->a1[1] = 1; p->a1[2] = 2; p->a1[3] = 3; p->a1[4] = 4; + p->a1[0] = 0; p->a1[1] = 1; p->a1[2] = 2; p->a1[3] = 3; + p->a1[4] = 4; // { dg-warning "\\\[-Warray-bounds" "" { target default_packed } } p->a1[5] = 5; // { dg-warning "\\\[-Warray-bounds" } } -- cgit v1.1 From 7ee307bbbb13f16e2f69781cf4ec4e9552543bad Mon Sep 17 00:00:00 2001 From: Dimitar Dimitrov Date: Sun, 15 May 2022 10:43:38 +0300 Subject: testsuite: Skip ifcvt-4.c for PRU PRU has no condition code and conditional moves. gcc/testsuite/ChangeLog: * gcc.dg/ifcvt-4.c: Skip for PRU. Signed-off-by: Dimitar Dimitrov --- gcc/testsuite/gcc.dg/ifcvt-4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/ifcvt-4.c b/gcc/testsuite/gcc.dg/ifcvt-4.c index 37aa76a..46245f0 100644 --- a/gcc/testsuite/gcc.dg/ifcvt-4.c +++ b/gcc/testsuite/gcc.dg/ifcvt-4.c @@ -2,7 +2,7 @@ /* { dg-additional-options "-misel" { target { powerpc*-*-* } } } */ /* { dg-additional-options "-march=z196" { target { s390x-*-* } } } */ /* { dg-additional-options "-mtune-ctrl=^one_if_conv_insn" { target { i?86-*-* x86_64-*-* } } } */ -/* { dg-skip-if "Multiple set if-conversion not guaranteed on all subtargets" { "arm*-*-* avr-*-* hppa*64*-*-* visium-*-*" riscv*-*-* msp430-*-* nios2-*-*} } */ +/* { dg-skip-if "Multiple set if-conversion not guaranteed on all subtargets" { "arm*-*-* avr-*-* hppa*64*-*-* visium-*-*" riscv*-*-* msp430-*-* nios2-*-* pru-*-* } } */ /* { dg-skip-if "" { "s390x-*-*" } { "-m31" } } */ typedef int word __attribute__((mode(word))); -- cgit v1.1 From 0380b6575f61e5bd9f428887790716a57dd66488 Mon Sep 17 00:00:00 2001 From: Dimitar Dimitrov Date: Sun, 15 May 2022 17:11:39 +0300 Subject: testsuite: Skip gcc.dg/pr46647.c for PRU Like AVR and Cris, PRU has no alignment requirements. Thus it is also affected by PR53535. PR middle-end/53535 gcc/testsuite/ChangeLog: * gcc.dg/pr46647.c: Skip for pru target. Signed-off-by: Dimitar Dimitrov --- gcc/testsuite/gcc.dg/pr46647.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/pr46647.c b/gcc/testsuite/gcc.dg/pr46647.c index 7eefc6e..a903273 100644 --- a/gcc/testsuite/gcc.dg/pr46647.c +++ b/gcc/testsuite/gcc.dg/pr46647.c @@ -25,5 +25,5 @@ func3 (void) return 0; } -/* The xfail for avr and cris-* is due to PR53535. */ -/* { dg-final { scan-tree-dump-not "memset" "optimized" { xfail avr-*-* cris-*-* } } } */ +/* The xfail for avr, cris-* and pru is due to PR53535. */ +/* { dg-final { scan-tree-dump-not "memset" "optimized" { xfail avr-*-* cris-*-* pru-*-* } } } */ -- cgit v1.1 From addacdc87b044e63d72054036907c91a18be6734 Mon Sep 17 00:00:00 2001 From: Dimitar Dimitrov Date: Sun, 15 May 2022 17:21:59 +0300 Subject: testsuite: Adjust pr91088.c for default_packed targets PR ipa/91088 gcc/testsuite/ChangeLog: * gcc.dg/ipa/pr91088.c: Adjust member offset checks to accommodate targets which pack structures by default. Signed-off-by: Dimitar Dimitrov --- gcc/testsuite/gcc.dg/ipa/pr91088.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/ipa/pr91088.c b/gcc/testsuite/gcc.dg/ipa/pr91088.c index cc146a8..f8b3c49 100644 --- a/gcc/testsuite/gcc.dg/ipa/pr91088.c +++ b/gcc/testsuite/gcc.dg/ipa/pr91088.c @@ -115,6 +115,7 @@ int caller () /* { dg-final { scan-ipa-dump-times "Creating a specialized node of callee1" 1 "cp" } } */ /* { dg-final { scan-ipa-dump-times "Creating a specialized node of callee2" 1 "cp" } } */ /* { dg-final { scan-ipa-dump-times "Creating a specialized node of callee3" 1 "cp" } } */ -/* { dg-final { scan-ipa-dump "op0\\\[offset: 32],\\(\\(short int\\) #\\),\\(\\(int\\) #\\),\\(1300 / #\\) == 19" "cp" } } */ +/* { dg-final { scan-ipa-dump "op0\\\[offset: 16],\\(\\(short int\\) #\\),\\(\\(int\\) #\\),\\(1300 / #\\) == 19" "cp" { target default_packed } } } */ +/* { dg-final { scan-ipa-dump "op0\\\[offset: 32],\\(\\(short int\\) #\\),\\(\\(int\\) #\\),\\(1300 / #\\) == 19" "cp" { target { ! default_packed } } } } */ /* { dg-final { scan-ipa-dump "op0\\\[ref offset: 0],\\(# \\^ 1\\) <" "cp" } } */ /* { dg-final { scan-ipa-dump "op0,\\(# & 255\\),\\(1 - #\\),\\(# \\* 3\\),\\(27 % #\\) <" "cp" } } */ -- cgit v1.1 From 570fbf448d126f1e4b3ef55327c3ea3ab0d3a806 Mon Sep 17 00:00:00 2001 From: Dimitar Dimitrov Date: Sun, 15 May 2022 18:20:29 +0300 Subject: testsuite: Skip vectorize tests for PRU PRU has single-cycle constant cost for any jump, and it cannot vectorise. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/gen-vect-11.c: For PRU target, skip the vectorizing checks in tree dumps. * gcc.dg/tree-ssa/gen-vect-11a.c: Ditto. * gcc.dg/tree-ssa/gen-vect-2.c: Ditto. * gcc.dg/tree-ssa/gen-vect-25.c: Ditto. * gcc.dg/tree-ssa/gen-vect-26.c: Ditto. * gcc.dg/tree-ssa/gen-vect-28.c: Ditto. * gcc.dg/tree-ssa/gen-vect-32.c: Ditto. Signed-off-by: Dimitar Dimitrov --- gcc/testsuite/gcc.dg/tree-ssa/gen-vect-11.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/gen-vect-11a.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/gen-vect-2.c | 4 ++-- gcc/testsuite/gcc.dg/tree-ssa/gen-vect-25.c | 4 ++-- gcc/testsuite/gcc.dg/tree-ssa/gen-vect-26.c | 6 +++--- gcc/testsuite/gcc.dg/tree-ssa/gen-vect-28.c | 6 +++--- gcc/testsuite/gcc.dg/tree-ssa/gen-vect-32.c | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-11.c b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-11.c index dd1c0ac..6916843 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-11.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-11.c @@ -34,4 +34,4 @@ int main () } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! { avr-*-* msp430-*-* } } } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! { avr-*-* msp430-*-* pru-*-* } } } } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-11a.c b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-11a.c index e2fb362..6326bf7 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-11a.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-11a.c @@ -38,4 +38,4 @@ int main () } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! avr-*-* } } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! { avr-*-* pru-*-* } } } } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-2.c b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-2.c index 42171a2..b84f318 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-2.c @@ -36,5 +36,5 @@ int main () return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! avr-*-* } } } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target { ! avr-*-* } } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! { avr-*-* pru-*-* } } } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target { ! { avr-*-* pru-*-* } } } } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-25.c b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-25.c index 60ec270..18fe1aa 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-25.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-25.c @@ -54,5 +54,5 @@ int main (void) return main_1 (n + 2, (int *) &n); } -/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { ! { avr-*-* msp430-*-* } } } } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target { ! { avr-*-* msp430-*-* } } } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { ! { avr-*-* msp430-*-* pru-*-* } } } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target { ! { avr-*-* msp430-*-* pru-*-* } } } } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-26.c b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-26.c index 6f3c2b7..7106961 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-26.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-26.c @@ -29,7 +29,7 @@ int main () } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! avr-*-* } } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! { avr-*-* pru-*-* } } } } } */ /* IBM Z does not require special alignment for vectorization. */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target { ! { avr-*-* s390*-*-* } } } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { ! { avr-*-* s390*-*-* } } } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target { ! { avr-*-* pru-*-* s390*-*-* } } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { ! { avr-*-* pru-*-* s390*-*-* } } } } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-28.c b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-28.c index 7b26bbd..c5f1b5a 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-28.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-28.c @@ -37,7 +37,7 @@ int main (void) } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! avr-*-* } } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! { avr-*-* pru-*-* } } } } } */ /* IBM Z does not require special alignment for vectorization. */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target { ! { avr-*-* s390*-*-* } } } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { ! { avr-*-* s390*-*-* } } } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target { ! { avr-*-* pru-*-* s390*-*-* } } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { ! { avr-*-* pru-*-* s390*-*-* } } } } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-32.c b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-32.c index 378dd0b..62d2b50 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-32.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/gen-vect-32.c @@ -33,5 +33,5 @@ int main () } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! avr-*-* } } } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target { ! avr-*-* } } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! { avr-*-* pru-*-* } } } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target { ! { avr-*-* pru-*-* } } } } } */ -- cgit v1.1 From a60228404f2ac11b5eb66270037ff3fa6bf948e5 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Sun, 22 May 2022 00:16:38 +0000 Subject: Daily bump. --- gcc/DATESTAMP | 2 +- gcc/testsuite/ChangeLog | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 3f0681b..99ebccd 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20220521 +20220522 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 392e6ca..ef7e0b4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,34 @@ +2022-05-21 Dimitar Dimitrov + + * gcc.dg/tree-ssa/gen-vect-11.c: For PRU target, skip the + vectorizing checks in tree dumps. + * gcc.dg/tree-ssa/gen-vect-11a.c: Ditto. + * gcc.dg/tree-ssa/gen-vect-2.c: Ditto. + * gcc.dg/tree-ssa/gen-vect-25.c: Ditto. + * gcc.dg/tree-ssa/gen-vect-26.c: Ditto. + * gcc.dg/tree-ssa/gen-vect-28.c: Ditto. + * gcc.dg/tree-ssa/gen-vect-32.c: Ditto. + +2022-05-21 Dimitar Dimitrov + + PR ipa/91088 + * gcc.dg/ipa/pr91088.c: Adjust member offset checks to + accommodate targets which pack structures by default. + +2022-05-21 Dimitar Dimitrov + + PR middle-end/53535 + * gcc.dg/pr46647.c: Skip for pru target. + +2022-05-21 Dimitar Dimitrov + + * gcc.dg/ifcvt-4.c: Skip for PRU. + +2022-05-21 Dimitar Dimitrov + + * gcc.dg/Warray-bounds-48-novec.c: Add expected warnings + if target packs the structs by default. + 2022-05-20 Marc Poulhiès * g++.dg/ext/visibility/visibility-local-extern1.C: Add missing -- cgit v1.1 From 260f189335054ffdbf3866dfd2bff1abb5c989f0 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Mon, 23 May 2022 00:16:28 +0000 Subject: Daily bump. --- gcc/DATESTAMP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 99ebccd..9cf4f57 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20220522 +20220523 -- cgit v1.1 From 657612fb9f58c9cca44b091e3cf40d704fe3ec75 Mon Sep 17 00:00:00 2001 From: liuhongt Date: Thu, 19 May 2022 15:32:22 +0800 Subject: Increase move cost between mask and gpr. kmovd only uses port5 which is often the bottleneck of performance. Also from latency perspective, spill and reload mostly could be STLF or even MRN which only take 1 cycle. So the patch increase move cost between gpr and mask to be the same as gpr <-> sse register. gcc/ChangeLog: * config/i386/x86-tune-costs.h (skylake_cost): Increase gpr <-> mask cost from 5 to 6. (icelake_cost): Ditto. gcc/testsuite/ChangeLog: * gcc.target/i386/spill_to_mask-1.c: New test. --- gcc/config/i386/x86-tune-costs.h | 4 ++-- gcc/testsuite/gcc.target/i386/spill_to_mask-1.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc') diff --git a/gcc/config/i386/x86-tune-costs.h b/gcc/config/i386/x86-tune-costs.h index 017ffa6..05cbd49 100644 --- a/gcc/config/i386/x86-tune-costs.h +++ b/gcc/config/i386/x86-tune-costs.h @@ -1866,7 +1866,7 @@ struct processor_costs skylake_cost = { {8, 8, 8, 12, 24}, /* cost of storing SSE registers in 32,64,128,256 and 512-bit */ 6, 6, /* SSE->integer and integer->SSE moves */ - 5, 5, /* mask->integer and integer->mask moves */ + 6, 6, /* mask->integer and integer->mask moves */ {8, 8, 8}, /* cost of loading mask register in QImode, HImode, SImode. */ {6, 6, 6}, /* cost if storing mask register @@ -1992,7 +1992,7 @@ struct processor_costs icelake_cost = { {8, 8, 8, 12, 24}, /* cost of storing SSE registers in 32,64,128,256 and 512-bit */ 6, 6, /* SSE->integer and integer->SSE moves */ - 5, 5, /* mask->integer and integer->mask moves */ + 6, 6, /* mask->integer and integer->mask moves */ {8, 8, 8}, /* cost of loading mask register in QImode, HImode, SImode. */ {6, 6, 6}, /* cost if storing mask register diff --git a/gcc/testsuite/gcc.target/i386/spill_to_mask-1.c b/gcc/testsuite/gcc.target/i386/spill_to_mask-1.c index 94d6764..be19239 100644 --- a/gcc/testsuite/gcc.target/i386/spill_to_mask-1.c +++ b/gcc/testsuite/gcc.target/i386/spill_to_mask-1.c @@ -120,7 +120,7 @@ void foo (DTYPE in[16], DTYPE out[8], const DTYPE C[16]) out[7] += h; } -/* { dg-final { scan-assembler "kmovd" } } */ +/* { dg-final { scan-assembler "kmovd" { xfail *-*-* } } } */ /* { dg-final { scan-assembler-not "knot" } } */ /* { dg-final { scan-assembler-not "kxor" } } */ /* { dg-final { scan-assembler-not "kor" } } */ -- cgit v1.1 From 075fb873c264a030f56793cb162c9fdecbdd1773 Mon Sep 17 00:00:00 2001 From: Tsukasa OI Date: Sun, 22 May 2022 18:29:14 +0900 Subject: RISC-V: Fix canonical extension order (K and J) This commit fixes canonical extension order to follow the RISC-V ISA Manual draft-20210402-1271737 or later. gcc/ChangeLog: * common/config/riscv/riscv-common.cc (riscv_supported_std_ext): Fix "K" extension prefix to be placed before "J". * config/riscv/arch-canonicalize: Likewise. Signed-off-by: Tsukasa OI --- gcc/common/config/riscv/riscv-common.cc | 2 +- gcc/config/riscv/arch-canonicalize | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc index 1501242..0b0ec2c 100644 --- a/gcc/common/config/riscv/riscv-common.cc +++ b/gcc/common/config/riscv/riscv-common.cc @@ -594,7 +594,7 @@ riscv_subset_list::lookup (const char *subset, int major_version, static const char * riscv_supported_std_ext (void) { - return "mafdqlcbjktpvn"; + return "mafdqlcbkjtpvn"; } /* Parsing subset version. diff --git a/gcc/config/riscv/arch-canonicalize b/gcc/config/riscv/arch-canonicalize index 41bab69..71b2232 100755 --- a/gcc/config/riscv/arch-canonicalize +++ b/gcc/config/riscv/arch-canonicalize @@ -32,7 +32,7 @@ import itertools from functools import reduce SUPPORTED_ISA_SPEC = ["2.2", "20190608", "20191213"] -CANONICAL_ORDER = "imafdgqlcbjktpvn" +CANONICAL_ORDER = "imafdgqlcbkjtpvn" LONG_EXT_PREFIXES = ['z', 's', 'h', 'x'] # -- cgit v1.1 From 7707d7fddf7d6858399c8a47b139dc4708c5d7d9 Mon Sep 17 00:00:00 2001 From: Roger Sayle Date: Mon, 23 May 2022 08:47:42 +0100 Subject: Some additional ix86_rtx_costs clean-ups: NEG, AND, andn and pandn. Double-word NOT requires two operations, but double-word NEG requires three operations. Using SSE, vector NOT requires a pxor with -1, but AND of NOT is cheap thanks to the existence of pandn. There's also some legacy (aka incorrect) logic explicitly testing for DImode [independently of TARGET_64BIT] in determining the cost of logic operations that's not required. 2022-05-23 Roger Sayle gcc/ChangeLog * config/i386/i386.cc (ix86_rtx_costs) : Split from XOR/IOR case. Account for two instructions for double-word operations. In case of vector pandn, account for single instruction. Likewise for integer andn with TARGET_BMI. : Vector NOT requires more than 1 instruction (pxor). : Double-word negation requires 3 instructions. --- gcc/config/i386/i386.cc | 133 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 94 insertions(+), 39 deletions(-) (limited to 'gcc') diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index 30a9cd0..daa60ac 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -20738,70 +20738,125 @@ ix86_rtx_costs (rtx x, machine_mode mode, int outer_code_i, int opno, } if (SSE_FLOAT_MODE_SSEMATH_OR_HF_P (mode)) - { - *total = cost->addss; - return false; - } + *total = cost->addss; else if (X87_FLOAT_MODE_P (mode)) - { - *total = cost->fadd; - return false; - } + *total = cost->fadd; else if (FLOAT_MODE_P (mode)) - { - *total = ix86_vec_cost (mode, cost->addss); - return false; - } - /* FALLTHRU */ + *total = ix86_vec_cost (mode, cost->addss); + else if (GET_MODE_CLASS (mode) == MODE_VECTOR_INT) + *total = ix86_vec_cost (mode, cost->sse_op); + else if (GET_MODE_SIZE (mode) > UNITS_PER_WORD) + *total = cost->add * 2; + else + *total = cost->add; + return false; - case AND: case IOR: case XOR: - if (GET_MODE_CLASS (mode) == MODE_INT - && GET_MODE_SIZE (mode) > UNITS_PER_WORD) + if (GET_MODE_CLASS (mode) == MODE_VECTOR_INT) + *total = ix86_vec_cost (mode, cost->sse_op); + else if (GET_MODE_SIZE (mode) > UNITS_PER_WORD) + *total = cost->add * 2; + else + *total = cost->add; + return false; + + case AND: + if (address_no_seg_operand (x, mode)) { - *total = (cost->add * 2 - + (rtx_cost (XEXP (x, 0), mode, outer_code, opno, speed) - << (GET_MODE (XEXP (x, 0)) != DImode)) - + (rtx_cost (XEXP (x, 1), mode, outer_code, opno, speed) - << (GET_MODE (XEXP (x, 1)) != DImode))); + *total = cost->lea; return true; } - else if (code == AND - && address_no_seg_operand (x, mode)) + else if (GET_MODE_CLASS (mode) == MODE_VECTOR_INT) { - *total = cost->lea; - return true; + /* pandn is a single instruction. */ + if (GET_CODE (XEXP (x, 0)) == NOT) + { + *total = ix86_vec_cost (mode, cost->sse_op) + + rtx_cost (XEXP (XEXP (x, 0), 0), mode, + outer_code, opno, speed) + + rtx_cost (XEXP (x, 1), mode, + outer_code, opno, speed); + return true; + } + else if (GET_CODE (XEXP (x, 1)) == NOT) + { + *total = ix86_vec_cost (mode, cost->sse_op) + + rtx_cost (XEXP (x, 0), mode, + outer_code, opno, speed) + + rtx_cost (XEXP (XEXP (x, 1), 0), mode, + outer_code, opno, speed); + return true; + } + *total = ix86_vec_cost (mode, cost->sse_op); } - /* FALLTHRU */ - - case NEG: - if (SSE_FLOAT_MODE_SSEMATH_OR_HF_P (mode)) + else if (GET_MODE_SIZE (mode) > UNITS_PER_WORD) { - *total = cost->sse_op; - return false; + if (TARGET_BMI && GET_CODE (XEXP (x,0)) == NOT) + { + *total = cost->add * 2 + + rtx_cost (XEXP (XEXP (x, 0), 0), mode, + outer_code, opno, speed) + + rtx_cost (XEXP (x, 1), mode, + outer_code, opno, speed); + return true; + } + else if (TARGET_BMI && GET_CODE (XEXP (x, 1)) == NOT) + { + *total = cost->add * 2 + + rtx_cost (XEXP (x, 0), mode, + outer_code, opno, speed) + + rtx_cost (XEXP (XEXP (x, 1), 0), mode, + outer_code, opno, speed); + return true; + } + *total = cost->add * 2; } - else if (X87_FLOAT_MODE_P (mode)) + else if (TARGET_BMI && GET_CODE (XEXP (x,0)) == NOT) { - *total = cost->fchs; - return false; + *total = cost->add + + rtx_cost (XEXP (XEXP (x, 0), 0), mode, + outer_code, opno, speed) + + rtx_cost (XEXP (x, 1), mode, outer_code, opno, speed); + return true; } - else if (FLOAT_MODE_P (mode)) + else if (TARGET_BMI && GET_CODE (XEXP (x,1)) == NOT) { - *total = ix86_vec_cost (mode, cost->sse_op); - return false; + *total = cost->add + + rtx_cost (XEXP (x, 0), mode, outer_code, opno, speed) + + rtx_cost (XEXP (XEXP (x, 1), 0), mode, + outer_code, opno, speed); + return true; } - /* FALLTHRU */ + else + *total = cost->add; + return false; case NOT: if (GET_MODE_CLASS (mode) == MODE_VECTOR_INT) - *total = ix86_vec_cost (mode, cost->sse_op); + // vnot is pxor -1. + *total = ix86_vec_cost (mode, cost->sse_op) + 1; else if (GET_MODE_SIZE (mode) > UNITS_PER_WORD) *total = cost->add * 2; else *total = cost->add; return false; + case NEG: + if (SSE_FLOAT_MODE_SSEMATH_OR_HF_P (mode)) + *total = cost->sse_op; + else if (X87_FLOAT_MODE_P (mode)) + *total = cost->fchs; + else if (FLOAT_MODE_P (mode)) + *total = ix86_vec_cost (mode, cost->sse_op); + else if (GET_MODE_CLASS (mode) == MODE_VECTOR_INT) + *total = ix86_vec_cost (mode, cost->sse_op); + else if (GET_MODE_SIZE (mode) > UNITS_PER_WORD) + *total = cost->add * 3; + else + *total = cost->add; + return false; + case COMPARE: rtx op0, op1; op0 = XEXP (x, 0); -- cgit v1.1 From 49d1a2f91325fa8cc011149e27e5093a988b3a49 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Mon, 23 May 2022 10:54:32 +0200 Subject: OpenMP: Handle descriptors in target's firstprivate [PR104949] For allocatable/pointer arrays, a firstprivate to a device not only needs to privatize the descriptor but also the actual data. This is implemented as: firstprivate(x) firstprivate(x.data) attach(x [bias: &x.data-&x) where the address of x in device memory is saved in hostaddrs[i] by libgomp and the middle end actually passes hostaddrs[i]' to attach. As side effect, has_device_addr(array_desc) had to be changed: before, it was converted to firstprivate in the front end; now it is handled in omp-low.cc as has_device_addr requires a shallow firstprivate (not touching the data pointer) while the normal firstprivate requires (now) a deep firstprivate. gcc/fortran/ChangeLog: PR fortran/104949 * f95-lang.cc (LANG_HOOKS_OMP_ARRAY_SIZE): Redefine. * trans-openmp.cc (gfc_omp_array_size): New. (gfc_trans_omp_variable_list): Never turn has_device_addr to firstprivate. * trans.h (gfc_omp_array_size): New. gcc/ChangeLog: PR fortran/104949 * langhooks-def.h (lhd_omp_array_size): New. (LANG_HOOKS_OMP_ARRAY_SIZE): Define. (LANG_HOOKS_DECLS): Add it. * langhooks.cc (lhd_omp_array_size): New. * langhooks.h (struct lang_hooks_for_decls): Add hook. * omp-low.cc (scan_sharing_clauses, lower_omp_target): Handle GOMP_MAP_FIRSTPRIVATE for array descriptors. libgomp/ChangeLog: PR fortran/104949 * target.c (gomp_map_vars_internal, copy_firstprivate_data): Support attach for GOMP_MAP_FIRSTPRIVATE. * testsuite/libgomp.fortran/target-firstprivate-1.f90: New test. * testsuite/libgomp.fortran/target-firstprivate-2.f90: New test. * testsuite/libgomp.fortran/target-firstprivate-3.f90: New test. --- gcc/fortran/f95-lang.cc | 2 + gcc/fortran/trans-openmp.cc | 53 ++++++++++++++++++----- gcc/fortran/trans.h | 1 + gcc/langhooks-def.h | 3 ++ gcc/langhooks.cc | 8 ++++ gcc/langhooks.h | 5 +++ gcc/omp-low.cc | 102 +++++++++++++++++++++++++++++++++++++++++++- 7 files changed, 163 insertions(+), 11 deletions(-) (limited to 'gcc') diff --git a/gcc/fortran/f95-lang.cc b/gcc/fortran/f95-lang.cc index 1a895a2..e83fef3 100644 --- a/gcc/fortran/f95-lang.cc +++ b/gcc/fortran/f95-lang.cc @@ -114,6 +114,7 @@ static const struct attribute_spec gfc_attribute_table[] = #undef LANG_HOOKS_TYPE_FOR_SIZE #undef LANG_HOOKS_INIT_TS #undef LANG_HOOKS_OMP_ARRAY_DATA +#undef LANG_HOOKS_OMP_ARRAY_SIZE #undef LANG_HOOKS_OMP_IS_ALLOCATABLE_OR_PTR #undef LANG_HOOKS_OMP_CHECK_OPTIONAL_ARGUMENT #undef LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE @@ -152,6 +153,7 @@ static const struct attribute_spec gfc_attribute_table[] = #define LANG_HOOKS_TYPE_FOR_SIZE gfc_type_for_size #define LANG_HOOKS_INIT_TS gfc_init_ts #define LANG_HOOKS_OMP_ARRAY_DATA gfc_omp_array_data +#define LANG_HOOKS_OMP_ARRAY_SIZE gfc_omp_array_size #define LANG_HOOKS_OMP_IS_ALLOCATABLE_OR_PTR gfc_omp_is_allocatable_or_ptr #define LANG_HOOKS_OMP_CHECK_OPTIONAL_ARGUMENT gfc_omp_check_optional_argument #define LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE gfc_omp_privatize_by_reference diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc index e1907a4..bfd24f9 100644 --- a/gcc/fortran/trans-openmp.cc +++ b/gcc/fortran/trans-openmp.cc @@ -169,6 +169,48 @@ gfc_omp_array_data (tree decl, bool type_only) return decl; } +/* Return the byte-size of the passed array descriptor. */ + +tree +gfc_omp_array_size (tree decl, gimple_seq *pre_p) +{ + stmtblock_t block; + if (POINTER_TYPE_P (TREE_TYPE (decl))) + decl = build_fold_indirect_ref (decl); + tree type = TREE_TYPE (decl); + gcc_assert (GFC_DESCRIPTOR_TYPE_P (type)); + bool allocatable = (GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_ALLOCATABLE + || GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_POINTER + || GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_POINTER_CONT); + gfc_init_block (&block); + tree size = gfc_full_array_size (&block, decl, + GFC_TYPE_ARRAY_RANK (TREE_TYPE (decl))); + size = fold_convert (size_type_node, size); + tree elemsz = gfc_get_element_type (TREE_TYPE (decl)); + if (TREE_CODE (elemsz) == ARRAY_TYPE && TYPE_STRING_FLAG (elemsz)) + elemsz = gfc_conv_descriptor_elem_len (decl); + else + elemsz = TYPE_SIZE_UNIT (elemsz); + size = fold_build2 (MULT_EXPR, size_type_node, size, elemsz); + if (!allocatable) + gimplify_and_add (gfc_finish_block (&block), pre_p); + else + { + tree var = create_tmp_var (size_type_node); + gfc_add_expr_to_block (&block, build2 (MODIFY_EXPR, sizetype, var, size)); + tree tmp = fold_build2_loc (input_location, NE_EXPR, boolean_type_node, + gfc_conv_descriptor_data_get (decl), + null_pointer_node); + tmp = build3_loc (input_location, COND_EXPR, void_type_node, tmp, + gfc_finish_block (&block), + build2 (MODIFY_EXPR, sizetype, var, size_zero_node)); + gimplify_and_add (tmp, pre_p); + size = var; + } + return size; +} + + /* True if OpenMP should privatize what this DECL points to rather than the DECL itself. */ @@ -1922,16 +1964,7 @@ gfc_trans_omp_variable_list (enum omp_clause_code code, if (t != error_mark_node) { tree node; - /* For HAS_DEVICE_ADDR of an array descriptor, firstprivatize the - descriptor such that the bounds are available; its data component - is unmodified; it is handled as device address inside target. */ - if (code == OMP_CLAUSE_HAS_DEVICE_ADDR - && (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (t)) - || (POINTER_TYPE_P (TREE_TYPE (t)) - && GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (TREE_TYPE (t)))))) - node = build_omp_clause (input_location, OMP_CLAUSE_FIRSTPRIVATE); - else - node = build_omp_clause (input_location, code); + node = build_omp_clause (input_location, code); OMP_CLAUSE_DECL (node) = t; list = gfc_trans_add_clause (node, list); diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h index 623acee..03d5288 100644 --- a/gcc/fortran/trans.h +++ b/gcc/fortran/trans.h @@ -808,6 +808,7 @@ bool gfc_get_array_descr_info (const_tree, struct array_descr_info *); bool gfc_omp_is_allocatable_or_ptr (const_tree); tree gfc_omp_check_optional_argument (tree, bool); tree gfc_omp_array_data (tree, bool); +tree gfc_omp_array_size (tree, gimple_seq *); bool gfc_omp_privatize_by_reference (const_tree); enum omp_clause_default_kind gfc_omp_predetermined_sharing (tree); enum omp_clause_defaultmap_kind gfc_omp_predetermined_mapping (tree); diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index e226395..95d8dec 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -84,6 +84,7 @@ extern enum omp_clause_default_kind lhd_omp_predetermined_sharing (tree); extern enum omp_clause_defaultmap_kind lhd_omp_predetermined_mapping (tree); extern tree lhd_omp_assignment (tree, tree, tree); extern void lhd_omp_finish_clause (tree, gimple_seq *, bool); +extern tree lhd_omp_array_size (tree, gimple_seq *); struct gimplify_omp_ctx; extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *, tree); @@ -257,6 +258,7 @@ extern tree lhd_unit_size_without_reusable_padding (tree); #define LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS NULL #define LANG_HOOKS_DECL_OK_FOR_SIBCALL lhd_decl_ok_for_sibcall #define LANG_HOOKS_OMP_ARRAY_DATA hook_tree_tree_bool_null +#define LANG_HOOKS_OMP_ARRAY_SIZE lhd_omp_array_size #define LANG_HOOKS_OMP_IS_ALLOCATABLE_OR_PTR hook_bool_const_tree_false #define LANG_HOOKS_OMP_CHECK_OPTIONAL_ARGUMENT hook_tree_tree_bool_null #define LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE hook_bool_const_tree_false @@ -290,6 +292,7 @@ extern tree lhd_unit_size_without_reusable_padding (tree); LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS, \ LANG_HOOKS_DECL_OK_FOR_SIBCALL, \ LANG_HOOKS_OMP_ARRAY_DATA, \ + LANG_HOOKS_OMP_ARRAY_SIZE, \ LANG_HOOKS_OMP_IS_ALLOCATABLE_OR_PTR, \ LANG_HOOKS_OMP_CHECK_OPTIONAL_ARGUMENT, \ LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE, \ diff --git a/gcc/langhooks.cc b/gcc/langhooks.cc index df97067..97e5139 100644 --- a/gcc/langhooks.cc +++ b/gcc/langhooks.cc @@ -634,6 +634,14 @@ lhd_omp_finish_clause (tree, gimple_seq *, bool) { } +/* Return array size; cf. omp_array_data. */ + +tree +lhd_omp_array_size (tree, gimple_seq *) +{ + return NULL_TREE; +} + /* Return true if DECL is a scalar variable (for the purpose of implicit firstprivatization & mapping). Only if alloc_ptr_ok are allocatables and pointers accepted. */ diff --git a/gcc/langhooks.h b/gcc/langhooks.h index 4731f08..7502555 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -246,6 +246,11 @@ struct lang_hooks_for_decls is true, only the TREE_TYPE is returned without generating a new tree. */ tree (*omp_array_data) (tree, bool); + /* Return a tree for the actual data of an array descriptor - or NULL_TREE + if original tree is not an array descriptor. If the second argument + is true, only the TREE_TYPE is returned without generating a new tree. */ + tree (*omp_array_size) (tree, gimple_seq *pre_p); + /* True if OpenMP should regard this DECL as being a scalar which has Fortran's allocatable or pointer attribute. */ bool (*omp_is_allocatable_or_ptr) (const_tree); diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc index b037938..16f5965 100644 --- a/gcc/omp-low.cc +++ b/gcc/omp-low.cc @@ -1372,7 +1372,9 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_HAS_DEVICE_ADDR) && is_gimple_omp_offloaded (ctx->stmt)) { - if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FIRSTPRIVATE) + if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FIRSTPRIVATE + || (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_HAS_DEVICE_ADDR + && lang_hooks.decls.omp_array_data (decl, true))) { by_ref = !omp_privatize_by_reference (decl); install_var_field (decl, by_ref, 3, ctx); @@ -1424,6 +1426,15 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) install_var_field (decl, by_ref, 3, ctx); } install_var_local (decl, ctx); + /* For descr arrays on target: firstprivatize data + attach ptr. */ + if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_FIRSTPRIVATE + && is_gimple_omp_offloaded (ctx->stmt) + && !is_gimple_omp_oacc (ctx->stmt) + && lang_hooks.decls.omp_array_data (decl, true)) + { + install_var_field (decl, false, 16 | 3, ctx); + install_var_field (decl, true, 8 | 3, ctx); + } break; case OMP_CLAUSE_USE_DEVICE_PTR: @@ -12871,6 +12882,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) break; case OMP_CLAUSE_FIRSTPRIVATE: + omp_firstprivate_recv: gcc_checking_assert (offloaded); if (is_gimple_omp_oacc (ctx->stmt)) { @@ -12902,6 +12914,10 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) SET_DECL_VALUE_EXPR (new_var, x); DECL_HAS_VALUE_EXPR_P (new_var) = 1; } + /* Fortran array descriptors: firstprivate of data + attach. */ + if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_HAS_DEVICE_ADDR + && lang_hooks.decls.omp_array_data (var, true)) + map_cnt += 2; break; case OMP_CLAUSE_PRIVATE: @@ -12941,6 +12957,8 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) while (TREE_CODE (var) == INDIRECT_REF || TREE_CODE (var) == ARRAY_REF) var = TREE_OPERAND (var, 0); + if (lang_hooks.decls.omp_array_data (var, true)) + goto omp_firstprivate_recv; } map_cnt++; if (is_variable_sized (var)) @@ -13354,6 +13372,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) break; case OMP_CLAUSE_FIRSTPRIVATE: + omp_has_device_addr_descr: if (is_gimple_omp_oacc (ctx->stmt)) goto oacc_firstprivate_map; ovar = OMP_CLAUSE_DECL (c); @@ -13419,6 +13438,82 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) <= tree_to_uhwi (TYPE_MAX_VALUE (tkind_type))); CONSTRUCTOR_APPEND_ELT (vkind, purpose, build_int_cstu (tkind_type, tkind)); + /* Fortran array descriptors: firstprivate of data + attach. */ + if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_HAS_DEVICE_ADDR + && lang_hooks.decls.omp_array_data (ovar, true)) + { + tree not_null_lb, null_lb, after_lb; + tree var1, var2, size1, size2; + tree present = omp_check_optional_argument (ovar, true); + if (present) + { + location_t clause_loc = OMP_CLAUSE_LOCATION (c); + not_null_lb = create_artificial_label (clause_loc); + null_lb = create_artificial_label (clause_loc); + after_lb = create_artificial_label (clause_loc); + gimple_seq seq = NULL; + present = force_gimple_operand (present, &seq, true, + NULL_TREE); + gimple_seq_add_seq (&ilist, seq); + gimple_seq_add_stmt (&ilist, + gimple_build_cond_from_tree (present, + not_null_lb, null_lb)); + gimple_seq_add_stmt (&ilist, + gimple_build_label (not_null_lb)); + } + var1 = lang_hooks.decls.omp_array_data (var, false); + size1 = lang_hooks.decls.omp_array_size (var, &ilist); + var2 = build_fold_addr_expr (x); + if (!POINTER_TYPE_P (TREE_TYPE (var))) + var = build_fold_addr_expr (var); + size2 = fold_build2 (POINTER_DIFF_EXPR, ssizetype, + build_fold_addr_expr (var1), var); + size2 = fold_convert (sizetype, size2); + if (present) + { + tree tmp = create_tmp_var (TREE_TYPE (var1)); + gimplify_assign (tmp, var1, &ilist); + var1 = tmp; + tmp = create_tmp_var (TREE_TYPE (var2)); + gimplify_assign (tmp, var2, &ilist); + var2 = tmp; + tmp = create_tmp_var (TREE_TYPE (size1)); + gimplify_assign (tmp, size1, &ilist); + size1 = tmp; + tmp = create_tmp_var (TREE_TYPE (size2)); + gimplify_assign (tmp, size2, &ilist); + size2 = tmp; + gimple_seq_add_stmt (&ilist, gimple_build_goto (after_lb)); + gimple_seq_add_stmt (&ilist, gimple_build_label (null_lb)); + gimplify_assign (var1, null_pointer_node, &ilist); + gimplify_assign (var2, null_pointer_node, &ilist); + gimplify_assign (size1, size_zero_node, &ilist); + gimplify_assign (size2, size_zero_node, &ilist); + gimple_seq_add_stmt (&ilist, gimple_build_label (after_lb)); + } + x = build_sender_ref ((splay_tree_key) &DECL_NAME (ovar), ctx); + gimplify_assign (x, var1, &ilist); + tkind = GOMP_MAP_FIRSTPRIVATE; + talign = DECL_ALIGN_UNIT (ovar); + talign = ceil_log2 (talign); + tkind |= talign << talign_shift; + gcc_checking_assert (tkind + <= tree_to_uhwi ( + TYPE_MAX_VALUE (tkind_type))); + purpose = size_int (map_idx++); + CONSTRUCTOR_APPEND_ELT (vsize, purpose, size1); + if (TREE_CODE (size1) != INTEGER_CST) + TREE_STATIC (TREE_VEC_ELT (t, 1)) = 0; + CONSTRUCTOR_APPEND_ELT (vkind, purpose, + build_int_cstu (tkind_type, tkind)); + x = build_sender_ref ((splay_tree_key) &DECL_UID (ovar), ctx); + gimplify_assign (x, var2, &ilist); + tkind = GOMP_MAP_ATTACH; + purpose = size_int (map_idx++); + CONSTRUCTOR_APPEND_ELT (vsize, purpose, size2); + CONSTRUCTOR_APPEND_ELT (vkind, purpose, + build_int_cstu (tkind_type, tkind)); + } break; case OMP_CLAUSE_USE_DEVICE_PTR: @@ -13428,6 +13523,8 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) ovar = OMP_CLAUSE_DECL (c); if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_HAS_DEVICE_ADDR) { + if (lang_hooks.decls.omp_array_data (ovar, true)) + goto omp_has_device_addr_descr; while (TREE_CODE (ovar) == INDIRECT_REF || TREE_CODE (ovar) == ARRAY_REF) ovar = TREE_OPERAND (ovar, 0); @@ -13594,6 +13691,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) default: break; case OMP_CLAUSE_FIRSTPRIVATE: + omp_firstprivatize_data_region: if (is_gimple_omp_oacc (ctx->stmt)) break; var = OMP_CLAUSE_DECL (c); @@ -13688,6 +13786,8 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) do_optional_check = false; var = OMP_CLAUSE_DECL (c); is_array_data = lang_hooks.decls.omp_array_data (var, true) != NULL; + if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_HAS_DEVICE_ADDR && is_array_data) + goto omp_firstprivatize_data_region; if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_IS_DEVICE_PTR && OMP_CLAUSE_CODE (c) != OMP_CLAUSE_HAS_DEVICE_ADDR) -- cgit v1.1 From 68e0063397ba820e71adc220b2da0581dce29ffa Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 11 Apr 2022 13:36:53 +0200 Subject: Force the selection operand of a GIMPLE COND_EXPR to be a register This goes away with the selection operand allowed to be a GENERIC tcc_comparison tree. It keeps those for vectorizer pattern recog, those are short lived and removing this instance is a bigger task. The patch doesn't yet remove dead code and functionality, that's left for a followup. Instead the patch makes sure to produce valid GIMPLE IL and continue to optimize COND_EXPRs where the previous IL allowed and the new IL showed regressions in the testsuite. 2022-05-16 Richard Biener * gimple-expr.cc (is_gimple_condexpr): Equate to is_gimple_val. * gimplify.cc (gimplify_pure_cond_expr): Gimplify the condition as is_gimple_val. * gimple-fold.cc (valid_gimple_rhs_p): Simplify. * tree-cfg.cc (verify_gimple_assign_ternary): Likewise. * gimple-loop-interchange.cc (loop_cand::undo_simple_reduction): Build the condition of the COND_EXPR separately. * tree-ssa-loop-im.cc (move_computations_worker): Likewise. * tree-vect-generic.cc (expand_vector_condition): Likewise. * tree-vect-loop.cc (vect_create_epilog_for_reduction): Likewise. * vr-values.cc (simplify_using_ranges::simplify): Likewise. * tree-vect-patterns.cc: Add comment indicating we are building invalid COND_EXPRs and why. * omp-expand.cc (expand_omp_simd): Gimplify the condition to the COND_EXPR separately. (expand_omp_atomic_cas): Note part that should be unreachable now. * tree-ssa-forwprop.cc (forward_propagate_into_cond): Adjust condition for valid replacements. * tree-if-conv.cc (predicate_bbs): Simulate previous re-folding of the condition in folded COND_EXPRs which is necessary because of unfolded GIMPLE_CONDs in the IL as in for example gcc.dg/fold-bopcond-1.c. * gimple-range-gori.cc (gori_compute::condexpr_adjust): Handle that the comparison is now in the def stmt of the select operand. Required by gcc.dg/pr104526.c. * gcc.dg/gimplefe-27.c: Adjust. * gcc.dg/gimplefe-45.c: Likewise. * gcc.dg/pr101145-2.c: Likewise. * gcc.dg/pr98211.c: Likewise. * gcc.dg/torture/pr89595.c: Likewise. * gcc.dg/tree-ssa/divide-7.c: Likewise. * gcc.dg/tree-ssa/ssa-lim-12.c: Likewise. --- gcc/gimple-expr.cc | 2 +- gcc/gimple-fold.cc | 4 +--- gcc/gimple-loop-interchange.cc | 4 +++- gcc/gimple-range-gori.cc | 20 ++++++++++++-------- gcc/gimplify.cc | 6 +++--- gcc/omp-expand.cc | 7 ++++--- gcc/testsuite/gcc.dg/gimplefe-27.c | 4 +++- gcc/testsuite/gcc.dg/gimplefe-45.c | 4 +++- gcc/testsuite/gcc.dg/pr101145-2.c | 4 +++- gcc/testsuite/gcc.dg/pr98211.c | 8 ++++++-- gcc/testsuite/gcc.dg/torture/pr89595.c | 4 +++- gcc/testsuite/gcc.dg/tree-ssa/divide-7.c | 3 ++- gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-12.c | 2 +- gcc/tree-cfg.cc | 12 +----------- gcc/tree-if-conv.cc | 29 +++++++++++++++++++++++++---- gcc/tree-ssa-forwprop.cc | 2 +- gcc/tree-ssa-loop-im.cc | 7 +++++-- gcc/tree-vect-generic.cc | 6 +++--- gcc/tree-vect-loop.cc | 27 ++++++++++++++------------- gcc/tree-vect-patterns.cc | 6 ++++++ gcc/vr-values.cc | 5 ++++- 21 files changed, 104 insertions(+), 62 deletions(-) (limited to 'gcc') diff --git a/gcc/gimple-expr.cc b/gcc/gimple-expr.cc index 5d10c24..09eac80 100644 --- a/gcc/gimple-expr.cc +++ b/gcc/gimple-expr.cc @@ -622,7 +622,7 @@ is_gimple_condexpr (tree t) { /* Always split out _Complex type compares since complex lowering doesn't handle this case. */ - return is_gimple_condexpr_1 (t, true, false); + return is_gimple_val (t); } /* Like is_gimple_condexpr, but does not allow T to trap. */ diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc index 8555a2b..f61bc87 100644 --- a/gcc/gimple-fold.cc +++ b/gcc/gimple-fold.cc @@ -418,9 +418,7 @@ valid_gimple_rhs_p (tree expr) default: if (get_gimple_rhs_class (code) == GIMPLE_TERNARY_RHS) { - if ((code == COND_EXPR - ? !is_gimple_condexpr (TREE_OPERAND (expr, 0)) - : !is_gimple_val (TREE_OPERAND (expr, 0))) + if (!is_gimple_val (TREE_OPERAND (expr, 0)) || !is_gimple_val (TREE_OPERAND (expr, 1)) || !is_gimple_val (TREE_OPERAND (expr, 2))) return false; diff --git a/gcc/gimple-loop-interchange.cc b/gcc/gimple-loop-interchange.cc index 53adc02..d5d690b 100644 --- a/gcc/gimple-loop-interchange.cc +++ b/gcc/gimple-loop-interchange.cc @@ -897,7 +897,9 @@ loop_cand::undo_simple_reduction (reduction_p re, bitmap dce_seeds) /* Init new_var to MEM_REF or CONST depending on if it is the first iteration. */ induction_p iv = m_inductions[0]; - cond = fold_build2 (NE_EXPR, boolean_type_node, iv->var, iv->init_val); + cond = make_ssa_name (boolean_type_node); + stmt = gimple_build_assign (cond, NE_EXPR, iv->var, iv->init_val); + gimple_seq_add_stmt_without_update (&stmts, stmt); new_var = copy_ssa_name (re->var); stmt = gimple_build_assign (new_var, COND_EXPR, cond, tmp, re->init); gimple_seq_add_stmt_without_update (&stmts, stmt); diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc index 772ccb8..3e15eb5 100644 --- a/gcc/gimple-range-gori.cc +++ b/gcc/gimple-range-gori.cc @@ -1319,17 +1319,21 @@ gori_compute::condexpr_adjust (irange &r1, irange &r2, gimple *, tree cond, tree ssa2 = gimple_range_ssa_p (op2); if (!ssa1 && !ssa2) return false; - if (!COMPARISON_CLASS_P (cond)) + if (TREE_CODE (cond) != SSA_NAME) return false; - tree type = TREE_TYPE (TREE_OPERAND (cond, 0)); - if (!range_compatible_p (type, TREE_TYPE (TREE_OPERAND (cond, 1)))) + gassign *cond_def = dyn_cast (SSA_NAME_DEF_STMT (cond)); + if (!cond_def + || TREE_CODE_CLASS (gimple_assign_rhs_code (cond_def)) != tcc_comparison) return false; - range_operator *hand = range_op_handler (TREE_CODE (cond), type); + tree type = TREE_TYPE (gimple_assign_rhs1 (cond_def)); + if (!range_compatible_p (type, TREE_TYPE (gimple_assign_rhs2 (cond_def)))) + return false; + range_operator *hand = range_op_handler (gimple_assign_rhs_code (cond_def), type); if (!hand) return false; - tree c1 = gimple_range_ssa_p (TREE_OPERAND (cond, 0)); - tree c2 = gimple_range_ssa_p (TREE_OPERAND (cond, 1)); + tree c1 = gimple_range_ssa_p (gimple_assign_rhs1 (cond_def)); + tree c2 = gimple_range_ssa_p (gimple_assign_rhs2 (cond_def)); // Only solve if there is one SSA name in the condition. if ((!c1 && !c2) || (c1 && c2)) @@ -1337,8 +1341,8 @@ gori_compute::condexpr_adjust (irange &r1, irange &r2, gimple *, tree cond, // Pick up the current values of each part of the condition. int_range_max cl, cr; - src.get_operand (cl, TREE_OPERAND (cond, 0)); - src.get_operand (cr, TREE_OPERAND (cond, 1)); + src.get_operand (cl, gimple_assign_rhs1 (cond_def)); + src.get_operand (cr, gimple_assign_rhs2 (cond_def)); tree cond_name = c1 ? c1 : c2; gimple *def_stmt = SSA_NAME_DEF_STMT (cond_name); diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc index 260993b..2b92b63 100644 --- a/gcc/gimplify.cc +++ b/gcc/gimplify.cc @@ -4257,14 +4257,14 @@ gimplify_pure_cond_expr (tree *expr_p, gimple_seq *pre_p) TREE_SET_CODE (cond, TRUTH_AND_EXPR); else if (code == TRUTH_ORIF_EXPR) TREE_SET_CODE (cond, TRUTH_OR_EXPR); - ret = gimplify_expr (&cond, pre_p, NULL, is_gimple_condexpr, fb_rvalue); + ret = gimplify_expr (&cond, pre_p, NULL, is_gimple_val, fb_rvalue); COND_EXPR_COND (*expr_p) = cond; tret = gimplify_expr (&COND_EXPR_THEN (expr), pre_p, NULL, - is_gimple_val, fb_rvalue); + is_gimple_val, fb_rvalue); ret = MIN (ret, tret); tret = gimplify_expr (&COND_EXPR_ELSE (expr), pre_p, NULL, - is_gimple_val, fb_rvalue); + is_gimple_val, fb_rvalue); return MIN (ret, tret); } diff --git a/gcc/omp-expand.cc b/gcc/omp-expand.cc index 9fcc67a..5729a20 100644 --- a/gcc/omp-expand.cc +++ b/gcc/omp-expand.cc @@ -6613,9 +6613,9 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd) altn2 = create_tmp_var (TREE_TYPE (altv)); expand_omp_build_assign (&gsi, altn2, t); tree t2 = fold_convert (TREE_TYPE (fd->loop.v), n2); + t2 = fold_build2 (fd->loop.cond_code, boolean_type_node, fd->loop.v, t2); t2 = force_gimple_operand_gsi (&gsi, t2, true, NULL_TREE, true, GSI_SAME_STMT); - t2 = fold_build2 (fd->loop.cond_code, boolean_type_node, fd->loop.v, t2); gassign *g = gimple_build_assign (altn2, COND_EXPR, t2, altn2, build_zero_cst (TREE_TYPE (altv))); gsi_insert_before (&gsi, g, GSI_SAME_STMT); @@ -6989,10 +6989,10 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd) tree t2 = fold_convert (TREE_TYPE (fd->loops[i + 1].v), fd->loops[i + 1].m2 ? n2v : fd->loops[i + 1].n2); - t2 = force_gimple_operand_gsi (&gsi, t2, true, NULL_TREE, - true, GSI_SAME_STMT); t2 = fold_build2 (fd->loops[i + 1].cond_code, boolean_type_node, fd->loops[i + 1].v, t2); + t2 = force_gimple_operand_gsi (&gsi, t2, true, NULL_TREE, + true, GSI_SAME_STMT); gassign *g = gimple_build_assign (altn2, COND_EXPR, t2, altn2, build_zero_cst (TREE_TYPE (altv))); @@ -8978,6 +8978,7 @@ expand_omp_atomic_cas (basic_block load_bb, tree addr, tree cond_op1, cond_op2; if (cond_stmt) { + /* We should now always get a separate cond_stmt. */ if (!operand_equal_p (cond, gimple_assign_lhs (cond_stmt))) return false; cond_op1 = gimple_assign_rhs1 (cond_stmt); diff --git a/gcc/testsuite/gcc.dg/gimplefe-27.c b/gcc/testsuite/gcc.dg/gimplefe-27.c index 604a2cc..0053222 100644 --- a/gcc/testsuite/gcc.dg/gimplefe-27.c +++ b/gcc/testsuite/gcc.dg/gimplefe-27.c @@ -4,6 +4,8 @@ int __GIMPLE () p (int n) { int _2; - _2 = n_1(D) != 0 ? 2 : 0; + _Bool _3; + _3 = n_1(D) != 0; + _2 = _3 ? 2 : 0; return _2; } diff --git a/gcc/testsuite/gcc.dg/gimplefe-45.c b/gcc/testsuite/gcc.dg/gimplefe-45.c index b1d3cbb..8e1447f 100644 --- a/gcc/testsuite/gcc.dg/gimplefe-45.c +++ b/gcc/testsuite/gcc.dg/gimplefe-45.c @@ -10,10 +10,12 @@ p (int n) int *_2; int *_t; int *_t1; + _Bool _3; _t = (int*)8; _t1 = 0; n = n & 2; - _2 = n != 0 ? _t : _t1; + _3 = n != 0; + _2 = _3 ? _t : _t1; return _2; } diff --git a/gcc/testsuite/gcc.dg/pr101145-2.c b/gcc/testsuite/gcc.dg/pr101145-2.c index 6ecfeb2..dad192c 100644 --- a/gcc/testsuite/gcc.dg/pr101145-2.c +++ b/gcc/testsuite/gcc.dg/pr101145-2.c @@ -12,4 +12,6 @@ unsigned foo(unsigned val, unsigned start) return cnt; } -/* { dg-final { scan-tree-dump "cnt_\[0-9\] = start_\[0-9\]\\(D\\) >= val_\[0-9\]\\(D\\) \\? _\[0-9\] : 1;" "optimized" } } */ +/* Look for start >= val ? -start : 1 */ +/* { dg-final { scan-tree-dump " = start_\[0-9\]\\(D\\) >= val_\[0-9\]\\(D\\);" "optimized" } } */ +/* { dg-final { scan-tree-dump "cnt_\[0-9\] = _\[0-9\]+ \\? _\[0-9\]+ : 1;" "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/pr98211.c b/gcc/testsuite/gcc.dg/pr98211.c index cea371d..8f14c8f 100644 --- a/gcc/testsuite/gcc.dg/pr98211.c +++ b/gcc/testsuite/gcc.dg/pr98211.c @@ -13,15 +13,19 @@ test (int var_1, short int a, short int b, short int c, short int d) _Bool _28; short int _30; short int _32; + _Bool _29; + _Bool _31; __BB(2): _24 = test_var_3; tem_25 = _24 != 0; tem2_26 = var_1_11(D) != 0; _28 = tem_25 | tem2_26; - _30 = _28 != _Literal (_Bool) 0 ? a_16(D) : b_15(D); + _29 = _28 != _Literal (_Bool) 0; + _30 = _29 ? a_16(D) : b_15(D); arr_20[0u] = _30; - _32 = _28 != _Literal (_Bool) 0 ? c_19(D) : d_18(D); + _31 = _28 != _Literal (_Bool) 0; + _32 = _31 ? c_19(D) : d_18(D); arr_20[8u] = _32; arr_20[1u] = _30; arr_20[9u] = _32; diff --git a/gcc/testsuite/gcc.dg/torture/pr89595.c b/gcc/testsuite/gcc.dg/torture/pr89595.c index f45dc98..3a4bed9 100644 --- a/gcc/testsuite/gcc.dg/torture/pr89595.c +++ b/gcc/testsuite/gcc.dg/torture/pr89595.c @@ -5,6 +5,7 @@ int __attribute__((noipa)) __GIMPLE(ssa,startwith("dom")) bar(int cond, int val) { int i; + _Bool _7; __BB(3): if (0 != 0) @@ -20,7 +21,8 @@ __BB(2): __BB(4): i_6 = val_2(D); - i_1 = val_2(D) > 0 ? i_6 : 0; + _7 = val_2(D) > 0; + i_1 = _7 ? i_6 : 0; goto __BB5; __BB(5): diff --git a/gcc/testsuite/gcc.dg/tree-ssa/divide-7.c b/gcc/testsuite/gcc.dg/tree-ssa/divide-7.c index c605515..c577ea3 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/divide-7.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/divide-7.c @@ -6,4 +6,5 @@ int f(int x) { } /* { dg-final { scan-tree-dump-not "1 / x_\[0-9]\+\\\(D\\\);" "optimized" } } */ -/* { dg-final { scan-tree-dump " <= 2 \\? x_\[0-9]\+\\\(D\\\) : 0;" "optimized" } } */ +/* { dg-final { scan-tree-dump " <= 2;" "optimized" } } */ +/* { dg-final { scan-tree-dump " \\? x_\[0-9]\+\\\(D\\\) : 0;" "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-12.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-12.c index 016ff22..c483951 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-12.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-12.c @@ -23,4 +23,4 @@ void bar (int x, int z) } } -/* { dg-final { scan-tree-dump-times "!= 0 ? " 2 "lim2" } } */ +/* { dg-final { scan-tree-dump-times " = _\[0-9\]+ ? " 2 "lim2" } } */ diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc index 19ba09f..0a962dd 100644 --- a/gcc/tree-cfg.cc +++ b/gcc/tree-cfg.cc @@ -4240,8 +4240,7 @@ verify_gimple_assign_ternary (gassign *stmt) return true; } - if ((rhs_code == COND_EXPR - ? !is_gimple_condexpr (rhs1) : !is_gimple_val (rhs1)) + if (!is_gimple_val (rhs1) || !is_gimple_val (rhs2) || !is_gimple_val (rhs3)) { @@ -4284,17 +4283,8 @@ verify_gimple_assign_ternary (gassign *stmt) debug_generic_expr (rhs1_type); return true; } - if (!is_gimple_val (rhs1)) - return true; /* Fallthrough. */ case COND_EXPR: - if (!is_gimple_val (rhs1) - && (!is_gimple_condexpr (rhs1) - || verify_gimple_comparison (TREE_TYPE (rhs1), - TREE_OPERAND (rhs1, 0), - TREE_OPERAND (rhs1, 1), - TREE_CODE (rhs1)))) - return true; if (!useless_type_conversion_p (lhs_type, rhs2_type) || !useless_type_conversion_p (lhs_type, rhs3_type)) { diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc index 4531ca5..5b884aa 100644 --- a/gcc/tree-if-conv.cc +++ b/gcc/tree-if-conv.cc @@ -1298,10 +1298,31 @@ predicate_bbs (loop_p loop) tree c2; edge true_edge, false_edge; location_t loc = gimple_location (stmt); - tree c = build2_loc (loc, gimple_cond_code (stmt), - boolean_type_node, - gimple_cond_lhs (stmt), - gimple_cond_rhs (stmt)); + tree c; + /* gcc.dg/fold-bopcond-1.c shows that despite all forwprop passes + conditions can remain unfolded because of multiple uses so + try to re-fold here, especially to get precision changing + conversions sorted out. Do not simply fold the stmt since + this is analysis only. When conditions were embedded in + COND_EXPRs those were folded separately before folding the + COND_EXPR but as they are now outside we have to make sure + to fold them. Do it here - another opportunity would be to + fold predicates as they are inserted. */ + gimple_match_op cexpr (gimple_match_cond::UNCOND, + gimple_cond_code (stmt), + boolean_type_node, + gimple_cond_lhs (stmt), + gimple_cond_rhs (stmt)); + if (cexpr.resimplify (NULL, follow_all_ssa_edges) + && cexpr.code.is_tree_code () + && TREE_CODE_CLASS ((tree_code)cexpr.code) == tcc_comparison) + c = build2_loc (loc, (tree_code)cexpr.code, boolean_type_node, + cexpr.ops[0], cexpr.ops[1]); + else + c = build2_loc (loc, gimple_cond_code (stmt), + boolean_type_node, + gimple_cond_lhs (stmt), + gimple_cond_rhs (stmt)); /* Add new condition into destination's predicate list. */ extract_true_false_edges_from_block (gimple_bb (stmt), diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc index 0917202..b582529 100644 --- a/gcc/tree-ssa-forwprop.cc +++ b/gcc/tree-ssa-forwprop.cc @@ -610,7 +610,7 @@ forward_propagate_into_cond (gimple_stmt_iterator *gsi_p) } if (tmp - && is_gimple_condexpr (tmp)) + && is_gimple_val (tmp)) { if (dump_file) { diff --git a/gcc/tree-ssa-loop-im.cc b/gcc/tree-ssa-loop-im.cc index 6d9316e..bfd6126 100644 --- a/gcc/tree-ssa-loop-im.cc +++ b/gcc/tree-ssa-loop-im.cc @@ -1241,8 +1241,11 @@ move_computations_worker (basic_block bb) edges of COND. */ extract_true_false_args_from_phi (dom, stmt, &arg0, &arg1); gcc_assert (arg0 && arg1); - t = build2 (gimple_cond_code (cond), boolean_type_node, - gimple_cond_lhs (cond), gimple_cond_rhs (cond)); + t = make_ssa_name (boolean_type_node); + new_stmt = gimple_build_assign (t, gimple_cond_code (cond), + gimple_cond_lhs (cond), + gimple_cond_rhs (cond)); + gsi_insert_on_edge (loop_preheader_edge (level), new_stmt); new_stmt = gimple_build_assign (gimple_phi_result (stmt), COND_EXPR, t, arg0, arg1); todo |= TODO_cleanup_cfg; diff --git a/gcc/tree-vect-generic.cc b/gcc/tree-vect-generic.cc index d99e320..f7de64c 100644 --- a/gcc/tree-vect-generic.cc +++ b/gcc/tree-vect-generic.cc @@ -1131,15 +1131,15 @@ expand_vector_condition (gimple_stmt_iterator *gsi, bitmap dce_ssa_names) comp_width, comp_index); tree aa2 = tree_vec_extract (gsi, comp_inner_type, a2, comp_width, comp_index); - aa = build2 (code, cond_type, aa1, aa2); + aa = gimplify_build2 (gsi, code, cond_type, aa1, aa2); } else if (a_is_scalar_bitmask) { wide_int w = wi::set_bit_in_zero (i, TYPE_PRECISION (TREE_TYPE (a))); result = gimplify_build2 (gsi, BIT_AND_EXPR, TREE_TYPE (a), a, wide_int_to_tree (TREE_TYPE (a), w)); - aa = build2 (NE_EXPR, boolean_type_node, result, - build_zero_cst (TREE_TYPE (a))); + aa = gimplify_build2 (gsi, NE_EXPR, boolean_type_node, result, + build_zero_cst (TREE_TYPE (a))); } else aa = tree_vec_extract (gsi, cond_type, a, comp_width, comp_index); diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index ab7dade..f204b72 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -5697,14 +5697,13 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo, old_idx_val); gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT); } + tree cond = make_ssa_name (boolean_type_node); + epilog_stmt = gimple_build_assign (cond, GT_EXPR, + idx_val, old_idx_val); + gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT); tree new_val = make_ssa_name (data_eltype); - epilog_stmt = gimple_build_assign (new_val, - COND_EXPR, - build2 (GT_EXPR, - boolean_type_node, - idx_val, - old_idx_val), - val, old_val); + epilog_stmt = gimple_build_assign (new_val, COND_EXPR, + cond, val, old_val); gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT); idx_val = new_idx_val; val = new_val; @@ -5747,10 +5746,11 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo, values. Check the result and if it is induc_val then replace with the original initial value, unless induc_val is the same as initial_def already. */ - tree zcompare = build2 (EQ_EXPR, boolean_type_node, new_temp, - induc_val); + tree zcompare = make_ssa_name (boolean_type_node); + epilog_stmt = gimple_build_assign (zcompare, EQ_EXPR, + new_temp, induc_val); + gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT); tree initial_def = reduc_info->reduc_initial_values[0]; - tmp = make_ssa_name (new_scalar_dest); epilog_stmt = gimple_build_assign (tmp, COND_EXPR, zcompare, initial_def, new_temp); @@ -6039,10 +6039,11 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo, values. Check the result and if it is induc_val then replace with the original initial value, unless induc_val is the same as initial_def already. */ - tree zcompare = build2 (EQ_EXPR, boolean_type_node, new_temp, - induc_val); + tree zcompare = make_ssa_name (boolean_type_node); + epilog_stmt = gimple_build_assign (zcompare, EQ_EXPR, new_temp, + induc_val); + gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT); tree initial_def = reduc_info->reduc_initial_values[0]; - tree tmp = make_ssa_name (new_scalar_dest); epilog_stmt = gimple_build_assign (tmp, COND_EXPR, zcompare, initial_def, new_temp); diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc index 8c61eb9..ac49c1a 100644 --- a/gcc/tree-vect-patterns.cc +++ b/gcc/tree-vect-patterns.cc @@ -50,6 +50,12 @@ along with GCC; see the file COPYING3. If not see #include "vec-perm-indices.h" #include "gimple-range.h" + +/* TODO: Note the vectorizer still builds COND_EXPRs with GENERIC compares + in the first operand. Disentangling this is future work, the + IL is properly transfered to VEC_COND_EXPRs with separate compares. */ + + /* Return true if we have a useful VR_RANGE range for VAR, storing it in *MIN_VALUE and *MAX_VALUE if so. Note the range in the dump files. */ diff --git a/gcc/vr-values.cc b/gcc/vr-values.cc index 2cc5084..47faa4f 100644 --- a/gcc/vr-values.cc +++ b/gcc/vr-values.cc @@ -4292,7 +4292,10 @@ simplify_using_ranges::simplify (gimple_stmt_iterator *gsi) in divide by zero, new_rhs1 / new_rhs will be NULL_TREE. */ if (new_rhs1 && new_rhs2) { - tree cond = build2 (EQ_EXPR, boolean_type_node, cmp_var, val1); + tree cond = gimple_build (gsi, true, GSI_SAME_STMT, + UNKNOWN_LOCATION, + EQ_EXPR, boolean_type_node, + cmp_var, val1); gimple_assign_set_rhs_with_ops (gsi, COND_EXPR, cond, new_rhs1, -- cgit v1.1 From 19dd439389be2c5eb6b986d164760e061ba01938 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 12 May 2022 15:26:22 +0200 Subject: Remove is_gimple_condexpr This removes is_gimple_condexpr, note the vectorizer via patterns still creates COND_EXPRs with embedded GENERIC conditions and has a reference to the function in comments. Otherwise is_gimple_condexpr is now equal to is_gimple_val. 2022-05-16 Richard Biener * gimple-expr.cc (is_gimple_condexpr): Remove. * gimple-expr.h (is_gimple_condexpr): Likewise. * gimplify.cc (gimplify_expr): Remove is_gimple_condexpr usage. * tree-if-conv.cc (set_bb_predicate): Likewie. (add_to_predicate_list): Likewise. (gen_phi_arg_condition): Likewise. (predicate_scalar_phi): Likewise. (predicate_statements): Likewise. --- gcc/gimple-expr.cc | 11 ----------- gcc/gimple-expr.h | 1 - gcc/gimplify.cc | 1 - gcc/tree-if-conv.cc | 33 ++++++++++++++------------------- 4 files changed, 14 insertions(+), 32 deletions(-) (limited to 'gcc') diff --git a/gcc/gimple-expr.cc b/gcc/gimple-expr.cc index 09eac80..c9c7285 100644 --- a/gcc/gimple-expr.cc +++ b/gcc/gimple-expr.cc @@ -614,17 +614,6 @@ is_gimple_condexpr_1 (tree t, bool allow_traps, bool allow_cplx) && is_gimple_val (TREE_OPERAND (t, 1)))); } -/* Return true if T is a condition operand in a GIMPLE assignment - with a COND_EXPR RHS. */ - -bool -is_gimple_condexpr (tree t) -{ - /* Always split out _Complex type compares since complex lowering - doesn't handle this case. */ - return is_gimple_val (t); -} - /* Like is_gimple_condexpr, but does not allow T to trap. */ bool diff --git a/gcc/gimple-expr.h b/gcc/gimple-expr.h index ba53b80..0c3ac09 100644 --- a/gcc/gimple-expr.h +++ b/gcc/gimple-expr.h @@ -40,7 +40,6 @@ extern void extract_ops_from_tree (tree, enum tree_code *, tree *, tree *, extern void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *); extern bool is_gimple_lvalue (tree); -extern bool is_gimple_condexpr (tree); extern bool is_gimple_condexpr_for_cond (tree); extern bool is_gimple_address (const_tree); extern bool is_gimple_invariant_address (const_tree); diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc index 2b92b63..98f5544 100644 --- a/gcc/gimplify.cc +++ b/gcc/gimplify.cc @@ -15023,7 +15023,6 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, gcc_assert (fallback & (fb_rvalue | fb_lvalue)); else if (gimple_test_f == is_gimple_val || gimple_test_f == is_gimple_call_addr - || gimple_test_f == is_gimple_condexpr || gimple_test_f == is_gimple_condexpr_for_cond || gimple_test_f == is_gimple_mem_rhs || gimple_test_f == is_gimple_mem_rhs_or_call diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc index 5b884aa..2245b6b 100644 --- a/gcc/tree-if-conv.cc +++ b/gcc/tree-if-conv.cc @@ -244,8 +244,8 @@ static inline void set_bb_predicate (basic_block bb, tree cond) { gcc_assert ((TREE_CODE (cond) == TRUTH_NOT_EXPR - && is_gimple_condexpr (TREE_OPERAND (cond, 0))) - || is_gimple_condexpr (cond)); + && is_gimple_val (TREE_OPERAND (cond, 0))) + || is_gimple_val (cond)); ((struct bb_predicate *) bb->aux)->predicate = cond; } @@ -544,10 +544,10 @@ add_to_predicate_list (class loop *loop, basic_block bb, tree nc) tp = &TREE_OPERAND (bc, 0); else tp = &bc; - if (!is_gimple_condexpr (*tp)) + if (!is_gimple_val (*tp)) { gimple_seq stmts; - *tp = force_gimple_operand_1 (*tp, &stmts, is_gimple_condexpr, NULL_TREE); + *tp = force_gimple_operand (*tp, &stmts, true, NULL_TREE); add_bb_predicate_gimplified_stmts (bb, stmts); } set_bb_predicate (bb, bc); @@ -1884,16 +1884,14 @@ gen_phi_arg_condition (gphi *phi, vec *occur, cond = c; break; } - c = force_gimple_operand_gsi_1 (gsi, unshare_expr (c), - is_gimple_condexpr, NULL_TREE, - true, GSI_SAME_STMT); + c = force_gimple_operand_gsi (gsi, unshare_expr (c), + true, NULL_TREE, true, GSI_SAME_STMT); if (cond != NULL_TREE) { /* Must build OR expression. */ cond = fold_or_predicates (EXPR_LOCATION (c), c, cond); - cond = force_gimple_operand_gsi_1 (gsi, unshare_expr (cond), - is_gimple_condexpr, NULL_TREE, - true, GSI_SAME_STMT); + cond = force_gimple_operand_gsi (gsi, unshare_expr (cond), true, + NULL_TREE, true, GSI_SAME_STMT); } else cond = c; @@ -1973,9 +1971,8 @@ predicate_scalar_phi (gphi *phi, gimple_stmt_iterator *gsi) else cond = bb_predicate (first_edge->src); /* Gimplify the condition to a valid cond-expr conditonal operand. */ - cond = force_gimple_operand_gsi_1 (gsi, unshare_expr (cond), - is_gimple_condexpr, NULL_TREE, - true, GSI_SAME_STMT); + cond = force_gimple_operand_gsi (gsi, unshare_expr (cond), true, + NULL_TREE, true, GSI_SAME_STMT); true_bb = first_edge->src; if (EDGE_PRED (bb, 1)->src == true_bb) { @@ -2074,9 +2071,8 @@ predicate_scalar_phi (gphi *phi, gimple_stmt_iterator *gsi) cond = TREE_OPERAND (cond, 0); } /* Gimplify the condition to a valid cond-expr conditonal operand. */ - cond = force_gimple_operand_gsi_1 (gsi, unshare_expr (cond), - is_gimple_condexpr, NULL_TREE, - true, GSI_SAME_STMT); + cond = force_gimple_operand_gsi (gsi, unshare_expr (cond), true, + NULL_TREE, true, GSI_SAME_STMT); if (!(is_cond_scalar_reduction (phi, &reduc, arg0 , arg1, &op0, &op1, true, &has_nop, &nop_reduc))) rhs = fold_build_cond_expr (TREE_TYPE (res), unshare_expr (cond), @@ -2612,9 +2608,8 @@ predicate_statements (loop_p loop) rhs = ifc_temp_var (type, unshare_expr (rhs), &gsi); if (swap) std::swap (lhs, rhs); - cond = force_gimple_operand_gsi_1 (&gsi, unshare_expr (cond), - is_gimple_condexpr, NULL_TREE, - true, GSI_SAME_STMT); + cond = force_gimple_operand_gsi (&gsi, unshare_expr (cond), true, + NULL_TREE, true, GSI_SAME_STMT); rhs = fold_build_cond_expr (type, unshare_expr (cond), rhs, lhs); gimple_assign_set_rhs1 (stmt, ifc_temp_var (type, rhs, &gsi)); update_stmt (stmt); -- cgit v1.1 From 0236ea984c0d08f282ad03b1c36acad014e5ba4d Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 17 May 2022 09:05:00 +0200 Subject: Remove forward_propagate_into_cond This is a first cleanup opportunity from the COND_EXPR gimplification which allows us to remove now redundant forward_propagate_into_cond. 2022-05-23 Richard Biener * tree-ssa-forwprop.cc (forward_propagate_into_cond): Remove. (pass_forwprop::execute): Do not propagate into COND_EXPR conditions. --- gcc/tree-ssa-forwprop.cc | 79 ++---------------------------------------------- 1 file changed, 2 insertions(+), 77 deletions(-) (limited to 'gcc') diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc index b582529..d698a48 100644 --- a/gcc/tree-ssa-forwprop.cc +++ b/gcc/tree-ssa-forwprop.cc @@ -511,9 +511,7 @@ forward_propagate_into_comparison (gimple_stmt_iterator *gsi) /* Propagate from the ssa name definition statements of COND_EXPR in GIMPLE_COND statement STMT into the conditional if that simplifies it. Returns zero if no statement was changed, one if there were - changes and two if cfg_cleanup needs to run. - - This must be kept in sync with forward_propagate_into_cond. */ + changes and two if cfg_cleanup needs to run. */ static int forward_propagate_into_gimple_cond (gcond *stmt) @@ -573,70 +571,6 @@ forward_propagate_into_gimple_cond (gcond *stmt) return 0; } - -/* Propagate from the ssa name definition statements of COND_EXPR - in the rhs of statement STMT into the conditional if that simplifies it. - Returns true zero if the stmt was changed. */ - -static bool -forward_propagate_into_cond (gimple_stmt_iterator *gsi_p) -{ - gimple *stmt = gsi_stmt (*gsi_p); - tree tmp = NULL_TREE; - tree cond = gimple_assign_rhs1 (stmt); - enum tree_code code = gimple_assign_rhs_code (stmt); - - /* We can do tree combining on SSA_NAME and comparison expressions. */ - if (COMPARISON_CLASS_P (cond)) - tmp = forward_propagate_into_comparison_1 (stmt, TREE_CODE (cond), - TREE_TYPE (cond), - TREE_OPERAND (cond, 0), - TREE_OPERAND (cond, 1)); - else if (TREE_CODE (cond) == SSA_NAME) - { - enum tree_code def_code; - tree name = cond; - gimple *def_stmt = get_prop_source_stmt (name, true, NULL); - if (!def_stmt || !can_propagate_from (def_stmt)) - return 0; - - def_code = gimple_assign_rhs_code (def_stmt); - if (TREE_CODE_CLASS (def_code) == tcc_comparison) - tmp = fold_build2_loc (gimple_location (def_stmt), - def_code, - TREE_TYPE (cond), - gimple_assign_rhs1 (def_stmt), - gimple_assign_rhs2 (def_stmt)); - } - - if (tmp - && is_gimple_val (tmp)) - { - if (dump_file) - { - fprintf (dump_file, " Replaced '"); - print_generic_expr (dump_file, cond); - fprintf (dump_file, "' with '"); - print_generic_expr (dump_file, tmp); - fprintf (dump_file, "'\n"); - } - - if ((code == VEC_COND_EXPR) ? integer_all_onesp (tmp) - : integer_onep (tmp)) - gimple_assign_set_rhs_from_tree (gsi_p, gimple_assign_rhs2 (stmt)); - else if (integer_zerop (tmp)) - gimple_assign_set_rhs_from_tree (gsi_p, gimple_assign_rhs3 (stmt)); - else - gimple_assign_set_rhs1 (stmt, unshare_expr (tmp)); - stmt = gsi_stmt (*gsi_p); - update_stmt (stmt); - - return true; - } - - return 0; -} - /* We've just substituted an ADDR_EXPR into stmt. Update all the relevant data structures to match. */ @@ -3720,16 +3654,7 @@ pass_forwprop::execute (function *fun) tree rhs1 = gimple_assign_rhs1 (stmt); enum tree_code code = gimple_assign_rhs_code (stmt); - if (code == COND_EXPR) - { - /* In this case the entire COND_EXPR is in rhs1. */ - if (forward_propagate_into_cond (&gsi)) - { - changed = true; - stmt = gsi_stmt (gsi); - } - } - else if (TREE_CODE_CLASS (code) == tcc_comparison) + if (TREE_CODE_CLASS (code) == tcc_comparison) { int did_something; did_something = forward_propagate_into_comparison (&gsi); -- cgit v1.1 From 63798f67dcc848dcd110ce222b97304565c9ea29 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 23 May 2022 13:54:53 +0200 Subject: tilepro: fix missing ARRAY_SIZE macro gcc/ChangeLog: * config/tilepro/gen-mul-tables.cc (ARRAY_SIZE): Add new macro. --- gcc/config/tilepro/gen-mul-tables.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc') diff --git a/gcc/config/tilepro/gen-mul-tables.cc b/gcc/config/tilepro/gen-mul-tables.cc index 798766a..5218398 100644 --- a/gcc/config/tilepro/gen-mul-tables.cc +++ b/gcc/config/tilepro/gen-mul-tables.cc @@ -90,6 +90,8 @@ typedef long long MUL_TYPE; #define MIN(x, y) ((x) <= (y) ? (x) : (y)) #define MAX(x, y) ((x) >= (y) ? (x) : (y)) +#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) + /* For this program a unary op is one which has only one nonconstant operand. So shift left by 5 is considered unary. */ typedef MUL_TYPE (*unary_op_func) (MUL_TYPE); -- cgit v1.1 From e6c04ac9fd9c7b5538a6f5f45e5f9dc22954764b Mon Sep 17 00:00:00 2001 From: Dimitar Dimitrov Date: Sun, 3 Apr 2022 13:41:04 +0300 Subject: testsuite: mallign: Handle word size of 1 byte This patch fixes a spurious warning for the pru-unknown-elf target: gcc/testsuite/gcc.dg/mallign.c:12:27: warning: ignoring return value of 'malloc' declared with attribute 'warn_unused_result' [-Wunused-result] For 8-bit targets the resulting mask ignores all bits in the value returned by malloc. Fix by first checking the target word size. gcc/testsuite/ChangeLog: * gcc.dg/mallign.c: Skip check if sizeof(word)==1. Signed-off-by: Dimitar Dimitrov --- gcc/testsuite/gcc.dg/mallign.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/testsuite/gcc.dg/mallign.c b/gcc/testsuite/gcc.dg/mallign.c index 349cdaa..9a18a00 100644 --- a/gcc/testsuite/gcc.dg/mallign.c +++ b/gcc/testsuite/gcc.dg/mallign.c @@ -9,7 +9,7 @@ typedef int word __attribute__((mode(word))); int main() { - if ((__UINTPTR_TYPE__)malloc (1) & (sizeof(word)-1)) + if ((sizeof(word)>1) && ((__UINTPTR_TYPE__)malloc (1) & (sizeof(word)-1))) abort (); return 0; } -- cgit v1.1 From a239aff82c3771242d957c0f744cf62b42ed2f2a Mon Sep 17 00:00:00 2001 From: Mayshao Date: Mon, 23 May 2022 17:05:31 +0200 Subject: [x86_64]: Zhaoxin lujiazui enablement This patch fix Zhaoxin CPU vendor ID detection problem and add zhaoxin "lujiazui" processor support. Currently gcc can't recognize Zhaoxin CPU (vendor ID "CentaurHauls" and "Shanghai") if user use -march=native option, which is confusing for users. This patch enables -march=native in zhaoxin family 7th processor and -march/-mtune=lujiazui, costs and tunning are set according to the characteristics of the processor. We add a new md file to describe lujiazui pipeline. Testing: Bootstrap is ok, and no regressions for i386/x86-64 testsuite. Background: Related Zhaoxin linux kernel patch can be found at: https://lore.kernel.org/lkml/01042674b2f741b2aed1f797359bdffb@zhaoxin.com/ Related Zhaoxin glibc patch can be found at: https://sourceware.org/git/?p=glibc.git;a=commit;h=32ac0b988466785d6e3cc1dffc364bb26fc63193 gcc/ChangeLog: * common/config/i386/cpuinfo.h (get_zhaoxin_cpu): Detect the specific type of Zhaoxin CPU, and return Zhaoxin CPU name. (cpu_indicator_init): Handle Zhaoxin processors. * common/config/i386/i386-common.cc: Add lujiazui. * common/config/i386/i386-cpuinfo.h (enum processor_vendor): Add VENDOR_ZHAOXIN. (enum processor_types): Add ZHAOXIN_FAM7H. (enum processor_subtypes): Add ZHAOXIN_FAM7H_LUJIAZUI. * config.gcc: Add lujiazui. * config/i386/cpuid.h (signature_SHANGHAI_ebx): Add Signatures for zhaoxin (signature_SHANGHAI_ecx): Ditto. (signature_SHANGHAI_edx): Ditto. * config/i386/driver-i386.cc (host_detect_local_cpu): Let -march=native recognize lujiazui processors. * config/i386/i386-c.cc (ix86_target_macros_internal): Add lujiazui. * config/i386/i386-options.cc (m_LUJIAZUI): New_definition. * config/i386/i386.h (enum processor_type): Ditto. * config/i386/i386.md: Add lujiazui. * config/i386/x86-tune-costs.h (struct processor_costs): Add lujiazui costs. * config/i386/x86-tune-sched.cc (ix86_issue_rate): Add lujiazui. (ix86_adjust_cost): Ditto. * config/i386/x86-tune.def (X86_TUNE_SCHEDULE): Add lujiazui Tunnings. (X86_TUNE_PARTIAL_REG_DEPENDENCY): Ditto. (X86_TUNE_SSE_PARTIAL_REG_DEPENDENCY): Ditto. (X86_TUNE_SSE_PARTIAL_REG_FP_CONVERTS_DEPENDENCY): Ditto. (X86_TUNE_SSE_PARTIAL_REG_CONVERTS_DEPENDENCY): Ditto. (X86_TUNE_MOVX): Ditto. (X86_TUNE_MEMORY_MISMATCH_STALL): Ditto. (X86_TUNE_FUSE_CMP_AND_BRANCH_32): Ditto. (X86_TUNE_FUSE_CMP_AND_BRANCH_64): Ditto. (X86_TUNE_FUSE_CMP_AND_BRANCH_SOFLAGS): Ditto. (X86_TUNE_FUSE_ALU_AND_BRANCH): Ditto. (X86_TUNE_ACCUMULATE_OUTGOING_ARGS): Ditto. (X86_TUNE_USE_LEAVE): Ditto. (X86_TUNE_PUSH_MEMORY): Ditto. (X86_TUNE_LCP_STALL): Ditto. (X86_TUNE_USE_INCDEC): Ditto. (X86_TUNE_INTEGER_DFMODE_MOVES): Ditto. (X86_TUNE_OPT_AGU): Ditto. (X86_TUNE_PREFER_KNOWN_REP_MOVSB_STOSB): Ditto. (X86_TUNE_MISALIGNED_MOVE_STRING_PRO_EPILOGUES): Ditto. (X86_TUNE_USE_SAHF): Ditto. (X86_TUNE_USE_BT): Ditto. (X86_TUNE_AVOID_FALSE_DEP_FOR_BMI): Ditto. (X86_TUNE_ONE_IF_CONV_INSN): Ditto. (X86_TUNE_AVOID_MFENCE): Ditto. (X86_TUNE_EXPAND_ABS): Ditto. (X86_TUNE_USE_SIMODE_FIOP): Ditto. (X86_TUNE_USE_FFREEP): Ditto. (X86_TUNE_EXT_80387_CONSTANTS): Ditto. (X86_TUNE_SSE_UNALIGNED_LOAD_OPTIMAL): Ditto. (X86_TUNE_SSE_UNALIGNED_STORE_OPTIMAL): Ditto. (X86_TUNE_SSE_TYPELESS_STORES): Ditto. (X86_TUNE_SSE_LOAD0_BY_PXOR): Ditto. * doc/extend.texi: Add details about lujiazui. * doc/invoke.texi: Add details about lujiazui. * config/i386/lujiazui.md: Introduce lujiazui cpu and include new md file. gcc/testsuite/ChangeLog: * gcc.target/i386/funcspec-56.inc: Test -arch=lujiauzi and -tune=lujiazui. * g++.target/i386/mv32.C: Ditto. Signed-off-by: mayshao --- gcc/common/config/i386/cpuinfo.h | 54 +- gcc/common/config/i386/i386-common.cc | 8 + gcc/common/config/i386/i386-cpuinfo.h | 3 + gcc/config.gcc | 10 +- gcc/config/i386/cpuid.h | 4 + gcc/config/i386/driver-i386.cc | 20 +- gcc/config/i386/i386-c.cc | 7 + gcc/config/i386/i386-options.cc | 3 + gcc/config/i386/i386.h | 1 + gcc/config/i386/i386.md | 5 +- gcc/config/i386/lujiazui.md | 844 ++++++++++++++++++++++++++ gcc/config/i386/x86-tune-costs.h | 115 ++++ gcc/config/i386/x86-tune-sched.cc | 2 + gcc/config/i386/x86-tune.def | 89 +-- gcc/doc/extend.texi | 3 + gcc/doc/invoke.texi | 5 + gcc/testsuite/g++.target/i386/mv32.C | 31 + gcc/testsuite/gcc.target/i386/funcspec-56.inc | 2 + 18 files changed, 1159 insertions(+), 47 deletions(-) create mode 100644 gcc/config/i386/lujiazui.md create mode 100644 gcc/testsuite/g++.target/i386/mv32.C (limited to 'gcc') diff --git a/gcc/common/config/i386/cpuinfo.h b/gcc/common/config/i386/cpuinfo.h index 6d6171f..adc02bc 100644 --- a/gcc/common/config/i386/cpuinfo.h +++ b/gcc/common/config/i386/cpuinfo.h @@ -526,6 +526,39 @@ get_intel_cpu (struct __processor_model *cpu_model, return cpu; } +/* Get the specific type of ZHAOXIN CPU and return ZHAOXIN CPU name. + Return NULL for unknown ZHAOXIN CPU. */ + +static inline const char * +get_zhaoxin_cpu (struct __processor_model *cpu_model, + struct __processor_model2 *cpu_model2, + unsigned int *cpu_features2) +{ + const char *cpu = NULL; + unsigned int family = cpu_model2->__cpu_family; + unsigned int model = cpu_model2->__cpu_model; + + switch (family) + { + /* ZHAOXIN family 7h. */ + case 0x07: + cpu_model->__cpu_type = ZHAOXIN_FAM7H; + if (model == 0x3b) + { + cpu = "lujiazui"; + CHECK___builtin_cpu_is ("lujiazui"); + cpu_model->__cpu_features[0] &= ~(1U <<(FEATURE_AVX & 31)); + cpu_features2[0] &= ~(1U <<((FEATURE_F16C - 32) & 31)); + cpu_model->__cpu_subtype = ZHAOXIN_FAM7H_LUJIAZUI; + } + break; + default: + break; + } + + return cpu; +} + /* ECX and EDX are output of CPUID at level one. */ static inline void get_available_features (struct __processor_model *cpu_model, @@ -936,8 +969,27 @@ cpu_indicator_init (struct __processor_model *cpu_model, get_amd_cpu (cpu_model, cpu_model2, cpu_features2); cpu_model->__cpu_vendor = VENDOR_AMD; } - else if (vendor == signature_CENTAUR_ebx) + else if (vendor == signature_CENTAUR_ebx && family < 0x07) cpu_model->__cpu_vendor = VENDOR_CENTAUR; + else if (vendor == signature_SHANGHAI_ebx + || vendor == signature_CENTAUR_ebx) + { + /* Adjust model and family for ZHAOXIN CPUS. */ + if (family == 0x07) + { + model += extended_model; + } + + cpu_model2->__cpu_family = family; + cpu_model2->__cpu_model = model; + + /* Find available features. */ + get_available_features (cpu_model, cpu_model2, cpu_features2, + ecx, edx); + /* Get CPU type. */ + get_zhaoxin_cpu (cpu_model, cpu_model2,cpu_features2); + cpu_model->__cpu_vendor = VENDOR_ZHAOXIN; + } else if (vendor == signature_CYRIX_ebx) cpu_model->__cpu_vendor = VENDOR_CYRIX; else if (vendor == signature_NSC_ebx) diff --git a/gcc/common/config/i386/i386-common.cc b/gcc/common/config/i386/i386-common.cc index 07fdd04..cb878163 100644 --- a/gcc/common/config/i386/i386-common.cc +++ b/gcc/common/config/i386/i386-common.cc @@ -1817,6 +1817,7 @@ const char *const processor_names[] = "alderlake", "rocketlake", "intel", + "lujiazui", "geode", "k6", "athlon", @@ -1995,6 +1996,13 @@ const pta processor_alias_table[] = {"nano-x4", PROCESSOR_K8, CPU_K8, PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3 | PTA_SSSE3 | PTA_SSE4_1 | PTA_FXSR, 0, P_NONE}, + {"lujiazui", PROCESSOR_LUJIAZUI, CPU_LUJIAZUI, + PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3 + | PTA_CX16 | PTA_ABM | PTA_SSSE3 | PTA_SSE4_1 + | PTA_SSE4_2 | PTA_AES | PTA_PCLMUL | PTA_BMI | PTA_BMI2 + | PTA_PRFCHW | PTA_FXSR | PTA_XSAVE | PTA_XSAVEOPT | PTA_FSGSBASE + | PTA_RDRND | PTA_MOVBE | PTA_ADX | PTA_RDSEED | PTA_POPCNT, + M_CPU_SUBTYPE (ZHAOXIN_FAM7H_LUJIAZUI), P_NONE}, {"k8", PROCESSOR_K8, CPU_K8, PTA_64BIT | PTA_MMX | PTA_3DNOW | PTA_3DNOW_A | PTA_SSE | PTA_SSE2 | PTA_NO_SAHF | PTA_FXSR, 0, P_NONE}, diff --git a/gcc/common/config/i386/i386-cpuinfo.h b/gcc/common/config/i386/i386-cpuinfo.h index 3f6d201..643fbd9 100644 --- a/gcc/common/config/i386/i386-cpuinfo.h +++ b/gcc/common/config/i386/i386-cpuinfo.h @@ -29,6 +29,7 @@ enum processor_vendor { VENDOR_INTEL = 1, VENDOR_AMD, + VENDOR_ZHAOXIN, VENDOR_OTHER, VENDOR_CENTAUR, VENDOR_CYRIX, @@ -56,6 +57,7 @@ enum processor_types INTEL_GOLDMONT_PLUS, INTEL_TREMONT, AMDFAM19H, + ZHAOXIN_FAM7H, CPU_TYPE_MAX, BUILTIN_CPU_TYPE_MAX = CPU_TYPE_MAX }; @@ -89,6 +91,7 @@ enum processor_subtypes INTEL_COREI7_ALDERLAKE, AMDFAM19H_ZNVER3, INTEL_COREI7_ROCKETLAKE, + ZHAOXIN_FAM7H_LUJIAZUI, CPU_SUBTYPE_MAX }; diff --git a/gcc/config.gcc b/gcc/config.gcc index b48d545..600ac35 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -665,7 +665,7 @@ slm nehalem westmere sandybridge ivybridge haswell broadwell bonnell \ silvermont knl knm skylake-avx512 cannonlake icelake-client icelake-server \ skylake goldmont goldmont-plus tremont cascadelake tigerlake cooperlake \ sapphirerapids alderlake rocketlake eden-x2 nano nano-1000 nano-2000 nano-3000 \ -nano-x2 eden-x4 nano-x4 x86-64 x86-64-v2 x86-64-v3 x86-64-v4 native" +nano-x2 eden-x4 nano-x4 lujiazui x86-64 x86-64-v2 x86-64-v3 x86-64-v4 native" # Additional x86 processors supported by --with-cpu=. Each processor # MUST be separated by exactly one space. @@ -3790,6 +3790,10 @@ case ${target} in cpu=geode arch_without_sse2=yes ;; + lujiazui-*) + arch=lujiazui + cpu=lujiazui + ;; pentium2-*) arch=pentium2 cpu=pentium2 @@ -3899,6 +3903,10 @@ case ${target} in arch=k8 cpu=k8 ;; + lujiazui-*) + arch=lujiazui + cpu=lujiazui + ;; nocona-*) arch=nocona cpu=nocona diff --git a/gcc/config/i386/cpuid.h b/gcc/config/i386/cpuid.h index 8b3dc2b..a4c2fed 100644 --- a/gcc/config/i386/cpuid.h +++ b/gcc/config/i386/cpuid.h @@ -204,6 +204,10 @@ #define signature_VORTEX_ecx 0x436f5320 #define signature_VORTEX_edx 0x36387865 +#define signature_SHANGHAI_ebx 0x68532020 +#define signature_SHANGHAI_ecx 0x20206961 +#define signature_SHANGHAI_edx 0x68676e61 + #ifndef __x86_64__ /* At least one cpu (Winchip 2) does not set %ebx and %ecx for cpuid leaf 1. Forcibly zero the two registers before diff --git a/gcc/config/i386/driver-i386.cc b/gcc/config/i386/driver-i386.cc index 9e0ae0b..3c702fd 100644 --- a/gcc/config/i386/driver-i386.cc +++ b/gcc/config/i386/driver-i386.cc @@ -438,7 +438,8 @@ const char *host_detect_local_cpu (int argc, const char **argv) || vendor == VENDOR_CYRIX || vendor == VENDOR_NSC) cache = detect_caches_amd (ext_level); - else if (vendor == VENDOR_INTEL) + else if (vendor == VENDOR_INTEL + || vendor == VENDOR_ZHAOXIN) { bool xeon_mp = (family == 15 && model == 6); cache = detect_caches_intel (xeon_mp, max_level, @@ -518,6 +519,20 @@ const char *host_detect_local_cpu (int argc, const char **argv) processor = PROCESSOR_I486; } } + else if (vendor == VENDOR_ZHAOXIN) + { + processor = PROCESSOR_GENERIC; + + switch (family) + { + case 7: + if (model == 0x3b) + processor = PROCESSOR_LUJIAZUI; + break; + default: + break; + } + } else { switch (family) @@ -773,6 +788,9 @@ const char *host_detect_local_cpu (int argc, const char **argv) case PROCESSOR_BTVER2: cpu = "btver2"; break; + case PROCESSOR_LUJIAZUI: + cpu = "lujiazui"; + break; default: /* Use something reasonable. */ diff --git a/gcc/config/i386/i386-c.cc b/gcc/config/i386/i386-c.cc index c73c1b1..eb0e3b3 100644 --- a/gcc/config/i386/i386-c.cc +++ b/gcc/config/i386/i386-c.cc @@ -140,6 +140,10 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag, def_or_undef (parse_in, "__btver2"); def_or_undef (parse_in, "__btver2__"); break; + case PROCESSOR_LUJIAZUI: + def_or_undef (parse_in, "__lujiazui"); + def_or_undef (parse_in, "__lujiazui__"); + break; case PROCESSOR_PENTIUM4: def_or_undef (parse_in, "__pentium4"); def_or_undef (parse_in, "__pentium4__"); @@ -332,6 +336,9 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag, case PROCESSOR_BTVER2: def_or_undef (parse_in, "__tune_btver2__"); break; + case PROCESSOR_LUJIAZUI: + def_or_undef (parse_in, "__tune_lujiazui__"); + break; case PROCESSOR_PENTIUM4: def_or_undef (parse_in, "__tune_pentium4__"); break; diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc index 32cc58a..e11f681 100644 --- a/gcc/config/i386/i386-options.cc +++ b/gcc/config/i386/i386-options.cc @@ -138,6 +138,8 @@ along with GCC; see the file COPYING3. If not see #define m_TREMONT (HOST_WIDE_INT_1U<. +;; + +;; Scheduling for ZHAOXIN lujiazui processor. + +;; Modeling automatons for decoders, execution pipes and AGU pipes. +(define_automaton "lujiazui_decoder,lujiazui_core,lujiazui_agu") + +;; The rules for the decoder are simple: +;; - an instruction with 1 uop can be decoded by any of the three +;; decoders in one cycle. +;; - an instruction with 2 uops can be decoded by decoder 0 or decoder 1 +;; but still in only one cycle. +;; - a complex (microcode) instruction can only be decoded by +;; decoder 0, and this takes an unspecified number of cycles. +;; +;; The goal is to schedule such that we have a few-one-two uops sequence +;; in each cycle, to decode as many instructions per cycle as possible. +(define_cpu_unit "lua_decoder0" "lujiazui_decoder") +(define_cpu_unit "lua_decoder1" "lujiazui_decoder") +(define_cpu_unit "lua_decoder2" "lujiazui_decoder") + +;; We first wish to find an instruction for lua_decoder0, so exclude +;; lua_decoder1 and lua_decoder2 from being reserved until +;; lua_decoder0 is reserved, and also exclude lua_decoder2 +;; from being reserved until lua_decoder1 is reserved. +(presence_set "lua_decoder1" "lua_decoder0") +(presence_set "lua_decoder2" "lua_decoder0") +(presence_set "lua_decoder2" "lua_decoder1") + +;; Most instructions can be decoded on any of the three decoders. +(define_reservation "lua_decodern" "lua_decoder0|lua_decoder1|lua_decoder2") +(define_reservation "lua_decoder01" "lua_decoder0|lua_decoder1") + +;; The out-of-order core has six pipelines. +;; Port 4, 5 are responsible for address calculations, load or store. +;; Port 0, 1, 2, 3 for everything else. + +(define_cpu_unit "lua_p0,lua_p1,lua_p2,lua_p3" "lujiazui_core") +(define_cpu_unit "lua_p4,lua_p5" "lujiazui_agu") + +(define_reservation "lua_p03" "lua_p0|lua_p3") +(define_reservation "lua_p12" "lua_p1|lua_p2") +(define_reservation "lua_p1p2" "lua_p1+lua_p2") +(define_reservation "lua_p45" "lua_p4|lua_p5") +(define_reservation "lua_p4p5" "lua_p4+lua_p5") +(define_reservation "lua_p0p1p2p3" "lua_p0+lua_p1+lua_p2+lua_p3") + +;; Only the irregular instructions have to be modeled here. + +;; Complex instruction. +(define_insn_reservation "lua_complex_insn" 6 + (and (eq_attr "cpu" "lujiazui") + (eq_attr "type" "other,multi,str")) + "lua_decoder0") + +;; Call instruction. +(define_insn_reservation "lua_call" 1 + (and (eq_attr "cpu" "lujiazui") + (eq_attr "type" "call,callv")) + "lua_decoder0,lua_p45,lua_p1") + +;; MOV - integer moves. +(define_insn_reservation "lua_imov" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (eq_attr "type" "imov,imovx"))) + "lua_decodern,lua_p12") + +(define_insn_reservation "lua_imov_load" 4 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (eq_attr "type" "imov,imovx"))) + "lua_decoder01,lua_p45") + +(define_insn_reservation "lua_imov_store" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "store") + (eq_attr "type" "imov"))) + "lua_decodern,lua_p12+lua_p45") + +(define_insn_reservation "lua_icmov" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none,unknown") + (eq_attr "type" "icmov"))) + "lua_decodern,lua_p2") + +(define_insn_reservation "lua_icmov_load" 5 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (eq_attr "type" "icmov"))) + "lua_decoder01,lua_p45,lua_p2") + +;; Push and pop. +(define_insn_reservation "lua_push_reg" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "store") + (eq_attr "type" "push"))) + "lua_decodern,lua_p12+lua_p45") + +(define_insn_reservation "lua_push_mem" 4 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "both") + (eq_attr "type" "push"))) + "lua_decoder01,lua_p45,lua_p12+lua_p45") + +(define_insn_reservation "lua_pop_reg" 4 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (eq_attr "type" "pop"))) + "lua_decoder01,lua_p45") + +(define_insn_reservation "lua_pop_mem" 4 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "both") + (eq_attr "type" "pop"))) + "lua_decoder0,lua_p45,lua_p12+lua_p45") + +(define_insn_reservation "lua_lea" 1 + (and (eq_attr "cpu" "lujiazui") + (eq_attr "type" "lea")) + "hsw_decodern,lua_p45") + +(define_insn_reservation "lua_shift_rotate" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none,unknown") + (eq_attr "type" "ishift,ishift1,rotate,rotate1"))) + "lua_decodern,lua_p2") + +(define_insn_reservation "lua_shift_rotate_load" 5 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (eq_attr "type" "ishift,ishift1,rotate,rotate1"))) + "lua_decoder01,lua_p45,lua_p2") + +(define_insn_reservation "lua_shift_rotate_store" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "store") + (eq_attr "type" "ishift,ishift1,rotate,rotate1"))) + "lua_decoder01,lua_p2,lua_p45") + +(define_insn_reservation "lua_shift_rotate_both" 5 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "both") + (eq_attr "type" "ishift,ishift1,rotate,rotate1"))) + "lua_decoder0,lua_p45,lua_p2,lua_p45") + +(define_insn_reservation "lua_branch" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (eq_attr "type" "ibr"))) + "lua_decodern,lua_p1") + +(define_insn_reservation "lua_indirect_branch_load" 5 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (eq_attr "type" "ibr"))) + "lua_decodern,lua_p45,lua_p1") + +(define_insn_reservation "lua_leave" 4 + (and (eq_attr "cpu" "lujiazui") + (eq_attr "type" "leave")) + "lua_decoder0,lua_p45+lua_p12,lua_p12") + +;; Multiplication instructions. + +(define_insn_reservation "lua_imul_qi" 2 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (and (eq_attr "mode" "QI") + (eq_attr "type" "imul,imulx")))) + "lua_decodern,lua_p1p2") + +(define_insn_reservation "lua_imul_qi_mem" 6 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "!none") + (and (eq_attr "mode" "QI") + (eq_attr "type" "imul,imulx")))) + "lua_decoder01,lua_p1p2+lua_p45") + +(define_insn_reservation "lua_imul_hisi" 3 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (and (eq_attr "mode" "HI,SI") + (eq_attr "type" "imul,imulx")))) + "lua_decoder0,lua_p1p2") + +(define_insn_reservation "lua_imul_hisi_mem" 7 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "!none") + (and (eq_attr "mode" "HI,SI") + (eq_attr "type" "imul,imulx")))) + "lua_decoder0,lua_p1p2+lua_p45") + +(define_insn_reservation "lua_imul_di" 12 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (and (eq_attr "mode" "DI") + (eq_attr "type" "imul,imulx")))) + "lua_decoder0,lua_p0p1p2p3") + +(define_insn_reservation "lua_imul_di_mem" 16 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "!none") + (and (eq_attr "mode" "DI") + (eq_attr "type" "imul,imulx")))) + "lua_decoder0,lua_p0p1p2p3+lua_p45") + +;; Division instructions. + +(define_insn_reservation "lua_idiv_qi" 21 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (and (eq_attr "mode" "QI") + (eq_attr "type" "idiv")))) + "lua_decoder0,lua_p0p1p2p3*21") + +(define_insn_reservation "lua_idiv_qi_load" 25 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (and (eq_attr "mode" "QI") + (eq_attr "type" "idiv")))) + "lua_decoder0,lua_p45,lua_p0p1p2p3*21") + +(define_insn_reservation "lua_idiv_hi" 22 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (and (eq_attr "mode" "HI") + (eq_attr "type" "idiv")))) + "lua_decoder0,lua_p0p1p2p3*22") + +(define_insn_reservation "lua_idiv_hi_load" 26 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (and (eq_attr "mode" "HI") + (eq_attr "type" "idiv")))) + "lua_decoder0,lua_p45,lua_p0p1p2p3*22") + +(define_insn_reservation "lua_idiv_si" 20 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (and (eq_attr "mode" "SI") + (eq_attr "type" "idiv")))) + "lua_decoder0,lua_p0p1p2p3*20") + +(define_insn_reservation "lua_idiv_si_load" 24 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (and (eq_attr "mode" "SI") + (eq_attr "type" "idiv")))) + "lua_decoder0,lua_p45,lua_p0p1p2p3*20") + +(define_insn_reservation "lua_idiv_di" 150 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (and (eq_attr "mode" "DI") + (eq_attr "type" "idiv")))) + "lua_decoder0,lua_p0p1p2p3*150") + +(define_insn_reservation "lua_idiv_di_load" 154 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (and (eq_attr "mode" "DI") + (eq_attr "type" "idiv")))) + "lua_decoder0,lua_p45,lua_p0p1p2p3*150") + +;; x87 floating point operations. + +(define_insn_reservation "lua_fxch" 1 + (and (eq_attr "cpu" "lujiazui") + (eq_attr "type" "fxch")) + "lua_decodern,lua_p1") + +(define_insn_reservation "lua_fop" 3 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none,unknown") + (eq_attr "type" "fop"))) + "lua_decodern,lua_p0") + +(define_insn_reservation "lua_fop_load" 7 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (eq_attr "type" "fop"))) + "lua_decoder01,lua_p45,lua_p0") + +(define_insn_reservation "lua_fop_store" 3 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "store") + (eq_attr "type" "fop"))) + "lua_decodern,lua_p0,lua_p45") + +(define_insn_reservation "lua_fop_both" 7 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "both") + (eq_attr "type" "fop"))) + "lua_decoder0,lua_p45,lua_p0,lua_p45") + +(define_insn_reservation "lua_fsgn" 1 + (and (eq_attr "cpu" "lujiazui") + (eq_attr "type" "fsgn")) + "lua_decodern,lua_p0") + +(define_insn_reservation "lua_fistp" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (eq_attr "type" "fistp"))) + "lua_decodern,lua_p0") + +(define_insn_reservation "lua_fistp_mem" 4 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "!none") + (eq_attr "type" "fistp"))) + "lua_decoder0,lua_p0+lua_p45") + +(define_insn_reservation "lua_fcmov" 3 + (and (eq_attr "cpu" "lujiazui") + (eq_attr "type" "fcmov")) + "lua_decodern,lua_p0") + +(define_insn_reservation "lua_fcmp" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (eq_attr "type" "fcmp"))) + "lua_decodern,lua_p0") + +(define_insn_reservation "lua_fcmp_load" 5 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (eq_attr "type" "fcmp"))) + "lua_decoder01,lua_p45,lua_p0") + +(define_insn_reservation "lua_fmov" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (eq_attr "type" "fmov"))) + "lua_decodern,lua_p0") + +(define_insn_reservation "lua_fmov_load" 4 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (and (eq_attr "mode" "!XF") + (eq_attr "type" "fmov")))) + "lua_decoder01,lua_p45,lua_p0") + +(define_insn_reservation "lua_fmov_XF_load" 3 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (and (eq_attr "mode" "XF") + (eq_attr "type" "fmov")))) + "lua_decoder0,lua_p45,lua_p0") + +(define_insn_reservation "lua_fmov_store" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "store") + (and (eq_attr "mode" "!XF") + (eq_attr "type" "fmov")))) + "lua_decoder0,lua_p0,lua_p45") + +(define_insn_reservation "lua_fmov_XF_store" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "store") + (and (eq_attr "mode" "XF") + (eq_attr "type" "fmov")))) + "lua_decoder0,lua_p0,lua_p45") + +(define_insn_reservation "lua_fmul" 4 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (eq_attr "type" "fmul"))) + "lua_decodern,lua_p3") + +(define_insn_reservation "lua_fmul_load" 8 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "fp_int_src" "false") + (and (eq_attr "memory" "load") + (eq_attr "type" "fmul")))) + "lua_decoder01,lua_p45,lua_p3") + +(define_insn_reservation "lua_fimul_load" 8 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "fp_int_src" "true") + (and (eq_attr "memory" "load") + (eq_attr "type" "fmul")))) + "lua_decoder0,lua_p45,lua_p3") + +;; fdiv instructions. + +(define_insn_reservation "lua_fdiv_SF" 15 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (and (eq_attr "mode" "SF") + (eq_attr "type" "fdiv,fpspc")))) + "lua_decodern,lua_p0*15") + +(define_insn_reservation "lua_fdiv_SF_load" 19 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (and (eq_attr "mode" "SF") + (eq_attr "type" "fdiv,fpspc")))) + "lua_decoder01,lua_p45,lua_p0*15") + +(define_insn_reservation "lua_fdiv_DF" 18 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (and (eq_attr "mode" "DF") + (eq_attr "type" "fdiv,fpspc")))) + "lua_decodern,lua_p0*18") + +(define_insn_reservation "lua_fdiv_DF_load" 22 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (and (eq_attr "mode" "DF") + (eq_attr "type" "fdiv,fpspc")))) + "lua_decoder01,lua_p45,lua_p0*18") + +(define_insn_reservation "lua_fdiv_XF" 22 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (and (eq_attr "mode" "XF") + (eq_attr "type" "fdiv,fpspc")))) + "lua_decoder0,lua_p0*22") + +(define_insn_reservation "lua_fdiv_XF_load" 26 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (and (eq_attr "mode" "XF") + (eq_attr "type" "fdiv,fpspc")))) + "lua_decoder0,lua_p45,lua_p0*22") + +;; MMX instructions. + +(define_insn_reservation "lua_mmx_sse_add_shft" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (eq_attr "type" "mmxadd,sseiadd,mmxshft,sseishft"))) + "lua_decodern,lua_p0") + +(define_insn_reservation "lua_mmx_sse_add_shft_load" 5 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (eq_attr "type" "mmxadd,sseiadd,mmxshft,sseishft"))) + "lua_decoder01,lua_p45,lua_p0") + +(define_insn_reservation "lua_mmx_sse_add_shft_store" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "store") + (eq_attr "type" "mmxadd,sseiadd,mmxshft,sseishft"))) + "lua_decodern,lua_p0,lua_p45") + +(define_insn_reservation "lua_mmx_mul" 5 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (eq_attr "type" "mmxmul,sseimul"))) + "lua_decodern,lua_p3") + +(define_insn_reservation "lua_mmx_mul_load" 9 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (eq_attr "type" "mmxmul,sseimul"))) + "lua_decoder01,lua_p45,lua_p3") + +(define_insn_reservation "lua_mmxcvt" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (eq_attr "type" "mmxcvt"))) + "lua_decodern,lua_p03") + +(define_insn_reservation "lua_mmxcvt_load" 5 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (eq_attr "type" "mmxcvt"))) + "lua_decoder01,lua_p45,lua_p03") + +;; The sfence instruction. +(define_insn_reservation "lua_sse_sfence" 13 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "unknown") + (eq_attr "type" "sse"))) + "lua_decoder0,lua_p45") + +(define_insn_reservation "lua_sse_SFDF" 5 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "mode" "SF,DF") + (eq_attr "type" "sse"))) + "lua_decodern,lua_p0") + +(define_insn_reservation "lua_sse_V4SF" 13 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "mode" "V4SF") + (eq_attr "type" "sse"))) + "lua_decodern,lua_p0") + +(define_insn_reservation "lua_sse_V8SF" 19 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "mode" "V8SF,V4DF") + (eq_attr "type" "sse"))) + "lua_decodern,lua_p0") + +(define_insn_reservation "lua_sse_add1" 5 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (eq_attr "type" "sseadd1"))) + "lua_decoder0,lua_p0") + +(define_insn_reservation "lua_sse_add1_load" 8 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (eq_attr "type" "sseadd1"))) + "lua_decoder0,lua_p45,lua_p0") + +(define_insn_reservation "lua_sse_cmp" 3 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (eq_attr "type" "ssecmp,ssecomi"))) + "lua_decodern,lua_p0") + +(define_insn_reservation "lua_sse_cmp_load" 7 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (eq_attr "type" "ssecmp,ssecomi"))) + "lua_decoder01,lua_p45,lua_p0") + +(define_insn_reservation "lua_sse_logic" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (eq_attr "type" "sselog,sselog1"))) + "lua_decodern,lua_p03") + +(define_insn_reservation "lua_sse_logic_load" 5 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (eq_attr "type" "sselog,sselog1"))) + "lua_decoder01,lua_p45,lua_p03") + +(define_insn_reservation "lua_sse_add" 3 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (eq_attr "type" "sseadd"))) + "lua_decodern,lua_p0") + +(define_insn_reservation "lua_sse_add_load" 7 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (eq_attr "type" "sseadd"))) + "lua_decoder01,lua_p45,lua_p0") + +(define_insn_reservation "lua_ssemul_ss_ps" 3 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (and (eq_attr "mode" "SF,V4SF,V8SF") + (eq_attr "type" "ssemul")))) + "lua_decodern,lua_p3") + +(define_insn_reservation "lua_ssemul_ss_ps_load" 7 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (and (eq_attr "mode" "SF,V4SF,V8SF") + (eq_attr "type" "ssemul")))) + "lua_decoder01,lua_p45,lua_p3") + +(define_insn_reservation "lua_ssemul_sd_pd" 4 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (and (eq_attr "mode" "DF,V2DF,V4DF") + (eq_attr "type" "ssemul")))) + "lua_decodern,lua_p3") + +(define_insn_reservation "lua_ssemul_sd_pd_load" 8 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (and (eq_attr "mode" "DF,V2DF,V4DF") + (eq_attr "type" "ssemul")))) + "lua_decoder01,lua_p45,lua_p3") + +(define_insn_reservation "lua_ssediv_SF" 13 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (and (eq_attr "mode" "SF") + (eq_attr "type" "ssediv")))) + "lua_decodern,lua_p0*13") + +(define_insn_reservation "lua_ssediv_load_SF" 17 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (and (eq_attr "mode" "SF") + (eq_attr "type" "ssediv")))) + "lua_decoder01,lua_p45,lua_p0*13") + +(define_insn_reservation "lua_ssediv_V4SF" 23 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (and (eq_attr "mode" "V4SF") + (eq_attr "type" "ssediv")))) + "lua_decodern,lua_p0*23") + +(define_insn_reservation "lua_ssediv_load_V4SF" 27 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (and (eq_attr "mode" "V4SF") + (eq_attr "type" "ssediv")))) + "lua_decoder01,lua_p45,lua_p0*23") + +(define_insn_reservation "lua_ssediv_V8SF" 47 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (and (eq_attr "mode" "V8SF") + (eq_attr "type" "ssediv")))) + "lua_decoder0,lua_p0*47") + +(define_insn_reservation "lua_ssediv_load_V8SF" 51 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (and (eq_attr "mode" "V8SF") + (eq_attr "type" "ssediv")))) + "lua_decoder0,lua_p45,lua_p0*47") + +(define_insn_reservation "lua_ssediv_SD" 17 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (and (eq_attr "mode" "DF") + (eq_attr "type" "ssediv")))) + "lua_decodern,lua_p0*17") + +(define_insn_reservation "lua_ssediv_load_SD" 21 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (and (eq_attr "mode" "DF") + (eq_attr "type" "ssediv")))) + "lua_decoder01,lua_p45,lua_p0*17") + +(define_insn_reservation "lua_ssediv_V2DF" 30 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (and (eq_attr "mode" "V2DF") + (eq_attr "type" "ssediv")))) + "lua_decodern,lua_p0*30") + +(define_insn_reservation "lua_ssediv_load_V2DF" 34 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (and (eq_attr "mode" "V2DF") + (eq_attr "type" "ssediv")))) + "lua_decoder01,lua_p45,lua_p0*30") + +(define_insn_reservation "lua_ssediv_V4DF" 56 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (and (eq_attr "mode" "V4DF") + (eq_attr "type" "ssediv")))) + "lua_decoder0,lua_p0*56") + +(define_insn_reservation "lua_ssediv_load_V4DF" 60 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (and (eq_attr "mode" "V4DF") + (eq_attr "type" "ssediv")))) + "lua_decoder0,lua_p4p5,lua_p0*56") + + +(define_insn_reservation "lua_sseicvt_si" 2 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (and (eq_attr "mode" "SI") + (and (match_operand:SF 1 "memory_operand") + (eq_attr "type" "sseicvt"))))) + "lua_decoder01,lua_p0") + +(define_insn_reservation "lua_sseicvt_si_load" 6 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (and (eq_attr "mode" "SI") + (and (match_operand:SF 1 "memory_operand") + (eq_attr "type" "sseicvt"))))) + "lua_decoder0,lua_p45,lua_p0") + +(define_insn_reservation "lua_sseicvtdf_si" 3 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (and (eq_attr "mode" "SI") + (and (match_operand:DF 1 "memory_operand") + (eq_attr "type" "sseicvt"))))) + "lua_decodern,lua_p0") + +(define_insn_reservation "lua_sseicvtdf_si_load" 7 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (and (eq_attr "mode" "SI") + (and (match_operand:DF 1 "memory_operand") + (eq_attr "type" "sseicvt"))))) + "lua_decoder01,lua_p45,lua_p0") + +(define_insn_reservation "lua_ssecvt" 6 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (eq_attr "type" "ssecvt"))) + "lua_decoder01,lua_p03") + +(define_insn_reservation "lua_ssecvt_load" 10 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (eq_attr "type" "ssecvt"))) + "lua_decoder0,lua_p45,lua_p03") + +(define_insn_reservation "lua_sse_mov" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (eq_attr "type" "ssemov"))) + "lua_decodern,lua_p03") + +(define_insn_reservation "lua_sse_mov_load" 5 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (eq_attr "type" "ssemov"))) + "lua_decoder01,lua_p45,lua_p03") + +(define_insn_reservation "lua_sse_mov_store" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "store") + (eq_attr "type" "ssemov"))) + "lua_decoder01,lua_p0,lua_p45") + +(define_insn_reservation "lua_insn_alu" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none,unknown") + (eq_attr "type" "alu"))) + "lua_decodern,lua_p12") + +(define_insn_reservation "lua_insn_alu_load" 5 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (eq_attr "type" "alu"))) + "lua_decoder01,lua_p45,lua_p12") + +(define_insn_reservation "lua_insn_alu_store" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "store") + (eq_attr "type" "alu"))) + "lua_decoder01,lua_p12,lua_p45") + +(define_insn_reservation "lua_insn_alu_both" 5 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "both") + (eq_attr "type" "alu"))) + "lua_decoder0,lua_p45,lua_p12,lua_p45") + +(define_insn_reservation "lua_insn_alu1" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none,unknown") + (eq_attr "type" "alu1"))) + "lua_decodern,lua_p12") + +(define_insn_reservation "lua_insn_alu1_load" 5 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (eq_attr "type" "alu1"))) + "lua_decoder01,lua_p45,lua_p12") + +(define_insn_reservation "lua_insn_alu1_store" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "store") + (eq_attr "type" "alu1"))) + "lua_decoder01,lua_p12,lua_p45") + +(define_insn_reservation "lua_insn_alu1_both" 5 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "both") + (eq_attr "type" "alu1"))) + "lua_decoder0,lua_p45,lua_p12,lua_p45") + +(define_insn_reservation "lua_insn_negnot_incdec" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (eq_attr "type" "negnot,incdec"))) + "lua_decodern,lua_p12") + +(define_insn_reservation "lua_insn_negnot_setcc" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (eq_attr "type" "setcc"))) + "lua_decodern,lua_p2") + +(define_insn_reservation "lua_insn_negnot_setcc_mem" 5 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "!none") + (eq_attr "type" "negnot,setcc"))) + "lua_decoder01,lua_p45,lua_p2,lua_p45") + +(define_insn_reservation "lua_insn_incdec_mem" 5 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "!none") + (eq_attr "type" "incdec"))) + "lua_decoder0,lua_p45,lua_p12,lua_p45") + +(define_insn_reservation "lua_insn_icmptest" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none,unknown") + (eq_attr "type" "icmp,test"))) + "lua_decodern,lua_p12") + +(define_insn_reservation "lua_insn_icmptest_load" 5 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (eq_attr "type" "icmp,test"))) + "lua_decoder01,lua_p45,lua_p12") + +(define_insn_reservation "lua_insn_icmptest_store" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "store") + (eq_attr "type" "icmp,test"))) + "lua_decoder01,lua_p12,lua_p45") + +(define_insn_reservation "lua_insn_icmptest_both" 5 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "both") + (eq_attr "type" "icmp,test"))) + "lua_decoder0,lua_p45,lua_p12,lua_p45") + +(define_insn_reservation "lua_insn_sseishft1_mmx" 1 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "none") + (eq_attr "type" "sseishft1,mmx,mmxcmp"))) + "lua_decodern,lua_p03") + +(define_insn_reservation "lua_insn_sseishft1_mmx_mem" 5 + (and (eq_attr "cpu" "lujiazui") + (and (eq_attr "memory" "load") + (eq_attr "type" "sseishft1,mmx,mmxcmp"))) + "lua_decoder01,lua_p45,lua_p03") diff --git a/gcc/config/i386/x86-tune-costs.h b/gcc/config/i386/x86-tune-costs.h index 05cbd49..ea34a93 100644 --- a/gcc/config/i386/x86-tune-costs.h +++ b/gcc/config/i386/x86-tune-costs.h @@ -3088,6 +3088,121 @@ struct processor_costs intel_cost = { "16", /* Func alignment. */ }; +/* lujiazui_cost should produce code tuned for ZHAOXIN lujiazui CPU. */ +static stringop_algs lujiazui_memcpy[2] = { + {libcall, {{32, loop, false}, {8192, rep_prefix_4_byte, false}, + {-1, libcall, false}}}, + {libcall, {{12, unrolled_loop, true}, {32, loop, false}, + {6144, rep_prefix_8_byte, false}, + {-1, libcall, false}}}}; +static stringop_algs lujiazui_memset[2] = { + {libcall, {{32, loop, false}, {8192, rep_prefix_4_byte, false}, + {-1, libcall, false}}}, + {libcall, {{12, loop, true}, {32, loop, false}, + {640, rep_prefix_8_byte, false}, + {-1, libcall, false}}}}; +static const +struct processor_costs lujiazui_cost = { + { + /* Start of register allocator costs. integer->integer move cost is 2. */ + 6, /* cost for loading QImode using movzbl. */ + {6, 6, 6}, /* cost of loading integer registers + in QImode, HImode and SImode. + Relative to reg-reg move (2). */ + {6, 6, 6}, /* cost of storing integer registers. */ + 2, /* cost of reg,reg fld/fst. */ + {6, 6, 8}, /* cost of loading fp registers + in SFmode, DFmode and XFmode. */ + {6, 6, 8}, /* cost of storing fp registers + in SFmode, DFmode and XFmode. */ + 2, /* cost of moving MMX register. */ + {6, 6}, /* cost of loading MMX registers + in SImode and DImode. */ + {6, 6}, /* cost of storing MMX registers + in SImode and DImode. */ + 2, 3, 4, /* cost of moving XMM,YMM,ZMM register. */ + {6, 6, 6, 10, 15}, /* cost of loading SSE registers + in 32,64,128,256 and 512-bit. */ + {6, 6, 6, 10, 15}, /* cost of storing SSE registers + in 32,64,128,256 and 512-bit. */ + 6, 6, /* SSE->integer and integer->SSE moves. */ + 6, 6, /* mask->integer and integer->mask moves. */ + {6, 6, 6}, /* cost of loading mask register + in QImode, HImode, SImode. */ + {6, 6, 6}, /* cost if storing mask register + in QImode, HImode, SImode. */ + 2, /* cost of moving mask register. */ + /* End of register allocator costs. */ + }, + + COSTS_N_INSNS (1), /* cost of an add instruction. */ + COSTS_N_INSNS (1) + 1, /* cost of a lea instruction. */ + COSTS_N_INSNS (1), /* variable shift costs. */ + COSTS_N_INSNS (1), /* constant shift costs. */ + {COSTS_N_INSNS (2), /* cost of starting multiply for QI. */ + COSTS_N_INSNS (3), /* HI. */ + COSTS_N_INSNS (3), /* SI. */ + COSTS_N_INSNS (12), /* DI. */ + COSTS_N_INSNS (14)}, /* other. */ + 0, /* cost of multiply per each bit set. */ + {COSTS_N_INSNS (22), /* cost of a divide/mod for QI. */ + COSTS_N_INSNS (24), /* HI. */ + COSTS_N_INSNS (24), /* SI. */ + COSTS_N_INSNS (150), /* DI. */ + COSTS_N_INSNS (152)}, /* other. */ + COSTS_N_INSNS (1), /* cost of movsx. */ + COSTS_N_INSNS (1), /* cost of movzx. */ + 8, /* "large" insn. */ + 17, /* MOVE_RATIO. */ + 6, /* CLEAR_RATIO. */ + {6, 6, 6}, /* cost of loading integer registers + in QImode, HImode and SImode. + Relative to reg-reg move (2). */ + {6, 6, 6}, /* cost of storing integer registers. */ + {6, 6, 6, 10, 15}, /* cost of loading SSE register + in 32bit, 64bit, 128bit, 256bit and 512bit. */ + {6, 6, 6, 10, 15}, /* cost of storing SSE register + in 32bit, 64bit, 128bit, 256bit and 512bit. */ + {6, 6, 6, 10, 15}, /* cost of unaligned loads. */ + {6, 6, 6, 10, 15}, /* cost of unaligned storess. */ + 2, 3, 4, /* cost of moving XMM,YMM,ZMM register. */ + 6, /* cost of moving SSE register to integer. */ + 18, 6, /* Gather load static, per_elt. */ + 18, 6, /* Gather store static, per_elt. */ + 32, /* size of l1 cache. */ + 4096, /* size of l2 cache. */ + 64, /* size of prefetch block. */ + /* Lujiazui processor never drop prefetches, like AMD processors. */ + 100, /* number of parallel prefetches. */ + 3, /* Branch cost. */ + COSTS_N_INSNS (3), /* cost of FADD and FSUB insns. */ + COSTS_N_INSNS (4), /* cost of FMUL instruction. */ + COSTS_N_INSNS (22), /* cost of FDIV instruction. */ + COSTS_N_INSNS (1), /* cost of FABS instruction. */ + COSTS_N_INSNS (1), /* cost of FCHS instruction. */ + COSTS_N_INSNS (44), /* cost of FSQRT instruction. */ + + COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */ + COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */ + COSTS_N_INSNS (3), /* cost of MULSS instruction. */ + COSTS_N_INSNS (4), /* cost of MULSD instruction. */ + COSTS_N_INSNS (6), /* cost of FMA SS instruction. */ + COSTS_N_INSNS (6), /* cost of FMA SD instruction. */ + COSTS_N_INSNS (13), /* cost of DIVSS instruction. */ + COSTS_N_INSNS (17), /* cost of DIVSD instruction. */ + COSTS_N_INSNS (32), /* cost of SQRTSS instruction. */ + COSTS_N_INSNS (60), /* cost of SQRTSD instruction. */ + 1, 4, 3, 3, /* reassoc int, fp, vec_int, vec_fp. */ + lujiazui_memcpy, + lujiazui_memset, + COSTS_N_INSNS (4), /* cond_taken_branch_cost. */ + COSTS_N_INSNS (2), /* cond_not_taken_branch_cost. */ + "16:11:8", /* Loop alignment. */ + "16:11:8", /* Jump alignment. */ + "0:0:8", /* Label alignment. */ + "16", /* Func alignment. */ +}; + /* Generic should produce code tuned for Core-i7 (and newer chips) and btver1 (and newer chips). */ diff --git a/gcc/config/i386/x86-tune-sched.cc b/gcc/config/i386/x86-tune-sched.cc index e413d04..1ffaeef 100644 --- a/gcc/config/i386/x86-tune-sched.cc +++ b/gcc/config/i386/x86-tune-sched.cc @@ -58,6 +58,7 @@ ix86_issue_rate (void) case PROCESSOR_K8: case PROCESSOR_AMDFAM10: case PROCESSOR_BTVER1: + case PROCESSOR_LUJIAZUI: return 3; case PROCESSOR_BDVER1: @@ -368,6 +369,7 @@ ix86_adjust_cost (rtx_insn *insn, int dep_type, rtx_insn *dep_insn, int cost, case PROCESSOR_ATHLON: case PROCESSOR_K8: + case PROCESSOR_LUJIAZUI: memory = get_attr_memory (insn); /* Show ability of reorder buffer to hide latency of load by executing diff --git a/gcc/config/i386/x86-tune.def b/gcc/config/i386/x86-tune.def index d983e2f..540e45d 100644 --- a/gcc/config/i386/x86-tune.def +++ b/gcc/config/i386/x86-tune.def @@ -41,8 +41,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see /* X86_TUNE_SCHEDULE: Enable scheduling. */ DEF_TUNE (X86_TUNE_SCHEDULE, "schedule", m_PENT | m_LAKEMONT | m_PPRO | m_CORE_ALL | m_BONNELL | m_SILVERMONT - | m_INTEL | m_KNL | m_KNM | m_K6_GEODE | m_AMD_MULTIPLE | m_GOLDMONT - | m_GOLDMONT_PLUS | m_TREMONT | m_ALDERLAKE | m_GENERIC) + | m_INTEL | m_KNL | m_KNM | m_K6_GEODE | m_AMD_MULTIPLE | m_LUJIAZUI + | m_GOLDMONT | m_GOLDMONT_PLUS | m_TREMONT | m_ALDERLAKE | m_GENERIC) /* X86_TUNE_PARTIAL_REG_DEPENDENCY: Enable more register renaming on modern chips. Prefer stores affecting whole integer register @@ -51,8 +51,8 @@ DEF_TUNE (X86_TUNE_SCHEDULE, "schedule", DEF_TUNE (X86_TUNE_PARTIAL_REG_DEPENDENCY, "partial_reg_dependency", m_P4_NOCONA | m_CORE2 | m_NEHALEM | m_SANDYBRIDGE | m_CORE_AVX2 | m_BONNELL | m_SILVERMONT | m_GOLDMONT | m_GOLDMONT_PLUS | m_INTEL - | m_KNL | m_KNM | m_AMD_MULTIPLE | m_TREMONT | m_ALDERLAKE - | m_GENERIC) + | m_KNL | m_KNM | m_AMD_MULTIPLE | m_LUJIAZUI | m_TREMONT + | m_ALDERLAKE | m_GENERIC) /* X86_TUNE_SSE_PARTIAL_REG_DEPENDENCY: This knob promotes all store destinations to be 128bit to allow register renaming on 128bit SSE units, @@ -62,7 +62,8 @@ DEF_TUNE (X86_TUNE_PARTIAL_REG_DEPENDENCY, "partial_reg_dependency", that can be partly masked by careful scheduling of moves. */ DEF_TUNE (X86_TUNE_SSE_PARTIAL_REG_DEPENDENCY, "sse_partial_reg_dependency", m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_BONNELL | m_AMDFAM10 - | m_BDVER | m_ZNVER | m_TREMONT | m_ALDERLAKE | m_GENERIC) + | m_BDVER | m_ZNVER | m_LUJIAZUI | m_TREMONT | m_ALDERLAKE + | m_GENERIC) /* X86_TUNE_SSE_PARTIAL_REG_FP_CONVERTS_DEPENDENCY: This knob avoids partial write to the destination in scalar SSE conversion from FP @@ -70,14 +71,14 @@ DEF_TUNE (X86_TUNE_SSE_PARTIAL_REG_DEPENDENCY, "sse_partial_reg_dependency", DEF_TUNE (X86_TUNE_SSE_PARTIAL_REG_FP_CONVERTS_DEPENDENCY, "sse_partial_reg_fp_converts_dependency", m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_BONNELL | m_AMDFAM10 - | m_BDVER | m_ZNVER | m_ALDERLAKE | m_GENERIC) + | m_BDVER | m_ZNVER | m_LUJIAZUI | m_ALDERLAKE | m_GENERIC) /* X86_TUNE_SSE_PARTIAL_REG_CONVERTS_DEPENDENCY: This knob avoids partial write to the destination in scalar SSE conversion from integer to FP. */ DEF_TUNE (X86_TUNE_SSE_PARTIAL_REG_CONVERTS_DEPENDENCY, "sse_partial_reg_converts_dependency", m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_BONNELL | m_AMDFAM10 - | m_BDVER | m_ZNVER | m_ALDERLAKE | m_GENERIC) + | m_BDVER | m_ZNVER | m_LUJIAZUI | m_ALDERLAKE | m_GENERIC) /* X86_TUNE_DEST_FALSE_DEP_FOR_GLC: This knob inserts zero-idiom before several insns to break false dependency on the dest register for GLC @@ -108,7 +109,7 @@ DEF_TUNE (X86_TUNE_PARTIAL_FLAG_REG_STALL, "partial_flag_reg_stall", DEF_TUNE (X86_TUNE_MOVX, "movx", m_PPRO | m_P4_NOCONA | m_CORE2 | m_NEHALEM | m_SANDYBRIDGE | m_BONNELL | m_SILVERMONT | m_GOLDMONT | m_KNL | m_KNM | m_INTEL - | m_GOLDMONT_PLUS | m_GEODE | m_AMD_MULTIPLE + | m_GOLDMONT_PLUS | m_GEODE | m_AMD_MULTIPLE | m_LUJIAZUI | m_CORE_AVX2 | m_TREMONT | m_ALDERLAKE | m_GENERIC) /* X86_TUNE_MEMORY_MISMATCH_STALL: Avoid partial stores that are followed by @@ -116,31 +117,31 @@ DEF_TUNE (X86_TUNE_MOVX, "movx", DEF_TUNE (X86_TUNE_MEMORY_MISMATCH_STALL, "memory_mismatch_stall", m_P4_NOCONA | m_CORE_ALL | m_BONNELL | m_SILVERMONT | m_INTEL | m_KNL | m_KNM | m_GOLDMONT | m_GOLDMONT_PLUS | m_AMD_MULTIPLE - | m_TREMONT | m_ALDERLAKE | m_GENERIC) + | m_LUJIAZUI | m_TREMONT | m_ALDERLAKE | m_GENERIC) /* X86_TUNE_FUSE_CMP_AND_BRANCH_32: Fuse compare with a subsequent conditional jump instruction for 32 bit TARGET. */ DEF_TUNE (X86_TUNE_FUSE_CMP_AND_BRANCH_32, "fuse_cmp_and_branch_32", - m_CORE_ALL | m_BDVER | m_ZNVER | m_GENERIC) + m_CORE_ALL | m_BDVER | m_ZNVER | m_LUJIAZUI | m_GENERIC) /* X86_TUNE_FUSE_CMP_AND_BRANCH_64: Fuse compare with a subsequent conditional jump instruction for TARGET_64BIT. */ DEF_TUNE (X86_TUNE_FUSE_CMP_AND_BRANCH_64, "fuse_cmp_and_branch_64", m_NEHALEM | m_SANDYBRIDGE | m_CORE_AVX2 | m_BDVER - | m_ZNVER | m_GENERIC) + | m_ZNVER | m_LUJIAZUI | m_GENERIC) /* X86_TUNE_FUSE_CMP_AND_BRANCH_SOFLAGS: Fuse compare with a subsequent conditional jump instruction when the condition jump check sign flag (SF) or overflow flag (OF). */ DEF_TUNE (X86_TUNE_FUSE_CMP_AND_BRANCH_SOFLAGS, "fuse_cmp_and_branch_soflags", m_NEHALEM | m_SANDYBRIDGE | m_CORE_AVX2 | m_BDVER - | m_ZNVER | m_GENERIC) + | m_ZNVER | m_LUJIAZUI | m_GENERIC) /* X86_TUNE_FUSE_ALU_AND_BRANCH: Fuse alu with a subsequent conditional jump instruction when the alu instruction produces the CCFLAG consumed by the conditional jump instruction. */ DEF_TUNE (X86_TUNE_FUSE_ALU_AND_BRANCH, "fuse_alu_and_branch", - m_SANDYBRIDGE | m_CORE_AVX2 | m_GENERIC) + m_SANDYBRIDGE | m_CORE_AVX2 | m_LUJIAZUI | m_GENERIC) /*****************************************************************************/ @@ -157,7 +158,7 @@ DEF_TUNE (X86_TUNE_FUSE_ALU_AND_BRANCH, "fuse_alu_and_branch", DEF_TUNE (X86_TUNE_ACCUMULATE_OUTGOING_ARGS, "accumulate_outgoing_args", m_PPRO | m_P4_NOCONA | m_BONNELL | m_SILVERMONT | m_KNL | m_KNM | m_INTEL - | m_GOLDMONT | m_GOLDMONT_PLUS | m_ATHLON_K8) + | m_GOLDMONT | m_GOLDMONT_PLUS | m_ATHLON_K8 | m_LUJIAZUI) /* X86_TUNE_PROLOGUE_USING_MOVE: Do not use push/pop in prologues that are considered on critical path. */ @@ -171,15 +172,15 @@ DEF_TUNE (X86_TUNE_EPILOGUE_USING_MOVE, "epilogue_using_move", /* X86_TUNE_USE_LEAVE: Use "leave" instruction in epilogues where it fits. */ DEF_TUNE (X86_TUNE_USE_LEAVE, "use_leave", - m_386 | m_CORE_ALL | m_K6_GEODE | m_AMD_MULTIPLE | m_TREMONT - | m_ALDERLAKE | m_GENERIC) + m_386 | m_CORE_ALL | m_K6_GEODE | m_AMD_MULTIPLE | m_LUJIAZUI + | m_TREMONT | m_ALDERLAKE | m_GENERIC) /* X86_TUNE_PUSH_MEMORY: Enable generation of "push mem" instructions. Some chips, like 486 and Pentium works faster with separate load and push instructions. */ DEF_TUNE (X86_TUNE_PUSH_MEMORY, "push_memory", m_386 | m_P4_NOCONA | m_CORE_ALL | m_K6_GEODE | m_AMD_MULTIPLE - | m_TREMONT | m_ALDERLAKE | m_GENERIC) + | m_LUJIAZUI | m_TREMONT | m_ALDERLAKE | m_GENERIC) /* X86_TUNE_SINGLE_PUSH: Enable if single push insn is preferred over esp subtraction. */ @@ -234,7 +235,7 @@ DEF_TUNE (X86_TUNE_SOFTWARE_PREFETCHING_BENEFICIAL, "software_prefetching_benefi /* X86_TUNE_LCP_STALL: Avoid an expensive length-changing prefix stall on 16-bit immediate moves into memory on Core2 and Corei7. */ -DEF_TUNE (X86_TUNE_LCP_STALL, "lcp_stall", m_CORE_ALL | m_GENERIC) +DEF_TUNE (X86_TUNE_LCP_STALL, "lcp_stall", m_CORE_ALL | m_LUJIAZUI | m_GENERIC) /* X86_TUNE_READ_MODIFY: Enable use of read-modify instructions such as "add mem, reg". */ @@ -249,19 +250,20 @@ DEF_TUNE (X86_TUNE_READ_MODIFY, "read_modify", ~(m_PENT | m_LAKEMONT | m_PPRO)) DEF_TUNE (X86_TUNE_USE_INCDEC, "use_incdec", ~(m_P4_NOCONA | m_CORE2 | m_NEHALEM | m_SANDYBRIDGE | m_BONNELL | m_SILVERMONT | m_INTEL | m_KNL | m_KNM | m_GOLDMONT - | m_GOLDMONT_PLUS | m_TREMONT | m_ALDERLAKE | m_GENERIC)) + | m_GOLDMONT_PLUS | m_TREMONT | m_ALDERLAKE | m_LUJIAZUI + | m_GENERIC)) /* X86_TUNE_INTEGER_DFMODE_MOVES: Enable if integer moves are preferred for DFmode copies */ DEF_TUNE (X86_TUNE_INTEGER_DFMODE_MOVES, "integer_dfmode_moves", ~(m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_BONNELL | m_SILVERMONT - | m_KNL | m_KNM | m_INTEL | m_GEODE | m_AMD_MULTIPLE | m_GOLDMONT - | m_GOLDMONT_PLUS | m_TREMONT | m_ALDERLAKE | m_GENERIC)) + | m_KNL | m_KNM | m_INTEL | m_GEODE | m_AMD_MULTIPLE | m_LUJIAZUI + | m_GOLDMONT | m_GOLDMONT_PLUS | m_TREMONT | m_ALDERLAKE | m_GENERIC)) /* X86_TUNE_OPT_AGU: Optimize for Address Generation Unit. This flag will impact LEA instruction selection. */ DEF_TUNE (X86_TUNE_OPT_AGU, "opt_agu", m_BONNELL | m_SILVERMONT | m_KNL - | m_KNM | m_GOLDMONT | m_GOLDMONT_PLUS | m_INTEL) + | m_KNM | m_GOLDMONT | m_GOLDMONT_PLUS | m_INTEL | m_LUJIAZUI) /* X86_TUNE_AVOID_LEA_FOR_ADDR: Avoid lea for address computation. */ DEF_TUNE (X86_TUNE_AVOID_LEA_FOR_ADDR, "avoid_lea_for_addr", @@ -294,7 +296,7 @@ DEF_TUNE (X86_TUNE_SINGLE_STRINGOP, "single_stringop", m_386 | m_P4_NOCONA) move/set sequences of bytes with known size. */ DEF_TUNE (X86_TUNE_PREFER_KNOWN_REP_MOVSB_STOSB, "prefer_known_rep_movsb_stosb", - m_SKYLAKE | m_ALDERLAKE | m_TREMONT | m_CORE_AVX512) + m_SKYLAKE | m_ALDERLAKE | m_TREMONT | m_CORE_AVX512 | m_LUJIAZUI) /* X86_TUNE_MISALIGNED_MOVE_STRING_PRO_EPILOGUES: Enable generation of compact prologues and epilogues by issuing a misaligned moves. This @@ -303,15 +305,15 @@ DEF_TUNE (X86_TUNE_PREFER_KNOWN_REP_MOVSB_STOSB, FIXME: This may actualy be a win on more targets than listed here. */ DEF_TUNE (X86_TUNE_MISALIGNED_MOVE_STRING_PRO_EPILOGUES, "misaligned_move_string_pro_epilogues", - m_386 | m_486 | m_CORE_ALL | m_AMD_MULTIPLE | m_TREMONT + m_386 | m_486 | m_CORE_ALL | m_AMD_MULTIPLE | m_LUJIAZUI | m_TREMONT | m_ALDERLAKE | m_GENERIC) /* X86_TUNE_USE_SAHF: Controls use of SAHF. */ DEF_TUNE (X86_TUNE_USE_SAHF, "use_sahf", m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_BONNELL | m_SILVERMONT | m_KNL | m_KNM | m_INTEL | m_K6_GEODE | m_K8 | m_AMDFAM10 | m_BDVER - | m_BTVER | m_ZNVER | m_GOLDMONT | m_GOLDMONT_PLUS | m_TREMONT - | m_ALDERLAKE | m_GENERIC) + | m_BTVER | m_ZNVER | m_LUJIAZUI | m_GOLDMONT | m_GOLDMONT_PLUS + | m_TREMONT | m_ALDERLAKE | m_GENERIC) /* X86_TUNE_USE_CLTD: Controls use of CLTD and CTQO instructions. */ DEF_TUNE (X86_TUNE_USE_CLTD, "use_cltd", @@ -321,13 +323,14 @@ DEF_TUNE (X86_TUNE_USE_CLTD, "use_cltd", /* X86_TUNE_USE_BT: Enable use of BT (bit test) instructions. */ DEF_TUNE (X86_TUNE_USE_BT, "use_bt", m_CORE_ALL | m_BONNELL | m_SILVERMONT | m_KNL | m_KNM | m_INTEL - | m_LAKEMONT | m_AMD_MULTIPLE | m_GOLDMONT | m_GOLDMONT_PLUS - | m_TREMONT | m_ALDERLAKE | m_GENERIC) + | m_LAKEMONT | m_AMD_MULTIPLE | m_LUJIAZUI | m_GOLDMONT + | m_GOLDMONT_PLUS | m_TREMONT | m_ALDERLAKE | m_GENERIC) /* X86_TUNE_AVOID_FALSE_DEP_FOR_BMI: Avoid false dependency for bit-manipulation instructions. */ DEF_TUNE (X86_TUNE_AVOID_FALSE_DEP_FOR_BMI, "avoid_false_dep_for_bmi", - m_SANDYBRIDGE | m_CORE_AVX2 | m_TREMONT | m_ALDERLAKE | m_GENERIC) + m_SANDYBRIDGE | m_CORE_AVX2 | m_TREMONT | m_ALDERLAKE | m_LUJIAZUI + | m_GENERIC) /* X86_TUNE_ADJUST_UNROLL: This enables adjusting the unroll factor based on hardware capabilities. Bdver3 hardware has a loop buffer which makes @@ -339,18 +342,19 @@ DEF_TUNE (X86_TUNE_ADJUST_UNROLL, "adjust_unroll_factor", m_BDVER3 | m_BDVER4) if-converted sequence to one. */ DEF_TUNE (X86_TUNE_ONE_IF_CONV_INSN, "one_if_conv_insn", m_SILVERMONT | m_KNL | m_KNM | m_INTEL | m_CORE_ALL | m_GOLDMONT - | m_GOLDMONT_PLUS | m_TREMONT | m_ALDERLAKE | m_GENERIC) + | m_GOLDMONT_PLUS | m_TREMONT | m_ALDERLAKE | m_LUJIAZUI | m_GENERIC) /* X86_TUNE_AVOID_MFENCE: Use lock prefixed instructions instead of mfence. */ DEF_TUNE (X86_TUNE_AVOID_MFENCE, "avoid_mfence", - m_CORE_ALL | m_BDVER | m_ZNVER | m_TREMONT | m_ALDERLAKE | m_GENERIC) + m_CORE_ALL | m_BDVER | m_ZNVER | m_LUJIAZUI | m_TREMONT | m_ALDERLAKE + | m_GENERIC) /* X86_TUNE_EXPAND_ABS: This enables a new abs pattern by generating instructions for abs (x) = (((signed) x >> (W-1) ^ x) - (signed) x >> (W-1)) instead of cmove or SSE max/abs instructions. */ DEF_TUNE (X86_TUNE_EXPAND_ABS, "expand_abs", m_CORE_ALL | m_SILVERMONT | m_KNL | m_KNM | m_GOLDMONT - | m_GOLDMONT_PLUS) + | m_GOLDMONT_PLUS | m_LUJIAZUI) /*****************************************************************************/ /* 387 instruction selection tuning */ @@ -367,17 +371,17 @@ DEF_TUNE (X86_TUNE_USE_HIMODE_FIOP, "use_himode_fiop", DEF_TUNE (X86_TUNE_USE_SIMODE_FIOP, "use_simode_fiop", ~(m_PENT | m_LAKEMONT | m_PPRO | m_CORE_ALL | m_BONNELL | m_SILVERMONT | m_KNL | m_KNM | m_INTEL | m_AMD_MULTIPLE - | m_GOLDMONT | m_GOLDMONT_PLUS | m_TREMONT | m_ALDERLAKE - | m_GENERIC)) + | m_LUJIAZUI | m_GOLDMONT | m_GOLDMONT_PLUS | m_TREMONT + | m_ALDERLAKE | m_GENERIC)) /* X86_TUNE_USE_FFREEP: Use freep instruction instead of fstp. */ -DEF_TUNE (X86_TUNE_USE_FFREEP, "use_ffreep", m_AMD_MULTIPLE) +DEF_TUNE (X86_TUNE_USE_FFREEP, "use_ffreep", m_AMD_MULTIPLE | m_LUJIAZUI) /* X86_TUNE_EXT_80387_CONSTANTS: Use fancy 80387 constants, such as PI. */ DEF_TUNE (X86_TUNE_EXT_80387_CONSTANTS, "ext_80387_constants", m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_BONNELL | m_SILVERMONT - | m_KNL | m_KNM | m_INTEL | m_K6_GEODE | m_ATHLON_K8 | m_GOLDMONT - | m_GOLDMONT_PLUS | m_TREMONT | m_ALDERLAKE | m_GENERIC) + | m_KNL | m_KNM | m_INTEL | m_K6_GEODE | m_ATHLON_K8 | m_LUJIAZUI + | m_GOLDMONT | m_GOLDMONT_PLUS | m_TREMONT | m_ALDERLAKE | m_GENERIC) /*****************************************************************************/ /* SSE instruction selection tuning */ @@ -393,14 +397,14 @@ DEF_TUNE (X86_TUNE_GENERAL_REGS_SSE_SPILL, "general_regs_sse_spill", DEF_TUNE (X86_TUNE_SSE_UNALIGNED_LOAD_OPTIMAL, "sse_unaligned_load_optimal", m_NEHALEM | m_SANDYBRIDGE | m_CORE_AVX2 | m_SILVERMONT | m_KNL | m_KNM | m_INTEL | m_GOLDMONT | m_GOLDMONT_PLUS | m_TREMONT | m_ALDERLAKE - | m_AMDFAM10 | m_BDVER | m_BTVER | m_ZNVER | m_GENERIC) + | m_AMDFAM10 | m_BDVER | m_BTVER | m_ZNVER | m_LUJIAZUI | m_GENERIC) /* X86_TUNE_SSE_UNALIGNED_STORE_OPTIMAL: Use movups for misaligned stores instead of a sequence loading registers by parts. */ DEF_TUNE (X86_TUNE_SSE_UNALIGNED_STORE_OPTIMAL, "sse_unaligned_store_optimal", m_NEHALEM | m_SANDYBRIDGE | m_CORE_AVX2 | m_SILVERMONT | m_KNL | m_KNM - | m_INTEL | m_GOLDMONT | m_GOLDMONT_PLUS - | m_TREMONT | m_ALDERLAKE | m_BDVER | m_ZNVER | m_GENERIC) + | m_INTEL | m_GOLDMONT | m_GOLDMONT_PLUS | m_TREMONT | m_ALDERLAKE + | m_BDVER | m_ZNVER | m_LUJIAZUI | m_GENERIC) /* X86_TUNE_SSE_PACKED_SINGLE_INSN_OPTIMAL: Use packed single precision 128bit instructions instead of double where possible. */ @@ -409,13 +413,14 @@ DEF_TUNE (X86_TUNE_SSE_PACKED_SINGLE_INSN_OPTIMAL, "sse_packed_single_insn_optim /* X86_TUNE_SSE_TYPELESS_STORES: Always movaps/movups for 128bit stores. */ DEF_TUNE (X86_TUNE_SSE_TYPELESS_STORES, "sse_typeless_stores", - m_AMD_MULTIPLE | m_CORE_ALL | m_TREMONT | m_ALDERLAKE | m_GENERIC) + m_AMD_MULTIPLE | m_LUJIAZUI | m_CORE_ALL | m_TREMONT | m_ALDERLAKE + | m_GENERIC) /* X86_TUNE_SSE_LOAD0_BY_PXOR: Always use pxor to load0 as opposed to xorps/xorpd and other variants. */ DEF_TUNE (X86_TUNE_SSE_LOAD0_BY_PXOR, "sse_load0_by_pxor", m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_BDVER | m_BTVER | m_ZNVER - | m_TREMONT | m_ALDERLAKE | m_GENERIC) + | m_LUJIAZUI | m_TREMONT | m_ALDERLAKE | m_GENERIC) /* X86_TUNE_INTER_UNIT_MOVES_TO_VEC: Enable moves in from integer to SSE registers. If disabled, the moves will be done by storing diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 84e6f66..a2e2a30 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -21840,6 +21840,9 @@ Intel Knights Landing CPU. @item knm Intel Knights Mill CPU. +@item lujiazui +ZHAOXIN lujiazui CPU. + @item amdfam10h AMD Family 10h CPU. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index d8095e3..8becba3 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -31816,6 +31816,11 @@ VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 instruction set support. (No scheduling is implemented for this chip.) +@item lujiazui +ZHAOXIN lujiazui CPU with x86-64, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, +SSE4.2, AVX, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, CX16, +ABM, BMI, BMI2, F16C, FXSR, RDSEED instruction set support. + @item geode AMD Geode embedded processor with MMX and 3DNow!@: instruction set support. @end table diff --git a/gcc/testsuite/g++.target/i386/mv32.C b/gcc/testsuite/g++.target/i386/mv32.C new file mode 100644 index 0000000..8f74352 --- /dev/null +++ b/gcc/testsuite/g++.target/i386/mv32.C @@ -0,0 +1,31 @@ +// Test that dispatching can choose the right multiversion +// for ZHAOXIN CPU with the same internal GCC processor id + +// { dg-do run } +// { dg-require-ifunc "" } +// { dg-options "-O2" } + +#include + +int __attribute__ ((target("default"))) +foo () +{ + return 0; +} + +int __attribute__ ((target("arch=lujiazui"))) foo () { + return 1; +} + + +int main () +{ + int val = foo (); + + if (__builtin_cpu_is ("lujiazui")) + assert (val == 1); + else + assert (val == 0); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/funcspec-56.inc b/gcc/testsuite/gcc.target/i386/funcspec-56.inc index 8499fdf..b76dddb 100644 --- a/gcc/testsuite/gcc.target/i386/funcspec-56.inc +++ b/gcc/testsuite/gcc.target/i386/funcspec-56.inc @@ -184,6 +184,7 @@ extern void test_arch_cooperlake (void) __attribute__((__target__("arch= extern void test_arch_sapphirerapids (void) __attribute__((__target__("arch=sapphirerapids"))); extern void test_arch_alderlake (void) __attribute__((__target__("arch=alderlake"))); extern void test_arch_rocketlake (void) __attribute__((__target__("arch=rocketlake"))); +extern void test_arch_lujiazui (void) __attribute__((__target__("arch=lujiazui"))); extern void test_arch_k8 (void) __attribute__((__target__("arch=k8"))); extern void test_arch_k8_sse3 (void) __attribute__((__target__("arch=k8-sse3"))); extern void test_arch_opteron (void) __attribute__((__target__("arch=opteron"))); @@ -205,6 +206,7 @@ extern void test_tune_core2 (void) __attribute__((__target__("tune=core2"))); extern void test_tune_corei7 (void) __attribute__((__target__("tune=corei7"))); extern void test_tune_corei7_avx (void) __attribute__((__target__("tune=corei7-avx"))); extern void test_tune_core_avx2 (void) __attribute__((__target__("tune=core-avx2"))); +extern void test_tune_lujiazui (void) __attribute__((__target__("tune=lujiazui"))); extern void test_tune_k8 (void) __attribute__((__target__("tune=k8"))); extern void test_tune_k8_sse3 (void) __attribute__((__target__("tune=k8-sse3"))); extern void test_tune_opteron (void) __attribute__((__target__("tune=opteron"))); -- cgit v1.1 From 2ac1459f044ee5a6ec5aee53a87fd3b8974a77f5 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Mon, 23 May 2022 15:08:13 -0400 Subject: analyzer: use 'final' and 'override' where appropriate gcc/analyzer/ChangeLog: * call-info.cc: Add "final" and "override" to all vfunc implementations that were missing them, as appropriate. * engine.cc: Likewise. * region-model.cc: Likewise. * sm-malloc.cc: Likewise. * supergraph.h: Likewise. * svalue.cc: Likewise. * varargs.cc: Likewise. Signed-off-by: David Malcolm --- gcc/analyzer/call-info.cc | 2 +- gcc/analyzer/engine.cc | 10 +++++----- gcc/analyzer/region-model.cc | 2 +- gcc/analyzer/sm-malloc.cc | 6 ++++-- gcc/analyzer/supergraph.h | 3 ++- gcc/analyzer/svalue.cc | 4 ++-- gcc/analyzer/varargs.cc | 2 +- 7 files changed, 16 insertions(+), 13 deletions(-) (limited to 'gcc') diff --git a/gcc/analyzer/call-info.cc b/gcc/analyzer/call-info.cc index 2d3fe0a..b3ff51e 100644 --- a/gcc/analyzer/call-info.cc +++ b/gcc/analyzer/call-info.cc @@ -96,7 +96,7 @@ call_info::add_events_to_path (checker_path *emission_path, m_call_info (call_info) {} - label_text get_desc (bool can_colorize) const + label_text get_desc (bool can_colorize) const final override { return m_call_info->get_desc (can_colorize); } diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc index c59374b..5ccfedf 100644 --- a/gcc/analyzer/engine.cc +++ b/gcc/analyzer/engine.cc @@ -328,7 +328,7 @@ public: } state_machine::state_t get_state (const gimple *stmt ATTRIBUTE_UNUSED, - tree var) + tree var) final override { logger * const logger = get_logger (); LOG_FUNC (logger); @@ -342,7 +342,7 @@ public: return current; } state_machine::state_t get_state (const gimple *stmt ATTRIBUTE_UNUSED, - const svalue *sval) + const svalue *sval) final override { logger * const logger = get_logger (); LOG_FUNC (logger); @@ -355,7 +355,7 @@ public: void set_next_state (const gimple *stmt, tree var, state_machine::state_t to, - tree origin) + tree origin) final override { logger * const logger = get_logger (); LOG_FUNC (logger); @@ -384,7 +384,7 @@ public: void set_next_state (const gimple *stmt, const svalue *sval, state_machine::state_t to, - tree origin) + tree origin) final override { logger * const logger = get_logger (); LOG_FUNC (logger); @@ -1597,7 +1597,7 @@ public: return false; } - label_text describe_final_event (const evdesc::final_event &ev) + label_text describe_final_event (const evdesc::final_event &ev) final override { if (m_stack_pop_event) return ev.formatted_print diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc index 6f6a061..6b49719 100644 --- a/gcc/analyzer/region-model.cc +++ b/gcc/analyzer/region-model.cc @@ -1640,7 +1640,7 @@ public: const char *get_kind () const final override { return "reason_attr_access"; } - void emit () const + void emit () const final override { inform (DECL_SOURCE_LOCATION (m_callee_fndecl), "parameter %i of %qD marked with attribute %qs", diff --git a/gcc/analyzer/sm-malloc.cc b/gcc/analyzer/sm-malloc.cc index abdce6b..3c0f890 100644 --- a/gcc/analyzer/sm-malloc.cc +++ b/gcc/analyzer/sm-malloc.cc @@ -1015,7 +1015,8 @@ public: const char *get_kind () const final override { return "possible_null_arg"; } - bool subclass_equal_p (const pending_diagnostic &base_other) const + bool subclass_equal_p (const pending_diagnostic &base_other) + const final override { const possible_null_arg &sub_other = (const possible_null_arg &)base_other; @@ -1119,7 +1120,8 @@ public: const char *get_kind () const final override { return "null_arg"; } - bool subclass_equal_p (const pending_diagnostic &base_other) const + bool subclass_equal_p (const pending_diagnostic &base_other) + const final override { const null_arg &sub_other = (const null_arg &)base_other; diff --git a/gcc/analyzer/supergraph.h b/gcc/analyzer/supergraph.h index cc53fcb..42c6df5 100644 --- a/gcc/analyzer/supergraph.h +++ b/gcc/analyzer/supergraph.h @@ -308,7 +308,8 @@ class superedge : public dedge void dump (pretty_printer *pp) const; void dump () const; - void dump_dot (graphviz_out *gv, const dump_args_t &args) const; + void dump_dot (graphviz_out *gv, const dump_args_t &args) + const final override; virtual void dump_label_to_pp (pretty_printer *pp, bool user_facing) const = 0; diff --git a/gcc/analyzer/svalue.cc b/gcc/analyzer/svalue.cc index ed289c6..2f91494 100644 --- a/gcc/analyzer/svalue.cc +++ b/gcc/analyzer/svalue.cc @@ -600,13 +600,13 @@ public: involvement_visitor (const svalue *needle) : m_needle (needle), m_found (false) {} - void visit_initial_svalue (const initial_svalue *candidate) + void visit_initial_svalue (const initial_svalue *candidate) final override { if (candidate == m_needle) m_found = true; } - void visit_conjured_svalue (const conjured_svalue *candidate) + void visit_conjured_svalue (const conjured_svalue *candidate) final override { if (candidate == m_needle) m_found = true; diff --git a/gcc/analyzer/varargs.cc b/gcc/analyzer/varargs.cc index 3f15ada..2d27484 100644 --- a/gcc/analyzer/varargs.cc +++ b/gcc/analyzer/varargs.cc @@ -466,7 +466,7 @@ public: return va_list_sm_diagnostic::subclass_equal_p (other); } - bool emit (rich_location *rich_loc) + bool emit (rich_location *rich_loc) final override { auto_diagnostic_group d; return warning_at (rich_loc, get_controlling_option (), -- cgit v1.1 From 58c9c7407a1a992ac253826790cd2b8920e3fe8f Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Mon, 23 May 2022 15:09:30 -0400 Subject: jit: use 'final' and 'override' where appropriate gcc/jit/ChangeLog: * jit-recording.h: Add "final" and "override" to all vfunc implementations that were missing them, as appropriate. Signed-off-by: David Malcolm --- gcc/jit/jit-recording.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gcc') diff --git a/gcc/jit/jit-recording.h b/gcc/jit/jit-recording.h index 2dd8a95..0dfb42f 100644 --- a/gcc/jit/jit-recording.h +++ b/gcc/jit/jit-recording.h @@ -721,14 +721,14 @@ public: /* Strip off the "const", giving the underlying type. */ type *unqualified () final override { return m_other_type; } - virtual bool is_same_type_as (type *other) + bool is_same_type_as (type *other) final override { if (!other->is_const ()) return false; return m_other_type->is_same_type_as (other->is_const ()); } - virtual type *is_const () { return m_other_type; } + type *is_const () final override { return m_other_type; } void replay_into (replayer *) final override; @@ -744,7 +744,7 @@ public: memento_of_get_volatile (type *other_type) : decorated_type (other_type) {} - virtual bool is_same_type_as (type *other) + bool is_same_type_as (type *other) final override { if (!other->is_volatile ()) return false; @@ -754,7 +754,7 @@ public: /* Strip off the "volatile", giving the underlying type. */ type *unqualified () final override { return m_other_type; } - virtual type *is_volatile () { return m_other_type; } + type *is_volatile () final override { return m_other_type; } void replay_into (replayer *) final override; @@ -1051,7 +1051,7 @@ public: void replay_into (replayer *r) final override; - virtual bool is_union () const final override { return true; } + bool is_union () const final override { return true; } private: string * make_debug_string () final override; -- cgit v1.1