summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* libstdc++: Require tzdb support for chrono::zoned_time printer testJonathan Wakely2023-05-161-1/+2
| | | | | | | | libstdc++-v3/ChangeLog: * testsuite/libstdc++-prettyprinters/chrono.cc: Only test printer for chrono::zoned_time for cx11 ABI and tzdb effective target.
* libstdc++: Do not use pthread_mutex_clocklock with ThreadSanitizerJonathan Wakely2023-05-162-2/+2
| | | | | | | | | | | | | | | | | | | | | | As noted in https://github.com/llvm/llvm-project/issues/62623 there are no tsan interceptors for some of the new POSIX-1:202x APIs added by https://austingroupbugs.net/view.php?id=1216 so tsan gives false positive warnings for try_lock_for on timed mutexes. Disable the uses of the new pthread_mutex_clocklock API when tsan is active. This changes the semantics of the try_lock_for functions, because it can change which clock is used for the wait. This means those functions might be affected by system clock adjustments when tsan is used, when they would not be affected otherwise. Reviewed-by: Thomas Rodgers <trodgers@redhat.com> Reviewed-by: Mike Crowe <mac@mcrowe.com> libstdc++-v3/ChangeLog: * acinclude.m4 (GLIBCXX_CHECK_PTHREAD_MUTEX_CLOCKLOCK): Define _GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK in terms of _GLIBCXX_TSAN. * configure: Regenerate.
* ada: Add "gnat --help-ada" text for new switches.Steve Baird2023-05-161-0/+4
| | | | | | | | | | The output generated by "gnat --help-ada" should include descriptions for the newly added -gnatw_s and -gnatw_S switches". gcc/ada/ * usage.adb: Generate output text describing the -gnatw_s switch (and the corresponding -gnatw_S switch).
* ada: Use accumulator type in expansion of 'Reduce attributeEric Botcazou2023-05-161-10/+62
| | | | | | | | | | | | | | | | The current expansion of the 'Reduce attribute uses the resolution type of the expression for the accumulator. Now this type can be unresolved or set to a universal type, for example if it is itself the prefix of the 'Image attribute, and this may yield a spurious type mismatch error in that case. This changes the expansion to use the accumulator type instead as defined by the RM 4.5.10 clause, albeit only in the prefixed case for now. gcc/ada/ * exp_attr.adb (Expand_N_Attribute_Reference) <Attribute_Reduce>: Use the canonical accumulator type as the type of the accumulator in the prefixed case.
* ada: Fix missing warning on aggregate with iterated componentEric Botcazou2023-05-161-1/+0
| | | | | | | | | This happens when the iterated component does not really iterate. gcc/ada/ * exp_aggr.adb (Expand_Array_Aggregate): Do not set Warnings_Off on the temporary created when in-place expansion is not possible.
* ada: Fix crash on iterated component in expression functionEric Botcazou2023-05-161-6/+8
| | | | | | | | | | | The problem is that the freeze node generated for the type of a static subexpression present in the expression function is incorrectly placed inside instead of outside the function. gcc/ada/ * freeze.adb (Freeze_Expression): When the freezing is to be done outside the current scope, skip any scope that is an internal loop.
* ada: Fix internal error on 'Image applied to array componentEric Botcazou2023-05-161-2/+21
| | | | | | | | | This happens because the array component depends on a discriminant. gcc/ada/ * exp_imgv.adb (Rewrite_Object_Image): If the prefix is a component that depends on a discriminant, create an actual subtype for it.
* ada: Fix internal error on chain of predicated record typesEric Botcazou2023-05-161-6/+21
| | | | | | | | | | | | The preanalysis of a predicate set on one of the record types was causing premature freezing of another record type. gcc/ada/ * sem_ch13.adb: Add with and use clauses for Expander. (Resolve_Aspect_Expressions) <Aspect_Predicate>: Emulate a bona-fide preanalysis setup before calling Resolve_Aspect_Expression.
* ada: Update proof of runtime unitsYannick Moy2023-05-166-45/+31
| | | | | | | | | | | | | | | | Following changes in GNATprove, proofs need to be amended. gcc/ada/ * libgnat/s-aridou.adb (Lemma_Div_Pow2): Add assertion. * libgnat/s-arit32.adb (Lemma_Abs_Div_Commutation): Simplify. * libgnat/s-expmod.adb (Lemma_Exp_Mod): Add assertions. (Lemma_Euclidean_Mod): Add body to lemma. (Lemma_Mult_Mod): Add assertion. * libgnat/s-valueu.adb (Scan_Raw_Unsigned): Modify assertion. * libgnat/s-vauspe.ads (Raw_Unsigned_Last_Ghost): Add postcondition. * libgnat/s-widthi.adb: Use more precise types.
* ada: Implement inheritance of user-defined literal aspects for untagged typesEric Botcazou2023-05-163-8/+38
| | | | | | | | | | | | | In Ada 2022, user-defined literal aspects are nonoverridable but the named subprograms present in them can be overridden, including for untagged types. gcc/ada/ * sem_res.adb (Has_Applicable_User_Defined_Literal): Apply the same processing for derived untagged types as for tagged types. * sem_util.ads (Corresponding_Primitive_Op): Adjust description. * sem_util.adb (Corresponding_Primitive_Op): Handle untagged types.
* ada: Spurious error analyzing 'old or 'result in class-wide conditionsJavier Miranda2023-05-161-2/+21
| | | | | | | | | | | gcc/ada/ * sem_attr.adb (Analyze_Attribute_Old_Result): When preanalyzing a class-wide condition, search in the scopes stack for the subprogram that has the condition. This is required because returning the current scope causes reporting spurious errors when the occurrence of the attribute is found, for example, in a quantified expression.
* ada: Spurious error on function returning CPP typeJavier Miranda2023-05-161-1/+6
| | | | | | | | gcc/ada/ * exp_ch6.adb (Needs_BIP_Alloc_Form): Return False for functions with foreign convention since we never use build-in-place for such functions.
* ada: Apply range checks to preanalyzed aggregate expressionsPiotr Trojanek2023-05-161-1/+1
| | | | | | | | | | | | | When preanalyzing expressions in GNATprove mode, e.g. Pre/Post contracts, we apply checks, because these expressions will never be expanded. This didn't happen for aggregate expressions, most likely because of an oversight. gcc/ada/ * sem_util.adb (Aggregate_Constraint_Checks): Don't exit early when preanalysing in GNATprove mode. Now the condition is consistent with other similar conditions in other code.
* ada: usage.adb: document -gnatyD switchGhjuvan Lacambre2023-05-161-0/+1
| | | | | | | | -gnatyD was documented in the user guide but not in `gnat --help-ada`. gcc/ada/ * usage.adb (Usage): Document -gnatyD.
* ada: Fix Ada representation of r_debug and link_map typesMarc Poulhiès2023-05-161-6/+13
| | | | | | | | | | | | | | | | | Both record types need to have their components 'aliased' to match their C version. The mismatch could be observed when using LTO: warning: type of 'r_debug' does not match original declaration [-Wlto-type-mismatch] /usr/include/link.h:66:23: note: type 'struct r_debug' should match type 'struct system__traceback__symbolic__module_name__build_... ...cache_for_all_modules__r_debug_type' gcc/ada/ * libgnat/s-tsmona__linux.adb (link_map, r_debug_type): Add 'aliased' on all components.
* ada: Enable Support_Atomic_Primitives on PPC LinuxJohannes Kliemann2023-05-163-0/+151
| | | | | | | | gcc/ada/ * libgnat/system-linux-ppc.ads: Add Support_Atomic_Primitives. * libgnat/s-atopri__32.ads: Add 32 bit version of s-atopri.ads. * Makefile.rtl: Use s-atopro__32.ads for ppc-linux.
* ada: Follow-up improvement to implementation of storage modelsEric Botcazou2023-05-161-0/+16
| | | | | | | | | | It avoids to recreate an actual subtype for an explicit dereference. gcc/ada/ * sem_util.adb (Get_Actual_Subtype): For an explicit dereference, return the Actual_Designated_Subtype if it is present. (Get_Actual_Subtype_If_Available): Likewise.
* ada: Add tags on style messagesArnaud Charlet2023-05-1610-62/+75
| | | | | | | | | | | | | | | | Similar to tags on warnings [-gnatwx], we add tags on style messages [-gnatyx] when -gnatw.d is enabled. gcc/ada/ * errout.ads: Update comment. * errout.adb (Skip_Msg_Insertion_Warning): Update to take e.g. -gnatyM into account. * erroutc.adb (Get_Warning_Option, Get_Warning_Tag) (Prescan_Message): Add support for Style tags. * par-ch5.adb, par-ch6.adb, par-ch7.adb, par-endh.adb, par-util.adb, style.adb, styleg.adb: Set tag on all style messages.
* ada: Fix typo in "pattern"Tom Tromey2023-05-163-4/+4
| | | | | | | | | | | | I found a couple of spots using the typo "patterm" rather than the correct "pattern". gcc/ada/ * doc/gnat_ugn/building_executable_programs_with_gnat.rst (Switches_for_gnatbind): Fix typo. * libgnat/g-spipat.ads: Fix typo. * gnat_ugn.texi: Regenerate.
* ada: Adjust semantics and implementation of storage modelsEric Botcazou2023-05-168-82/+274
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes the following adjustments to the semantics and implementation of storage models in the compiler: 1. By-copy semantics in subprogram calls: when an object accessed with a nonnative storage model is passed as an actual parameter in a call to a subprogram, an intermediate copy made on the host is passed instead. 2. More generally, any additional temporary required on the host by the semantics of nonnative storage models is now created by the front-end instead of the code generator. 3. All the temporaries created on the host for nonnative storage models are allocated on the secondary stack instead of the primary stack. As a result, this should simplify the implementation in code generators. gcc/ada/ * exp_aggr.adb (Build_Assignment_With_Temporary): Adjust comment and fix type of second parameter. Create the temporary on the secondary stack by calling Build_Temporary_On_Secondary_Stack. (Convert_Array_Aggr_In_Allocator): Adjust formatting. (Expand_Array_Aggregate): Likewise. * exp_ch4.adb (Expand_N_Allocator): Set Actual_Designated_Subtype on the dereference in the initialization for all composite types. * exp_ch5.adb (Expand_N_Assignment_Statement): Create a temporary on the host for an assignment between nonnative storage models. Suppress more checks when Suppress_Assignment_Checks is set. * exp_ch6.adb (Add_Simple_Call_By_Copy_Code): Deal with actuals that are dereferences with an Actual_Designated_Subtype. Add support for nonnative storage models. (Expand_Actuals): Create a copy if the actual is a dereference with a nonnative storage model. * exp_util.ads (Build_Temporary_On_Secondary_Stack): Declare. * exp_util.adb (Build_Temporary_On_Secondary_Stack): New function. * sem_ch5.adb (Analyze_Assignment.Set_Assignment_Type): Do not build an actual subtype for dereferences with an Actual_Designated_Subtype * sinfo.ads (Actual_Designated_Subtype): Adjust documentation. (Suppress_Assignment_Checks): Likewise.
* ada: Build invariant procedure while freezing in GNATprove modePiotr Trojanek2023-05-161-8/+46
| | | | | | | | | | | | | | | | | | | | | | | Invariant procedure bodies are created either by expansion of freezing nodes (but only in ordinary compilation mode) or at the end of package private declarations (but not for with private types in the type derivation chain). In GNATprove mode we didn't create invariant procedure bodies in lightweight expansion, so we didn't create them at all when there were private types in the type derivation chain. This patch copies the relevant freezing part from ordinary to lightweight expansion. This obviously involves code duplication, but it seems better to duplicate whole sections that work properly instead of small pieces that are incomplete. There are other pieces of freezing that are similarly duplicated, so this patch doesn't make the code substantially worse. gcc/ada/ * exp_spark.adb (SPARK_Freeze_Type): Copy whole handling of DIC and Type_Invariant from Freeze_Type.
* ada: Get name from entity if that's what's passed to Subprogram_NameRichard Kenner2023-05-161-0/+3
| | | | | | | gcc/ada/ * sem_util.adb (Subprogram_Name): If what's passed is already an entity, use that for the name.
* ada: Document examples of No_Dependence restriction for code generationEric Botcazou2023-05-162-2/+43
| | | | | | | | gcc/ada/ * doc/gnat_rm/standard_and_implementation_defined_restrictions.rst (No_Dependence): Give examples of new No_Dependence restrictions. * gnat_rm.texi: Regenerate.
* ada: Bad handling of ASCII with -gnatynArnaud Charlet2023-05-162-3/+3
| | | | | | | | | | ASCII is special cased but this wasn't taking into account all cases such as Standard.ASCII. gcc/ada/ * snames.ads-tmpl (Name_ASCII): New. * style.adb (Check_Identifier): Fix handling of ASCII.
* ada: Introduce Cannot_Be_Superflat flag on N_Range nodesEric Botcazou2023-05-164-9/+22
| | | | | | | | | | | | | | | | | | | The support of superflat arrays in the language generates an overhead that the code generator attempts to minimize, but it cannot handle too complex cases and it would be helpful if the front-end could lend a hand. This change introduces the Cannot_Be_Superflat flag on N_Range nodes for this purpose, and sets it on the result of string concatenations when it is guaranteed to be nonnull. gcc/ada/ * gen_il-fields.ads (Opt_Field_Enum): Add Cannot_Be_Superflat. * gen_il-gen-gen_nodes.adb (N_Range): Add Cannot_Be_Superflat as semantical flag and change Includes_Infinities to semantical. * sinfo.ads (Cannot_Be_Superflat): Document it for N_Range. * exp_ch4.adb (Expand_Concatenate): Set Cannot_Be_Superflat on the range of the result if the result cannot be null.
* ada: Change Present_Expr field type to UintRichard Kenner2023-05-161-1/+1
| | | | | | | | | | We want the field to be initialized to No_Uint because we want to be able to test in GNAT LLVM whether we've already set it so we can be sure we only set it once. gcc/ada/ * gen_il-gen-gen_nodes.adb (Present_Expr): Type is now Uint.
* ada: Simplify dramatically ghost code for proof of System.Arith_DoubleYannick Moy2023-05-162-384/+56
| | | | | | | | | | | | | | | | Using Inline_For_Proof annotation on key expression functions makes it possible to remove hundreds of lines of ghost code that were previously needed to guide provers. gcc/ada/ * libgnat/s-aridou.adb (Big3, Is_Mult_Decomposition) (Is_Scaled_Mult_Decomposition): Add annotation for inlining. (Double_Divide, Scaled_Divide): Simplify and remove ghost code. (Prove_Multiplication): Add calls to lemmas to make proof go through. * libgnat/s-aridou.ads (Big, In_Double_Int_Range): Add annotation for inlining.
* ada: Add intermediate assertions for proof of Super_TailYannick Moy2023-05-161-0/+6
| | | | | | | | Proof of Superbounded internal unit requires a little more help. gcc/ada/ * libgnat/a-strsup.adb: Add intermediate assertions.
* ada: Missing dependency with -gnatcArnaud Charlet2023-05-161-11/+11
| | | | | | | | | | When using -gnatc, dependencies on preprocessor and config files were not recorded. gcc/ada/ * gnat1drv.adb: Ensure all dependencies are recorded even when not generating code.
* ada: Set Loop_Variant assertion policy to Ignore in bothYannick Moy2023-05-161-1/+2
| | | | | | | | Set Loop_Variant assertion policy to Ignore in both. gcc/ada/ * libgnat/a-strsup.adb: Set assertion policy for Loop_Variant.
* ada: Trivial refactoring in Instantiate_*_BodyMarc Poulhiès2023-05-161-10/+6
| | | | | | | | | | Factor out Par_Vis/Install_Parent/Par_Installed in Instantiate_Package_Body and Instantiate_Subprogram_Body. gcc/ada/ * sem_ch12.adb (Instantiate_Package_Body): Simplify if/then/else. (Instantiate_Subprogram_Body): Likewise.
* ada: Restore proof of System.Arith_DoubleYannick Moy2023-05-161-31/+119
| | | | | | | | | | | | | | | | | | Use Assert_And_Cut to simplify proof of second part of the Scaled_Divide. Add intermediate assertions and simplify where necessary. gcc/ada/ * libgnat/s-aridou.adb: (Big3): Remove override made useless. (Lemma_Quot_Rem): Add new lemma and justify it, as no prover manages to prove it. (Lemma_Div_Pow2): Use new lemma Lemma_Quot_Rem. (Prove_Scaled_Mult_Decomposition_Regroup3): Retype for simplification. (Scaled_Divide): Remove useless assertions.Decompose some assertions with cut operations. Use Assert_And_Cut for second half. Add assertions.
* RISC-V: Adjust stdint.h to stdint-gcc.h for rvv testsPan Li2023-05-1615-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch would like to align the stdint.h to the stdint-gcc.h for all the RVV test files. Aka: stdint.h => stdint-gcc.h Signed-off-by: Pan Li <pan2.li@intel.com> gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/binop/shift-scalar-template.h: Replace stdint.h with stdint-gcc.h. * gcc.target/riscv/rvv/autovec/binop/shift-template.h: Ditto. * gcc.target/riscv/rvv/autovec/binop/vadd-template.h: Ditto. * gcc.target/riscv/rvv/autovec/binop/vand-template.h: Ditto. * gcc.target/riscv/rvv/autovec/binop/vdiv-template.h: Ditto. * gcc.target/riscv/rvv/autovec/binop/vmax-template.h: Ditto. * gcc.target/riscv/rvv/autovec/binop/vmin-template.h: Ditto. * gcc.target/riscv/rvv/autovec/binop/vmul-template.h: Ditto. * gcc.target/riscv/rvv/autovec/binop/vor-template.h: Ditto. * gcc.target/riscv/rvv/autovec/binop/vrem-template.h: Ditto. * gcc.target/riscv/rvv/autovec/binop/vsub-template.h: Ditto. * gcc.target/riscv/rvv/autovec/binop/vxor-template.h: Ditto. * gcc.target/riscv/rvv/autovec/series-1.c: Ditto. * gcc.target/riscv/rvv/autovec/vmv-imm-run.c: Ditto. * gcc.target/riscv/rvv/autovec/vmv-imm-template.h: Ditto.
* s390: Refactor block operation setmemStefan Schulze Frielinghaus2023-05-164-20/+132
| | | | | | | | | | | | | | | | | | | | | | | Vectorize memset with a constant length of less than or equal to 64 bytes. Do not perform a libc function call into memset in case the size is not a compile-time constant but bounded and the upper bound is less than or equal to 256 bytes. gcc/ChangeLog: * config/s390/s390-protos.h (s390_expand_setmem): Change function signature. * config/s390/s390.cc (s390_expand_setmem): For memset's less than or equal to 256 byte do not perform a libc call. * config/s390/s390.md: Change expander into a version which takes 8 operands. gcc/testsuite/ChangeLog: * gcc.target/s390/memset-1.c: Test case memset1 makes use of vst, now.
* s390: Add block operation movmemStefan Schulze Frielinghaus2023-05-163-0/+124
| | | | | | | | | | gcc/ChangeLog: * config/s390/s390-protos.h (s390_expand_movmem): New. * config/s390/s390.cc (s390_expand_movmem): New. * config/s390/s390.md (movmem<mode>): New. (*mvcrl): New. (mvcrl): New.
* s390: Refactor block operation cpymemStefan Schulze Frielinghaus2023-05-163-22/+74
| | | | | | | | | | | | | | | | | Do not perform a libc function call into memcpy in case the size is not a compile-time constant but bounded and the upper bound is less than or equal to 256 bytes. gcc/ChangeLog: * config/s390/s390-protos.h (s390_expand_cpymem): Change function signature. * config/s390/s390.cc (s390_expand_cpymem): For memcpy's less than or equal to 256 byte do not perform a libc call. (s390_expand_insv): Adapt new function signature of s390_expand_cpymem. * config/s390/s390.md: Change expander into a version which takes 8 operands.
* Fortran: Fix an assortment of bugsPaul Thomas2023-05-1610-54/+223
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2023-05-16 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/105152 * interface.cc (gfc_compare_actual_formal): Emit an error if an unlimited polymorphic actual is not matched either to an unlimited or assumed type formal argument. PR fortran/100193 * resolve.cc (resolve_ordinary_assign): Emit an error if the var expression of an ordinary assignment is a proc pointer component. PR fortran/87496 * trans-array.cc (gfc_walk_array_ref): Provide assumed shape arrays coming from interface mapping with a viable arrayspec. PR fortran/103389 * trans-expr.cc (gfc_conv_intrinsic_to_class): Tidy up flagging of unlimited polymorphic 'class_ts'. (gfc_conv_gfc_desc_to_cfi_desc): Assumed type is unlimited polymorphic and should accept any actual type. PR fortran/104429 (gfc_conv_procedure_call): Replace dreadful kludge with a call to gfc_finalize_tree_expr. Avoid dereferencing a void pointer by giving it the pointer type of the actual argument. PR fortran/82774 (alloc_scalar_allocatable_subcomponent): Shorten the function name and replace the symbol argument with the se string length. If a deferred length character length is either not present or is not a variable, give the typespec a variable and assign the string length to that. Use gfc_deferred_strlen to find the hidden string length component. (gfc_trans_subcomponent_assign): Convert the expression before the call to alloc_scalar_allocatable_subcomponent so that a good string length is provided. (gfc_trans_structure_assign): Remove the unneeded derived type symbol from calls to gfc_trans_subcomponent_assign. gcc/testsuite/ PR fortran/105152 * gfortran.dg/pr105152.f90 : New test PR fortran/100193 * gfortran.dg/pr100193.f90 : New test PR fortran/87946 * gfortran.dg/pr87946.f90 : New test PR fortran/103389 * gfortran.dg/pr103389.f90 : New test PR fortran/104429 * gfortran.dg/pr104429.f90 : New test PR fortran/82774 * gfortran.dg/pr82774.f90 : New test
* Skip -fdelete-null-pointer-check tests if target keeps_null_pointer_checksSenthil Kumar Selvaraj2023-05-169-1/+10
| | | | | | | | | | | | | | | | | | | A bunch of tests explicitly pass in -fdelete-null-pointer-checks and fail if the target keeps null pointer checks. Skip such tests by adding a dg-skip-if for keeps_null_pointer_checks. gcc/testsuite/ChangeLog: * gcc.dg/attr-returns-nonnull.c: Skip if keeps_null_pointer_checks. * gcc.dg/init-compare-1.c: Likewise. * gcc.dg/ipa/pr85734.c: Likewise. * gcc.dg/ipa/propmalloc-1.c: Likewise. * gcc.dg/ipa/propmalloc-2.c: Likewise. * gcc.dg/ipa/propmalloc-3.c: Likewise. * gcc.dg/ipa/propmalloc-4.c: Likewise. * gcc.dg/tree-ssa/evrp11.c: Likewise. * gcc.dg/tree-ssa/pr83648.c: Likewise.
* MATCH: [PR109424] Simplify min/max of boolean argumentsAndrew Pinski2023-05-165-0/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is version 2 of https://gcc.gnu.org/pipermail/gcc-patches/2021-August/577394.html which does not depend on adding gimple_truth_valued_p at this point. Instead will use zero_one_valued_p which is already used for mult simplifications to make sure that we only have [0,1] rather having the mistake of maybe having [-1,0] as the range for signed bools. This shows up in a few places in GCC itself but only at -O1, we miss the min/max conversion because of PR 107888 (which I will be testing seperately). OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. Thanks, Andrew Pinski PR tree-optimization/109424 gcc/ChangeLog: * match.pd: Add patterns for min/max of zero_one_valued values to `&`/`|`. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/bool-12.c: New test. * gcc.dg/tree-ssa/bool-13.c: New test. * gcc.dg/tree-ssa/minmax-20.c: New test. * gcc.dg/tree-ssa/minmax-21.c: New test.
* RISC-V: Add FRM and rounding mode operand into floating point intrinsicsJuzhe-Zhong2023-05-167-55/+251
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is adding rounding mode operand and FRM_REGNUM dependency into floating-point instructions. The floating-point instructions we added FRM and rounding mode operand: 1. vfadd/vfsub 2. vfwadd/vfwsub 3. vfmul 4. vfdiv 5. vfwmul 6. vfwmacc/vfwnmacc/vfwmsac/vfwnmsac 7. vfsqrt 8. floating-point conversions. 9. floating-point reductions. 10. floating-point ternary. The floating-point instructions we did NOT add FRM and rounding mode operand: 1. vfabs/vfneg/vfsqrt7/vfrec7 2. vfmin/vfmax 3. comparisons 4. vfclass 5. vfsgnj/vfsgnjn/vfsgnjx 6. vfmerge 7. vfmv.v.f gcc/ChangeLog: * config/riscv/riscv-protos.h (enum frm_field_enum): New enum. * config/riscv/riscv-vector-builtins.cc (function_expander::use_ternop_insn): Add default rounding mode. (function_expander::use_widen_ternop_insn): Ditto. * config/riscv/riscv.cc (riscv_hard_regno_nregs): Add FRM REGNUM. (riscv_hard_regno_mode_ok): Ditto. (riscv_conditional_register_usage): Ditto. * config/riscv/riscv.h (DWARF_FRAME_REGNUM): Ditto. (FRM_REG_P): Ditto. (RISCV_DWARF_FRM): Ditto. * config/riscv/riscv.md: Ditto. * config/riscv/vector-iterators.md: split no frm and has frm operations. * config/riscv/vector.md (@pred_<optab><mode>_scalar): New pattern. (@pred_<optab><mode>): Ditto. Signed-off-by: Juzhe-Zhong <juzhe.zhong@rivai.ai>
* Daily bump.GCC Administrator2023-05-169-1/+447
|
* c: Ignore _Atomic on function return type for C2xJoseph Myers2023-05-153-2/+49
| | | | | | | | | | | | | | | | | For C2x it was decided that _Atomic would be completely ignored on function return types (just as was done for qualifiers in C11 DR#423), to eliminate the potential for an rvalue returned by a function having _Atomic-qualified type when an rvalue resulting from lvalue-to-rvalue conversion could not have such a type. Implement this for GCC. Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/c/ * c-decl.cc (grokdeclarator): Ignore _Atomic on function return type for C2x. gcc/testsuite/ * gcc.dg/qual-return-9.c, gcc.dg/qual-return-10.c: New tests.
* c: Update __has_c_attribute values for C2xJoseph Myers2023-05-152-24/+20
| | | | | | | | | | | | | | | | | | | | | WG14 decided that __has_c_attribute should return the same value (equal to the intended __STDC_VERSION__ value) for all standard attributes in C2x, with values associated with when an attribute was added to the working draft (or had semantics added or changed in the working draft) only being used in earlier stages of development of that draft. The intent is that the values for existing attributes increase in future standard versions only if there are new features / semantic changes for those attributes. Implement this change for GCC. Bootstrapped with no regressions for x86_64-pc-linux-gnu. gcc/c-family/ * c-lex.cc (c_common_has_attribute): Use 202311 as __has_c_attribute return for all C2x attributes. gcc/testsuite/ * gcc.dg/c2x-has-c-attribute-2.c: Expect 202311L return value from __has_c_attribute for all C2x attributes.
* Fortran: CLASS pointer function result in variable definition context [PR109846]Harald Anlauf2023-05-152-1/+40
| | | | | | | | | | | | | | gcc/fortran/ChangeLog: PR fortran/109846 * expr.cc (gfc_check_vardef_context): Check appropriate pointer attribute for CLASS vs. non-CLASS function result in variable definition context. gcc/testsuite/ChangeLog: PR fortran/109846 * gfortran.dg/ptr-func-5.f90: New test.
* Add auto-resizing capability to irange's [PR109695]Aldy Hernandez2023-05-152-30/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <tldr> We can now have int_range<N, RESIZABLE=false> for automatically resizable ranges. int_range_max is now int_range<3, true> for a 69X reduction in size from current trunk, and 6.9X reduction from GCC12. This incurs a 5% performance penalty for VRP that is more than covered by our > 13% improvements recently. </tldr> int_range_max is the temporary range object we use in the ranger for integers. With the conversion to wide_int, this structure bloated up significantly because wide_ints are huge (80 bytes a piece) and are about 10 times as big as a plain tree. Since the temporary object requires 255 sub-ranges, that's 255 * 80 * 2, plus the control word. This means the structure grew from 4112 bytes to 40912 bytes. This patch adds the ability to resize ranges as needed, defaulting to no resizing, while int_range_max now defaults to 3 sub-ranges (instead of 255) and grows to 255 when the range being calculated does not fit. For example: int_range<1> foo; // 1 sub-range with no resizing. int_range<5> foo; // 5 sub-ranges with no resizing. int_range<5, true> foo; // 5 sub-ranges with resizing. I ran some tests and found that 3 sub-ranges cover 99% of cases, so I've set the int_range_max default to that: typedef int_range<3, /*RESIZABLE=*/true> int_range_max; We don't bother growing incrementally, since the default covers most cases and we have a 255 hard-limit. This hard limit could be reduced to 128, since my tests never saw a range needing more than 124, but we could do that as a follow-up if needed. With 3-subranges, int_range_max is now 592 bytes versus 40912 for trunk, and versus 4112 bytes for GCC12! The penalty is 5.04% for VRP and 3.02% for threading, with no noticeable change in overall compilation (0.27%). This is more than covered by our 13.26% improvements for the legacy removal + wide_int conversion. I think this approach is a good alternative, while providing us with flexibility going forward. For example, we could try defaulting to a 8 sub-ranges for a noticeable improvement in VRP. We could also use large sub-ranges for switch analysis to avoid resizing. Another approach I tried was always resizing. With this, we could drop the whole int_range<N> nonsense, and have irange just hold a resizable range. This simplified things, but incurred a 7% penalty on ipa_cp. This was hard to pinpoint, and I'm not entirely convinced this wasn't some artifact of valgrind. However, until we're sure, let's avoid massive changes, especially since IPA changes are coming up. For the curious, a particular hot spot for IPA in this area was: ipcp_vr_lattice::meet_with_1 (const value_range *other_vr) { ... ... value_range save (m_vr); m_vr.union_ (*other_vr); return m_vr != save; } The problem isn't the resizing (since we do that at most once) but the fact that for some functions with lots of callers we end up a huge range that gets copied and compared for every meet operation. Maybe the IPA algorithm could be adjusted somehow??. Anywhooo... for now there is nothing to worry about, since value_range still has 2 subranges and is not resizable. But we should probably think what if anything we want to do here, as I envision IPA using infinite ranges here (well, int_range_max) and handling frange's, etc. gcc/ChangeLog: PR tree-optimization/109695 * value-range.cc (irange::operator=): Resize range. (irange::union_): Same. (irange::intersect): Same. (irange::invert): Same. (int_range_max): Default to 3 sub-ranges and resize as needed. * value-range.h (irange::maybe_resize): New. (~int_range): New. (int_range::int_range): Adjust for resizing. (int_range::operator=): Same.
* Only return changed=true in union_nonzero when appropriate.Aldy Hernandez2023-05-152-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | irange::union_ was being overly pessimistic in its return value. It was returning false when the nonzero mask was possibly the same. The reason for this is because the nonzero mask is not entirely kept up to date. We avoid setting it up when a new range is set (from a set, intersect, union, etc), because calculating a mask from a range is measurably expensive. However, irange::get_nonzero_bits() will always return the correct mask because it will calculate the nonzero mask inherit in the mask on the fly and bitwise or it with the saved mask. This was an optimization because last release it was a big penalty to keep the mask up to date. This may not necessarily be the case with the conversion to wide_int's. We should investigate. Just to be clear, the result from get_nonzero_bits() is always correct as seen by the user, but the wide_int in the irange does not contain all the information, since part of the nonzero bits can be determined by the range itself, on the fly. The fix here is to make sure that the result the user sees (callers of get_nonzero_bits()) changed when unioning bits. This allows ipcp_vr_lattice::meet_with_1 to avoid unnecessary copies when determining if a range changed. This patch yields an 6.89% improvement to the ipa_cp pass. I'm including the IPA changes in this patch, as it's a testcase of sorts for the change. gcc/ChangeLog: * ipa-cp.cc (ipcp_vr_lattice::meet_with_1): Avoid unnecessary range copying * value-range.cc (irange::union_nonzero_bits): Return TRUE only when range changed.
* c++: add feature-test macro for auto(x)Patrick Palka2023-05-152-0/+7
| | | | | | | | | | | | | | This adds the feature-test macro for PR0849R8, as per https://github.com/cplusplus/CWG/issues/281. gcc/c-family/ChangeLog: * c-cppbuiltin.cc (c_cpp_builtins): Predefine __cpp_auto_cast for C++23. gcc/testsuite/ChangeLog: * g++.dg/cpp23/feat-cxx2b.C: Test __cpp_auto_cast.
* RISC-V: Add rounding mode operand for fixed-point patternsJuzhe-Zhong2023-05-156-23/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Since we are going to have fixed-point intrinsics that are modeling rounding mode https://github.com/riscv-non-isa/rvv-intrinsic-doc/pull/222 We should have operand to specify rounding mode in fixed-point instructions. We don't support these modeling rounding mode intrinsics yet but we will definetely support them later. This is the preparing patch for new coming intrinsics. gcc/ChangeLog: * config/riscv/riscv-protos.h (enum vxrm_field_enum): New enum. * config/riscv/riscv-vector-builtins.cc (function_expander::use_exact_insn): Add default rounding mode operand. * config/riscv/riscv.cc (riscv_hard_regno_nregs): Add VXRM_REGNUM. (riscv_hard_regno_mode_ok): Ditto. (riscv_conditional_register_usage): Ditto. * config/riscv/riscv.h (DWARF_FRAME_REGNUM): Ditto. (VXRM_REG_P): Ditto. (RISCV_DWARF_VXRM): Ditto. * config/riscv/riscv.md: Ditto. * config/riscv/vector.md: Ditto Signed-off-by: Juzhe-Zhong <juzhe.zhong@rivai.ai>
* OPTABS: Extend the number of expanding instructions patternPan Li2023-05-151-0/+5
| | | | | | | | | | | | | | | | | | | We (RVV) is going to add a rounding mode operand into floating-point instructions which have 11 operands. Since we are going have intrinsic that is adding rounding mode argument: https://github.com/riscv-non-isa/rvv-intrinsic-doc/pull/226 This is the patch that is adding rounding mode operand in RISC-V port: https://gcc.gnu.org/pipermail/gcc-patches/2023-May/618573.html You can see there are 11 operands in these patterns. gcc/ChangeLog: * optabs.cc (maybe_gen_insn): Add case to generate instruction that has 11 operands. Signed-off-by: Juzhe-Zhong <juzhe.zhong@rivai.ai>
* fix assert in non-atomic pathThomas Neumann2023-05-151-1/+3
| | | | | | | | The non-atomic path does not have range information, we have to adjust the assert handle that case, too. libgcc/ChangeLog: * unwind-dw2-fde.c: Fix assert in non-atomic path.