diff options
author | Gaius Mulley <gaius.mulley@southwales.ac.uk> | 2022-05-23 22:10:01 +0100 |
---|---|---|
committer | Gaius Mulley <gaius.mulley@southwales.ac.uk> | 2022-05-23 22:10:01 +0100 |
commit | f17a10fdcf2dfb35a106dbd1e6732d1f8adcb7fe (patch) | |
tree | 53e66fcabf4701f4138254eb8c6f6e2965b283cc | |
parent | 9f1a305893cf32a6907e1fed8d9dd5bd4652e767 (diff) | |
parent | 58c9c7407a1a992ac253826790cd2b8920e3fe8f (diff) | |
download | gcc-f17a10fdcf2dfb35a106dbd1e6732d1f8adcb7fe.zip gcc-f17a10fdcf2dfb35a106dbd1e6732d1f8adcb7fe.tar.gz gcc-f17a10fdcf2dfb35a106dbd1e6732d1f8adcb7fe.tar.bz2 |
Merge branch 'master' into devel/modula-2.
301 files changed, 8952 insertions, 2589 deletions
diff --git a/config/ChangeLog b/config/ChangeLog index 9f122ad..9e6cc47 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,7 @@ +2022-05-20 Christophe Lyon <christophe.lyon@arm.com> + + * dfp.m4: Add aarch64 support. + 2022-05-03 Christophe Lyon <christophe.lyon@arm.com> * dfp.m4: Add license header. diff --git a/config/dfp.m4 b/config/dfp.m4 index 5b6a3f9..d1d151b 100644 --- a/config/dfp.m4 +++ b/config/dfp.m4 @@ -38,6 +38,7 @@ Valid choices are 'yes', 'bid', 'dpd', and 'no'.]) ;; ], [ case $1 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* | \ @@ -55,7 +56,7 @@ Valid choices are 'yes', 'bid', 'dpd', and 'no'.]) ;; case x$enable_decimal_float in xyes) case $1 in - i?86*-*-* | x86_64*-*-*) + aarch64* | i?86*-*-* | x86_64*-*-*) enable_decimal_float=bid ;; *) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 66fe54b..b91d393 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,173 @@ +2022-05-20 Wilco Dijkstra <wilco.dijkstra@arm.com> + + * config/aarch64/aarch64.md + (and_<SHIFT:optab><mode>3_compare0): Support rotate left. + (and_<SHIFT:optab>si3_compare0_uxtw): Likewise. + (<LOGICAL:optab>_<SHIFT:optab><mode>3): Likewise. + (<LOGICAL:optab>_<SHIFT:optab>si3_uxtw): Likewise. + (one_cmpl_<optab><mode>2): Likewise. + (<LOGICAL:optab>_one_cmpl_<SHIFT:optab><mode>3): Likewise. + (<LOGICAL:optab>_one_cmpl_<SHIFT:optab>sidi_uxtw): New pattern. + (eor_one_cmpl_<SHIFT:optab><mode>3_alt): Support rotate left. + (eor_one_cmpl_<SHIFT:optab>sidi3_alt_ze): Likewise. + (and_one_cmpl_<SHIFT:optab><mode>3_compare0): Likewise. + (and_one_cmpl_<SHIFT:optab>si3_compare0_uxtw): Likewise. + (and_one_cmpl_<SHIFT:optab><mode>3_compare0_no_reuse): Likewise. + (and_<SHIFT:optab><mode>3nr_compare0): Likewise. + (*<optab>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 <wilco.dijkstra@arm.com> + + * 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 <dmalcolm@redhat.com> + + * 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 <marcel@codesourcery.com> + + * 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 <christophe.lyon@arm.com> + + * doc/sourcebuild.texi (Decimal floating point attributes): Document + dfp_bid effective-target. + +2022-05-20 Christophe Lyon <christophe.lyon@arm.com> + + * 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<mode>_aarch64. + (movdf_aarch64): Use DFD iterator and rename into + mov<mode>_aarch64. + (movtf_aarch64): Use TFD iterator and rename into + mov<mode>_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 <christophe.lyon@arm.com> + + * configure: Regenerate. + +2022-05-19 Roger Sayle <roger@nextmovesoftware.com> + + 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 <will_schmidt@vnet.ibm.com> + + * 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 <rguenther@suse.de> + + * omp-expand.cc (expand_omp_atomic_cas): Do not short-cut + computation of the new value. + +2022-05-19 Richard Biener <rguenther@suse.de> + + * 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 <dmalcolm@redhat.com> + + * 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 <jakub@redhat.com> + + 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 <jakub@redhat.com> + + 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 <polacek@redhat.com> PR c/105131 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 756cdcb..9cf4f57 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20220519 +20220523 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 <ebotcazou@adacore.com> + + * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Constant>: 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) <N_Object_Declaration>: Deal with a constant related + to a return in a function specially. + +2022-05-19 Eric Botcazou <ebotcazou@adacore.com> + + * 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 <ebotcazou@adacore.com> + + * gcc-interface/trans.cc (gnat_gimplify_expr): Tidy up. + +2022-05-19 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Function>: 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 <ebotcazou@adacore.com> + + * 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 <ebotcazou@adacore.com> + + * gcc-interface/trans.cc (gnat_to_gnu): Do not set Current_Error_Node + to a node without location. + +2022-05-19 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Access_Subtype>: And + skip the elaboration of the designated subtype when that of its base + type has been delayed. + +2022-05-19 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Record_Subtype>: If + it is a special subtype designated by an access subtype, then defer + the completion of incomplete types. + +2022-05-19 Eric Botcazou <ebotcazou@adacore.com> + + * 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 <ebotcazou@adacore.com> + + * 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 <trojanek@adacore.com> + + * sem_prag.adb (Analyze_Pragma): Remove redundant call to + Set_Error_Posted. + +2022-05-19 Piotr Trojanek <trojanek@adacore.com> + + * 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 <ebotcazou@adacore.com> + + * sem_util.ads (Requires_Transient_Scope): Add pragma Inline. + +2022-05-19 Steve Baird <baird@adacore.com> + + * 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 <ebotcazou@adacore.com> + + * 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 <mercier@adacore.com> + + * sem_ch13.adb (Build_Predicate_Function): Ignore predicate + failure in CodePeer mode. + +2022-05-19 Arnaud Charlet <charlet@adacore.com> + + * raise-gcc.c: Fix compilation with -DSTANDALONE under windows. + +2022-05-19 Eric Botcazou <ebotcazou@adacore.com> + + * exp_ch4.adb (Narrow_Large_Operation): Preserve and reuse Etype. + +2022-05-19 Javier Miranda <miranda@adacore.com> + + * 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 <trojanek@adacore.com> + + * sem_ch13.adb (Build_Predicate_Function): Ignore predicate + failure in GNATprove mode. + +2022-05-19 Steve Baird <baird@adacore.com> + + * 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 <ebotcazou@adacore.com> + + * 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 <trojanek@adacore.com> + + * exp_ch9.adb (Build_Find_Body_Index): Remove empty Elsif_Parts + from the constructed IF statement. + +2022-05-19 Piotr Trojanek <trojanek@adacore.com> + + * 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 <charlet@adacore.com> + + * 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 <dross@adacore.com> + + * libgnat/a-strfix.adb: Add assertions. + * libgnat/a-strsup.adb: Idem. + +2022-05-19 Ed Schonberg <schonberg@adacore.com> + + * 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 <moy@adacore.com> + + * 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 <duff@adacore.com> + + * 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 <duff@adacore.com> + + * 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 <ebotcazou@adacore.com> + + * 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) <N_Simple_Return_Statement>: + 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 <ebotcazou@adacore.com> + + * 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) <N_Exception_Handler>: Adjust to above renaming. + +2022-05-19 Eric Botcazou <ebotcazou@adacore.com> + + * 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 <ebotcazou@adacore.com> + + * 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 <trojanek@adacore.com> + + * 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 <dross@adacore.com> * libgnat/s-imageu.adb (Set_Image_Unsigned): Change assertion. 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 <dmalcolm@redhat.com> + + * 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 <dmalcolm@redhat.com> PR analyzer/105103 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.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/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 <const gassign *> (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..5ccfedf 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 ()*/, @@ -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); @@ -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<exploded_node *> (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 <const gassign *> (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. */ @@ -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 @@ -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<eg_traits> 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<eg_traits> 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<fg_traits> { 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..6b49719 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<dump_path_diagnostic> { 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,9 +1638,9 @@ 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 + void emit () const final override { inform (DECL_SOURCE_LOCATION (m_callee_fndecl), "parameter %i of %qD marked with attribute %qs", @@ -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 %<fclose%> 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..3c0f890 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 <const deallocator *> 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,9 +1013,10 @@ 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 + bool subclass_equal_p (const pending_diagnostic &base_other) + const final override { const possible_null_arg &sub_other = (const possible_null_arg &)base_other; @@ -1024,12 +1025,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 +1045,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 +1075,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 +1092,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 +1100,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,9 +1118,10 @@ 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 + bool subclass_equal_p (const pending_diagnostic &base_other) + const final override { const null_arg &sub_other = (const null_arg &)base_other; @@ -1128,12 +1130,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 +1155,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 +1186,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 +1204,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 +1225,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 +1261,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 +1280,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 +1300,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 +1311,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 +1345,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 +1389,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<pattern_match> @@ -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..42c6df5 100644 --- a/gcc/analyzer/supergraph.h +++ b/gcc/analyzer/supergraph.h @@ -245,7 +245,7 @@ class supernode : public dnode<supergraph_traits> 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; @@ -308,7 +308,8 @@ class superedge : public dedge<supergraph_traits> 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; @@ -389,14 +390,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 +440,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 +476,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 +510,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 +548,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.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/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<tg_traits> 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..2d27484 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; } @@ -466,17 +466,17 @@ 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 (), "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 ("%<va_arg%> 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/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 <dmalcolm@redhat.com> + + * c-format.cc: Replace uses of "FINAL" and "OVERRIDE" with "final" + and "override". + * c-pretty-print.h: Likewise. + 2022-05-18 Marek Polacek <polacek@redhat.com> PR c/105131 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/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/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.gcc b/gcc/config.gcc index c5064dd..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 @@ -4178,8 +4186,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 +4193,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 +4223,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 +4232,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-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<function_base> { 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<multi_vector_function> (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<function_base> { 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<function_base> { 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<function_base> { 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<function_base> { 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<multi_vector_function> (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<function_base> { 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<function_base> { 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<function_base> { 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<function_base> { 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<multi_vector_function> (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<multi_vector_function> (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<poly_uint64> (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<unsigned int EXPLICIT_MASK> 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<type_class_index CLASS = function_resolver::SAME_TYPE_CLASS> 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<type_class_index CLASS = function_resolver::SAME_TYPE_CLASS> 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<typename BASE, unsigned int N> 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<unsigned int MODIFIER, struct ternary_resize2_opt_n_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; @@ -884,7 +884,7 @@ template<unsigned int MODIFIER, struct ternary_resize2_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; @@ -908,7 +908,7 @@ template<unsigned int MODIFIER, struct ternary_resize2_lane_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; @@ -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<type_class_index CLASS = function_resolver::SAME_TYPE_CLASS> 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<type_class_index CLASS = function_resolver::SAME_TYPE_CLASS> 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<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,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<function_resolver::HALF_SIZE> { 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<function_resolver::HALF_SIZE> { 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<function_resolver::QUARTER_SIZE> { 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<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,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<multi_vector_function> (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/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 2902f94..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 { @@ -4828,7 +4826,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 +10566,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 +10609,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 +10689,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 +10698,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 +10821,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 +10990,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 +11073,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 +11114,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 +11160,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 +12360,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 +12469,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 +12479,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 +13619,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 +13745,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 +13775,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 += @@ -18057,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]; + gcc_assert (arch != aarch64_no_arch); - const struct processor *cpu - = &all_cores[TARGET_CPU_DEFAULT & TARGET_CPU_MASK]; - - return &all_architectures[cpu->arch]; + return &all_architectures[arch]; } /* Return the VG value associated with -msve-vector-bits= value VALUE. */ @@ -18127,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; @@ -18145,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) { @@ -18251,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. */ @@ -18365,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; @@ -19352,7 +19307,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 +19748,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 +20011,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 +20328,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 +23238,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 +26056,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 +26334,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.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 diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index f5c6359..acec8c1 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<mode>_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>mode) + || aarch64_reg_or_fp_zero (operands[1], <MODE>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<mode>_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>mode) + || aarch64_reg_or_fp_zero (operands[1], <MODE>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<mode>_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>mode) + || aarch64_reg_or_fp_zero (operands[1], <MODE>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)] { @@ -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%<w>0, %<w>3, %<w>1, <SHIFT:shift> %2" +{ + if (<SHIFT:is_rotl>) + operands[2] = GEN_INT (<sizen> - UINTVAL (operands[2])); + return "ands\\t%<w>0, %<w>3, %<w>1, <SHIFT:shift> %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, <SHIFT:shift> %2" +{ + if (<SHIFT:is_rotl>) + operands[2] = GEN_INT (32 - UINTVAL (operands[2])); + return "ands\\t%w0, %w3, %w1, <SHIFT:shift> %2"; +} [(set_attr "type" "logics_shift_imm")] ) @@ -4577,7 +4585,11 @@ (match_operand:QI 2 "aarch64_shift_imm_<mode>" "n")) (match_operand:GPI 3 "register_operand" "r")))] "" - "<LOGICAL:logical>\\t%<w>0, %<w>3, %<w>1, <SHIFT:shift> %2" +{ + if (<SHIFT:is_rotl>) + operands[2] = GEN_INT (<sizen> - UINTVAL (operands[2])); + return "<LOGICAL:logical>\\t%<w>0, %<w>3, %<w>1, <SHIFT:shift> %2"; +} [(set_attr "type" "logic_shift_imm")] ) @@ -4647,17 +4659,6 @@ "operands[3] = gen_reg_rtx (<MODE>mode);" ) -(define_insn "*<optab>_rol<mode>3" - [(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_<mode>" "n")) - (match_operand:GPI 3 "register_operand" "r")))] - "" - "<logical>\\t%<w>0, %<w>3, %<w>1, ror #(<sizen> - %2)" - [(set_attr "type" "logic_shift_imm")] -) - ;; zero_extend versions of above (define_insn "*<LOGICAL:optab>_<SHIFT:optab>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"))))] "" - "<LOGICAL:logical>\\t%w0, %w3, %w1, <SHIFT:shift> %2" - [(set_attr "type" "logic_shift_imm")] -) - -(define_insn "*<optab>_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"))))] - "" - "<logical>\\t%w0, %w3, %w1, ror #(32 - %2)" +{ + if (<SHIFT:is_rotl>) + operands[2] = GEN_INT (32 - UINTVAL (operands[2])); + return "<LOGICAL:logical>\\t%w0, %w3, %w1, <SHIFT:shift> %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_<mode>" "n"))))] "" - "mvn\\t%<w>0, %<w>1, <shift> %2" +{ + if (<SHIFT:is_rotl>) + operands[2] = GEN_INT (<sizen> - UINTVAL (operands[2])); + return "mvn\\t%<w>0, %<w>1, <shift> %2"; +} [(set_attr "type" "logic_shift_imm")] ) @@ -4815,7 +4812,28 @@ (match_operand:QI 2 "aarch64_shift_imm_<mode>" "n"))) (match_operand:GPI 3 "register_operand" "r")))] "" - "<LOGICAL:nlogical>\\t%<w>0, %<w>3, %<w>1, <SHIFT:shift> %2" +{ + if (<SHIFT:is_rotl>) + operands[2] = GEN_INT (<sizen> - UINTVAL (operands[2])); + return "<LOGICAL:nlogical>\\t%<w>0, %<w>3, %<w>1, <SHIFT:shift> %2"; +} + [(set_attr "type" "logic_shift_imm")] +) + +;; Zero-extend version of the above. +(define_insn "<LOGICAL:optab>_one_cmpl_<SHIFT:optab>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 (<SHIFT:is_rotl>) + operands[2] = GEN_INT (32 - UINTVAL (operands[2])); + return "<LOGICAL:nlogical>\\t%w0, %w3, %w1, <SHIFT:shift> %2"; +} [(set_attr "type" "logic_shift_imm")] ) @@ -4827,7 +4845,11 @@ (match_operand:QI 2 "aarch64_shift_imm_<mode>" "n")) (match_operand:GPI 3 "register_operand" "r"))))] "" - "eon\\t%<w>0, %<w>3, %<w>1, <SHIFT:shift> %2" +{ + if (<SHIFT:is_rotl>) + operands[2] = GEN_INT (<sizen> - UINTVAL (operands[2])); + return "eon\\t%<w>0, %<w>3, %<w>1, <SHIFT:shift> %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, <SHIFT:shift> %2" +{ + if (<SHIFT:is_rotl>) + operands[2] = GEN_INT (32 - UINTVAL (operands[2])); + return "eon\\t%w0, %w3, %w1, <SHIFT:shift> %2"; +} [(set_attr "type" "logic_shift_imm")] ) @@ -4859,7 +4885,11 @@ (SHIFT:GPI (match_dup 1) (match_dup 2))) (match_dup 3)))] "" - "bics\\t%<w>0, %<w>3, %<w>1, <SHIFT:shift> %2" +{ + if (<SHIFT:is_rotl>) + operands[2] = GEN_INT (<sizen> - UINTVAL (operands[2])); + return "bics\\t%<w>0, %<w>3, %<w>1, <SHIFT:shift> %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, <SHIFT:shift> %2" +{ + if (<SHIFT:is_rotl>) + operands[2] = GEN_INT (32 - UINTVAL (operands[2])); + return "bics\\t%w0, %w3, %w1, <SHIFT:shift> %2"; +} [(set_attr "type" "logics_shift_imm")] ) @@ -4892,7 +4926,11 @@ (match_operand:GPI 2 "register_operand" "r")) (const_int 0)))] "" - "bics\\t<w>zr, %<w>2, %<w>0, <SHIFT:shift> %1" +{ + if (<SHIFT:is_rotl>) + operands[1] = GEN_INT (<sizen> - UINTVAL (operands[1])); + return "bics\\t<w>zr, %<w>2, %<w>0, <SHIFT:shift> %1"; +} [(set_attr "type" "logics_shift_imm")] ) @@ -5066,7 +5104,11 @@ (match_operand:GPI 2 "register_operand" "r")) (const_int 0)))] "" - "tst\\t%<w>2, %<w>0, <SHIFT:shift> %1" +{ + if (<SHIFT:is_rotl>) + operands[1] = GEN_INT (<sizen> - UINTVAL (operands[1])); + return "tst\\t%<w>2, %<w>0, <SHIFT:shift> %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 "*rol<mode>3_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>mode)" +{ + operands[3] = GEN_INT (<sizen> - UINTVAL (operands[2])); + return "ror\\t%<w>0, %<w>1, %3"; +} + [(set_attr "type" "rotate_imm")] +) + +;; zero_extend version of shifts (define_insn "*<optab>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 "*<optab><mode>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 "*ror<mode>3_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>mode)" -{ - operands[3] = GEN_INT (<sizen> - UINTVAL (operands[2])); - return "ror\\t%<w>0, %<w>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 "*<ANY_EXTEND:optab><GPI:mode>_ashl<SHORT:mode>" [(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 88af964..1be6a91 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]) @@ -2109,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]) @@ -2239,6 +2252,7 @@ (ashiftrt "ashr") (lshiftrt "lshr") (rotatert "rotr") + (rotate "rotl") (sign_extend "extend") (zero_extend "zero_extend") (sign_extract "extv") @@ -2328,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/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<<PROCESSOR_TREMONT) #define m_INTEL (HOST_WIDE_INT_1U<<PROCESSOR_INTEL) +#define m_LUJIAZUI (HOST_WIDE_INT_1U<<PROCESSOR_LUJIAZUI) + #define m_GEODE (HOST_WIDE_INT_1U<<PROCESSOR_GEODE) #define m_K6 (HOST_WIDE_INT_1U<<PROCESSOR_K6) #define m_K6_GEODE (m_K6 | m_GEODE) @@ -755,6 +757,7 @@ static const struct processor_costs *processor_cost_table[] = &alderlake_cost, &icelake_cost, &intel_cost, + &lujiazui_cost, &geode_cost, &k6_cost, &athlon_cost, 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); diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 363082b..f16df63 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2243,6 +2243,7 @@ enum processor_type PROCESSOR_ALDERLAKE, PROCESSOR_ROCKETLAKE, PROCESSOR_INTEL, + PROCESSOR_LUJIAZUI, PROCESSOR_GEODE, PROCESSOR_K6, PROCESSOR_ATHLON, diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 792bae1..050dee7 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -473,8 +473,8 @@ ;; Processor type. (define_attr "cpu" "none,pentium,pentiumpro,geode,k6,athlon,k8,core2,nehalem, - atom,slm,glm,haswell,generic,amdfam10,bdver1,bdver2,bdver3, - bdver4,btver2,znver1,znver2,znver3" + atom,slm,glm,haswell,generic,lujiazui,amdfam10,bdver1, + bdver2,bdver3,bdver4,btver2,znver1,znver2,znver3" (const (symbol_ref "ix86_schedule"))) ;; A basic instruction type. Refinements due to arguments to be @@ -1310,6 +1310,7 @@ (include "glm.md") (include "core2.md") (include "haswell.md") +(include "lujiazui.md") ;; Operand and operator predicates and constraints diff --git a/gcc/config/i386/lujiazui.md b/gcc/config/i386/lujiazui.md new file mode 100644 index 0000000..9046c09 --- /dev/null +++ b/gcc/config/i386/lujiazui.md @@ -0,0 +1,844 @@ +;; Copyright (C) 2012-2022 Free Software Foundation, Inc. +;; +;; This file is part of GCC. +;; +;; GCC is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. +;; +;; GCC is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GCC; see the file COPYING3. If not see +;; <http://www.gnu.org/licenses/>. +;; + +;; 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 017ffa6..ea34a93 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 @@ -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/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'] # 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); 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 ;; *) 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 <dmalcolm@redhat.com> + + * cxx-pretty-print.h: Replace uses of "FINAL" and "OVERRIDE" with + "final" and "override". + * error.cc: Likewise. + 2022-05-18 Marek Polacek <polacek@redhat.com> PR c++/105634 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_graph_traits> { 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<test_graph_traits> : dedge<test_graph_traits> (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/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/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index c603afd..9c9b337 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1942,6 +1942,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/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/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-expr.cc b/gcc/gimple-expr.cc index 5d10c24..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_condexpr_1 (t, true, false); -} - /* 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/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-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-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 <gassign *> (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/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/gimplify.cc b/gcc/gimplify.cc index 260993b..98f5544 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); } @@ -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/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/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 <dmalcolm@redhat.com> + + * 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 <mliska@suse.cz> * jit-builtins.cc (find_builtin_by_name): Use ARRAY_SIZE. 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..0dfb42f 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 <playback::location *> (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,29 +712,29 @@ 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) + 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; + 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". */ @@ -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; @@ -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; } + type *is_volatile () 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; }; /* 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<type *> &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; } + 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 <playback::param *> (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 <playback::block *> (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 <block *> 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 <typename T> 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 <block *> 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 <block *> get_successor_blocks () const FINAL OVERRIDE; + vec <block *> 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 <block *> get_successor_blocks () const FINAL OVERRIDE; + vec <block *> 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 <block *> get_successor_blocks () const FINAL OVERRIDE; + vec <block *> 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 <block *> get_successor_blocks () const FINAL OVERRIDE; + vec <block *> 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 <playback::block *> *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 <playback::block *> *) FINAL OVERRIDE + (auto_vec <playback::block *> *) 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 <block *> get_successor_blocks () const FINAL OVERRIDE; + vec <block *> 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 <playback::block *> *out) FINAL OVERRIDE; + (auto_vec <playback::block *> *out) final override; private: auto_vec <block *> 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; @@ -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/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-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/omp-low.cc b/gcc/omp-low.cc index c83af6c..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: @@ -4011,7 +4022,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. */ @@ -12869,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)) { @@ -12900,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: @@ -12939,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)) @@ -13352,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); @@ -13417,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: @@ -13426,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); @@ -13592,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); @@ -13686,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) 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/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e4c2c46..ef7e0b4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,150 @@ +2022-05-21 Dimitar Dimitrov <dimitar@dinux.eu> + + * 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 <dimitar@dinux.eu> + + 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 <dimitar@dinux.eu> + + PR middle-end/53535 + * gcc.dg/pr46647.c: Skip for pru target. + +2022-05-21 Dimitar Dimitrov <dimitar@dinux.eu> + + * gcc.dg/ifcvt-4.c: Skip for PRU. + +2022-05-21 Dimitar Dimitrov <dimitar@dinux.eu> + + * gcc.dg/Warray-bounds-48-novec.c: Add expected warnings + if target packs the structs by default. + +2022-05-20 Marc Poulhiès <poulhies@adacore.com> + + * g++.dg/ext/visibility/visibility-local-extern1.C: Add missing + dg-require-effective-target fpic. + +2022-05-20 Wilco Dijkstra <wilco.dijkstra@arm.com> + + * gcc.target/aarch64/ror_2.c: New test. + * gcc.target/aarch64/ror_3.c: New test. + +2022-05-20 Christophe Lyon <christophe.lyon@arm.com> + + * gcc.dg/torture/convert-dfp-2.c: New test. + * gcc.dg/torture/convert-dfp.c: New test. + +2022-05-20 Christophe Lyon <christophe.lyon@arm.com> + + * 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 <christophe.lyon@arm.com> + + * 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 <christophe.lyon@arm.com> + + * 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 <christophe.lyon@arm.com> + + * c-c++-common/dfp/pr39986.c: Accept .word directive. + +2022-05-19 Jonathan Wakely <jwakely@redhat.com> + + * g++.dg/cpp0x/variadic-tuple.C: Qualify function to avoid ADL + finding std::make_tuple. + +2022-05-19 Roger Sayle <roger@nextmovesoftware.com> + + PR middle-end/98865 + * gcc.target/i386/pr98865.c: New test case. + +2022-05-19 Giuliano Belinassi <gbelinassi@suse.de> + + 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 <jakub@redhat.com> + + PR debug/105630 + * gcc.dg/pr105630.c: New test. + +2022-05-19 Jakub Jelinek <jakub@redhat.com> + + PR c/105635 + * gcc.dg/pr105635.c: New test. + 2022-05-18 Marek Polacek <polacek@redhat.com> PR c/105131 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" } } */ 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<int, float, std::string> t3c = - make_tuple(17, 2.718281828, std::string("Fun")); + ::make_tuple(17, 2.718281828, std::string("Fun")); int seventeen = 17; double pi = 3.14159; 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 <decimal/decimal> + +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 <decimal/decimal> 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 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) 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 <assert.h> + +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.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" } } 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/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/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))); 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" } } */ 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; } 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/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-*-* } } } */ 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/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 } } } } */ 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/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-*-* } } } } } */ 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/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 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; +} 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"))); 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" } } */ 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 {} { 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-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_t> 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-if-conv.cc b/gcc/tree-if-conv.cc index 4531ca5..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); @@ -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), @@ -1863,16 +1884,14 @@ gen_phi_arg_condition (gphi *phi, vec<int> *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; @@ -1952,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) { @@ -2053,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), @@ -2591,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); 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-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc index 0917202..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_condexpr (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); 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/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.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, 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, diff --git a/include/demangle.h b/include/demangle.h index 44a2737..e2aa4a9 100644 --- a/include/demangle.h +++ b/include/demangle.h @@ -451,7 +451,12 @@ enum demangle_component_type DEMANGLE_COMPONENT_NOEXCEPT, DEMANGLE_COMPONENT_THROW_SPEC, - DEMANGLE_COMPONENT_STRUCTURED_BINDING + DEMANGLE_COMPONENT_STRUCTURED_BINDING, + + DEMANGLE_COMPONENT_MODULE_NAME, + DEMANGLE_COMPONENT_MODULE_PARTITION, + DEMANGLE_COMPONENT_MODULE_ENTITY, + DEMANGLE_COMPONENT_MODULE_INIT, }; /* Types which are only used internally. */ diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index a024289..d4dd88b 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,8 @@ +2022-05-20 David Malcolm <dmalcolm@redhat.com> + + * lex.cc: Replace uses of "FINAL" and "OVERRIDE" with "final" and + "override". + 2022-02-11 Joseph Myers <joseph@codesourcery.com> * Makefile.in (po/$(PACKAGE).pot): Also handle cpp_warning_at, diff --git a/libcpp/lex.cc b/libcpp/lex.cc index fb1dfab..f891d3e 100644 --- a/libcpp/lex.cc +++ b/libcpp/lex.cc @@ -1523,7 +1523,7 @@ class unpaired_bidi_rich_location : public rich_location class custom_range_label : public range_label { public: - label_text get_text (unsigned range_idx) const FINAL OVERRIDE + label_text get_text (unsigned range_idx) const final override { /* range 0 is the primary location; each subsequent range i + 1 is for bidi::vec[i]. */ diff --git a/libdecnumber/ChangeLog b/libdecnumber/ChangeLog index fb735a2..774c358 100644 --- a/libdecnumber/ChangeLog +++ b/libdecnumber/ChangeLog @@ -1,3 +1,7 @@ +2022-05-20 Christophe Lyon <christophe.lyon@arm.com> + + * configure: Regenerate. + 2021-10-22 Eric Gallager <egallager@gcc.gnu.org> PR other/102663 diff --git a/libdecnumber/configure b/libdecnumber/configure index da5302f..fb6db05 100755 --- a/libdecnumber/configure +++ b/libdecnumber/configure @@ -4903,6 +4903,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* | \ @@ -4923,7 +4924,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 ;; *) diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 5d351a6..cd82a1d 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,17 @@ +2022-05-20 Christophe Lyon <christophe.lyon@arm.com> + + * 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. + +2022-05-20 Christophe Lyon <christophe.lyon@arm.com> + + * config.host: Add t-dfprules to AArch64 targets. + +2022-05-20 Christophe Lyon <christophe.lyon@arm.com> + + * configure: Regenerate. + 2022-05-13 Sebastian Pop <spop@amazon.com> PR target/105162 diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in index 09b3ec8..1fe708a 100644 --- a/libgcc/Makefile.in +++ b/libgcc/Makefile.in @@ -677,7 +677,8 @@ D32PBIT_FUNCS = _addsub_sd _div_sd _mul_sd _plus_sd _minus_sd \ _si_to_sd _di_to_sd _usi_to_sd _udi_to_sd \ _sd_to_sf _sd_to_df _sd_to_xf _sd_to_tf \ _sf_to_sd _df_to_sd _xf_to_sd _tf_to_sd \ - _sd_to_dd _sd_to_td _unord_sd _conv_sd + _sd_to_dd _sd_to_td _unord_sd _conv_sd \ + _hf_to_sd _sd_to_hf D64PBIT_FUNCS = _addsub_dd _div_dd _mul_dd _plus_dd _minus_dd \ _eq_dd _ne_dd _lt_dd _gt_dd _le_dd _ge_dd \ @@ -685,7 +686,8 @@ D64PBIT_FUNCS = _addsub_dd _div_dd _mul_dd _plus_dd _minus_dd \ _si_to_dd _di_to_dd _usi_to_dd _udi_to_dd \ _dd_to_sf _dd_to_df _dd_to_xf _dd_to_tf \ _sf_to_dd _df_to_dd _xf_to_dd _tf_to_dd \ - _dd_to_sd _dd_to_td _unord_dd _conv_dd + _dd_to_sd _dd_to_td _unord_dd _conv_dd \ + _hf_to_dd _dd_to_hf D128PBIT_FUNCS = _addsub_td _div_td _mul_td _plus_td _minus_td \ _eq_td _ne_td _lt_td _gt_td _le_td _ge_td \ @@ -693,7 +695,8 @@ D128PBIT_FUNCS = _addsub_td _div_td _mul_td _plus_td _minus_td \ _si_to_td _di_to_td _usi_to_td _udi_to_td \ _td_to_sf _td_to_df _td_to_xf _td_to_tf \ _sf_to_td _df_to_td _xf_to_td _tf_to_td \ - _td_to_sd _td_to_dd _unord_td _conv_td + _td_to_sd _td_to_dd _unord_td _conv_td \ + _hf_to_td _td_to_hf ifeq ($(enable_decimal_float),bid) ifneq ($(D32PBIT),) diff --git a/libgcc/config.host b/libgcc/config.host index 8c56fca..927d34a 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -382,6 +382,7 @@ aarch64*-*-elf | aarch64*-*-rtems*) tmake_file="${tmake_file} ${cpu_type}/t-aarch64" tmake_file="${tmake_file} ${cpu_type}/t-lse t-slibgcc-libgcc" tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm" + tmake_file="${tmake_file} t-dfprules" md_unwind_header=aarch64/aarch64-unwind.h ;; aarch64*-*-freebsd*) @@ -389,18 +390,21 @@ aarch64*-*-freebsd*) tmake_file="${tmake_file} ${cpu_type}/t-aarch64" tmake_file="${tmake_file} ${cpu_type}/t-lse t-slibgcc-libgcc" tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm" + tmake_file="${tmake_file} t-dfprules" md_unwind_header=aarch64/freebsd-unwind.h ;; aarch64*-*-netbsd*) extra_parts="$extra_parts crtfastmath.o" tmake_file="${tmake_file} ${cpu_type}/t-aarch64" tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm" + tmake_file="${tmake_file} t-dfprules" md_unwind_header=aarch64/aarch64-unwind.h ;; aarch64*-*-fuchsia*) tmake_file="${tmake_file} ${cpu_type}/t-aarch64" tmake_file="${tmake_file} ${cpu_type}/t-lse t-slibgcc-libgcc" tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp" + tmake_file="${tmake_file} t-dfprules" ;; aarch64*-*-linux*) extra_parts="$extra_parts crtfastmath.o" @@ -408,6 +412,7 @@ aarch64*-*-linux*) tmake_file="${tmake_file} ${cpu_type}/t-aarch64" tmake_file="${tmake_file} ${cpu_type}/t-lse t-slibgcc-libgcc" tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm" + tmake_file="${tmake_file} t-dfprules" ;; aarch64*-*-vxworks7*) extra_parts="$extra_parts crtfastmath.o" @@ -415,6 +420,7 @@ aarch64*-*-vxworks7*) tmake_file="${tmake_file} ${cpu_type}/t-aarch64" tmake_file="${tmake_file} ${cpu_type}/t-lse t-slibgcc-libgcc" tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm" + tmake_file="${tmake_file} t-dfprules" ;; alpha*-*-linux*) tmake_file="${tmake_file} alpha/t-alpha alpha/t-ieee t-crtfm alpha/t-linux" diff --git a/libgcc/config/libbid/ChangeLog b/libgcc/config/libbid/ChangeLog index b26ca33..d3cec76 100644 --- a/libgcc/config/libbid/ChangeLog +++ b/libgcc/config/libbid/ChangeLog @@ -1,3 +1,51 @@ +2022-05-20 Christophe Lyon <christophe.lyon@arm.com> + + * bid_binarydecimal.c (CLZ32_MASK16): Delete. + (CLZ32_MASK8): Delete. + (CLZ32_MASK4): Delete. + (CLZ32_MASK2): Delete. + (CLZ32_MASK1): Delete. + (clz32_nz): Use __builtin_clz. + (ctz32_1bit): Delete. + (ctz32): Use __builtin_ctz. + (CLZ64_MASK32): Delete. + (CLZ64_MASK16): Delete. + (CLZ64_MASK8): Delete. + (CLZ64_MASK4): Delete. + (CLZ64_MASK2): Delete. + (CLZ64_MASK1): Delete. + (clz64_nz): Use __builtin_clzl. + (ctz64_1bit): Delete. + (ctz64): Use __builtin_ctzl. + +2022-05-20 Christophe Lyon <christophe.lyon@arm.com> + + * 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. + +2022-05-20 Christophe Lyon <christophe.lyon@arm.com> + + * _dd_to_xf.c: Check __LIBGCC_HAS_XF_MODE__. + * _sd_to_xf.c: Likewise. + * _td_to_xf.c: Likewise. + * _xf_to_dd.c: Likewise. + * _xf_to_sd.c: Likewise. + * _xf_to_td.c: Likewise. + 2020-10-23 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/97164 diff --git a/libgcc/config/libbid/_dd_to_hf.c b/libgcc/config/libbid/_dd_to_hf.c new file mode 100644 index 0000000..5e58288 --- /dev/null +++ b/libgcc/config/libbid/_dd_to_hf.c @@ -0,0 +1,38 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#include "bid_conf.h" +#include "bid_functions.h" +#include "bid_gcc_intrinsics.h" + +#if LIBGCC2_HAS_HF_MODE || BID_HAS_HF_MODE +HFtype +__bid_truncddhf (_Decimal64 x) { + HFtype res; + union decimal64 ux; + + ux.d = x; + res = __bid64_to_binary32 (ux.i); + return (res); +} +#endif diff --git a/libgcc/config/libbid/_dd_to_xf.c b/libgcc/config/libbid/_dd_to_xf.c index 5a2abbb..e4b12e8 100644 --- a/libgcc/config/libbid/_dd_to_xf.c +++ b/libgcc/config/libbid/_dd_to_xf.c @@ -25,6 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "bid_functions.h" #include "bid_gcc_intrinsics.h" +#ifdef __LIBGCC_HAS_XF_MODE__ XFtype __bid_extendddxf (_Decimal64 x) { XFtype res; @@ -34,3 +35,4 @@ __bid_extendddxf (_Decimal64 x) { res = __bid64_to_binary80 (ux.i); return (res); } +#endif diff --git a/libgcc/config/libbid/_hf_to_dd.c b/libgcc/config/libbid/_hf_to_dd.c new file mode 100644 index 0000000..f85100e --- /dev/null +++ b/libgcc/config/libbid/_hf_to_dd.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#include "bid_conf.h" +#include "bid_functions.h" +#include "bid_gcc_intrinsics.h" + +#if LIBGCC2_HAS_HF_MODE || BID_HAS_HF_MODE +_Decimal64 +__bid_extendhfdd (HFtype x) { + union decimal64 res; + SFtype xsf = x; + res.i = __binary32_to_bid64 (xsf); + return (res.d); +} +#endif diff --git a/libgcc/config/libbid/_hf_to_sd.c b/libgcc/config/libbid/_hf_to_sd.c new file mode 100644 index 0000000..285b80c --- /dev/null +++ b/libgcc/config/libbid/_hf_to_sd.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#include "bid_conf.h" +#include "bid_functions.h" +#include "bid_gcc_intrinsics.h" + +#if LIBGCC2_HAS_HF_MODE || BID_HAS_HF_MODE +_Decimal32 +__bid_extendhfsd (HFtype x) { + union decimal32 res; + SFtype xsf = x; + res.i = __binary32_to_bid32 (xsf); + return (res.d); +} +#endif diff --git a/libgcc/config/libbid/_hf_to_td.c b/libgcc/config/libbid/_hf_to_td.c new file mode 100644 index 0000000..99b661e --- /dev/null +++ b/libgcc/config/libbid/_hf_to_td.c @@ -0,0 +1,36 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#include "bid_conf.h" +#include "bid_functions.h" +#include "bid_gcc_intrinsics.h" + +#if LIBGCC2_HAS_HF_MODE || BID_HAS_HF_MODE +_Decimal128 +__bid_extendhftd (HFtype x) { + union decimal128 res; + SFtype xsf = x; + res.i = __binary32_to_bid128 (xsf); + return (res.d); +} +#endif diff --git a/libgcc/config/libbid/_sd_to_hf.c b/libgcc/config/libbid/_sd_to_hf.c new file mode 100644 index 0000000..e4e3125 --- /dev/null +++ b/libgcc/config/libbid/_sd_to_hf.c @@ -0,0 +1,38 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#include "bid_conf.h" +#include "bid_functions.h" +#include "bid_gcc_intrinsics.h" + +#if LIBGCC2_HAS_HF_MODE || BID_HAS_HF_MODE +HFtype +__bid_truncsdhf (_Decimal32 x) { + HFtype res; + union decimal32 ux; + + ux.d = x; + res = __bid32_to_binary32 (ux.i); + return (res); +} +#endif diff --git a/libgcc/config/libbid/_sd_to_xf.c b/libgcc/config/libbid/_sd_to_xf.c index 9af0991..288ccb2 100644 --- a/libgcc/config/libbid/_sd_to_xf.c +++ b/libgcc/config/libbid/_sd_to_xf.c @@ -25,6 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "bid_functions.h" #include "bid_gcc_intrinsics.h" +#ifdef __LIBGCC_HAS_XF_MODE__ XFtype __bid_extendsdxf (_Decimal32 x) { XFtype res; @@ -34,3 +35,4 @@ __bid_extendsdxf (_Decimal32 x) { res = __bid32_to_binary80 (ux.i); return (res); } +#endif diff --git a/libgcc/config/libbid/_td_to_hf.c b/libgcc/config/libbid/_td_to_hf.c new file mode 100644 index 0000000..c4ebe58 --- /dev/null +++ b/libgcc/config/libbid/_td_to_hf.c @@ -0,0 +1,38 @@ +/* Copyright (C) 2022 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#include "bid_conf.h" +#include "bid_functions.h" +#include "bid_gcc_intrinsics.h" + +#if LIBGCC2_HAS_HF_MODE || BID_HAS_HF_MODE +HFtype +__bid_trunctdhf (_Decimal128 x) { + HFtype res; + union decimal128 ux; + + ux.d = x; + res = __bid128_to_binary32 (ux.i); + return (res); +} +#endif diff --git a/libgcc/config/libbid/_td_to_xf.c b/libgcc/config/libbid/_td_to_xf.c index b0c76a7..e990282 100644 --- a/libgcc/config/libbid/_td_to_xf.c +++ b/libgcc/config/libbid/_td_to_xf.c @@ -25,6 +25,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "bid_functions.h" #include "bid_gcc_intrinsics.h" +#ifdef __LIBGCC_HAS_XF_MODE__ XFtype __bid_trunctdxf (_Decimal128 x) { XFtype res; @@ -34,3 +35,4 @@ __bid_trunctdxf (_Decimal128 x) { res = __bid128_to_binary80 (ux.i); return (res); } +#endif diff --git a/libgcc/config/libbid/_xf_to_dd.c b/libgcc/config/libbid/_xf_to_dd.c index 9feb0f2..e3246a1 100644 --- a/libgcc/config/libbid/_xf_to_dd.c +++ b/libgcc/config/libbid/_xf_to_dd.c @@ -25,9 +25,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "bid_functions.h" #include "bid_gcc_intrinsics.h" +#ifdef __LIBGCC_HAS_XF_MODE__ _Decimal64 __bid_truncxfdd (XFtype x) { union decimal64 res; res.i = __binary80_to_bid64 (x); return (res.d); } +#endif diff --git a/libgcc/config/libbid/_xf_to_sd.c b/libgcc/config/libbid/_xf_to_sd.c index 7d46548..9147e97 100644 --- a/libgcc/config/libbid/_xf_to_sd.c +++ b/libgcc/config/libbid/_xf_to_sd.c @@ -25,9 +25,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "bid_functions.h" #include "bid_gcc_intrinsics.h" +#ifdef __LIBGCC_HAS_XF_MODE__ _Decimal32 __bid_truncxfsd (XFtype x) { union decimal32 res; res.i = __binary80_to_bid32 (x); return (res.d); } +#endif diff --git a/libgcc/config/libbid/_xf_to_td.c b/libgcc/config/libbid/_xf_to_td.c index 07987fd..c8d102b 100644 --- a/libgcc/config/libbid/_xf_to_td.c +++ b/libgcc/config/libbid/_xf_to_td.c @@ -25,9 +25,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "bid_functions.h" #include "bid_gcc_intrinsics.h" +#ifdef __LIBGCC_HAS_XF_MODE__ _Decimal128 __bid_extendxftd (XFtype x) { union decimal128 res; res.i = __binary80_to_bid128 (x); return (res.d); } +#endif diff --git a/libgcc/config/libbid/bid_binarydecimal.c b/libgcc/config/libbid/bid_binarydecimal.c index e156ea6..5413acc 100644 --- a/libgcc/config/libbid/bid_binarydecimal.c +++ b/libgcc/config/libbid/bid_binarydecimal.c @@ -26,65 +26,22 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // Counting leading zeros in an unsigned 32-bit word // The "_nz" version will return the wrong answer (31) for zero inputs -#define CLZ32_MASK16 0xFFFF0000ul -#define CLZ32_MASK8 0xFF00FF00ul -#define CLZ32_MASK4 0xF0F0F0F0ul -#define CLZ32_MASK2 0xCCCCCCCCul -#define CLZ32_MASK1 0xAAAAAAAAul - -#define clz32_nz(n) \ - (((((n) & CLZ32_MASK16) <= ((n) & ~CLZ32_MASK16)) ? 16 : 0) + \ - ((((n) & CLZ32_MASK8) <= ((n) & ~CLZ32_MASK8)) ? 8 : 0) + \ - ((((n) & CLZ32_MASK4) <= ((n) & ~CLZ32_MASK4)) ? 4 : 0) + \ - ((((n) & CLZ32_MASK2) <= ((n) & ~CLZ32_MASK2)) ? 2 : 0) + \ - ((((n) & CLZ32_MASK1) <= ((n) & ~CLZ32_MASK1)) ? 1 : 0)) - +#define clz32_nz(n) (__builtin_clz (n)) #define clz32(n) (((n)==0) ? 32 : clz32_nz(n)) // Counting trailing zeros in an unsigned 32-bit word -// The ctz32_1bit version is for a single bit - -#define ctz32_1bit(n) \ - ((((n) & ~CLZ32_MASK16) ? 0 : 16) + \ - (((n) & ~CLZ32_MASK8) ? 0 : 8) + \ - (((n) & ~CLZ32_MASK4) ? 0 : 4) + \ - (((n) & ~CLZ32_MASK2) ? 0 : 2) + \ - (((n) & ~CLZ32_MASK1) ? 0 : 1)) +#define ctz32(n) (__builtin_ctz (n)) -#define ctz32(n) (((n) == 0) ? 32 : ctz32_1bit((n) & -(n))) // Counting leading zeros in an unsigned 64-bit word // The "_nz" version will return the wrong answer (63) for zero inputs -#define CLZ64_MASK32 0xFFFFFFFF00000000ull -#define CLZ64_MASK16 0xFFFF0000FFFF0000ull -#define CLZ64_MASK8 0xFF00FF00FF00FF00ull -#define CLZ64_MASK4 0xF0F0F0F0F0F0F0F0ull -#define CLZ64_MASK2 0xCCCCCCCCCCCCCCCCull -#define CLZ64_MASK1 0xAAAAAAAAAAAAAAAAull - -#define clz64_nz(n) \ - (((((n) & CLZ64_MASK32) <= ((n) & ~CLZ64_MASK32)) ? 32 : 0) + \ - ((((n) & CLZ64_MASK16) <= ((n) & ~CLZ64_MASK16)) ? 16 : 0) + \ - ((((n) & CLZ64_MASK8) <= ((n) & ~CLZ64_MASK8)) ? 8 : 0) + \ - ((((n) & CLZ64_MASK4) <= ((n) & ~CLZ64_MASK4)) ? 4 : 0) + \ - ((((n) & CLZ64_MASK2) <= ((n) & ~CLZ64_MASK2)) ? 2 : 0) + \ - ((((n) & CLZ64_MASK1) <= ((n) & ~CLZ64_MASK1)) ? 1 : 0)) \ - +#define clz64_nz(n) ( (__SIZEOF_LONG__ == 8) ?__builtin_clzl(n) : __builtin_clzll(n) ) #define clz64(n) (((n)==0) ? 64 : clz64_nz(n)) // Counting trailing zeros in an unsigned 64-bit word -// The ctz64_1bit version is for a single bit - -#define ctz64_1bit(n) \ - ((((n) & ~CLZ64_MASK32) ? 0 : 32) + \ - (((n) & ~CLZ64_MASK16) ? 0 : 16) + \ - (((n) & ~CLZ64_MASK8) ? 0 : 8) + \ - (((n) & ~CLZ64_MASK4) ? 0 : 4) + \ - (((n) & ~CLZ64_MASK2) ? 0 : 2) + \ - (((n) & ~CLZ64_MASK1) ? 0 : 1)) +#define ctz64(n) ( (__SIZEOF_LONG__ == 8) ?__builtin_ctzl(n) : __builtin_ctzll(n) ) -#define ctz64(n) (((n) == 0) ? 64 : ctz64_1bit((n) & -(n))) // Counting leading zeros in an unsigned 2-part 128-bit word diff --git a/libgcc/config/libbid/bid_gcc_intrinsics.h b/libgcc/config/libbid/bid_gcc_intrinsics.h index b0a23de..15c0507 100644 --- a/libgcc/config/libbid/bid_gcc_intrinsics.h +++ b/libgcc/config/libbid/bid_gcc_intrinsics.h @@ -31,6 +31,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "tm.h" #include "libgcc_tm.h" +#ifdef __LIBGCC_HAS_HF_MODE__ +#define LIBGCC2_HAS_HF_MODE 1 +#else +#define LIBGCC2_HAS_HF_MODE 0 +#endif + #ifdef __LIBGCC_HAS_XF_MODE__ #define LIBGCC2_HAS_XF_MODE 1 #else @@ -43,6 +49,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define LIBGCC2_HAS_TF_MODE 0 #endif +#ifndef BID_HAS_HF_MODE +#define BID_HAS_HF_MODE LIBGCC2_HAS_HF_MODE +#endif + #ifndef BID_HAS_XF_MODE #define BID_HAS_XF_MODE LIBGCC2_HAS_XF_MODE #endif @@ -53,6 +63,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see /* Some handy typedefs. */ +#if LIBGCC2_HAS_HF_MODE +typedef float HFtype __attribute__ ((mode (HF))); +#endif /* LIBGCC2_HAS_HF_MODE */ typedef float SFtype __attribute__ ((mode (SF))); typedef float DFtype __attribute__ ((mode (DF))); #if LIBGCC2_HAS_XF_MODE @@ -98,6 +111,12 @@ typedef __attribute__ ((aligned(16))) struct #endif #endif +#if BID_HAS_HF_MODE +#ifndef HFtype +#define HFtype _Float16 +#endif +#endif + #ifndef SFtype #define SFtype float #endif @@ -110,8 +129,7 @@ typedef __attribute__ ((aligned(16))) struct #ifndef XFtype #define XFtype long double #endif - -#endif /* IN_LIBGCC2 */ +#endif #if BID_HAS_TF_MODE #ifndef TFtype @@ -249,6 +267,14 @@ extern _Decimal128 __bid_extendxftd (XFtype); extern int isinfd32 (_Decimal32); extern int isinfd64 (_Decimal64); extern int isinfd128 (_Decimal128); +#if BID_HAS_HF_MODE +extern _Decimal32 __bid_extendhfsd (HFtype); +extern _Decimal64 __bid_extendhfdd (HFtype); +extern _Decimal128 __bid_extendhftd (HFtype); +extern HFtype __bid_truncsdhf (_Decimal32); +extern HFtype __bid_truncddhf (_Decimal64); +extern HFtype __bid_trunctdhf (_Decimal128); +#endif #endif /* BID_HAS_GCC_DECIMAL_INTRINSICS */ extern void __dfp_set_round (int); diff --git a/libgcc/configure b/libgcc/configure index 1f9b2ac..61f3ace 100755 --- a/libgcc/configure +++ b/libgcc/configure @@ -4771,6 +4771,7 @@ Valid choices are 'yes', 'bid', 'dpd', and 'no'." "$LINENO" 5 ;; else case $host 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* | \ @@ -4791,7 +4792,7 @@ fi case x$enable_decimal_float in xyes) case $host in - i?86*-*-* | x86_64*-*-*) + aarch64* | i?86*-*-* | x86_64*-*-*) enable_decimal_float=bid ;; *) diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index cc7ba37..f276d787 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,41 @@ +2022-05-20 Marcel Vollweiler <marcel@codesourcery.com> + + * 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. + 2022-05-18 Tobias Burnus <tobias@codesourcery.com> * libgomp.texi (OpenMP 5.1): Set 'inoutset' to Y. diff --git a/libgomp/libgomp.map b/libgomp/libgomp.map index d631a77..6334fdc 100644 --- a/libgomp/libgomp.map +++ b/libgomp/libgomp.map @@ -230,6 +230,8 @@ OMP_5.1.1 { global: omp_get_mapped_ptr; omp_target_is_accessible; + omp_target_memcpy_async; + omp_target_memcpy_rect_async; } OMP_5.1; GOMP_1.0 { diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi index c9d01cd..b54555d 100644 --- a/libgomp/libgomp.texi +++ b/libgomp/libgomp.texi @@ -315,7 +315,7 @@ The OpenMP 4.5 specification is fully supported. routines @tab Y @tab @item @code{omp_target_is_accessible} runtime routine @tab Y @tab @item @code{omp_target_memcpy_async} and @code{omp_target_memcpy_rect_async} - runtime routines @tab N @tab + runtime routines @tab Y @tab @item @code{omp_get_mapped_ptr} runtime routine @tab Y @tab @item @code{omp_calloc}, @code{omp_realloc}, @code{omp_aligned_alloc} and @code{omp_aligned_calloc} runtime routines @tab Y @tab diff --git a/libgomp/omp.h.in b/libgomp/omp.h.in index f427f42..c8427fc 100644 --- a/libgomp/omp.h.in +++ b/libgomp/omp.h.in @@ -272,6 +272,10 @@ extern int omp_target_is_present (const void *, int) __GOMP_NOTHROW; extern int omp_target_memcpy (void *, const void *, __SIZE_TYPE__, __SIZE_TYPE__, __SIZE_TYPE__, int, int) __GOMP_NOTHROW; +extern int omp_target_memcpy_async (void *, const void *, __SIZE_TYPE__, + __SIZE_TYPE__, __SIZE_TYPE__, int, int, + int, omp_depend_t *) + __GOMP_NOTHROW; extern int omp_target_memcpy_rect (void *, const void *, __SIZE_TYPE__, int, const __SIZE_TYPE__ *, const __SIZE_TYPE__ *, @@ -279,6 +283,14 @@ extern int omp_target_memcpy_rect (void *, const void *, __SIZE_TYPE__, int, const __SIZE_TYPE__ *, const __SIZE_TYPE__ *, int, int) __GOMP_NOTHROW; +extern int omp_target_memcpy_rect_async (void *, const void *, __SIZE_TYPE__, + int, const __SIZE_TYPE__ *, + const __SIZE_TYPE__ *, + const __SIZE_TYPE__ *, + const __SIZE_TYPE__ *, + const __SIZE_TYPE__ *, int, int, int, + omp_depend_t *) + __GOMP_NOTHROW; extern int omp_target_associate_ptr (const void *, const void *, __SIZE_TYPE__, __SIZE_TYPE__, int) __GOMP_NOTHROW; extern int omp_target_disassociate_ptr (const void *, int) __GOMP_NOTHROW; diff --git a/libgomp/omp_lib.f90.in b/libgomp/omp_lib.f90.in index a2854a6..8f68a22 100644 --- a/libgomp/omp_lib.f90.in +++ b/libgomp/omp_lib.f90.in @@ -799,6 +799,22 @@ end interface interface + function omp_target_memcpy_async (dst, src, length, dst_offset, & + src_offset, dst_device_num, & + src_device_num, depobj_count, & + depobj_list) bind(c) + use, intrinsic :: iso_c_binding, only : c_ptr, c_int, c_size_t + import :: omp_depend_kind + integer(c_int) :: omp_target_memcpy_async + type(c_ptr), value :: dst, src + integer(c_size_t), value :: length, dst_offset, src_offset + integer(c_int), value :: dst_device_num, src_device_num, & + depobj_count + integer(omp_depend_kind), optional :: depobj_list(*) + end function omp_target_memcpy_async + end interface + + interface function omp_target_memcpy_rect (dst,src,element_size, num_dims, & volume, dst_offsets, src_offsets, & dst_dimensions, src_dimensions, & @@ -816,6 +832,30 @@ end interface interface + function omp_target_memcpy_rect_async (dst,src,element_size, & + num_dims, volume, & + dst_offsets, src_offsets, & + dst_dimensions, & + src_dimensions, & + dst_device_num, & + src_device_num, & + depobj_count, & + depobj_list) bind(c) + use, intrinsic :: iso_c_binding, only : c_ptr, c_int, c_size_t + import :: omp_depend_kind + integer(c_int) :: omp_target_memcpy_rect_async + type(c_ptr), value :: dst, src + integer(c_size_t), value :: element_size + integer(c_int), value :: num_dims, dst_device_num, src_device_num, & + depobj_count + integer(c_size_t), intent(in) :: volume(*), dst_offsets(*), & + src_offsets(*), dst_dimensions(*), & + src_dimensions(*) + integer(omp_depend_kind), optional :: depobj_list(*) + end function omp_target_memcpy_rect_async + end interface + + interface function omp_target_associate_ptr (host_ptr, device_ptr, size, & device_offset, device_num) bind(c) use, intrinsic :: iso_c_binding, only : c_ptr, c_size_t, c_int diff --git a/libgomp/omp_lib.h.in b/libgomp/omp_lib.h.in index 2855433..68c6266 100644 --- a/libgomp/omp_lib.h.in +++ b/libgomp/omp_lib.h.in @@ -378,6 +378,22 @@ end interface interface + function omp_target_memcpy_async (dst, src, length, dst_offset, & + & src_offset, dst_device_num, & + & src_device_num, depobj_count, & + & depobj_list) bind(c) + use, intrinsic :: iso_c_binding, only : c_ptr, c_int, c_size_t + import :: omp_depend_kind + integer(c_int) :: omp_target_memcpy_async + type(c_ptr), value :: dst, src + integer(c_size_t), value :: length, dst_offset, src_offset + integer(c_int), value :: dst_device_num, src_device_num + integer(c_int), value :: depobj_count + integer(omp_depend_kind), optional :: depobj_list(*) + end function omp_target_memcpy_async + end interface + + interface function omp_target_memcpy_rect (dst,src,element_size, num_dims, & & volume, dst_offsets, & & src_offsets, dst_dimensions, & @@ -397,6 +413,31 @@ end interface interface + function omp_target_memcpy_rect_async (dst,src,element_size, & + & num_dims, volume, & + & dst_offsets, src_offsets, & + & dst_dimensions, & + & src_dimensions, & + & dst_device_num, & + & src_device_num, & + & depobj_count, & + & depobj_list) bind(c) + use, intrinsic :: iso_c_binding, only : c_ptr, c_int, c_size_t + import :: omp_depend_kind + integer(c_int) :: omp_target_memcpy_rect_async + type(c_ptr), value :: dst, src + integer(c_size_t), value :: element_size + integer(c_int), value :: num_dims, depobj_count + integer(c_int), value :: dst_device_num, src_device_num + integer(c_size_t), intent(in) :: volume(*), dst_offsets(*) + integer(c_size_t), intent(in) :: src_offsets(*) + integer(c_size_t), intent(in) :: dst_dimensions(*) + integer(c_size_t), intent(in) :: src_dimensions(*) + integer(omp_depend_kind), optional :: depobj_list(*) + end function omp_target_memcpy_rect_async + end interface + + interface function omp_target_associate_ptr (host_ptr, device_ptr, size, & & device_offset, device_num) & & bind(c) diff --git a/libgomp/target.c b/libgomp/target.c index 4d62efd..4740f8a 100644 --- a/libgomp/target.c +++ b/libgomp/target.c @@ -49,6 +49,8 @@ static inline void * htab_alloc (size_t size) { return gomp_malloc (size); } static inline void htab_free (void *ptr) { free (ptr); } #include "hashtab.h" +ialias_redirect (GOMP_task) + static inline hashval_t htab_hash (hash_entry_type element) { @@ -1350,7 +1352,24 @@ gomp_map_vars_internal (struct gomp_device_descr *devicep, gomp_copy_host2dev (devicep, aq, (void *) (tgt->tgt_start + tgt_size), (void *) hostaddrs[i], len, false, cbufp); + /* Save device address in hostaddr to permit latter availablity + when doing a deep-firstprivate with pointer attach. */ + hostaddrs[i] = (void *) (tgt->tgt_start + tgt_size); tgt_size += len; + + /* If followed by GOMP_MAP_ATTACH, pointer assign this + firstprivate to hostaddrs[i+1], which is assumed to contain a + device address. */ + if (i + 1 < mapnum + && (GOMP_MAP_ATTACH + == (typemask & get_kind (short_mapkind, kinds, i+1)))) + { + uintptr_t target = (uintptr_t) hostaddrs[i]; + void *devptr = *(void**) hostaddrs[i+1] + sizes[i+1]; + gomp_copy_host2dev (devicep, aq, devptr, &target, + sizeof (void *), false, cbufp); + ++i; + } continue; case GOMP_MAP_FIRSTPRIVATE_INT: case GOMP_MAP_ZERO_LEN_ARRAY_SECTION: @@ -2517,6 +2536,11 @@ copy_firstprivate_data (char *tgt, size_t mapnum, void **hostaddrs, memcpy (tgt + tgt_size, hostaddrs[i], sizes[i]); hostaddrs[i] = tgt + tgt_size; tgt_size = tgt_size + sizes[i]; + if (i + 1 < mapnum && (kinds[i+1] & 0xff) == GOMP_MAP_ATTACH) + { + *(*(uintptr_t**) hostaddrs[i+1] + sizes[i+1]) = (uintptr_t) hostaddrs[i]; + ++i; + } } } @@ -3355,40 +3379,49 @@ omp_target_is_present (const void *ptr, int device_num) return ret; } -int -omp_target_memcpy (void *dst, const void *src, size_t length, - size_t dst_offset, size_t src_offset, int dst_device_num, - int src_device_num) +static int +omp_target_memcpy_check (int dst_device_num, int src_device_num, + struct gomp_device_descr **dst_devicep, + struct gomp_device_descr **src_devicep) { - struct gomp_device_descr *dst_devicep = NULL, *src_devicep = NULL; - bool ret; - if (dst_device_num != gomp_get_num_devices ()) { if (dst_device_num < 0) return EINVAL; - dst_devicep = resolve_device (dst_device_num); - if (dst_devicep == NULL) + *dst_devicep = resolve_device (dst_device_num); + if (*dst_devicep == NULL) return EINVAL; - if (!(dst_devicep->capabilities & GOMP_OFFLOAD_CAP_OPENMP_400) - || dst_devicep->capabilities & GOMP_OFFLOAD_CAP_SHARED_MEM) - dst_devicep = NULL; + if (!((*dst_devicep)->capabilities & GOMP_OFFLOAD_CAP_OPENMP_400) + || (*dst_devicep)->capabilities & GOMP_OFFLOAD_CAP_SHARED_MEM) + *dst_devicep = NULL; } + if (src_device_num != num_devices_openmp) { if (src_device_num < 0) return EINVAL; - src_devicep = resolve_device (src_device_num); - if (src_devicep == NULL) + *src_devicep = resolve_device (src_device_num); + if (*src_devicep == NULL) return EINVAL; - if (!(src_devicep->capabilities & GOMP_OFFLOAD_CAP_OPENMP_400) - || src_devicep->capabilities & GOMP_OFFLOAD_CAP_SHARED_MEM) - src_devicep = NULL; + if (!((*src_devicep)->capabilities & GOMP_OFFLOAD_CAP_OPENMP_400) + || (*src_devicep)->capabilities & GOMP_OFFLOAD_CAP_SHARED_MEM) + *src_devicep = NULL; } + + return 0; +} + +static int +omp_target_memcpy_copy (void *dst, const void *src, size_t length, + size_t dst_offset, size_t src_offset, + struct gomp_device_descr *dst_devicep, + struct gomp_device_descr *src_devicep) +{ + bool ret; if (src_devicep == NULL && dst_devicep == NULL) { memcpy ((char *) dst + dst_offset, (char *) src + src_offset, length); @@ -3424,6 +3457,85 @@ omp_target_memcpy (void *dst, const void *src, size_t length, return EINVAL; } +int +omp_target_memcpy (void *dst, const void *src, size_t length, size_t dst_offset, + size_t src_offset, int dst_device_num, int src_device_num) +{ + struct gomp_device_descr *dst_devicep = NULL, *src_devicep = NULL; + int ret = omp_target_memcpy_check (dst_device_num, src_device_num, + &dst_devicep, &src_devicep); + + if (ret) + return ret; + + ret = omp_target_memcpy_copy (dst, src, length, dst_offset, src_offset, + dst_devicep, src_devicep); + + return ret; +} + +typedef struct +{ + void *dst; + const void *src; + size_t length; + size_t dst_offset; + size_t src_offset; + struct gomp_device_descr *dst_devicep; + struct gomp_device_descr *src_devicep; +} omp_target_memcpy_data; + +static void +omp_target_memcpy_async_helper (void *args) +{ + omp_target_memcpy_data *a = args; + if (omp_target_memcpy_copy (a->dst, a->src, a->length, a->dst_offset, + a->src_offset, a->dst_devicep, a->src_devicep)) + gomp_fatal ("omp_target_memcpy failed"); +} + +int +omp_target_memcpy_async (void *dst, const void *src, size_t length, + size_t dst_offset, size_t src_offset, + int dst_device_num, int src_device_num, + int depobj_count, omp_depend_t *depobj_list) +{ + struct gomp_device_descr *dst_devicep = NULL, *src_devicep = NULL; + unsigned int flags = 0; + void *depend[depobj_count + 5]; + int i; + int check = omp_target_memcpy_check (dst_device_num, src_device_num, + &dst_devicep, &src_devicep); + + omp_target_memcpy_data s = { + .dst = dst, + .src = src, + .length = length, + .dst_offset = dst_offset, + .src_offset = src_offset, + .dst_devicep = dst_devicep, + .src_devicep = src_devicep + }; + + if (check) + return check; + + if (depobj_count > 0 && depobj_list != NULL) + { + flags |= GOMP_TASK_FLAG_DEPEND; + depend[0] = 0; + depend[1] = (void *) (uintptr_t) depobj_count; + depend[2] = depend[3] = depend[4] = 0; + for (i = 0; i < depobj_count; ++i) + depend[i + 5] = &depobj_list[i]; + } + + GOMP_task (omp_target_memcpy_async_helper, &s, NULL, sizeof (s), + __alignof__ (s), true, flags, depend, 0, NULL); + + return 0; +} + static int omp_target_memcpy_rect_worker (void *dst, const void *src, size_t element_size, int num_dims, const size_t *volume, @@ -3500,50 +3612,36 @@ omp_target_memcpy_rect_worker (void *dst, const void *src, size_t element_size, return 0; } -int -omp_target_memcpy_rect (void *dst, const void *src, size_t element_size, - int num_dims, const size_t *volume, - const size_t *dst_offsets, - const size_t *src_offsets, - const size_t *dst_dimensions, - const size_t *src_dimensions, - int dst_device_num, int src_device_num) +static int +omp_target_memcpy_rect_check (void *dst, const void *src, int dst_device_num, + int src_device_num, + struct gomp_device_descr **dst_devicep, + struct gomp_device_descr **src_devicep) { - struct gomp_device_descr *dst_devicep = NULL, *src_devicep = NULL; - if (!dst && !src) return INT_MAX; - if (dst_device_num != gomp_get_num_devices ()) - { - if (dst_device_num < 0) - return EINVAL; + int ret = omp_target_memcpy_check (dst_device_num, src_device_num, + dst_devicep, src_devicep); + if (ret) + return ret; - dst_devicep = resolve_device (dst_device_num); - if (dst_devicep == NULL) - return EINVAL; - - if (!(dst_devicep->capabilities & GOMP_OFFLOAD_CAP_OPENMP_400) - || dst_devicep->capabilities & GOMP_OFFLOAD_CAP_SHARED_MEM) - dst_devicep = NULL; - } - if (src_device_num != num_devices_openmp) - { - if (src_device_num < 0) - return EINVAL; - - src_devicep = resolve_device (src_device_num); - if (src_devicep == NULL) - return EINVAL; - - if (!(src_devicep->capabilities & GOMP_OFFLOAD_CAP_OPENMP_400) - || src_devicep->capabilities & GOMP_OFFLOAD_CAP_SHARED_MEM) - src_devicep = NULL; - } - - if (src_devicep != NULL && dst_devicep != NULL && src_devicep != dst_devicep) + if (*src_devicep != NULL && *dst_devicep != NULL && *src_devicep != *dst_devicep) return EINVAL; + return 0; +} + +static int +omp_target_memcpy_rect_copy (void *dst, const void *src, + size_t element_size, int num_dims, + const size_t *volume, const size_t *dst_offsets, + const size_t *src_offsets, + const size_t *dst_dimensions, + const size_t *src_dimensions, + struct gomp_device_descr *dst_devicep, + struct gomp_device_descr *src_devicep) +{ if (src_devicep) gomp_mutex_lock (&src_devicep->lock); else if (dst_devicep) @@ -3556,10 +3654,116 @@ omp_target_memcpy_rect (void *dst, const void *src, size_t element_size, gomp_mutex_unlock (&src_devicep->lock); else if (dst_devicep) gomp_mutex_unlock (&dst_devicep->lock); + return ret; } int +omp_target_memcpy_rect (void *dst, const void *src, size_t element_size, + int num_dims, const size_t *volume, + const size_t *dst_offsets, + const size_t *src_offsets, + const size_t *dst_dimensions, + const size_t *src_dimensions, + int dst_device_num, int src_device_num) +{ + struct gomp_device_descr *dst_devicep = NULL, *src_devicep = NULL; + + int check = omp_target_memcpy_rect_check (dst, src, dst_device_num, + src_device_num, &dst_devicep, + &src_devicep); + + if (check) + return check; + + int ret = omp_target_memcpy_rect_copy (dst, src, element_size, num_dims, + volume, dst_offsets, src_offsets, + dst_dimensions, src_dimensions, + dst_devicep, src_devicep); + + return ret; +} + +typedef struct +{ + void *dst; + const void *src; + size_t element_size; + const size_t *volume; + const size_t *dst_offsets; + const size_t *src_offsets; + const size_t *dst_dimensions; + const size_t *src_dimensions; + struct gomp_device_descr *dst_devicep; + struct gomp_device_descr *src_devicep; + int num_dims; +} omp_target_memcpy_rect_data; + +static void +omp_target_memcpy_rect_async_helper (void *args) +{ + omp_target_memcpy_rect_data *a = args; + int ret = omp_target_memcpy_rect_copy (a->dst, a->src, a->element_size, + a->num_dims, a->volume, a->dst_offsets, + a->src_offsets, a->dst_dimensions, + a->src_dimensions, a->dst_devicep, + a->src_devicep); + if (ret) + gomp_fatal ("omp_target_memcpy_rect failed"); +} + +int +omp_target_memcpy_rect_async (void *dst, const void *src, size_t element_size, + int num_dims, const size_t *volume, + const size_t *dst_offsets, + const size_t *src_offsets, + const size_t *dst_dimensions, + const size_t *src_dimensions, + int dst_device_num, int src_device_num, + int depobj_count, omp_depend_t *depobj_list) +{ + struct gomp_device_descr *dst_devicep = NULL, *src_devicep = NULL; + unsigned flags = 0; + int check = omp_target_memcpy_rect_check (dst, src, dst_device_num, + src_device_num, &dst_devicep, + &src_devicep); + void *depend[depobj_count + 5]; + int i; + + omp_target_memcpy_rect_data s = { + .dst = dst, + .src = src, + .element_size = element_size, + .num_dims = num_dims, + .volume = volume, + .dst_offsets = dst_offsets, + .src_offsets = src_offsets, + .dst_dimensions = dst_dimensions, + .src_dimensions = src_dimensions, + .dst_devicep = dst_devicep, + .src_devicep = src_devicep + }; + + if (check) + return check; + + if (depobj_count > 0 && depobj_list != NULL) + { + flags |= GOMP_TASK_FLAG_DEPEND; + depend[0] = 0; + depend[1] = (void *) (uintptr_t) depobj_count; + depend[2] = depend[3] = depend[4] = 0; + for (i = 0; i < depobj_count; ++i) + depend[i + 5] = &depobj_list[i]; + } + + GOMP_task (omp_target_memcpy_rect_async_helper, &s, NULL, sizeof (s), + __alignof__ (s), true, flags, depend, 0, NULL); + + return 0; +} + +int omp_target_associate_ptr (const void *host_ptr, const void *device_ptr, size_t size, size_t device_offset, int device_num) { diff --git a/libgomp/task.c b/libgomp/task.c index e9a28bf..6b11a8f 100644 --- a/libgomp/task.c +++ b/libgomp/task.c @@ -712,6 +712,7 @@ GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *), } } +ialias (GOMP_task) ialias (GOMP_taskgroup_start) ialias (GOMP_taskgroup_end) ialias (GOMP_taskgroup_reduction_register) diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-memcpy-async-1.c b/libgomp/testsuite/libgomp.c-c++-common/target-memcpy-async-1.c new file mode 100644 index 0000000..f25c3bb --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/target-memcpy-async-1.c @@ -0,0 +1,46 @@ +/* Test for omp_target_memcpy_async without considering dependence objects. */ + +#include <omp.h> +#include <stdlib.h> + +int +main () +{ + int d = omp_get_default_device (); + int id = omp_get_initial_device (); + int q[128], i; + void *p; + + if (d < 0 || d >= omp_get_num_devices ()) + d = id; + + p = omp_target_alloc (130 * sizeof (int), d); + if (p == NULL) + return 0; + + for (i = 0; i < 128; i++) + q[i] = i; + + if (omp_target_memcpy_async (p, q, 128 * sizeof (int), sizeof (int), 0, d, id, + 0, NULL)) + abort (); + + #pragma omp taskwait + + int q2[128]; + for (i = 0; i < 128; ++i) + q2[i] = 0; + if (omp_target_memcpy_async (q2, p, 128 * sizeof(int), 0, sizeof (int), id, d, + 0, NULL)) + abort (); + + #pragma omp taskwait + + for (i = 0; i < 128; ++i) + if (q2[i] != q[i]) + abort (); + + omp_target_free (p, d); + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-memcpy-async-2.c b/libgomp/testsuite/libgomp.c-c++-common/target-memcpy-async-2.c new file mode 100644 index 0000000..d1353a5 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/target-memcpy-async-2.c @@ -0,0 +1,74 @@ +/* Test for omp_target_memcpy_async considering dependence objects. */ + +#include <omp.h> +#include <stdlib.h> + +int +main () +{ + int d = omp_get_default_device (); + int id = omp_get_initial_device (); + int a[128], b[64], c[32], e[16], q[128], i; + void *p; + + if (d < 0 || d >= omp_get_num_devices ()) + d = id; + + p = omp_target_alloc (130 * sizeof (int), d); + if (p == NULL) + return 0; + + for (i = 0; i < 128; ++i) + a[i] = i + 1; + for (i = 0; i < 64; ++i) + b[i] = i + 2; + for (i = 0; i < 32; i++) + c[i] = 0; + for (i = 0; i < 16; i++) + e[i] = i + 4; + + omp_depend_t obj[2]; + + #pragma omp parallel num_threads(5) + #pragma omp single + { + #pragma omp task depend(out: p) + omp_target_memcpy (p, a, 128 * sizeof (int), 0, 0, d, id); + + #pragma omp task depend(inout: p) + omp_target_memcpy (p, b, 64 * sizeof (int), 0, 0, d, id); + + #pragma omp task depend(out: c) + for (i = 0; i < 32; i++) + c[i] = i + 3; + + #pragma omp depobj(obj[0]) depend(inout: p) + #pragma omp depobj(obj[1]) depend(in: c) + omp_target_memcpy_async (p, c, 32 * sizeof (int), 0, 0, d, id, 2, obj); + + #pragma omp task depend(in: p) + omp_target_memcpy (p, e, 16 * sizeof (int), 0, 0, d, id); + } + + #pragma omp taskwait + + for (i = 0; i < 128; ++i) + q[i] = 0; + omp_target_memcpy (q, p, 128 * sizeof(int), 0, 0, id, d); + for (i = 0; i < 16; ++i) + if (q[i] != i + 4) + abort (); + for (i = 16; i < 32; ++i) + if (q[i] != i + 3) + abort (); + for (i = 32; i < 64; ++i) + if (q[i] != i + 2) + abort (); + for (i = 64; i < 128; ++i) + if (q[i] != i + 1) + abort (); + + omp_target_free (p, d); + + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-memcpy-rect-async-1.c b/libgomp/testsuite/libgomp.c-c++-common/target-memcpy-rect-async-1.c new file mode 100644 index 0000000..176bceb --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/target-memcpy-rect-async-1.c @@ -0,0 +1,68 @@ +/* Test for omp_target_memcpy_rect_async without considering dependence + objects. */ + +#include <omp.h> +#include <stdlib.h> + +#define NUM_DIMS 3 + +int +main () +{ + int d = omp_get_default_device (); + int id = omp_get_initial_device (); + int q[128], q2[128], i; + void *p; + + if (d < 0 || d >= omp_get_num_devices ()) + d = id; + + p = omp_target_alloc (130 * sizeof (int), d); + if (p == NULL) + return 0; + + if (omp_target_memcpy_rect_async (NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, + NULL, d, id, 0, NULL) < 3 + || omp_target_memcpy_rect_async (NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, + NULL, id, d, 0, NULL) < 3 + || omp_target_memcpy_rect_async (NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, + NULL, id, id, 0, NULL) < 3) + abort (); + + for (i = 0; i < 128; i++) + q[i] = 0; + if (omp_target_memcpy (p, q, 128 * sizeof (int), 0, 0, d, id) != 0) + abort (); + + for (i = 0; i < 128; i++) + q[i] = i + 1; + + size_t volume[NUM_DIMS] = { 1, 2, 3 }; + size_t dst_offsets[NUM_DIMS] = { 0, 0, 0 }; + size_t src_offsets[NUM_DIMS] = { 0, 0, 0 }; + size_t dst_dimensions[NUM_DIMS] = { 3, 4, 5 }; + size_t src_dimensions[NUM_DIMS] = { 2, 3, 4 }; + + if (omp_target_memcpy_rect_async (p, q, sizeof (int), NUM_DIMS, volume, + dst_offsets, src_offsets, dst_dimensions, + src_dimensions, d, id, 0, NULL) != 0) + abort (); + + #pragma omp taskwait + + for (i = 0; i < 128; i++) + q2[i] = 0; + if (omp_target_memcpy (q2, p, 128 * sizeof (int), 0, 0, id, d) != 0) + abort (); + + /* q2 is expected to contain: 1 2 3 0 0 5 6 7 0 0 .. 0 */ + if (q2[0] != 1 || q2[1] != 2 || q2[2] !=3 || q2[3] != 0 || q2[4] != 0 + || q2[5] != 5 || q2[6] != 6 || q2[7] != 7) + abort (); + for (i = 8; i < 128; ++i) + if (q2[i] != 0) + abort (); + + omp_target_free (p, d); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-memcpy-rect-async-2.c b/libgomp/testsuite/libgomp.c-c++-common/target-memcpy-rect-async-2.c new file mode 100644 index 0000000..4a5d80f --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/target-memcpy-rect-async-2.c @@ -0,0 +1,91 @@ +/* Test for omp_target_memcpy_rect_async considering dependence objects. */ + +#include <omp.h> +#include <stdlib.h> + +#define NUM_DIMS 3 + +int +main () +{ + int d = omp_get_default_device (); + int id = omp_get_initial_device (); + int a[128], b[64], c[128], e[16], q[128], i; + void *p; + + if (d < 0 || d >= omp_get_num_devices ()) + d = id; + + p = omp_target_alloc (130 * sizeof (int), d); + if (p == NULL) + return 0; + + for (i = 0; i < 128; i++) + q[i] = 0; + if (omp_target_memcpy (p, q, 128 * sizeof (int), 0, 0, d, id) != 0) + abort (); + + size_t volume[NUM_DIMS] = { 2, 2, 3 }; + size_t dst_offsets[NUM_DIMS] = { 0, 0, 0 }; + size_t src_offsets[NUM_DIMS] = { 0, 0, 0 }; + size_t dst_dimensions[NUM_DIMS] = { 3, 4, 5 }; + size_t src_dimensions[NUM_DIMS] = { 2, 3, 4 }; + + for (i = 0; i < 128; i++) + a[i] = 42; + for (i = 0; i < 64; i++) + b[i] = 24; + for (i = 0; i < 128; i++) + c[i] = 0; + for (i = 0; i < 16; i++) + e[i] = 77; + + omp_depend_t obj[2]; + + #pragma omp parallel num_threads(5) + #pragma omp single + { + #pragma omp task depend (out: p) + omp_target_memcpy (p, a, 128 * sizeof (int), 0, 0, d, id); + + #pragma omp task depend(inout: p) + omp_target_memcpy (p, b, 64 * sizeof (int), 0, 0, d, id); + + #pragma omp task depend(out: c) + for (i = 0; i < 128; i++) + c[i] = i + 1; + + #pragma omp depobj(obj[0]) depend(inout: p) + #pragma omp depobj(obj[1]) depend(in: c) + + /* This produces: 1 2 3 - - 5 6 7 - - at positions 0..9 and + 13 14 15 - - 17 18 19 - - at positions 20..29. */ + omp_target_memcpy_rect_async (p, c, sizeof (int), NUM_DIMS, volume, + dst_offsets, src_offsets, dst_dimensions, + src_dimensions, d, id, 2, obj); + + #pragma omp task depend(in: p) + omp_target_memcpy (p, e, 16 * sizeof (int), 0, 0, d, id); + } + + #pragma omp taskwait + + if (omp_target_memcpy (q, p, 128 * sizeof(int), 0, 0, id, d) != 0) + abort (); + + for (i = 0; i < 16; ++i) + if (q[i] != 77) + abort (); + if (q[20] != 13 || q[21] != 14 || q[22] != 15 || q[25] != 17 || q[26] != 18 + || q[27] != 19) + abort (); + for (i = 28; i < 64; ++i) + if (q[i] != 24) + abort (); + for (i = 64; i < 128; ++i) + if (q[i] != 42) + abort (); + + omp_target_free (p, d); + return 0; +} diff --git a/libgomp/testsuite/libgomp.fortran/target-firstprivate-1.f90 b/libgomp/testsuite/libgomp.fortran/target-firstprivate-1.f90 new file mode 100644 index 0000000..7b77992 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/target-firstprivate-1.f90 @@ -0,0 +1,33 @@ +! PR fortran/104949 + +implicit none (type,external) +integer, allocatable :: A(:) +A = [1,2,3,4,5,6] + +!$omp parallel firstprivate(A) +!$omp master + if (any (A /= [1,2,3,4,5])) error stop + A(:) = [99,88,77,66,55] +!$omp end master +!$omp end parallel + +!$omp target firstprivate(A) + if (any (A /= [1,2,3,4,5])) error stop + A(:) = [99,88,77,66,55] +!$omp end target +if (any (A /= [1,2,3,4,5])) error stop + +!$omp parallel default(firstprivate) +!$omp master + if (any (A /= [1,2,3,4,5])) error stop + A(:) = [99,88,77,66,55] +!$omp end master +!$omp end parallel +if (any (A /= [1,2,3,4,5])) error stop + +!$omp target defaultmap(firstprivate) + if (any (A /= [1,2,3,4,5])) error stop + A(:) = [99,88,77,66,55] +!$omp end target +if (any (A /= [1,2,3,4,5])) error stop +end diff --git a/libgomp/testsuite/libgomp.fortran/target-firstprivate-2.f90 b/libgomp/testsuite/libgomp.fortran/target-firstprivate-2.f90 new file mode 100644 index 0000000..d00b407 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/target-firstprivate-2.f90 @@ -0,0 +1,113 @@ +! PR fortran/104949 + +module m +use omp_lib +implicit none (type, external) + +contains +subroutine one + integer, allocatable :: x(:) + integer :: i + + do i = 1, omp_get_num_devices() + 1 + !$omp target firstprivate(x) + if (allocated(x)) error stop + !$omp end target + if (allocated(x)) error stop + end do + + do i = 1, omp_get_num_devices() + 1 + !$omp target firstprivate(x, i) + if (allocated(x)) error stop + x = [10,20,30,40] + i + if (any (x /= [10,20,30,40] + i)) error stop + ! This leaks memory! + ! deallocate(x) + !$omp end target + if (allocated(x)) error stop + end do + + x = [1,2,3,4] + + do i = 1, omp_get_num_devices() + 1 + !$omp target firstprivate(x, i) + if (i <= 0) error stop + if (.not.allocated(x)) error stop + if (size(x) /= 4) error stop + if (lbound(x,1) /= 1) error stop + if (any (x /= [1,2,3,4])) error stop + ! no reallocation, just malloced + assignment + x = [10,20,30,40] + i + if (any (x /= [10,20,30,40] + i)) error stop + ! This leaks memory! + ! deallocate(x) + !$omp end target + if (.not.allocated(x)) error stop + if (size(x) /= 4) error stop + if (lbound(x,1) /= 1) error stop + if (any (x /= [1,2,3,4])) error stop + end do + deallocate(x) +end + +subroutine two + character(len=:), allocatable :: x(:) + character(len=5) :: str + integer :: i + + str = "abcde" ! work around for PR fortran/91544 + do i = 1, omp_get_num_devices() + 1 + !$omp target firstprivate(x) + if (allocated(x)) error stop + !$omp end target + if (allocated(x)) error stop + end do + + do i = 1, omp_get_num_devices() + 1 + !$omp target firstprivate(x, i) + if (allocated(x)) error stop + ! no reallocation, just malloced + assignment + x = [character(len=2+i) :: str,"fhji","klmno"] + if (len(x) /= 2+i) error stop + if (any (x /= [character(len=2+i) :: str,"fhji","klmno"])) error stop + ! This leaks memory! + ! deallocate(x) + !$omp end target + if (allocated(x)) error stop + end do + + x = [character(len=4) :: "ABCDE","FHJI","KLMNO"] + + do i = 1, omp_get_num_devices() + 1 + !$omp target firstprivate(x, i) + if (i <= 0) error stop + if (.not.allocated(x)) error stop + if (size(x) /= 3) error stop + if (lbound(x,1) /= 1) error stop + if (len(x) /= 4) error stop + if (any (x /= [character(len=4) :: "ABCDE","FHJI","KLMNO"])) error stop + !! Reallocation runs into the issue PR fortran/105538 + !! + !!x = [character(len=2+i) :: str,"fhji","klmno"] + !!if (len(x) /= 2+i) error stop + !!if (any (x /= [character(len=2+i) :: str,"fhji","klmno"])) error stop + !! This leaks memory! + !! deallocate(x) + ! Just assign: + x = [character(len=4) :: "abcde","fhji","klmno"] + if (any (x /= [character(len=4) :: "abcde","fhji","klmno"])) error stop + !$omp end target + if (.not.allocated(x)) error stop + if (lbound(x,1) /= 1) error stop + if (size(x) /= 3) error stop + if (len(x) /= 4) error stop + if (any (x /= [character(len=4) :: "ABCDE","FHJI","KLMNO"])) error stop + end do + deallocate(x) +end +end module m + +use m +call one +call two +end diff --git a/libgomp/testsuite/libgomp.fortran/target-firstprivate-3.f90 b/libgomp/testsuite/libgomp.fortran/target-firstprivate-3.f90 new file mode 100644 index 0000000..7406cdc --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/target-firstprivate-3.f90 @@ -0,0 +1,24 @@ +implicit none + integer, allocatable :: x(:) + x = [1,2,3,4] + call foo(x) + if (any (x /= [1,2,3,4])) error stop + call foo() +contains +subroutine foo(c) + integer, allocatable, optional :: c(:) + logical :: is_present + is_present = present (c) + !$omp target firstprivate(c) + if (is_present) then + if (.not. allocated(c)) error stop + if (any (c /= [1,2,3,4])) error stop + c = [99,88,77,66] + if (any (c /= [99,88,77,66])) error stop + end if + !$omp end target + if (is_present) then + if (any (c /= [1,2,3,4])) error stop + end if +end +end diff --git a/libgomp/testsuite/libgomp.fortran/target-memcpy-async-1.f90 b/libgomp/testsuite/libgomp.fortran/target-memcpy-async-1.f90 new file mode 100644 index 0000000..4679fd2 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/target-memcpy-async-1.f90 @@ -0,0 +1,42 @@ +! Test for omp_target_memcpy_async without considering dependence objects. + +program main + use omp_lib + use iso_c_binding + implicit none (external, type) + integer :: d, id, i, j + integer, target :: q(0:127), q2(0:127) + type(c_ptr) :: p + integer(omp_depend_kind) :: obj(1:0) + + d = omp_get_default_device () + id = omp_get_initial_device () + + if (d < 0 .or. d >= omp_get_num_devices ()) & + d = id + + p = omp_target_alloc (130 * c_sizeof (q), d) + if (.not. c_associated (p)) & + stop 0 ! okay + + q = [(i, i = 0, 127)] + if (omp_target_memcpy_async (p, c_loc (q), 128 * sizeof (q(0)), 0_c_size_t, & + 0_c_size_t, d, id, 0, obj) /= 0) & + stop 1 + + !$omp taskwait + + q2 = [(0, i = 0, 127)] + if (omp_target_memcpy_async (c_loc (q2), p, 128 * sizeof (q2(0)), 0_c_size_t,& + 0_c_size_t, id, d, 0, obj) /= 0) & + stop 2 + + !$omp taskwait + + do j = 0, 127 + if (q(j) /= q2(j)) & + stop 3 + end do + + call omp_target_free (p, d) +end program main diff --git a/libgomp/testsuite/libgomp.fortran/target-memcpy-async-2.f90 b/libgomp/testsuite/libgomp.fortran/target-memcpy-async-2.f90 new file mode 100644 index 0000000..2aa482a --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/target-memcpy-async-2.f90 @@ -0,0 +1,91 @@ +! Test for omp_target_memcpy_async considering dependence objects. + +program main + use omp_lib + use iso_c_binding + implicit none (external, type) + integer :: d, id, i, j + integer, target :: a(0:127), b(0:63), c(0:31), e(0:15), q(0:127) + type(c_ptr) :: p + integer(omp_depend_kind) :: obj(0:1) + + d = omp_get_default_device () + id = omp_get_initial_device () + + if (d < 0 .or. d >= omp_get_num_devices ()) & + d = id + + p = omp_target_alloc (130 * c_sizeof (q), d) + if (.not. c_associated (p)) & + stop 0 ! okay + + a = [(i + 1, i = 0, 127)] + b = [(i + 2, i = 0, 63)] + c = [(0, i = 0, 31)] + e = [(i + 4, i = 0, 15)] + + !$omp parallel num_threads(5) + !$omp single + + !$omp task depend(out: p) + if (omp_target_memcpy (p, c_loc (a), 128 * sizeof (a(0)), 0_c_size_t, & + 0_c_size_t, d, id) /= 0) & + stop 1 + !$omp end task + + !$omp task depend(inout: p) + if (omp_target_memcpy (p, c_loc (b), 64 * sizeof (b(0)), 0_c_size_t, & + 0_c_size_t, d, id) /= 0) & + stop 2 + !$omp end task + + !$omp task depend(out: c) + do j = 0, 31 + c(j) = j + 3 + end do + !$omp end task + + !$omp depobj(obj(0)) depend(inout: p) + !$omp depobj(obj(1)) depend(in: c) + if (omp_target_memcpy_async (p, c_loc (c), 32 * sizeof (c(0)), 0_c_size_t, & + 0_c_size_t, d, id, 2, obj) /= 0) & + stop 3 + + !$omp task depend(in: p) + if (omp_target_memcpy (p, c_loc (e), 16 * sizeof (e(0)), 0_c_size_t, & + 0_c_size_t, d, id) /= 0) & + stop 4 + !$omp end task + + !$omp end single + !$omp end parallel + + !$omp taskwait + + q = [(0, i = 0, 127)] + if (omp_target_memcpy (c_loc (q), p, 128 * sizeof (q(0)), 0_c_size_t, & + 0_c_size_t, id, d) /= 0) & + stop 5 + + do j = 0, 15 + if (q(j) /= j+4) & + stop 10 + end do + + do j = 16, 31 + if (q(j) /= j+3) & + stop 11 + end do + + do j = 32, 63 + if (q(j) /= j+2) & + stop 12 + end do + + do j = 64, 127 + if (q(j) /= j+1) & + stop 13 + end do + + call omp_target_free (p, d) +end program main diff --git a/libgomp/testsuite/libgomp.fortran/target-memcpy-rect-async-1.f90 b/libgomp/testsuite/libgomp.fortran/target-memcpy-rect-async-1.f90 new file mode 100644 index 0000000..c8c87c5 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/target-memcpy-rect-async-1.f90 @@ -0,0 +1,86 @@ +! Test for omp_target_memcpy_rect_async without considering dependence objects. + +program main + use omp_lib + use iso_c_binding + implicit none (external, type) + integer :: d, id, i, j + integer, target :: q(0:127), q2(0:127) + type(c_ptr) :: p + integer(omp_depend_kind) :: obj(1:0) + + integer(kind=c_size_t) :: volume(0:2) + integer(kind=c_size_t) :: dst_offsets(0:2) + integer(kind=c_size_t) :: src_offsets(0:2) + integer(kind=c_size_t) :: dst_dimensions(0:2) + integer(kind=c_size_t) :: src_dimensions(0:2) + integer(kind=c_size_t) :: empty(1:0) + + d = omp_get_default_device () + id = omp_get_initial_device () + + if (d < 0 .or. d >= omp_get_num_devices ()) & + d = id + + p = omp_target_alloc (130 * c_sizeof (q), d) + if (.not. c_associated (p)) & + stop 0 ! okay + + if (omp_target_memcpy_rect_async (C_NULL_PTR, C_NULL_PTR, 0_c_size_t, 0, & + empty, empty, empty, empty, empty, d, id, & + 0, obj) < 3 & + .or. omp_target_memcpy_rect_async (C_NULL_PTR, C_NULL_PTR, 0_c_size_t, 0, & + empty, empty, empty, empty, empty, & + id, d, 0, obj) < 3 & + .or. omp_target_memcpy_rect_async (C_NULL_PTR, C_NULL_PTR, 0_c_size_t, 0, & + empty, empty, empty, empty, empty, & + id, id, 0, obj) < 3) & + stop 1 + + q = [(0, i = 0, 127)] + if (omp_target_memcpy (p, c_loc (q), 128 * sizeof (q(0)), 0_c_size_t, & + 0_c_size_t, d, id) /= 0) & + stop 2 + + q = [(i+1, i = 0, 127)] + + volume(2) = 3 + volume(1) = 2 + volume(0) = 1 + dst_offsets(2) = 0 + dst_offsets(1) = 0 + dst_offsets(0) = 0 + src_offsets(2) = 0 + src_offsets(1) = 0 + src_offsets(0) = 0 + dst_dimensions(2) = 5 + dst_dimensions(1) = 4 + dst_dimensions(0) = 3 + src_dimensions(2) = 4 + src_dimensions(1) = 3 + src_dimensions(0) = 2 + + if (omp_target_memcpy_rect_async (p, c_loc (q), sizeof (q(0)), 3, volume, & + dst_offsets, src_offsets, dst_dimensions, src_dimensions, d, id, 0, & + obj) /= 0) & + stop 3 + + !$omp taskwait + + q2 = [(0, i = 0, 127)] + if (omp_target_memcpy (c_loc (q2), p, 128 * sizeof (q2(0)), 0_c_size_t, & + 0_c_size_t, id, d) /= 0) & + stop 4 + + ! q2 is expected to contain: 1 2 3 0 0 5 6 7 0 0 .. 0 + if (q2(0) /= 1 .or. q2(1) /= 2 .or. q2(2) /= 3 .or. q2(3) /= 0 & + .or. q2(4) /= 0 .or. q2(5) /= 5 .or. q2(6) /= 6 .or. q2(7) /= 7) & + stop 5 + + do j = 8, 127 + if (q2(j) /= 0) & + stop 6 + end do + + call omp_target_free (p, d) +end program main diff --git a/libgomp/testsuite/libgomp.fortran/target-memcpy-rect-async-2.f90 b/libgomp/testsuite/libgomp.fortran/target-memcpy-rect-async-2.f90 new file mode 100644 index 0000000..d0bc5ff --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/target-memcpy-rect-async-2.f90 @@ -0,0 +1,117 @@ +! Test for omp_target_memcpy_rect_async considering dependence objects. + +program main + use omp_lib + use iso_c_binding + implicit none (external, type) + integer :: d, id, i, j + integer, target :: a(0:127), b(0:63), c(0:127), e(0:15), q(0:127) + type(c_ptr) :: p + integer(omp_depend_kind) :: obj(0:2) + + integer(kind=c_size_t) :: volume(0:2) + integer(kind=c_size_t) :: dst_offsets(0:2) + integer(kind=c_size_t) :: src_offsets(0:2) + integer(kind=c_size_t) :: dst_dimensions(0:2) + integer(kind=c_size_t) :: src_dimensions(0:2) + + d = omp_get_default_device () + id = omp_get_initial_device () + + if (d < 0 .or. d >= omp_get_num_devices ()) & + d = id + + p = omp_target_alloc (130 * c_sizeof (q), d) + if (.not. c_associated (p)) & + stop 0 ! okay + + a = [(42, i = 0, 127)] + b = [(24, i = 0, 63)] + c = [(0, i = 0, 127)] + e = [(77, i = 0, 15)] + + volume(2) = 3 + volume(1) = 2 + volume(0) = 2 + dst_offsets(2) = 0 + dst_offsets(1) = 0 + dst_offsets(0) = 0 + src_offsets(2) = 0 + src_offsets(1) = 0 + src_offsets(0) = 0 + dst_dimensions(2) = 5 + dst_dimensions(1) = 4 + dst_dimensions(0) = 3 + src_dimensions(2) = 4 + src_dimensions(1) = 3 + src_dimensions(0) = 2 + + !$omp parallel num_threads(5) + !$omp single + + !$omp task depend(out: p) + if (omp_target_memcpy (p, c_loc (a), 128 * sizeof (a(0)), 0_c_size_t, & + 0_c_size_t, d, id) /= 0) & + stop 1 + !$omp end task + + !$omp task depend(inout: p) + if (omp_target_memcpy (p, c_loc (b), 64 * sizeof (b(0)), 0_c_size_t, & + 0_c_size_t, d, id) /= 0) & + stop 2 + !$omp end task + + !$omp task depend(out: c) + do j = 0, 127 + c(j) = j + 1 + end do + !$omp end task + + !$omp depobj(obj(0)) depend(inout: p) + !$omp depobj(obj(1)) depend(in: c) + + ! This produces: 1 2 3 - - 5 6 7 - - at positions 0..9 and + ! 13 14 15 - - 17 18 19 - - at positions 20..29. + if (omp_target_memcpy_rect_async (p, c_loc (c), sizeof (c(0)), 3, volume, & + dst_offsets, src_offsets, & + dst_dimensions, src_dimensions, d, id, & + 2, obj) /= 0) & + stop 3 + + !$omp task depend(in: p) + if (omp_target_memcpy (p, c_loc (e), 16 * sizeof (e(0)), 0_c_size_t, & + 0_c_size_t, d, id) /= 0) & + stop 4 + !$omp end task + + !$omp end single + !$omp end parallel + + !$omp taskwait + + q = [(0, i = 0, 127)] + if (omp_target_memcpy (c_loc (q), p, 128 * sizeof (q(0)), 0_c_size_t, & + 0_c_size_t, id, d) /= 0) & + stop 5 + + do j = 0, 15 + if (q(j) /= 77) & + stop 6 + end do + + if (q(20) /= 13 .or. q(21) /= 14 .or. q(22) /= 15 .or. q(25) /= 17 & + .or. q(26) /= 18 .or. q(27) /= 19) & + stop 7 + + do j = 28, 63 + if (q(j) /= 24) & + stop 8 + end do + + do j = 64, 127 + if (q(j) /= 42) & + stop 9 + end do + + call omp_target_free (p, d) +end program main diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index cf451c5..d06d80d 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -429,10 +429,12 @@ static struct demangle_component *d_name (struct d_info *, int substable); static struct demangle_component *d_nested_name (struct d_info *); +static int d_maybe_module_name (struct d_info *, struct demangle_component **); + static struct demangle_component *d_prefix (struct d_info *, int); static struct demangle_component *d_unqualified_name (struct d_info *, - struct demangle_component *scope); + struct demangle_component *scope, struct demangle_component *module); static struct demangle_component *d_source_name (struct d_info *); @@ -984,6 +986,7 @@ d_make_comp (struct d_info *di, enum demangle_component_type type, case DEMANGLE_COMPONENT_COMPOUND_NAME: case DEMANGLE_COMPONENT_VECTOR_TYPE: case DEMANGLE_COMPONENT_CLONE: + case DEMANGLE_COMPONENT_MODULE_ENTITY: if (left == NULL || right == NULL) return NULL; break; @@ -1022,6 +1025,7 @@ d_make_comp (struct d_info *di, enum demangle_component_type type, case DEMANGLE_COMPONENT_TRINARY_ARG2: case DEMANGLE_COMPONENT_TPARM_OBJ: case DEMANGLE_COMPONENT_STRUCTURED_BINDING: + case DEMANGLE_COMPONENT_MODULE_INIT: if (left == NULL) return NULL; break; @@ -1030,6 +1034,8 @@ d_make_comp (struct d_info *di, enum demangle_component_type type, empty. */ case DEMANGLE_COMPONENT_ARRAY_TYPE: case DEMANGLE_COMPONENT_INITIALIZER_LIST: + case DEMANGLE_COMPONENT_MODULE_NAME: + case DEMANGLE_COMPONENT_MODULE_PARTITION: if (right == NULL) return NULL; break; @@ -1422,6 +1428,7 @@ d_name (struct d_info *di, int substable) { char peek = d_peek_char (di); struct demangle_component *dc = NULL; + struct demangle_component *module = NULL; int subst = 0; switch (peek) @@ -1435,7 +1442,7 @@ d_name (struct d_info *di, int substable) break; case 'U': - dc = d_unqualified_name (di, NULL); + dc = d_unqualified_name (di, NULL, NULL); break; case 'S': @@ -1446,12 +1453,21 @@ d_name (struct d_info *di, int substable) dc = d_make_name (di, "std", 3); di->expansion += 3; } - else + + if (d_peek_char (di) == 'S') { - dc = d_substitution (di, 0); - if (!dc) + module = d_substitution (di, 0); + if (!module) return NULL; - subst = 1; + if (!(module->type == DEMANGLE_COMPONENT_MODULE_NAME + || module->type == DEMANGLE_COMPONENT_MODULE_PARTITION)) + { + if (dc) + return NULL; + subst = 1; + dc = module; + module = NULL; + } } } /* FALLTHROUGH */ @@ -1459,7 +1475,7 @@ d_name (struct d_info *di, int substable) case 'L': default: if (!subst) - dc = d_unqualified_name (di, dc); + dc = d_unqualified_name (di, dc, module); if (d_peek_char (di) == 'I') { /* This is <template-args>, which means that we just saw @@ -1552,15 +1568,6 @@ d_prefix (struct d_info *di, int substable) return NULL; ret = cplus_demangle_type (di); } - else if (peek == 'S') - { - if (ret) - return NULL; - ret = d_substitution (di, 1); - if (!ret) - return NULL; - continue; - } else if (peek == 'I') { if (ret == NULL) @@ -1586,7 +1593,24 @@ d_prefix (struct d_info *di, int substable) d_advance (di, 1); } else - ret = d_unqualified_name (di, ret); + { + struct demangle_component *module = NULL; + if (peek == 'S') + { + module = d_substitution (di, 1); + if (!module) + return NULL; + if (!(module->type == DEMANGLE_COMPONENT_MODULE_NAME + || module->type == DEMANGLE_COMPONENT_MODULE_PARTITION)) + { + if (ret) + return NULL; + ret = module; + continue; + } + } + ret = d_unqualified_name (di, ret, module); + } if (!ret) break; @@ -1601,20 +1625,46 @@ d_prefix (struct d_info *di, int substable) return ret; } -/* <unqualified-name> ::= <operator-name> [<abi-tags>] - ::= <ctor-dtor-name> [<abi-tags>] - ::= <source-name> [<abi-tags>] - ::= <local-source-name> [<abi-tags>] - ::= DC <source-name>+ E [<abi-tags>] +static int +d_maybe_module_name (struct d_info *di, struct demangle_component **name) +{ + while (d_peek_char (di) == 'W') + { + d_advance (di, 1); + enum demangle_component_type code = DEMANGLE_COMPONENT_MODULE_NAME; + if (d_peek_char (di) == 'P') + { + code = DEMANGLE_COMPONENT_MODULE_PARTITION; + d_advance (di, 1); + } + + *name = d_make_comp (di, code, *name, d_source_name (di)); + if (!*name) + return 0; + if (!d_add_substitution (di, *name)) + return 0; + } + return 1; +} + +/* <unqualified-name> ::= [<module-name>] <operator-name> [<abi-tags>] + ::= [<module-name>] <ctor-dtor-name> [<abi-tags>] + ::= [<module-name>] <source-name> [<abi-tags>] + ::= [<module-name>] <local-source-name> [<abi-tags>] + ::= [<module-name>] DC <source-name>+ E [<abi-tags>] <local-source-name> ::= L <source-name> <discriminator> [<abi-tags>] */ static struct demangle_component * -d_unqualified_name (struct d_info *di, struct demangle_component *scope) +d_unqualified_name (struct d_info *di, struct demangle_component *scope, + struct demangle_component *module) { struct demangle_component *ret; char peek; + if (!d_maybe_module_name (di, &module)) + return NULL; + peek = d_peek_char (di); if (IS_DIGIT (peek)) ret = d_source_name (di); @@ -1688,6 +1738,8 @@ d_unqualified_name (struct d_info *di, struct demangle_component *scope) else return NULL; + if (module) + ret = d_make_comp (di, DEMANGLE_COMPONENT_MODULE_ENTITY, ret, module); if (d_peek_char (di) == 'B') ret = d_abi_tags (di, ret); if (scope) @@ -2166,6 +2218,14 @@ d_special_name (struct d_info *di) return d_make_comp (di, DEMANGLE_COMPONENT_HIDDEN_ALIAS, d_encoding (di, 0), NULL); + case 'I': + { + struct demangle_component *module = NULL; + if (!d_maybe_module_name (di, &module) || !module) + return NULL; + return d_make_comp (di, DEMANGLE_COMPONENT_MODULE_INIT, + module, NULL); + } case 'T': switch (d_next_char (di)) { @@ -3302,7 +3362,7 @@ d_unresolved_name (struct d_info *di) } else type = cplus_demangle_type (di); - name = d_unqualified_name (di, type); + name = d_unqualified_name (di, type, NULL); if (d_peek_char (di) == 'I') name = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, name, d_template_args (di)); @@ -3375,7 +3435,7 @@ d_expression_1 (struct d_info *di) /* operator-function-id, i.e. operator+(t). */ d_advance (di, 2); - name = d_unqualified_name (di, NULL); + name = d_unqualified_name (di, NULL, NULL); if (name == NULL) return NULL; if (d_peek_char (di) == 'I') @@ -3483,7 +3543,7 @@ d_expression_1 (struct d_info *di) /* fold-expression. */ left = d_operator_name (di); else if (!strcmp (code, "di")) - left = d_unqualified_name (di, NULL); + left = d_unqualified_name (di, NULL, NULL); else left = d_expression_1 (di); if (!strcmp (code, "cl")) @@ -3501,7 +3561,7 @@ d_expression_1 (struct d_info *di) d_unqualified_name rather than d_expression_1 here for old mangled names that didn't add 'on' before operator names. */ - right = d_unqualified_name (di, NULL); + right = d_unqualified_name (di, NULL, NULL); if (d_peek_char (di) == 'I') right = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, right, d_template_args (di)); @@ -4147,6 +4207,9 @@ d_count_templates_scopes (struct d_print_info *dpi, case DEMANGLE_COMPONENT_NUMBER: case DEMANGLE_COMPONENT_UNNAMED_TYPE: case DEMANGLE_COMPONENT_STRUCTURED_BINDING: + case DEMANGLE_COMPONENT_MODULE_NAME: + case DEMANGLE_COMPONENT_MODULE_PARTITION: + case DEMANGLE_COMPONENT_MODULE_INIT: break; case DEMANGLE_COMPONENT_TEMPLATE: @@ -4252,6 +4315,7 @@ d_count_templates_scopes (struct d_print_info *dpi, case DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS: case DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS: + case DEMANGLE_COMPONENT_MODULE_ENTITY: d_count_templates_scopes (dpi, d_left (dc)); break; @@ -4831,6 +4895,25 @@ d_print_comp_inner (struct d_print_info *dpi, int options, d_append_char (dpi, ']'); return; + case DEMANGLE_COMPONENT_MODULE_ENTITY: + d_print_comp (dpi, options, d_left (dc)); + d_append_char (dpi, '@'); + d_print_comp (dpi, options, d_right (dc)); + return; + + case DEMANGLE_COMPONENT_MODULE_NAME: + case DEMANGLE_COMPONENT_MODULE_PARTITION: + { + if (d_left (dc)) + d_print_comp (dpi, options, d_left (dc)); + char c = dc->type == DEMANGLE_COMPONENT_MODULE_PARTITION + ? ':' : d_left (dc) ? '.' : 0; + if (c) + d_append_char (dpi, c); + d_print_comp (dpi, options, d_right (dc)); + } + return; + case DEMANGLE_COMPONENT_QUAL_NAME: case DEMANGLE_COMPONENT_LOCAL_NAME: d_print_comp (dpi, options, d_left (dc)); @@ -5062,6 +5145,11 @@ d_print_comp_inner (struct d_print_info *dpi, int options, d_print_comp (dpi, options, dc->u.s_dtor.name); return; + case DEMANGLE_COMPONENT_MODULE_INIT: + d_append_string (dpi, "initializer for module "); + d_print_comp (dpi, options, d_left (dc)); + return; + case DEMANGLE_COMPONENT_VTABLE: d_append_string (dpi, "vtable for "); d_print_comp (dpi, options, d_left (dc)); diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index 2b0b531..351af34 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -1503,3 +1503,70 @@ std::[a] _ZN3NMSDC1aEE NMS::[a] + +# Modules +_ZN5Outer5InnerW3FOO2FnERNS0_1XE +Outer::Inner::Fn@FOO(Outer::Inner::X&) + +_ZN5OuterW3FOO5Inner2FnERNS1_1XE +Outer::Inner@FOO::Fn(Outer::Inner@FOO::X&) + +_ZN4Quux4TotoW3FooW3Bar3BazEPNS0_S2_5PlughE +Quux::Toto::Baz@Foo.Bar(Quux::Toto::Plugh@Foo.Bar*) + +_ZW6Module1fNS_1a1bENS0_1cE +f@Module(a@Module::b, a@Module::c) + +_ZN3BobW3FOOW3BAR3BarEPS1_1APNS_S1_1BE +Bob::Bar@FOO.BAR(A@FOO.BAR*, Bob::B@FOO.BAR*) + +_ZW3FOOW3BAR3FooPS0_1APN3BobS0_1BE +Foo@FOO.BAR(A@FOO.BAR*, Bob::B@FOO.BAR*) + +_ZN3BobW3FOOW3BAZ3FooEPS0_W3BAR1APNS_S2_1BE +Bob::Foo@FOO.BAZ(A@FOO.BAR*, Bob::B@FOO.BAR*) + +_ZW3FOOW3BAZ3BarPS_W3BAR1APN3BobS1_1BE +Bar@FOO.BAZ(A@FOO.BAR*, Bob::B@FOO.BAR*) + +_ZNW3FOO3TPLIS_3OneE1MEPS1_ +TPL@FOO<One@FOO>::M(One@FOO*) + +_ZNW3FOO3TPLIS_3OneE1NIS_3TwoEEvPS1_PT_ +void TPL@FOO<One@FOO>::N<Two@FOO>(One@FOO*, Two@FOO*) + +_ZN3NMSW3FOO3TPLINS_S0_3OneEE1MEPS2_ +NMS::TPL@FOO<NMS::One@FOO>::M(NMS::One@FOO*) + +_ZN3NMSW3FOO3TPLINS_S0_3OneEE1NINS_S0_3TwoEEEvPS2_PT_ +void NMS::TPL@FOO<NMS::One@FOO>::N<NMS::Two@FOO>(NMS::One@FOO*, NMS::Two@FOO*) + +_ZNStW3STD9allocatorIiE1MEPi +std::allocator@STD<int>::M(int*) + +_ZNStW3STD9allocatorIiE1NIfEEPT_Pi +float* std::allocator@STD<int>::N<float>(int*) + +_ZNStW3STD9allocatorI4PoohE1MEPS1_ +std::allocator@STD<Pooh>::M(Pooh*) + +_ZNStW3STD9allocatorI4PoohE1NI6PigletEEPT_PS1_ +Piglet* std::allocator@STD<Pooh>::N<Piglet>(Pooh*) + +_ZW3FooDC1a1bE +[a, b]@Foo + +_ZN1NW3FooDC1a1bEE +N::[a, b]@Foo + +_ZN3NMSW3MOD3FooB3ABIEv +NMS::Foo@MOD[abi:ABI]() + +_ZGIW3Foo +initializer for module Foo + +_ZGIW3FooW3Bar +initializer for module Foo.Bar + +_ZGIW3FooWP3BarW3Baz +initializer for module Foo:Bar.Baz diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 0fc27da..5148c43 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,84 @@ +2022-05-20 Jonathan Wakely <jwakely@redhat.com> + + * testsuite/26_numerics/random/bernoulli_distribution/operators/values.cc: + Run fewer iterations for simulator targets. + * testsuite/26_numerics/random/binomial_distribution/operators/values.cc: + Likewise. + * testsuite/26_numerics/random/discrete_distribution/operators/values.cc: + Likewise. + * testsuite/26_numerics/random/geometric_distribution/operators/values.cc: + Likewise. + * testsuite/26_numerics/random/negative_binomial_distribution/operators/values.cc: + Likewise. + * testsuite/26_numerics/random/poisson_distribution/operators/values.cc: + Likewise. + * testsuite/26_numerics/random/uniform_int_distribution/operators/values.cc: + Likewise. + +2022-05-19 Jonathan Wakely <jwakely@redhat.com> + + * include/bits/char_traits.h: Only include <cstdint> when + necessary. + * include/std/stacktrace: Use __UINTPTR_TYPE__ instead of + uintptr_t. + * src/c++11/cow-stdexcept.cc: Include <stdint.h>. + * src/c++17/floating_to_chars.cc: Likewise. + * testsuite/20_util/assume_aligned/1.cc: Include <cstdint>. + * testsuite/20_util/assume_aligned/3.cc: Likewise. + * testsuite/20_util/shared_ptr/creation/array.cc: Likewise. + +2022-05-19 Jonathan Wakely <jwakely@redhat.com> + + * include/bits/basic_string.h: Do not include <ext/atomicity.h> + here. + * include/bits/cow_string.h: Include it here. + +2022-05-19 Jonathan Wakely <jwakely@redhat.com> + + * include/Makefile.am: Add new header. + * include/Makefile.in: Regenerate. + * include/bits/memory_resource.h: New file. + * include/std/deque: Include <bits/memory_resource.h>. + * include/std/forward_list: Likewise. + * include/std/list: Likewise. + * include/std/map: Likewise. + * include/std/memory_resource (pmr::memory_resource): Move to + new <bits/memory_resource.h> 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 <memory_resource> 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. + +2022-05-19 Jonathan Wakely <jwakely@redhat.com> + + * include/std/memory_resource (polymorphic_allocator): Add + non-template equality operator, as proposed for LWG 3683. + * testsuite/20_util/polymorphic_allocator/lwg3683.cc: New test. + 2022-05-17 Jonathan Wakely <jwakely@redhat.com> * src/c++17/memory_resource.cc (set_default_resource): Use diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index 77eea7d..b46def7 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -157,6 +157,7 @@ bits_headers = \ ${bits_srcdir}/localefwd.h \ ${bits_srcdir}/mask_array.h \ ${bits_srcdir}/max_size_type.h \ + ${bits_srcdir}/memory_resource.h \ ${bits_srcdir}/memoryfwd.h \ ${bits_srcdir}/mofunc_impl.h \ ${bits_srcdir}/move.h \ diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index 01bf3e0..f844008 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -515,6 +515,7 @@ bits_headers = \ ${bits_srcdir}/localefwd.h \ ${bits_srcdir}/mask_array.h \ ${bits_srcdir}/max_size_type.h \ + ${bits_srcdir}/memory_resource.h \ ${bits_srcdir}/memoryfwd.h \ ${bits_srcdir}/mofunc_impl.h \ ${bits_srcdir}/move.h \ diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index c3fbc53..6041d05 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -36,7 +36,6 @@ #pragma GCC system_header -#include <ext/atomicity.h> #include <ext/alloc_traits.h> #include <debug/debug.h> diff --git a/libstdc++-v3/include/bits/char_traits.h b/libstdc++-v3/include/bits/char_traits.h index cac1326..b856b1d 100644 --- a/libstdc++-v3/include/bits/char_traits.h +++ b/libstdc++-v3/include/bits/char_traits.h @@ -40,6 +40,9 @@ #include <cwchar> // For WEOF, wmemmove, wmemset, etc. #if __cplusplus >= 201103L # include <type_traits> +#if !defined __UINT_LEAST16_TYPE__ || !defined __UINT_LEAST32_TYPE__ +# include <cstdint> +#endif #endif #if __cplusplus >= 202002L # include <compare> @@ -728,8 +731,6 @@ _GLIBCXX_END_NAMESPACE_VERSION #if __cplusplus >= 201103L -#include <cstdint> - namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -738,10 +739,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct char_traits<char16_t> { typedef char16_t char_type; -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 - typedef uint_least16_t int_type; -#elif defined __UINT_LEAST16_TYPE__ +#ifdef __UINT_LEAST16_TYPE__ typedef __UINT_LEAST16_TYPE__ int_type; +#elif defined _GLIBCXX_USE_C99_STDINT_TR1 + typedef uint_least16_t int_type; #else typedef make_unsigned<char16_t>::type int_type; #endif @@ -859,10 +860,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct char_traits<char32_t> { typedef char32_t char_type; -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 - typedef uint_least32_t int_type; -#elif defined __UINT_LEAST32_TYPE__ +#ifdef __UINT_LEAST32_TYPE__ typedef __UINT_LEAST32_TYPE__ int_type; +#elif defined _GLIBCXX_USE_C99_STDINT_TR1 + typedef uint_least32_t int_type; #else typedef make_unsigned<char32_t>::type int_type; #endif diff --git a/libstdc++-v3/include/bits/cow_string.h b/libstdc++-v3/include/bits/cow_string.h index a49a5b0..7bceb06 100644 --- a/libstdc++-v3/include/bits/cow_string.h +++ b/libstdc++-v3/include/bits/cow_string.h @@ -34,6 +34,8 @@ #if ! _GLIBCXX_USE_CXX11_ABI +#include <ext/atomicity.h> // _Atomic_word, __is_single_threaded + #ifdef __cpp_lib_is_constant_evaluated // Support P1032R1 in C++20 (but not P0980R1 for COW strings). # define __cpp_lib_constexpr_string 201811L diff --git a/libstdc++-v3/include/bits/memory_resource.h b/libstdc++-v3/include/bits/memory_resource.h new file mode 100644 index 0000000..d8c7e16 --- /dev/null +++ b/libstdc++-v3/include/bits/memory_resource.h @@ -0,0 +1,507 @@ +// <memory_resource> -*- C++ -*- + +// Copyright (C) 2018-2022 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +/** @file include/bits/memory_resource.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{memory_resource} + */ + +#ifndef _GLIBCXX_MEMORY_RESOURCE_H +#define _GLIBCXX_MEMORY_RESOURCE_H 1 + +#pragma GCC system_header + +#if __cplusplus >= 201703L + +#include <new> // operator new(size_t, void*) +#include <cstddef> // size_t, max_align_t, byte +#include <bits/functexcept.h> // __throw_bad_array_new_length +#include <bits/uses_allocator.h> // allocator_arg_t, __use_alloc +#include <bits/uses_allocator_args.h> // uninitialized_construct_using_alloc +#include <ext/numeric_traits.h> // __int_traits +#include <debug/assertions.h> + +#if ! __cpp_lib_make_obj_using_allocator +# include <bits/utility.h> // index_sequence +# include <tuple> // tuple, forward_as_tuple +#endif + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION +namespace pmr +{ + /// Class memory_resource + class memory_resource + { + static constexpr size_t _S_max_align = alignof(max_align_t); + + public: + memory_resource() = default; + memory_resource(const memory_resource&) = default; + virtual ~memory_resource(); // key function + + memory_resource& operator=(const memory_resource&) = default; + + [[nodiscard]] + void* + allocate(size_t __bytes, size_t __alignment = _S_max_align) + __attribute__((__returns_nonnull__,__alloc_size__(2),__alloc_align__(3))) + { return ::operator new(__bytes, do_allocate(__bytes, __alignment)); } + + void + deallocate(void* __p, size_t __bytes, size_t __alignment = _S_max_align) + __attribute__((__nonnull__)) + { return do_deallocate(__p, __bytes, __alignment); } + + [[nodiscard]] + bool + is_equal(const memory_resource& __other) const noexcept + { return do_is_equal(__other); } + + private: + virtual void* + do_allocate(size_t __bytes, size_t __alignment) = 0; + + virtual void + do_deallocate(void* __p, size_t __bytes, size_t __alignment) = 0; + + virtual bool + do_is_equal(const memory_resource& __other) const noexcept = 0; + }; + + [[nodiscard]] + inline bool + operator==(const memory_resource& __a, const memory_resource& __b) noexcept + { return &__a == &__b || __a.is_equal(__b); } + +#if __cpp_impl_three_way_comparison < 201907L + [[nodiscard]] + inline bool + operator!=(const memory_resource& __a, const memory_resource& __b) noexcept + { return !(__a == __b); } +#endif + + // C++17 23.12.3 Class template polymorphic_allocator + template<typename _Tp> + class polymorphic_allocator + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2975. Missing case for pair construction in polymorphic allocators + template<typename _Up> + struct __not_pair { using type = void; }; + + template<typename _Up1, typename _Up2> + struct __not_pair<pair<_Up1, _Up2>> { }; + + public: + using value_type = _Tp; + + polymorphic_allocator() noexcept + { + extern memory_resource* get_default_resource() noexcept + __attribute__((__returns_nonnull__)); + _M_resource = get_default_resource(); + } + + polymorphic_allocator(memory_resource* __r) noexcept + __attribute__((__nonnull__)) + : _M_resource(__r) + { _GLIBCXX_DEBUG_ASSERT(__r); } + + polymorphic_allocator(const polymorphic_allocator& __other) = default; + + template<typename _Up> + polymorphic_allocator(const polymorphic_allocator<_Up>& __x) noexcept + : _M_resource(__x.resource()) + { } + + polymorphic_allocator& + operator=(const polymorphic_allocator&) = delete; + + [[nodiscard]] + _Tp* + allocate(size_t __n) + __attribute__((__returns_nonnull__)) + { + if ((__gnu_cxx::__int_traits<size_t>::__max / sizeof(_Tp)) < __n) + std::__throw_bad_array_new_length(); + return static_cast<_Tp*>(_M_resource->allocate(__n * sizeof(_Tp), + alignof(_Tp))); + } + + void + deallocate(_Tp* __p, size_t __n) noexcept + __attribute__((__nonnull__)) + { _M_resource->deallocate(__p, __n * sizeof(_Tp), alignof(_Tp)); } + +#if __cplusplus > 201703L + [[nodiscard]] void* + allocate_bytes(size_t __nbytes, + size_t __alignment = alignof(max_align_t)) + { return _M_resource->allocate(__nbytes, __alignment); } + + void + deallocate_bytes(void* __p, size_t __nbytes, + size_t __alignment = alignof(max_align_t)) + { _M_resource->deallocate(__p, __nbytes, __alignment); } + + template<typename _Up> + [[nodiscard]] _Up* + allocate_object(size_t __n = 1) + { + if ((__gnu_cxx::__int_traits<size_t>::__max / sizeof(_Up)) < __n) + std::__throw_bad_array_new_length(); + return static_cast<_Up*>(allocate_bytes(__n * sizeof(_Up), + alignof(_Up))); + } + + template<typename _Up> + void + deallocate_object(_Up* __p, size_t __n = 1) + { deallocate_bytes(__p, __n * sizeof(_Up), alignof(_Up)); } + + template<typename _Up, typename... _CtorArgs> + [[nodiscard]] _Up* + new_object(_CtorArgs&&... __ctor_args) + { + _Up* __p = allocate_object<_Up>(); + __try + { + construct(__p, std::forward<_CtorArgs>(__ctor_args)...); + } + __catch (...) + { + deallocate_object(__p); + __throw_exception_again; + } + return __p; + } + + template<typename _Up> + void + delete_object(_Up* __p) + { + __p->~_Up(); + deallocate_object(__p); + } +#endif // C++2a + +#if ! __cpp_lib_make_obj_using_allocator + template<typename _Tp1, typename... _Args> + __attribute__((__nonnull__)) + typename __not_pair<_Tp1>::type + construct(_Tp1* __p, _Args&&... __args) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2969. polymorphic_allocator::construct() shouldn't pass resource() + using __use_tag + = std::__uses_alloc_t<_Tp1, polymorphic_allocator, _Args...>; + if constexpr (is_base_of_v<__uses_alloc0, __use_tag>) + ::new(__p) _Tp1(std::forward<_Args>(__args)...); + else if constexpr (is_base_of_v<__uses_alloc1_, __use_tag>) + ::new(__p) _Tp1(allocator_arg, *this, + std::forward<_Args>(__args)...); + else + ::new(__p) _Tp1(std::forward<_Args>(__args)..., *this); + } + + template<typename _Tp1, typename _Tp2, + typename... _Args1, typename... _Args2> + __attribute__((__nonnull__)) + void + construct(pair<_Tp1, _Tp2>* __p, piecewise_construct_t, + tuple<_Args1...> __x, tuple<_Args2...> __y) + { + auto __x_tag = + __use_alloc<_Tp1, polymorphic_allocator, _Args1...>(*this); + auto __y_tag = + __use_alloc<_Tp2, polymorphic_allocator, _Args2...>(*this); + index_sequence_for<_Args1...> __x_i; + index_sequence_for<_Args2...> __y_i; + + ::new(__p) pair<_Tp1, _Tp2>(piecewise_construct, + _S_construct_p(__x_tag, __x_i, __x), + _S_construct_p(__y_tag, __y_i, __y)); + } + + template<typename _Tp1, typename _Tp2> + __attribute__((__nonnull__)) + void + construct(pair<_Tp1, _Tp2>* __p) + { this->construct(__p, piecewise_construct, tuple<>(), tuple<>()); } + + template<typename _Tp1, typename _Tp2, typename _Up, typename _Vp> + __attribute__((__nonnull__)) + void + construct(pair<_Tp1, _Tp2>* __p, _Up&& __x, _Vp&& __y) + { + this->construct(__p, piecewise_construct, + std::forward_as_tuple(std::forward<_Up>(__x)), + std::forward_as_tuple(std::forward<_Vp>(__y))); + } + + template <typename _Tp1, typename _Tp2, typename _Up, typename _Vp> + __attribute__((__nonnull__)) + void + construct(pair<_Tp1, _Tp2>* __p, const std::pair<_Up, _Vp>& __pr) + { + this->construct(__p, piecewise_construct, + std::forward_as_tuple(__pr.first), + std::forward_as_tuple(__pr.second)); + } + + template<typename _Tp1, typename _Tp2, typename _Up, typename _Vp> + __attribute__((__nonnull__)) + void + construct(pair<_Tp1, _Tp2>* __p, pair<_Up, _Vp>&& __pr) + { + this->construct(__p, piecewise_construct, + std::forward_as_tuple(std::forward<_Up>(__pr.first)), + std::forward_as_tuple(std::forward<_Vp>(__pr.second))); + } +#else // make_obj_using_allocator + template<typename _Tp1, typename... _Args> + __attribute__((__nonnull__)) + void + construct(_Tp1* __p, _Args&&... __args) + { + std::uninitialized_construct_using_allocator(__p, *this, + std::forward<_Args>(__args)...); + } +#endif + + template<typename _Up> + _GLIBCXX20_DEPRECATED_SUGGEST("allocator_traits::destroy") + __attribute__((__nonnull__)) + void + destroy(_Up* __p) + { __p->~_Up(); } + + polymorphic_allocator + select_on_container_copy_construction() const noexcept + { return polymorphic_allocator(); } + + memory_resource* + resource() const noexcept + __attribute__((__returns_nonnull__)) + { return _M_resource; } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3683. operator== for polymorphic_allocator cannot deduce template arg + [[nodiscard]] + friend bool + operator==(const polymorphic_allocator& __a, + const polymorphic_allocator& __b) noexcept + { return *__a.resource() == *__b.resource(); } + +#if __cpp_impl_three_way_comparison < 201907L + [[nodiscard]] + friend bool + operator!=(const polymorphic_allocator& __a, + const polymorphic_allocator& __b) noexcept + { return !(__a == __b); } +#endif + + private: +#if ! __cpp_lib_make_obj_using_allocator + using __uses_alloc1_ = __uses_alloc1<polymorphic_allocator>; + using __uses_alloc2_ = __uses_alloc2<polymorphic_allocator>; + + template<typename _Ind, typename... _Args> + static tuple<_Args&&...> + _S_construct_p(__uses_alloc0, _Ind, tuple<_Args...>& __t) + { return std::move(__t); } + + template<size_t... _Ind, typename... _Args> + static tuple<allocator_arg_t, polymorphic_allocator, _Args&&...> + _S_construct_p(__uses_alloc1_ __ua, index_sequence<_Ind...>, + tuple<_Args...>& __t) + { + return { + allocator_arg, *__ua._M_a, std::get<_Ind>(std::move(__t))... + }; + } + + template<size_t... _Ind, typename... _Args> + static tuple<_Args&&..., polymorphic_allocator> + _S_construct_p(__uses_alloc2_ __ua, index_sequence<_Ind...>, + tuple<_Args...>& __t) + { return { std::get<_Ind>(std::move(__t))..., *__ua._M_a }; } +#endif + + memory_resource* _M_resource; + }; + + template<typename _Tp1, typename _Tp2> + [[nodiscard]] + inline bool + operator==(const polymorphic_allocator<_Tp1>& __a, + const polymorphic_allocator<_Tp2>& __b) noexcept + { return *__a.resource() == *__b.resource(); } + +#if __cpp_impl_three_way_comparison < 201907L + template<typename _Tp1, typename _Tp2> + [[nodiscard]] + inline bool + operator!=(const polymorphic_allocator<_Tp1>& __a, + const polymorphic_allocator<_Tp2>& __b) noexcept + { return !(__a == __b); } +#endif + +} // namespace pmr + + template<typename _Alloc> struct allocator_traits; + + /// Partial specialization for std::pmr::polymorphic_allocator + template<typename _Tp> + struct allocator_traits<pmr::polymorphic_allocator<_Tp>> + { + /// The allocator type + using allocator_type = pmr::polymorphic_allocator<_Tp>; + + /// The allocated type + using value_type = _Tp; + + /// The allocator's pointer type. + using pointer = _Tp*; + + /// The allocator's const pointer type. + using const_pointer = const _Tp*; + + /// The allocator's void pointer type. + using void_pointer = void*; + + /// The allocator's const void pointer type. + using const_void_pointer = const void*; + + /// The allocator's difference type + using difference_type = std::ptrdiff_t; + + /// The allocator's size type + using size_type = std::size_t; + + /** @{ + * A `polymorphic_allocator` does not propagate when a + * container is copied, moved, or swapped. + */ + using propagate_on_container_copy_assignment = false_type; + using propagate_on_container_move_assignment = false_type; + using propagate_on_container_swap = false_type; + + static allocator_type + select_on_container_copy_construction(const allocator_type&) noexcept + { return allocator_type(); } + /// @} + + /// Whether all instances of the allocator type compare equal. + using is_always_equal = false_type; + + template<typename _Up> + using rebind_alloc = pmr::polymorphic_allocator<_Up>; + + template<typename _Up> + using rebind_traits = allocator_traits<pmr::polymorphic_allocator<_Up>>; + + /** + * @brief Allocate memory. + * @param __a An allocator. + * @param __n The number of objects to allocate space for. + * + * Calls `a.allocate(n)`. + */ + [[nodiscard]] static pointer + allocate(allocator_type& __a, size_type __n) + { return __a.allocate(__n); } + + /** + * @brief Allocate memory. + * @param __a An allocator. + * @param __n The number of objects to allocate space for. + * @return Memory of suitable size and alignment for `n` objects + * of type `value_type`. + * + * The third parameter is ignored.. + * + * Returns `a.allocate(n)`. + */ + [[nodiscard]] static pointer + allocate(allocator_type& __a, size_type __n, const_void_pointer) + { return __a.allocate(__n); } + + /** + * @brief Deallocate memory. + * @param __a An allocator. + * @param __p Pointer to the memory to deallocate. + * @param __n The number of objects space was allocated for. + * + * Calls `a.deallocate(p, n)`. + */ + static void + deallocate(allocator_type& __a, pointer __p, size_type __n) + { __a.deallocate(__p, __n); } + + /** + * @brief Construct an object of type `_Up` + * @param __a An allocator. + * @param __p Pointer to memory of suitable size and alignment for + * an object of type `_Up`. + * @param __args Constructor arguments. + * + * Calls `__a.construct(__p, std::forward<_Args>(__args)...)` + * in C++11, C++14 and C++17. Changed in C++20 to call + * `std::construct_at(__p, std::forward<_Args>(__args)...)` instead. + */ + template<typename _Up, typename... _Args> + static void + construct(allocator_type& __a, _Up* __p, _Args&&... __args) + { __a.construct(__p, std::forward<_Args>(__args)...); } + + /** + * @brief Destroy an object of type `_Up` + * @param __a An allocator. + * @param __p Pointer to the object to destroy + * + * Calls `p->_Up()`. + */ + template<typename _Up> + static _GLIBCXX20_CONSTEXPR void + destroy(allocator_type&, _Up* __p) + noexcept(is_nothrow_destructible<_Up>::value) + { __p->~_Up(); } + + /** + * @brief The maximum supported allocation size + * @return `numeric_limits<size_t>::max() / sizeof(value_type)` + */ + static _GLIBCXX20_CONSTEXPR size_type + max_size(const allocator_type&) noexcept + { return size_t(-1) / sizeof(value_type); } + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // C++17 +#endif // _GLIBCXX_MEMORY_RESOURCE_H diff --git a/libstdc++-v3/include/std/deque b/libstdc++-v3/include/std/deque index dc5c203..abdc2e0 100644 --- a/libstdc++-v3/include/std/deque +++ b/libstdc++-v3/include/std/deque @@ -71,12 +71,12 @@ #endif #if __cplusplus >= 201703L +#include <bits/memory_resource.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace pmr { - template<typename _Tp> class polymorphic_allocator; template<typename _Tp> using deque = std::deque<_Tp, polymorphic_allocator<_Tp>>; } // namespace pmr diff --git a/libstdc++-v3/include/std/forward_list b/libstdc++-v3/include/std/forward_list index 21d617b..fe99e5e 100644 --- a/libstdc++-v3/include/std/forward_list +++ b/libstdc++-v3/include/std/forward_list @@ -44,12 +44,12 @@ #endif #if __cplusplus >= 201703L +#include <bits/memory_resource.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace pmr { - template<typename _Tp> class polymorphic_allocator; template<typename _Tp> using forward_list = std::forward_list<_Tp, polymorphic_allocator<_Tp>>; } // namespace pmr diff --git a/libstdc++-v3/include/std/list b/libstdc++-v3/include/std/list index d7ef943..9151e98 100644 --- a/libstdc++-v3/include/std/list +++ b/libstdc++-v3/include/std/list @@ -68,12 +68,12 @@ #endif #if __cplusplus >= 201703L +#include <bits/memory_resource.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace pmr { - template<typename _Tp> class polymorphic_allocator; template<typename _Tp> using list = std::list<_Tp, polymorphic_allocator<_Tp>>; } // namespace pmr diff --git a/libstdc++-v3/include/std/map b/libstdc++-v3/include/std/map index 93c956a..ce07f29 100644 --- a/libstdc++-v3/include/std/map +++ b/libstdc++-v3/include/std/map @@ -68,12 +68,12 @@ #endif #if __cplusplus >= 201703L +#include <bits/memory_resource.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace pmr { - template<typename _Tp> class polymorphic_allocator; template<typename _Key, typename _Tp, typename _Cmp = std::less<_Key>> using map = std::map<_Key, _Tp, _Cmp, diff --git a/libstdc++-v3/include/std/memory_resource b/libstdc++-v3/include/std/memory_resource index 745422a..19c9225 100644 --- a/libstdc++-v3/include/std/memory_resource +++ b/libstdc++-v3/include/std/memory_resource @@ -33,22 +33,12 @@ #if __cplusplus >= 201703L -#include <new> +#include <bits/memory_resource.h> #include <vector> // vector -#include <cstddef> // size_t, max_align_t, byte #include <shared_mutex> // shared_mutex #include <bits/align.h> // align -#include <bits/functexcept.h> // __throw_bad_array_new_length -#include <bits/uses_allocator.h> // allocator_arg_t, __use_alloc -#include <bits/uses_allocator_args.h> // uninitialized_construct_using_alloc -#include <ext/numeric_traits.h> #include <debug/assertions.h> -#if ! __cpp_lib_make_obj_using_allocator -# include <bits/utility.h> // index_sequence -# include <tuple> // tuple, forward_as_tuple -#endif - namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -62,12 +52,7 @@ namespace pmr # define __cpp_lib_memory_resource 1 #endif - class memory_resource; - -#if __cplusplus == 201703L - template<typename _Tp> - class polymorphic_allocator; -#else // C++20 +#if __cplusplus >= 202002L # define __cpp_lib_polymorphic_allocator 201902L template<typename _Tp = std::byte> class polymorphic_allocator; @@ -103,451 +88,6 @@ namespace pmr class unsynchronized_pool_resource; class monotonic_buffer_resource; - /// Class memory_resource - class memory_resource - { - static constexpr size_t _S_max_align = alignof(max_align_t); - - public: - memory_resource() = default; - memory_resource(const memory_resource&) = default; - virtual ~memory_resource(); // key function - - memory_resource& operator=(const memory_resource&) = default; - - [[nodiscard]] - void* - allocate(size_t __bytes, size_t __alignment = _S_max_align) - __attribute__((__returns_nonnull__,__alloc_size__(2),__alloc_align__(3))) - { return ::operator new(__bytes, do_allocate(__bytes, __alignment)); } - - void - deallocate(void* __p, size_t __bytes, size_t __alignment = _S_max_align) - __attribute__((__nonnull__)) - { return do_deallocate(__p, __bytes, __alignment); } - - [[nodiscard]] - bool - is_equal(const memory_resource& __other) const noexcept - { return do_is_equal(__other); } - - private: - virtual void* - do_allocate(size_t __bytes, size_t __alignment) = 0; - - virtual void - do_deallocate(void* __p, size_t __bytes, size_t __alignment) = 0; - - virtual bool - do_is_equal(const memory_resource& __other) const noexcept = 0; - }; - - [[nodiscard]] - inline bool - operator==(const memory_resource& __a, const memory_resource& __b) noexcept - { return &__a == &__b || __a.is_equal(__b); } - -#if __cpp_impl_three_way_comparison < 201907L - [[nodiscard]] - inline bool - operator!=(const memory_resource& __a, const memory_resource& __b) noexcept - { return !(__a == __b); } -#endif - - // C++17 23.12.3 Class template polymorphic_allocator - template<typename _Tp> - class polymorphic_allocator - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2975. Missing case for pair construction in polymorphic allocators - template<typename _Up> - struct __not_pair { using type = void; }; - - template<typename _Up1, typename _Up2> - struct __not_pair<pair<_Up1, _Up2>> { }; - - public: - using value_type = _Tp; - - polymorphic_allocator() noexcept - : _M_resource(get_default_resource()) - { } - - polymorphic_allocator(memory_resource* __r) noexcept - __attribute__((__nonnull__)) - : _M_resource(__r) - { _GLIBCXX_DEBUG_ASSERT(__r); } - - polymorphic_allocator(const polymorphic_allocator& __other) = default; - - template<typename _Up> - polymorphic_allocator(const polymorphic_allocator<_Up>& __x) noexcept - : _M_resource(__x.resource()) - { } - - polymorphic_allocator& - operator=(const polymorphic_allocator&) = delete; - - [[nodiscard]] - _Tp* - allocate(size_t __n) - __attribute__((__returns_nonnull__)) - { - if ((__gnu_cxx::__int_traits<size_t>::__max / sizeof(_Tp)) < __n) - std::__throw_bad_array_new_length(); - return static_cast<_Tp*>(_M_resource->allocate(__n * sizeof(_Tp), - alignof(_Tp))); - } - - void - deallocate(_Tp* __p, size_t __n) noexcept - __attribute__((__nonnull__)) - { _M_resource->deallocate(__p, __n * sizeof(_Tp), alignof(_Tp)); } - -#if __cplusplus > 201703L - [[nodiscard]] void* - allocate_bytes(size_t __nbytes, - size_t __alignment = alignof(max_align_t)) - { return _M_resource->allocate(__nbytes, __alignment); } - - void - deallocate_bytes(void* __p, size_t __nbytes, - size_t __alignment = alignof(max_align_t)) - { _M_resource->deallocate(__p, __nbytes, __alignment); } - - template<typename _Up> - [[nodiscard]] _Up* - allocate_object(size_t __n = 1) - { - if ((__gnu_cxx::__int_traits<size_t>::__max / sizeof(_Up)) < __n) - std::__throw_bad_array_new_length(); - return static_cast<_Up*>(allocate_bytes(__n * sizeof(_Up), - alignof(_Up))); - } - - template<typename _Up> - void - deallocate_object(_Up* __p, size_t __n = 1) - { deallocate_bytes(__p, __n * sizeof(_Up), alignof(_Up)); } - - template<typename _Up, typename... _CtorArgs> - [[nodiscard]] _Up* - new_object(_CtorArgs&&... __ctor_args) - { - _Up* __p = allocate_object<_Up>(); - __try - { - construct(__p, std::forward<_CtorArgs>(__ctor_args)...); - } - __catch (...) - { - deallocate_object(__p); - __throw_exception_again; - } - return __p; - } - - template<typename _Up> - void - delete_object(_Up* __p) - { - __p->~_Up(); - deallocate_object(__p); - } -#endif // C++2a - -#if ! __cpp_lib_make_obj_using_allocator - template<typename _Tp1, typename... _Args> - __attribute__((__nonnull__)) - typename __not_pair<_Tp1>::type - construct(_Tp1* __p, _Args&&... __args) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2969. polymorphic_allocator::construct() shouldn't pass resource() - using __use_tag - = std::__uses_alloc_t<_Tp1, polymorphic_allocator, _Args...>; - if constexpr (is_base_of_v<__uses_alloc0, __use_tag>) - ::new(__p) _Tp1(std::forward<_Args>(__args)...); - else if constexpr (is_base_of_v<__uses_alloc1_, __use_tag>) - ::new(__p) _Tp1(allocator_arg, *this, - std::forward<_Args>(__args)...); - else - ::new(__p) _Tp1(std::forward<_Args>(__args)..., *this); - } - - template<typename _Tp1, typename _Tp2, - typename... _Args1, typename... _Args2> - __attribute__((__nonnull__)) - void - construct(pair<_Tp1, _Tp2>* __p, piecewise_construct_t, - tuple<_Args1...> __x, tuple<_Args2...> __y) - { - auto __x_tag = - __use_alloc<_Tp1, polymorphic_allocator, _Args1...>(*this); - auto __y_tag = - __use_alloc<_Tp2, polymorphic_allocator, _Args2...>(*this); - index_sequence_for<_Args1...> __x_i; - index_sequence_for<_Args2...> __y_i; - - ::new(__p) pair<_Tp1, _Tp2>(piecewise_construct, - _S_construct_p(__x_tag, __x_i, __x), - _S_construct_p(__y_tag, __y_i, __y)); - } - - template<typename _Tp1, typename _Tp2> - __attribute__((__nonnull__)) - void - construct(pair<_Tp1, _Tp2>* __p) - { this->construct(__p, piecewise_construct, tuple<>(), tuple<>()); } - - template<typename _Tp1, typename _Tp2, typename _Up, typename _Vp> - __attribute__((__nonnull__)) - void - construct(pair<_Tp1, _Tp2>* __p, _Up&& __x, _Vp&& __y) - { - this->construct(__p, piecewise_construct, - std::forward_as_tuple(std::forward<_Up>(__x)), - std::forward_as_tuple(std::forward<_Vp>(__y))); - } - - template <typename _Tp1, typename _Tp2, typename _Up, typename _Vp> - __attribute__((__nonnull__)) - void - construct(pair<_Tp1, _Tp2>* __p, const std::pair<_Up, _Vp>& __pr) - { - this->construct(__p, piecewise_construct, - std::forward_as_tuple(__pr.first), - std::forward_as_tuple(__pr.second)); - } - - template<typename _Tp1, typename _Tp2, typename _Up, typename _Vp> - __attribute__((__nonnull__)) - void - construct(pair<_Tp1, _Tp2>* __p, pair<_Up, _Vp>&& __pr) - { - this->construct(__p, piecewise_construct, - std::forward_as_tuple(std::forward<_Up>(__pr.first)), - std::forward_as_tuple(std::forward<_Vp>(__pr.second))); - } -#else // make_obj_using_allocator - template<typename _Tp1, typename... _Args> - __attribute__((__nonnull__)) - void - construct(_Tp1* __p, _Args&&... __args) - { - std::uninitialized_construct_using_allocator(__p, *this, - std::forward<_Args>(__args)...); - } -#endif - - template<typename _Up> - _GLIBCXX20_DEPRECATED_SUGGEST("allocator_traits::destroy") - __attribute__((__nonnull__)) - void - destroy(_Up* __p) - { __p->~_Up(); } - - polymorphic_allocator - select_on_container_copy_construction() const noexcept - { return polymorphic_allocator(); } - - memory_resource* - resource() const noexcept - __attribute__((__returns_nonnull__)) - { return _M_resource; } - - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 3683. operator== for polymorphic_allocator cannot deduce template arg - [[nodiscard]] - friend bool - operator==(const polymorphic_allocator& __a, - const polymorphic_allocator& __b) noexcept - { return *__a.resource() == *__b.resource(); } - -#if __cpp_impl_three_way_comparison < 201907L - [[nodiscard]] - friend bool - operator!=(const polymorphic_allocator& __a, - const polymorphic_allocator& __b) noexcept - { return !(__a == __b); } -#endif - - private: -#if ! __cpp_lib_make_obj_using_allocator - using __uses_alloc1_ = __uses_alloc1<polymorphic_allocator>; - using __uses_alloc2_ = __uses_alloc2<polymorphic_allocator>; - - template<typename _Ind, typename... _Args> - static tuple<_Args&&...> - _S_construct_p(__uses_alloc0, _Ind, tuple<_Args...>& __t) - { return std::move(__t); } - - template<size_t... _Ind, typename... _Args> - static tuple<allocator_arg_t, polymorphic_allocator, _Args&&...> - _S_construct_p(__uses_alloc1_ __ua, index_sequence<_Ind...>, - tuple<_Args...>& __t) - { - return { - allocator_arg, *__ua._M_a, std::get<_Ind>(std::move(__t))... - }; - } - - template<size_t... _Ind, typename... _Args> - static tuple<_Args&&..., polymorphic_allocator> - _S_construct_p(__uses_alloc2_ __ua, index_sequence<_Ind...>, - tuple<_Args...>& __t) - { return { std::get<_Ind>(std::move(__t))..., *__ua._M_a }; } -#endif - - memory_resource* _M_resource; - }; - - template<typename _Tp1, typename _Tp2> - [[nodiscard]] - inline bool - operator==(const polymorphic_allocator<_Tp1>& __a, - const polymorphic_allocator<_Tp2>& __b) noexcept - { return *__a.resource() == *__b.resource(); } - -#if __cpp_impl_three_way_comparison < 201907L - template<typename _Tp1, typename _Tp2> - [[nodiscard]] - inline bool - operator!=(const polymorphic_allocator<_Tp1>& __a, - const polymorphic_allocator<_Tp2>& __b) noexcept - { return !(__a == __b); } -#endif - -} // namespace pmr - - /// Partial specialization for std::pmr::polymorphic_allocator - template<typename _Tp> - struct allocator_traits<pmr::polymorphic_allocator<_Tp>> - { - /// The allocator type - using allocator_type = pmr::polymorphic_allocator<_Tp>; - - /// The allocated type - using value_type = _Tp; - - /// The allocator's pointer type. - using pointer = _Tp*; - - /// The allocator's const pointer type. - using const_pointer = const _Tp*; - - /// The allocator's void pointer type. - using void_pointer = void*; - - /// The allocator's const void pointer type. - using const_void_pointer = const void*; - - /// The allocator's difference type - using difference_type = std::ptrdiff_t; - - /// The allocator's size type - using size_type = std::size_t; - - /** @{ - * A `polymorphic_allocator` does not propagate when a - * container is copied, moved, or swapped. - */ - using propagate_on_container_copy_assignment = false_type; - using propagate_on_container_move_assignment = false_type; - using propagate_on_container_swap = false_type; - - static allocator_type - select_on_container_copy_construction(const allocator_type&) noexcept - { return allocator_type(); } - /// @} - - /// Whether all instances of the allocator type compare equal. - using is_always_equal = false_type; - - template<typename _Up> - using rebind_alloc = pmr::polymorphic_allocator<_Up>; - - template<typename _Up> - using rebind_traits = allocator_traits<pmr::polymorphic_allocator<_Up>>; - - /** - * @brief Allocate memory. - * @param __a An allocator. - * @param __n The number of objects to allocate space for. - * - * Calls `a.allocate(n)`. - */ - [[nodiscard]] static pointer - allocate(allocator_type& __a, size_type __n) - { return __a.allocate(__n); } - - /** - * @brief Allocate memory. - * @param __a An allocator. - * @param __n The number of objects to allocate space for. - * @return Memory of suitable size and alignment for `n` objects - * of type `value_type`. - * - * The third parameter is ignored.. - * - * Returns `a.allocate(n)`. - */ - [[nodiscard]] static pointer - allocate(allocator_type& __a, size_type __n, const_void_pointer) - { return __a.allocate(__n); } - - /** - * @brief Deallocate memory. - * @param __a An allocator. - * @param __p Pointer to the memory to deallocate. - * @param __n The number of objects space was allocated for. - * - * Calls `a.deallocate(p, n)`. - */ - static void - deallocate(allocator_type& __a, pointer __p, size_type __n) - { __a.deallocate(__p, __n); } - - /** - * @brief Construct an object of type `_Up` - * @param __a An allocator. - * @param __p Pointer to memory of suitable size and alignment for - * an object of type `_Up`. - * @param __args Constructor arguments. - * - * Calls `__a.construct(__p, std::forward<_Args>(__args)...)` - * in C++11, C++14 and C++17. Changed in C++20 to call - * `std::construct_at(__p, std::forward<_Args>(__args)...)` instead. - */ - template<typename _Up, typename... _Args> - static void - construct(allocator_type& __a, _Up* __p, _Args&&... __args) - { __a.construct(__p, std::forward<_Args>(__args)...); } - - /** - * @brief Destroy an object of type `_Up` - * @param __a An allocator. - * @param __p Pointer to the object to destroy - * - * Calls `p->_Up()`. - */ - template<typename _Up> - static _GLIBCXX20_CONSTEXPR void - destroy(allocator_type&, _Up* __p) - noexcept(is_nothrow_destructible<_Up>::value) - { __p->~_Up(); } - - /** - * @brief The maximum supported allocation size - * @return `numeric_limits<size_t>::max() / sizeof(value_type)` - */ - static _GLIBCXX20_CONSTEXPR size_type - max_size(const allocator_type&) noexcept - { return size_t(-1) / sizeof(value_type); } - }; - -namespace pmr -{ /// Parameters for tuning a pool resource's behaviour. struct pool_options { diff --git a/libstdc++-v3/include/std/regex b/libstdc++-v3/include/std/regex index d1b6a6c..491bced 100644 --- a/libstdc++-v3/include/std/regex +++ b/libstdc++-v3/include/std/regex @@ -67,12 +67,12 @@ #include <bits/regex_executor.h> #if __cplusplus >= 201703L && _GLIBCXX_USE_CXX11_ABI +#include <bits/memory_resource.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace pmr { - template<typename _Tp> class polymorphic_allocator; template<typename _BidirectionalIterator> using match_results = std::match_results<_BidirectionalIterator, polymorphic_allocator< diff --git a/libstdc++-v3/include/std/set b/libstdc++-v3/include/std/set index 45fed14..551c777 100644 --- a/libstdc++-v3/include/std/set +++ b/libstdc++-v3/include/std/set @@ -68,12 +68,12 @@ #endif #if __cplusplus >= 201703L +#include <bits/memory_resource.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace pmr { - template<typename _Tp> class polymorphic_allocator; template<typename _Key, typename _Cmp = std::less<_Key>> using set = std::set<_Key, _Cmp, polymorphic_allocator<_Key>>; template<typename _Key, typename _Cmp = std::less<_Key>> diff --git a/libstdc++-v3/include/std/stacktrace b/libstdc++-v3/include/std/stacktrace index 8e6c79a..39472d7 100644 --- a/libstdc++-v3/include/std/stacktrace +++ b/libstdc++-v3/include/std/stacktrace @@ -33,6 +33,7 @@ #include <new> #include <string> #include <sstream> +#include <bits/memory_resource.h> #include <bits/stl_algobase.h> #include <bits/stl_algo.h> #include <bits/stl_iterator.h> @@ -51,20 +52,20 @@ __glibcxx_backtrace_create_state(const char*, int, int __glibcxx_backtrace_simple(__glibcxx_backtrace_state*, int, - int (*) (void*, uintptr_t), + int (*) (void*, __UINTPTR_TYPE__), void(*)(void*, const char*, int), void*); int -__glibcxx_backtrace_pcinfo(__glibcxx_backtrace_state*, uintptr_t, - int (*)(void*, uintptr_t, +__glibcxx_backtrace_pcinfo(__glibcxx_backtrace_state*, __UINTPTR_TYPE__, + int (*)(void*, __UINTPTR_TYPE__, const char*, int, const char*), void(*)(void*, const char*, int), void*); int -__glibcxx_backtrace_syminfo(__glibcxx_backtrace_state*, uintptr_t addr, - void (*) (void*, uintptr_t, const char*, - uintptr_t, uintptr_t), +__glibcxx_backtrace_syminfo(__glibcxx_backtrace_state*, __UINTPTR_TYPE__ addr, + void (*) (void*, __UINTPTR_TYPE__, const char*, + __UINTPTR_TYPE__, __UINTPTR_TYPE__), void(*)(void*, const char*, int), void*); } @@ -224,6 +225,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class basic_stacktrace { using _AllocTraits = allocator_traits<_Allocator>; + using uintptr_t = __UINTPTR_TYPE__; public: using value_type = stacktrace_entry; @@ -758,7 +760,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace pmr { - template<typename _Tp> class polymorphic_allocator; using stacktrace = basic_stacktrace<polymorphic_allocator<stacktrace_entry>>; } diff --git a/libstdc++-v3/include/std/string b/libstdc++-v3/include/std/string index b1d8b6a..2405166 100644 --- a/libstdc++-v3/include/std/string +++ b/libstdc++-v3/include/std/string @@ -54,11 +54,11 @@ #include <bits/basic_string.tcc> #if __cplusplus >= 201703L && _GLIBCXX_USE_CXX11_ABI +#include <bits/memory_resource.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace pmr { - template<typename _Tp> class polymorphic_allocator; template<typename _CharT, typename _Traits = char_traits<_CharT>> using basic_string = std::basic_string<_CharT, _Traits, polymorphic_allocator<_CharT>>; diff --git a/libstdc++-v3/include/std/unordered_map b/libstdc++-v3/include/std/unordered_map index bb14ffa..e13bb9a 100644 --- a/libstdc++-v3/include/std/unordered_map +++ b/libstdc++-v3/include/std/unordered_map @@ -53,12 +53,12 @@ #endif #if __cplusplus >= 201703L +#include <bits/memory_resource.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace pmr { - template<typename _Tp> class polymorphic_allocator; template<typename _Key, typename _Tp, typename _Hash = std::hash<_Key>, typename _Pred = std::equal_to<_Key>> using unordered_map diff --git a/libstdc++-v3/include/std/unordered_set b/libstdc++-v3/include/std/unordered_set index 777e3b8..8b66571 100644 --- a/libstdc++-v3/include/std/unordered_set +++ b/libstdc++-v3/include/std/unordered_set @@ -53,12 +53,12 @@ #endif #if __cplusplus >= 201703L +#include <bits/memory_resource.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace pmr { - template<typename _Tp> class polymorphic_allocator; template<typename _Key, typename _Hash = std::hash<_Key>, typename _Pred = std::equal_to<_Key>> using unordered_set diff --git a/libstdc++-v3/include/std/vector b/libstdc++-v3/include/std/vector index a880dfc..d7f69fd 100644 --- a/libstdc++-v3/include/std/vector +++ b/libstdc++-v3/include/std/vector @@ -75,11 +75,11 @@ #endif #if __cplusplus >= 201703L +#include <bits/memory_resource.h> namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace pmr { - template<typename _Tp> class polymorphic_allocator; template<typename _Tp> using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>; } // namespace pmr diff --git a/libstdc++-v3/src/c++11/cow-stdexcept.cc b/libstdc++-v3/src/c++11/cow-stdexcept.cc index 5ccf2ca..9e87874 100644 --- a/libstdc++-v3/src/c++11/cow-stdexcept.cc +++ b/libstdc++-v3/src/c++11/cow-stdexcept.cc @@ -200,6 +200,10 @@ _GLIBCXX_END_NAMESPACE_VERSION #if _GLIBCXX_USE_WEAK_REF #ifdef _GLIBCXX_USE_C99_STDINT_TR1 +#include <stdint.h> + +using std::size_t; + extern "C" { #ifndef _GLIBCXX_MANGLE_SIZE_T diff --git a/libstdc++-v3/src/c++17/floating_to_chars.cc b/libstdc++-v3/src/c++17/floating_to_chars.cc index 4599d68..b1c915e 100644 --- a/libstdc++-v3/src/c++17/floating_to_chars.cc +++ b/libstdc++-v3/src/c++17/floating_to_chars.cc @@ -85,6 +85,8 @@ using F128_type = __float128; using F128_type = void; #endif +#include <stdint.h> + namespace { #if defined __SIZEOF_INT128__ diff --git a/libstdc++-v3/testsuite/20_util/assume_aligned/1.cc b/libstdc++-v3/testsuite/20_util/assume_aligned/1.cc index 5937958..0a1390d 100644 --- a/libstdc++-v3/testsuite/20_util/assume_aligned/1.cc +++ b/libstdc++-v3/testsuite/20_util/assume_aligned/1.cc @@ -19,6 +19,7 @@ // { dg-do run { target c++2a } } #include <memory> +#include <cstdint> #include <testsuite_hooks.h> void diff --git a/libstdc++-v3/testsuite/20_util/assume_aligned/3.cc b/libstdc++-v3/testsuite/20_util/assume_aligned/3.cc index e1abf17..93ee86c 100644 --- a/libstdc++-v3/testsuite/20_util/assume_aligned/3.cc +++ b/libstdc++-v3/testsuite/20_util/assume_aligned/3.cc @@ -20,6 +20,7 @@ // { dg-final { scan-assembler-not "undefined" } } #include <memory> +#include <cstdint> int* ptr(); extern "C" void undefined(); diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/creation/array.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/creation/array.cc index cd614c0..5c11a8b 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/creation/array.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/creation/array.cc @@ -65,6 +65,7 @@ test02() } #include <vector> +#include <cstdint> std::vector<std::uintptr_t> addresses; diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/types/pmr_typedefs.cc b/libstdc++-v3/testsuite/21_strings/basic_string/types/pmr_typedefs.cc index 51bbfb0..cabe590 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/types/pmr_typedefs.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/types/pmr_typedefs.cc @@ -19,7 +19,8 @@ // { dg-require-effective-target cxx11_abi } #include <string> -#include <memory_resource> + +std::pmr::string s = "polly"; struct T : std::char_traits<char> { }; diff --git a/libstdc++-v3/testsuite/23_containers/deque/types/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/deque/types/pmr_typedefs.cc index f6493e8..c973d4f 100644 --- a/libstdc++-v3/testsuite/23_containers/deque/types/pmr_typedefs.cc +++ b/libstdc++-v3/testsuite/23_containers/deque/types/pmr_typedefs.cc @@ -18,7 +18,8 @@ // { dg-do compile { target c++17 } } #include <deque> -#include <memory_resource> + +std::pmr::deque<int> c{1, 2, 3, 4}; struct X { }; diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/forward_list/pmr_typedefs.cc index 8559783..f66e53f 100644 --- a/libstdc++-v3/testsuite/23_containers/forward_list/pmr_typedefs.cc +++ b/libstdc++-v3/testsuite/23_containers/forward_list/pmr_typedefs.cc @@ -18,7 +18,8 @@ // { dg-do compile { target c++17 } } #include <forward_list> -#include <memory_resource> + +std::pmr::forward_list<int> c{1, 2, 3, 4}; struct X { }; diff --git a/libstdc++-v3/testsuite/23_containers/list/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/list/pmr_typedefs.cc index d6c408a..3c5ef79 100644 --- a/libstdc++-v3/testsuite/23_containers/list/pmr_typedefs.cc +++ b/libstdc++-v3/testsuite/23_containers/list/pmr_typedefs.cc @@ -18,7 +18,8 @@ // { dg-do compile { target c++17 } } #include <list> -#include <memory_resource> + +std::pmr::list<int> c{1, 2, 3, 4}; struct X { }; diff --git a/libstdc++-v3/testsuite/23_containers/map/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/map/pmr_typedefs.cc index cc82fcf..91602cc 100644 --- a/libstdc++-v3/testsuite/23_containers/map/pmr_typedefs.cc +++ b/libstdc++-v3/testsuite/23_containers/map/pmr_typedefs.cc @@ -18,7 +18,8 @@ // { dg-do compile { target c++17 } } #include <map> -#include <memory_resource> + +std::pmr::map<int, int> c{{1,0}, {2,0}, {3,0}, {4,0}}; struct X { }; struct Y { }; diff --git a/libstdc++-v3/testsuite/23_containers/multimap/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/multimap/pmr_typedefs.cc index 2312ad6..13b0970 100644 --- a/libstdc++-v3/testsuite/23_containers/multimap/pmr_typedefs.cc +++ b/libstdc++-v3/testsuite/23_containers/multimap/pmr_typedefs.cc @@ -18,7 +18,8 @@ // { dg-do compile { target c++17 } } #include <map> -#include <memory_resource> + +std::pmr::multimap<int, int> c{{1,0}, {2,0}, {3,0}, {4,0}}; struct X { }; struct Y { }; diff --git a/libstdc++-v3/testsuite/23_containers/multiset/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/multiset/pmr_typedefs.cc index 19e2802..f1013b6 100644 --- a/libstdc++-v3/testsuite/23_containers/multiset/pmr_typedefs.cc +++ b/libstdc++-v3/testsuite/23_containers/multiset/pmr_typedefs.cc @@ -18,7 +18,8 @@ // { dg-do compile { target c++17 } } #include <set> -#include <memory_resource> + +std::pmr::multiset<int> c{1, 2, 3, 4}; struct X { }; struct Cmp { bool operator()(X, X) const { return false; } }; diff --git a/libstdc++-v3/testsuite/23_containers/set/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/set/pmr_typedefs.cc index a65d071..4b70b98 100644 --- a/libstdc++-v3/testsuite/23_containers/set/pmr_typedefs.cc +++ b/libstdc++-v3/testsuite/23_containers/set/pmr_typedefs.cc @@ -18,7 +18,8 @@ // { dg-do compile { target c++17 } } #include <set> -#include <memory_resource> + +std::pmr::set<int> c{1, 2, 3, 4}; struct X { }; struct Cmp { bool operator()(X, X) const { return false; } }; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/pmr_typedefs.cc index 7c00633..d8e1713 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_map/pmr_typedefs.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/pmr_typedefs.cc @@ -18,7 +18,8 @@ // { dg-do compile { target c++17 } } #include <unordered_map> -#include <memory_resource> + +std::pmr::unordered_map<int, int> c{{1,0}, {2,0}, {3,0}, {4,0}}; struct X { }; struct Y { }; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/pmr_typedefs.cc index 51d598e..6dfe1d5 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_multimap/pmr_typedefs.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/pmr_typedefs.cc @@ -18,7 +18,8 @@ // { dg-do compile { target c++17 } } #include <unordered_map> -#include <memory_resource> + +std::pmr::unordered_multimap<int, int> c{{1,0}, {2,0}, {3,0}, {4,0}}; struct X { }; struct Y { }; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/pmr_typedefs.cc index f5b9d6c..4deeb71 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/pmr_typedefs.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/pmr_typedefs.cc @@ -18,7 +18,8 @@ // { dg-do compile { target c++17 } } #include <unordered_set> -#include <memory_resource> + +std::pmr::unordered_multiset<int> c{1, 2, 3, 4}; struct X { }; struct Hash { std::size_t operator()(X) const { return 0; } }; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/pmr_typedefs.cc index 5fe33e8..4736cff 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_set/pmr_typedefs.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/pmr_typedefs.cc @@ -18,7 +18,8 @@ // { dg-do compile { target c++17 } } #include <unordered_set> -#include <memory_resource> + +std::pmr::unordered_set<int> c{1, 2, 3, 4}; struct X { }; struct Hash { std::size_t operator()(X) const { return 0; } }; diff --git a/libstdc++-v3/testsuite/23_containers/vector/pmr_typedefs.cc b/libstdc++-v3/testsuite/23_containers/vector/pmr_typedefs.cc index 0fbc32b..f4969e3 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/pmr_typedefs.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/pmr_typedefs.cc @@ -18,7 +18,8 @@ // { dg-do compile { target c++17 } } #include <vector> -#include <memory_resource> + +std::pmr::vector<int> c{1, 2, 3, 4}; struct X { }; diff --git a/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/values.cc b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/values.cc index 4100692..b2cb86f 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/values.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/values.cc @@ -24,6 +24,14 @@ #include <functional> #include <testsuite_random.h> +// { dg-additional-options "-DSIMULATOR_TEST" { target simulator } } + +#ifdef SIMULATOR_TEST +# define ARGS 100, 1000 +#else +# define ARGS +#endif + void test01() { using namespace __gnu_test; @@ -32,15 +40,15 @@ void test01() std::bernoulli_distribution bd1(0.25); auto bbd1 = std::bind(bd1, eng); - testDiscreteDist(bbd1, [](int n) { return bernoulli_pdf(n, 0.25); } ); + testDiscreteDist<ARGS>(bbd1, [](int n) { return bernoulli_pdf(n, 0.25); } ); std::bernoulli_distribution bd2(0.5); auto bbd2 = std::bind(bd2, eng); - testDiscreteDist(bbd2, [](int n) { return bernoulli_pdf(n, 0.5); } ); + testDiscreteDist<ARGS>(bbd2, [](int n) { return bernoulli_pdf(n, 0.5); } ); std::bernoulli_distribution bd3(0.75); auto bbd3 = std::bind(bd3, eng); - testDiscreteDist(bbd3, [](int n) { return bernoulli_pdf(n, 0.75); } ); + testDiscreteDist<ARGS>(bbd3, [](int n) { return bernoulli_pdf(n, 0.75); } ); } int main() diff --git a/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/values.cc b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/values.cc index 96570d5..efa259b 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/values.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/values.cc @@ -25,6 +25,14 @@ #include <functional> #include <testsuite_random.h> +// { dg-additional-options "-DSIMULATOR_TEST" { target simulator } } + +#ifdef SIMULATOR_TEST +# define ARGS 100, 1000 +#else +# define ARGS +#endif + void test01() { using namespace __gnu_test; @@ -33,9 +41,9 @@ void test01() std::binomial_distribution<> bd1(5, 0.3); auto bbd1 = std::bind(bd1, eng); - testDiscreteDist(bbd1, [](int n) { return binomial_pdf(n, 5, 0.3); } ); + testDiscreteDist<ARGS>(bbd1, [](int n) { return binomial_pdf(n, 5, 0.3); } ); - // These tests take a relatively long time on soft-float simulated + // These tests take a relatively long time on soft-float simulated targets. // targets, so please don't add new tests here, instead add a new file. } diff --git a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/values.cc b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/values.cc index 1cedd64..8bacb86 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/values.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/values.cc @@ -24,6 +24,14 @@ #include <functional> #include <testsuite_random.h> +// { dg-additional-options "-DSIMULATOR_TEST" { target simulator } } + +#ifdef SIMULATOR_TEST +# define ARGS 100, 1000 +#else +# define ARGS +#endif + void test01() { using namespace __gnu_test; diff --git a/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/values.cc b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/values.cc index 65e0e79..41a83b1 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/values.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/values.cc @@ -24,6 +24,14 @@ #include <functional> #include <testsuite_random.h> +// { dg-additional-options "-DSIMULATOR_TEST" { target simulator } } + +#ifdef SIMULATOR_TEST +# define ARGS 100, 1000 +#else +# define ARGS +#endif + void test01() { using namespace __gnu_test; @@ -32,16 +40,16 @@ void test01() std::geometric_distribution<> gd1(0.5); auto bgd1 = std::bind(gd1, eng); - testDiscreteDist(bgd1, [](int n) { return geometric_pdf(n, 0.5); } ); + testDiscreteDist<ARGS>(bgd1, [](int n) { return geometric_pdf(n, 0.5); } ); std::geometric_distribution<> gd2(0.75); auto bgd2 = std::bind(gd2, eng); - testDiscreteDist(bgd2, [](int n) { return geometric_pdf(n, 0.75); } ); + testDiscreteDist<ARGS>(bgd2, [](int n) { return geometric_pdf(n, 0.75); } ); // libstdc++/48114 std::geometric_distribution<> gd3(0.25); auto bgd3 = std::bind(gd3, eng); - testDiscreteDist(bgd3, [](int n) { return geometric_pdf(n, 0.25); } ); + testDiscreteDist<ARGS>(bgd3, [](int n) { return geometric_pdf(n, 0.25); } ); } int main() diff --git a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/values.cc b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/values.cc index dda6f43..9856b88 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/values.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/values.cc @@ -26,6 +26,14 @@ #include <functional> #include <testsuite_random.h> +// { dg-additional-options "-DSIMULATOR_TEST" { target simulator } } + +#ifdef SIMULATOR_TEST +# define ARGS 100, 1000 +#else +# define ARGS +#endif + void test01() { using namespace __gnu_test; @@ -34,18 +42,18 @@ void test01() std::negative_binomial_distribution<> nbd1(5, 0.3); auto bnbd1 = std::bind(nbd1, eng); - testDiscreteDist(bnbd1, [](int n) - { return negative_binomial_pdf(n, 5, 0.3); } ); + testDiscreteDist<ARGS>(bnbd1, [](int n) + { return negative_binomial_pdf(n, 5, 0.3); } ); std::negative_binomial_distribution<> nbd2(55, 0.3); auto bnbd2 = std::bind(nbd2, eng); - testDiscreteDist(bnbd2, [](int n) - { return negative_binomial_pdf(n, 55, 0.3); } ); + testDiscreteDist<ARGS>(bnbd2, [](int n) + { return negative_binomial_pdf(n, 55, 0.3); } ); std::negative_binomial_distribution<> nbd3(10, 0.75); auto bnbd3 = std::bind(nbd3, eng); - testDiscreteDist(bnbd3, [](int n) - { return negative_binomial_pdf(n, 10, 0.75); } ); + testDiscreteDist<ARGS>(bnbd3, [](int n) + { return negative_binomial_pdf(n, 10, 0.75); } ); } int main() diff --git a/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/values.cc b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/values.cc index 169d720..05e8c9f 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/values.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/values.cc @@ -1,4 +1,3 @@ -// { dg-options "-DSIMULATOR_TEST" { target simulator } } // { dg-do run { target c++11 } } // { dg-require-cstdint "" } // { dg-require-cmath "" } @@ -26,6 +25,14 @@ #include <functional> #include <testsuite_random.h> +// { dg-additional-options "-DSIMULATOR_TEST" { target simulator } } + +#ifdef SIMULATOR_TEST +# define ARGS 100, 1000 +#else +# define ARGS +#endif + void test01() { using namespace __gnu_test; @@ -34,15 +41,15 @@ void test01() std::poisson_distribution<> pd1(3.0); auto bpd1 = std::bind(pd1, eng); - testDiscreteDist(bpd1, [](int n) { return poisson_pdf(n, 3.0); } ); + testDiscreteDist<ARGS>(bpd1, [](int n) { return poisson_pdf(n, 3.0); } ); std::poisson_distribution<> pd2(15.0); auto bpd2 = std::bind(pd2, eng); - testDiscreteDist(bpd2, [](int n) { return poisson_pdf(n, 15.0); } ); + testDiscreteDist<ARGS>(bpd2, [](int n) { return poisson_pdf(n, 15.0); } ); std::poisson_distribution<> pd3(30.0); auto bpd3 = std::bind(pd3, eng); - testDiscreteDist(bpd3, [](int n) { return poisson_pdf(n, 30.0); } ); + testDiscreteDist<ARGS>(bpd3, [](int n) { return poisson_pdf(n, 30.0); } ); // This can take extremely long on simulators, timing out the test. #ifndef SIMULATOR_TEST diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/values.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/values.cc index c1e4b49..ee1ea7e 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/values.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/values.cc @@ -24,6 +24,14 @@ #include <functional> #include <testsuite_random.h> +// { dg-additional-options "-DSIMULATOR_TEST" { target simulator } } + +#ifdef SIMULATOR_TEST +# define ARGS 100, 1000 +#else +# define ARGS +#endif + void test01() { using namespace __gnu_test; @@ -32,15 +40,15 @@ void test01() std::uniform_int_distribution<> uid1(0, 2); auto buid1 = std::bind(uid1, eng); - testDiscreteDist(buid1, [](int n) { return uniform_int_pdf(n, 0, 2); } ); + testDiscreteDist<ARGS>(buid1, [](int n) { return uniform_int_pdf(n, 0, 2); } ); std::uniform_int_distribution<> uid2(3, 7); auto buid2 = std::bind(uid2, eng); - testDiscreteDist(buid2, [](int n) { return uniform_int_pdf(n, 3, 7); } ); + testDiscreteDist<ARGS>(buid2, [](int n) { return uniform_int_pdf(n, 3, 7); } ); std::uniform_int_distribution<> uid3(1, 20); auto buid3 = std::bind(uid3, eng); - testDiscreteDist(buid3, [](int n) { return uniform_int_pdf(n, 1, 20); } ); + testDiscreteDist<ARGS>(buid3, [](int n) { return uniform_int_pdf(n, 1, 20); } ); } int main() diff --git a/libstdc++-v3/testsuite/28_regex/match_results/pmr_typedefs.cc b/libstdc++-v3/testsuite/28_regex/match_results/pmr_typedefs.cc index b8c22d0..5ff4c77 100644 --- a/libstdc++-v3/testsuite/28_regex/match_results/pmr_typedefs.cc +++ b/libstdc++-v3/testsuite/28_regex/match_results/pmr_typedefs.cc @@ -20,7 +20,8 @@ // { dg-require-effective-target cxx11_abi } #include <regex> -#include <memory_resource> + +std::pmr::match_results<const char*> m; struct X; static_assert(std::is_same_v<std::pmr::match_results<X*>, diff --git a/maintainer-scripts/ChangeLog b/maintainer-scripts/ChangeLog index d9d586d..3928635 100644 --- a/maintainer-scripts/ChangeLog +++ b/maintainer-scripts/ChangeLog @@ -1,3 +1,7 @@ +2022-05-20 Richard Biener <rguenther@suse.de> + + * crontab: Disable snapshots from the gcc-9 branch. + 2022-04-28 Jakub Jelinek <jakub@redhat.com> * crontab: Snapshots from trunk are now GCC 13 related. diff --git a/maintainer-scripts/crontab b/maintainer-scripts/crontab index a3417c3..a961ff1 100644 --- a/maintainer-scripts/crontab +++ b/maintainer-scripts/crontab @@ -1,7 +1,6 @@ 16 0 * * * sh /home/gccadmin/scripts/update_version_git 50 0 * * * sh /home/gccadmin/scripts/update_web_docs_git 55 0 * * * sh /home/gccadmin/scripts/update_web_docs_libstdcxx_git -32 22 * * 3 sh /home/gccadmin/scripts/gcc_release -s 9:releases/gcc-9 -l -d /sourceware/snapshot-tmp/gcc all 32 22 * * 4 sh /home/gccadmin/scripts/gcc_release -s 10:releases/gcc-10 -l -d /sourceware/snapshot-tmp/gcc all 32 22 * * 5 sh /home/gccadmin/scripts/gcc_release -s 11:releases/gcc-11 -l -d /sourceware/snapshot-tmp/gcc all 32 22 * * 6 sh /home/gccadmin/scripts/gcc_release -s 12:releases/gcc-12 -l -d /sourceware/snapshot-tmp/gcc all |