aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2022-06-01[Ada] Get rid of secondary stack for controlled components of limited typesEric Botcazou2-14/+17
The initial work didn't change anything for limited types because they use a specific return mechanism for functions called build-in-place where there is no anonymous return object, so the secondary stack was used only for the sake of consistency with the nonlimited case. This change aligns the limited case with the nonlimited case, i.e. either they both use the primary stack or they both use the secondary stack. gcc/ada/ * exp_ch6.adb (Caller_Known_Size): Call Returns_On_Secondary_Stack instead of Requires_Transient_Scope and tidy up. (Needs_BIP_Alloc_Form): Likewise. * exp_util.adb (Initialized_By_Aliased_BIP_Func_Call): Also return true if the build-in-place function call has no BIPalloc parameter. (Is_Finalizable_Transient): Remove redundant test.
2022-06-01[Ada] Note that hardening features are experimentalAlexandre Oliva2-0/+6
Some features haven't got customer feedback or made upstream yet. gcc/ada/ * doc/gnat_rm/security_hardening_features.rst: Note that hardening features are experimental. * gnat_rm.texi: Regenerate.
2022-06-01[Ada] Another case where freezing incorrectly suppresses checksSteve Baird2-4/+15
Avoid improperly suppressing checks for the wrapper subprogram that is built when a null type extension inherits (and does not override) a function with a controlling result. This is a follow-up to other changes already made on this ticket. gcc/ada/ * exp_ch3.adb (Make_Controlling_Function_Wrappers): Set the Corresponding_Spec field of a wrapper subprogram body before analyzing the subprogram body; the field will be set (again) during analysis, but we need it to be set earlier. * exp_ch13.adb (Expand_N_Freeze_Entity): Add wrapper subprogram bodies to the list of declarations for which we do not want to suppress checks.
2022-06-01[Ada] Adjust reference in commentEric Botcazou1-1/+1
This is needed after the creation of Returns_On_Secondary_Stack from the original Requires_Transient_Scope. gcc/ada/ * sem_util.adb (Indirect_Temp_Needed): Adjust reference in comment.
2022-06-01[Ada] QNX shared libraries - arm-qnx build gnatlib .so'sDoug Rupp1-2/+1
Shared libraries now fully supported on arm-qnx. gcc/ada/ * Makefile.rtl (GNATLIB_SHARED): Revert disablement for arm-qnx.
2022-06-01[Ada] Fix composability of return on the secondary stackEric Botcazou1-14/+47
Having components that need to be returned on the secondary stack would not always force a record type to be returned on the secondary stack itself. gcc/ada/ * sem_util.adb (Returns_On_Secondary_Stack.Caller_Known_Size_Record): Directly check the dependence on discriminants for the variant part, if any, instead of calling the Is_Definite_Subtype predicate.
2022-06-01[Ada] Fix "formal parameter & is not referenced" not being properly taggedGhjuvan Lacambre1-1/+2
gcc/ada/ * sem_warn.adb (Warn_On_Unreferenced_Entity): Fix warning tag.
2022-06-01[Ada] Adjust warning switchesGhjuvan Lacambre1-11/+12
This makes tagging more accurate. gcc/ada/ * sem_warn.adb (Check_References): Adjust conditions under which warning messages should be emitted and their tags as well.
2022-06-01[Ada] Minor tweaks to dispatching support codeEric Botcazou3-29/+33
No functional changes. gcc/ada/ * exp_disp.ads (Expand_Interface_Thunk): Change type of Prim. * exp_disp.adb (Expand_Interface_Thunk): Declare Is_Predef_Op earlier, do not initialize Iface_Formal, use No idiom and tweaks comments. (Register_Primitive): Declare L earlier and tweak comments. * sem_disp.adb (Check_Dispatching_Operation): Move tests out of loop.
2022-06-01[Ada] Missing discriminant checks when accessing variant fieldSteve Baird6-69/+128
In some cases, the compiler would incorrectly fail to generate discriminant checks when accessing fields declared in a variant part. Correct some such cases; detect the remaining cases and flag them as unsupported. The formerly-problematic cases that are now handled correctly involve component references occurring in a predicate expression (e.g., the expression of a Dynamic_Predicate aspect specification) for a type declaration (not for a subtype declaration). The cases which are now flagged as unsupported involve expression functions declared before the discriminated type in question has been frozen. gcc/ada/ * exp_ch3.ads: Replace visible Build_Discr_Checking_Funcs (which did not need to be visible - it was not referenced outside this package) with Build_Or_Copy_Discr_Checking_Funcs. * exp_ch3.adb: Refactor existing code into 3 procedures - Build_Discr_Checking_Funcs, Copy_Discr_Checking_Funcs, and Build_Or_Copy_Discr_Checking_Funcs. This refactoring is intended to be semantics-preserving. * exp_ch4.adb (Expand_N_Selected_Component): Detect case where a call should be generated to the Discriminant_Checking_Func for the component in question, but that subprogram does not yet exist. * sem_ch13.adb (Freeze_Entity_Checks): Immediately before calling Build_Predicate_Function, add a call to Exp_Ch3.Build_Or_Copy_Discr_Checking_Funcs in order to ensure that Discriminant_Checking_Func attributes are already set when Build_Predicate_Function is called. * sem_ch6.adb (Analyze_Expression_Function): If the expression of a static expression function has been transformed into an N_Raise_xxx_Error node, then we need to copy the original expression in order to check the requirement that the expression must be a potentially static expression. We also want to set aside a copy the untransformed expression for later use in checking calls to the expression function via Inline_Static_Function_Call. So introduce a new function, Make_Expr_Copy, for use in these situations. * sem_res.adb (Preanalyze_And_Resolve): When analyzing certain expressions (e.g., a default parameter expression in a subprogram declaration) we want to suppress checks. However, we do not want to suppress checks for the expression of an expression function.
2022-06-01[Ada] Fix search for "for ... of" loop subprogramsBob Duff2-7/+19
This patch makes the search for Get_Element_Access, Step (Next/Prev), Reference_Control_Type, and Pseudo_Reference (for optimized "for ... of" loops) more robust. In particular, we have a new Next procedure in Ada 2022, and we need to pick the right one. We have not yet added the new Next and other subprograms. gcc/ada/ * exp_ch5.adb (Expand_Iterator_Loop_Over_Container): For each subprogram found, assert that the variable is Empty, so we can detect bugs where we find two or more things with the same name. Without this patch, that bug would happen when we add the new Next procedure. For Step, make sure we pick the right one, by checking name and number of parameters. For Get_Element_Access, check that we're picking a function. That's not really necessary, because there is no procedure with that name, but it seems cleaner this way. * rtsfind.ads: Minor comment improvement. It seems kind of odd to say "under no circumstances", and then immediately contradict that with "The one exception is...".
2022-06-01[Ada] arm-qnx-7.1: unwind goes wrong after regs restoreDoug Rupp1-0/+30
The usual increment of the pc to pc+2 for ARM is needed. gcc/ada/ * init.c (QNX): __gnat_adjust_context_for_raise: New implementation for arm-qnx.
2022-06-01[Ada] Add reference counting in functional containersJulien Bortolussi2-52/+227
This patch adds reference counting to dynamically allocated pointers on arrays and elements used by the functional container. This is done by making both the arrays and the elements controlled. gcc/ada/ * libgnat/a-cofuba.ads, libgnat/a-cofuba.adb: Add reference counting.
2022-06-01[Ada] Issue a warning on entity hidden in use_clause with -gnatwhYannick Moy3-41/+83
Augment the warnings issued with switch -gnatwh, so that a warning is also issued when an entity from the package of a use_clause ends up hidden due to an existing visible homonym. gcc/ada/ * sem_ch8.adb (Use_One_Package): Possibly warn. * sem_util.adb (Enter_Name): Factor out warning on hidden entity. (Warn_On_Hiding_Entity): Extract warning logic from Enter_Name and generalize it to be applied also on use_clause. * sem_util.ads (Warn_On_Hiding_Entity): Add new procedure.
2022-06-01[Ada] Issue better error message for out-of-order keywords in record defYannick Moy1-1/+40
Various cases of out-of-order keywords in the definition of a record were already detected. This adds a similar detection after NULL and RECORD keywords. gcc/ada/ * par-ch3.adb (P_Known_Discriminant_Part_Opt): Reword error message to benefit from existing codefix. (P_Record_Definition): Detect out-of-order keywords in record definition and issue appropriate messages. Other cases are already caught at appropriate places.
2022-06-01[Ada] Use Actions field of freeze nodes for subprograms (continued)Eric Botcazou1-2/+10
This case was missed in the previous change. gcc/ada/ * exp_ch6.adb (Freeze_Subprogram.Register_Predefined_DT_Entry): Put the actions into the Actions field of the freeze node instead of inserting them after it.
2022-06-01[Ada] Add inline documentation for Is_{Parenthesis,Enum_Array}_AggregateMarc Poulhiès1-0/+9
Both flags were added when square brackets for array/container aggregates have been enabled with -gnat2022 without their corresponding inline documentation. This change adds the missing documention. gcc/ada/ * sinfo.ads: Add inline documention for Is_Parenthesis_Aggregate and Is_Enum_Array_Aggregate.
2022-06-01[Ada] Incorrect code for anonymous access-to-function with convention CBob Duff2-8/+4
This patch fixes a bug where the compiler generates incorrect code for a call via an object with convention C, whose type is an anonymous access-to-function type. gcc/ada/ * einfo-utils.adb (Set_Convention): Call Set_Convention recursively, so that Set_Can_Use_Internal_Rep is called (if appropriate) on the anonymous access type of the object, and its designated subprogram type. * sem_ch3.adb (Access_Definition): Remove redundant call to Set_Can_Use_Internal_Rep.
2022-06-01[Ada] Suppress warnings on membership test of rangesBob Duff3-46/+7
For a membership test "X in A .. B", the compiler used to warn if it could prove that X is within one of the bounds. For example, if we know at compile time that X >= A, then the above could be replaced by "X <= B". This patch suppresses that warning, because there is really nothing wrong with the membership test, and programmers sometimes find it annoying. gcc/ada/ * exp_ch4.adb (Expand_N_In): Do not warn in the above-mentioned cases. * fe.h (Assume_No_Invalid_Values): Remove from fe.h, because this is not used in gigi. * opt.ads (Assume_No_Invalid_Values): Improve the comment. We don't need to "clearly prove"; we can just "prove". Remove the comment about fe.h, which is no longer true.
2022-06-01tree-optimization/105763 - avoid abnormals with ranger queriesRichard Biener2-2/+22
In unswitching we use ranger to simplify switch statements so we have to avoid doing anything for abnormals. 2022-05-30 Richard Biener <rguenther@suse.de> PR tree-optimization/105763 * tree-ssa-loop-unswitch.cc (find_unswitching_predicates_for_bb): Check gimple_range_ssa_p. * gcc.dg/pr105763.c: New testcase.
2022-06-01Daily bump.GCC Administrator10-1/+119
2022-05-31c++: non-dep call with empty TYPE_BINFO [PR105758]Patrick Palka2-2/+21
Here the out-of-line definition of Z<T>::z causes duplicate_decls to change z's type from using the primary template type Z<T> (which is also the type of the injected class name) to the implicit instantiation Z<T>, and this latter type lacks a TYPE_BINFO (although its TYPE_CANONICAL was set by a special case in lookup_template_class to point to the former). Later, when processing the non-dependent call z->foo(0), build_over_call relies on the object argument's TYPE_BINFO to build the templated form for this call, which fails because the object argument type has empty TYPE_BINFO due to the above. It seems weird that the implicit instantiation Z<T> doesn't have the same TYPE_BINFO as the primary template type Z<T>, despite them being proclaimed equivalent via TYPE_CANONICAL. So I tried also setting TYPE_BINFO in the special case in lookup_template_class, but that led to some problems with constrained partial specializations of the form Z<T>. I'm not sure what, if anything, we ought to do about the subtle differences between these two versions of the same type. Fortunately it seems we don't need to rely on TYPE_BINFO at all in build_over_call here -- the z_candidate struct already contains the exact binfos we need to rebuild the BASELINK for the templated form. PR c++/105758 gcc/cp/ChangeLog: * call.cc (build_over_call): Use z_candidate::conversion_path and ::access_path instead of TYPE_BINFO when building the BASELINK for the templated form. gcc/testsuite/ChangeLog: * g++.dg/template/non-dependent24.C: New test.
2022-05-31c++: use auto_timevar instead of timevar_push/popPatrick Palka2-73/+25
r12-5487-g9bf69a8558638c replaced uses of timevar_cond_push/pop with auto_cond_timevar and removed now unnecessary wrapper functions. This patch does the same with timevar_push/pop and auto_timevar. gcc/cp/ChangeLog: * parser.cc: Use auto_timevar instead of timevar_push/pop. Remove wrapper functions. * pt.cc: Likewise.
2022-05-31c++: squash cp_build_qualified_type/_realPatrick Palka4-37/+33
This combines the two differently named versions of the same function into a single function utilizing a default argument. gcc/cp/ChangeLog: * cp-tree.h (cp_build_qualified_type_real): Rename to ... (cp_build_qualified_type): ... this. Give its last parameter a default argument. Remove macro of the same name. * decl.cc (grokdeclarator): Adjust accordingly. * pt.cc (tsubst_aggr_type): Likewise. (rebuild_function_or_method_type): Likewise. (tsubst): Likewise. (maybe_dependent_member_ref): Likewise. (unify): Likewise. * tree.cc (cp_build_qualified_type_real): Rename to ... (cp_build_qualified_type): ... this. Adjust accordingly.
2022-05-31build: TAGS and .cc transitionJason Merrill8-10/+10
A few globs missed in the .c -> .cc transition. Some targets were looking at both *.c and *.cc, but there are no longer any .c files to scan. gcc/ChangeLog: * Makefile.in (TAGS): Look at libcpp/*.cc. gcc/c/ChangeLog: * Make-lang.in (c.tags): Look at *.cc. gcc/cp/ChangeLog: * Make-lang.in (c++.tags): Just look at *.cc. gcc/d/ChangeLog: * Make-lang.in (d.tags): Just look at *.cc. gcc/fortran/ChangeLog: * Make-lang.in (fortran.tags): Look at *.cc. gcc/go/ChangeLog: * Make-lang.in (go.tags): Look at *.cc. gcc/objc/ChangeLog: * Make-lang.in (objc.tags): Look at *.cc. gcc/objcp/ChangeLog: * Make-lang.in (obj-c++.tags): Look at *.cc.
2022-05-31d: Fix D lexer sometimes fails to compile code read from stdinIain Buclaw1-0/+4
As of gdc-12, the lexer expects there 4 bytes of zero padding at the end of the source buffer to mark the end of input. Sometimes when reading from stdin, the data at the end of input is garbage rather than zeroes. Fix that by explicitly calling memset past the end of the buffer. PR d/105544 gcc/d/ChangeLog: * d-lang.cc (d_parse_file): Zero padding past the end of the stdin buffer so the D lexer has a sentinel to stop parsing at.
2022-05-31aarch64: Fix build with gcc-4.8Christophe Lyon1-3/+3
My r13-680-g0dc8e1e7026d9b commit to add support for Decimal Floating Point introduced: case SDmode: case DDmode: case TDmode: which are rejected by gcc-4.8 as build compiler. This patch replaces them with E_SDmode, E_DDmode and E_TD_mode. Committed as obvious. * config/aarch64/aarch64.cc (aarch64_gimplify_va_arg_expr): Prefix mode names with E_.
2022-05-31Correct spelling of DW_AT_namelist_itemAlan Modra1-1/+1
include/ * dwarf2.def: Correct spelling of DW_AT_namelist_item. gcc/ * dwarf2out.cc (gen_namelist_decl): Adjust to suit correct spelling of DW_AT_namelist_item.
2022-05-31c++: document comp_template_args's default argsPatrick Palka2-14/+12
In passing, use bool for its return type. gcc/cp/ChangeLog: * cp-tree.h (comp_template_args): Change return type to bool. * pt.cc (comp_template_args): Document default arguments. Change return type to bool and adjust returns accordingly.
2022-05-31c++: use current_template_constraints morePatrick Palka2-15/+5
gcc/cp/ChangeLog: * decl.cc (grokvardecl): Use current_template_constraints. (grokdeclarator): Likewise. (xref_tag): Likewise. * semantics.cc (finish_template_template_parm): Likewise.
2022-05-31openmp: Add support for firstprivate and allocate clauses on scope constructJakub Jelinek7-5/+54
OpenMP 5.2 adds support for firstprivate and allocate clauses on the scope construct and this patch adds that support to GCC. 5.2 unfortunately (IMNSHO mistakenly) marked scope construct as worksharing, which implies that it isn't possible to nest inside of it other scope, worksharing loop, sections, explicit barriers, single etc. which would make scope far less useful. I'm not implementing that part, keeping the 5.1 behavior here, and will file an issue to revert that for OpenMP 6.0. But, for firstprivate it keeps the restriction that is now implied from worksharing construct that listed var can't be private in outer context, where for reduction 5.1 had similar restriction explicit even for scope and 5.2 has it implicitly through worksharing construct. 2022-05-31 Jakub Jelinek <jakub@redhat.com> gcc/ * omp-low.cc (build_outer_var_ref): For code == OMP_CLAUSE_ALLOCATE allow var to be private in the outer context. (lower_private_allocate): Pass OMP_CLAUSE_ALLOCATE as last argument to build_outer_var_ref. gcc/c/ * c-parser.cc (OMP_SCOPE_CLAUSE_MASK): Add firstprivate and allocate clauses. gcc/cp/ * parser.cc (OMP_SCOPE_CLAUSE_MASK): Add firstprivate and allocate clauses. gcc/testsuite/ * c-c++-common/gomp/scope-5.c: New test. * c-c++-common/gomp/scope-6.c: New test. * g++.dg/gomp/attrs-1.C (bar): Add firstprivate and allocate clauses to scope construct. * g++.dg/gomp/attrs-2.C (bar): Likewise. libgomp/ * testsuite/libgomp.c-c++-common/allocate-1.c (foo): Add testcase for scope construct with allocate clause. * testsuite/libgomp.c-c++-common/allocate-3.c (foo): Likewise. * testsuite/libgomp.c-c++-common/scope-2.c: New test.
2022-05-31Daily bump.GCC Administrator6-1/+337
2022-05-30c++: Add !TYPE_P assert to type_dependent_expression_p [PR99080]Marek Polacek2-0/+11
As discussed here: <https://gcc.gnu.org/pipermail/gcc-patches/2021-February/564629.html>, type_dependent_expression_p should not be called with a type argument. I promised I'd add an assert so here it is. One place needed adjusting. PR c++/99080 gcc/cp/ChangeLog: * pt.cc (type_dependent_expression_p): Assert !TYPE_P. * semantics.cc (finish_id_expression_1): Handle UNBOUND_CLASS_TEMPLATE specifically.
2022-05-30Allow SCmode and DImode to be tieable with TARGET_64BIT on x86_64.Roger Sayle1-0/+12
This patch is a form of insurance policy in case my patch for PR 7061 runs into problems on non-x86 targets; the middle-end can add an extra check that the backend is happy placing SCmode and DImode values in the same register, before creating a SUBREG. Unfortunately, ix86_modes_tieable_p currently claims this is not allowed(?), even though the default target hook for modes_tieable_p is to always return true [i.e. false can be used to specifically prohibit bad combinations], and the x86_64 ABI passes SCmode values in DImode registers!. This makes the backend's modes_tiable_p hook a little more forgiving, and additionally enables interconversion between SCmode and V2SFmode, and between DCmode and VD2Fmode, which opens interesting opporutunities in the future. 2022-05-30 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog * config/i386/i386.cc (ix86_modes_tieable_p): Allow SCmode to be tieable with DImode on TARGET_64BIT, and SCmode tieable with V2SFmode, and DCmode with V2DFmode.
2022-05-30Fortran: improve runtime error message with ALLOCATE and ERRMSG= [PR91300]Harald Anlauf4-5/+82
ALLOCATE: generate different STAT,ERRMSG results for failures from allocation of already allocated objects or insufficient virtual memory. gcc/fortran/ChangeLog: PR fortran/91300 * libgfortran.h: Define new error code LIBERROR_NO_MEMORY. * trans-stmt.cc (gfc_trans_allocate): Generate code for setting ERRMSG depending on result of STAT result of ALLOCATE. * trans.cc (gfc_allocate_using_malloc): Use STAT value of LIBERROR_NO_MEMORY in case of failed malloc. gcc/testsuite/ChangeLog: PR fortran/91300 * gfortran.dg/allocate_alloc_opt_15.f90: New test.
2022-05-30PR rtl-optimization/101617: Use neg/sbb in ix86_expand_int_movcc.Roger Sayle3-1/+67
This patch resolves PR rtl-optimization/101617 where we should generate the exact same code for (X ? -1 : 1) as we do for ((X ? -1 : 0) | 1). The cause of the current difference on x86_64 is actually in ix86_expand_int_movcc that doesn't know that negl;sbbl can be used to create a -1/0 result depending on whether the input is zero/nonzero. So for Andrew Pinski's test case: int f1(int i) { return i ? -1 : 1; } GCC currently generates: f1: cmpl $1, %edi sbbl %eax, %eax // x ? 0 : -1 andl $2, %eax // x ? 0 : 2 subl $1, %eax // x ? -1 : 1 ret but with the attached patch, now generates: f1: negl %edi sbbl %eax, %eax // x ? -1 : 0 orl $1, %eax // x ? -1 : 1 ret To implement this I needed to add two expanders to i386.md to generate the required instructions (in both SImode and DImode) matching the pre-existing define_insns of the same name. 2022-05-30 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog PR rtl-optimization/101617 * config/i386/i386-expand.cc (ix86_expand_int_movcc): Add a special case (indicated by negate_cc_compare_p) to generate a -1/0 mask using neg;sbb. * config/i386/i386.md (x86_neg<mode>_ccc): New define_expand to generate an *x86_neg<mode>_ccc instruction. (x86_mov<mode>cc_0_m1_neg): Likewise, a new define_expand to generate a *x86_mov<mode>cc_0_m1_neg instruction. gcc/testsuite/ChangeLog PR rtl-optimization/101617 * gcc.target/i386/pr101617.c: New test case.
2022-05-30Make the default rtx_costs of MULT/DIV variants consistent.Roger Sayle1-0/+7
GCC's middle-end provides a default cost model for RTL expressions, for backends that don't specify their own instruction timings, that can be summarized as multiplications are COSTS_N_INSNS(4), divisions are COSTS_N_INSNS(7) and all other operations are COSTS_N_INSNS(1). This patch tweaks the above definition so that fused-multiply-add (FMA) and high-part multiplications cost the same as regular multiplications, or more importantly aren't (by default) considered less expensive. Likewise the saturating forms of multiplication and division cost the same as the regular variants. These values can always be changed by the target, but the goal is to avoid RTL expansion substituting a suitable operation with its saturating equivalent because it (accidentally) looks much cheaper. For example, PR 89845 is about implementing division/modulus via highpart multiply, which may accidentally look extremely cheap. 2022-05-30 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog * rtlanal.cc (rtx_cost) <MULT>: Treat FMA, SS_MULT, US_MULT, SMUL_HIGHPART and UMUL_HIGHPART as having the same cost as MULT. <DIV>: Likewise, SS_DIV and US_DIV have the same default as DIV.
2022-05-30PR target/70321: Split double word equality/inequality after STV on x86.Roger Sayle7-93/+149
This patch resolves the last piece of PR target/70321 a code quality (P2 regression) affecting mainline. Currently, for HJ's testcase: void foo (long long ixi) { if (ixi != 14348907) __builtin_abort (); } GCC with -m32 -O2 generates four instructions for the comparison: movl 16(%esp), %eax movl 20(%esp), %edx xorl $14348907, %eax orl %eax, %edx but with this patch it now requires only three, making better use of x86's addressing modes: movl 16(%esp), %eax xorl $14348907, %eax orl 20(%esp), %eax The solution is to expand "doubleword" equality/inequality expressions using flag setting COMPARE instructions for the early RTL passes, and then split them during split1, after STV and before reload. Hence on x86_64, we now see/allow things like: (insn 11 8 12 2 (set (reg:CCZ 17 flags) (compare:CCZ (reg/v:TI 84 [ x ]) (reg:TI 96))) "cmpti.c":2:43 30 {*cmpti_doubleword} This allows the STV pass to decide whether it's preferrable to perform this comparison using vector operations, i.e. a pxor/ptest sequence, or as scalar integer operations, i.e. a xor/xor/or sequence. Alas this required tweaking of the STV pass to recognize the "new" form of these comparisons and split out the pxor operation itself. To confirm this still works as expected I've added a new STV test case: long long a[1024]; long long b[1024]; int foo() { for (int i=0; i<1024; i++) { long long t = (a[i]<<8) | (b[i]<<24); if (t == 0) return 1; } return 0; } where with -m32 -O2 -msse4.1 the above comparison with zero should look like: punpcklqdq %xmm0, %xmm0 ptest %xmm0, %xmm0 Although this patch includes one or two minor tweaks to provide all the necessary infrastructure to support conversion of TImode comparisons to V1TImode (and SImode comparisons to V4SImode), STV doesn't yet implement these transformations, but this is something that can be considered after stage 4. Indeed the new convert_compare functionality is split out into a method to simplify its potential reuse by the timode_scalar_chain class. 2022-05-30 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog PR target/70321 * config/i386/i386-expand.cc (ix86_expand_branch): Don't decompose DI mode equality/inequality using XOR here. Instead generate a COMPARE for doubleword modes (DImode on !TARGET_64BIT or TImode). * config/i386/i386-features.cc (gen_gpr_to_xmm_move_src): Use gen_rtx_SUBREG when NUNITS is 1, i.e. for TImode to V1TImode. (general_scalar_chain::convert_compare): New function to convert scalar equality/inequality comparison into vector operations. (general_scalar_chain::convert_insn) [COMPARE]: Refactor. Call new convert_compare helper method. (convertible_comparion_p): Update to match doubleword COMPARE of two register, memory or integer constant operands. * config/i386/i386-features.h (general_scalar_chain::convert_compare): Prototype/declare member function here. * config/i386/i386.md (cstore<mode>4): Change mode to SDWIM, but only allow new doubleword modes for EQ and NE operators. (*cmp<dwi>_doubleword): New define_insn_and_split, to split a doubleword comparison into a pair of XORs followed by an IOR to set the (zero) flags register, optimizing the XORs if possible. * config/i386/sse.md (V_AVX): Include V1TI and V2TI in mode iterator; V_AVX is (currently) only used by ptest. (sse4_1 mode attribute): Update to support V1TI and V2TI. gcc/testsuite/ChangeLog PR target/70321 * gcc.target/i386/pr70321.c: New test case. * gcc.target/i386/sse4_1-stv-1.c: New test case.
2022-05-30i386: Remove constraints when used with constant integer predicates, take 2Uros Bizjak6-247/+247
const_int_operand and other const*_operand predicates do not need constraints when the constraint is inherited from the range of constant integer predicate. Remove the constraint in case all alternatives use the same inherited constraint. However, when there are operands, commitative with a non-constant operand, the operand effectively matches e.g. nonimmediate_operand|const_int_operand rather than just const_int_operand. We should keep the constraint for const_int_operand that are in a % pair. See PR 105624. 2022-05-30 Uroš Bizjak <ubizjak@gmail.com> gcc/ChangeLog: * config/i386/i386.md: Remove constraints when used with const_int_operand, const0_operand, const_1_operand, constm1_operand, const8_operand, const128_operand, const248_operand, const123_operand, const2367_operand, const1248_operand, const359_operand, const_4_or_8_to_11_operand, const48_operand, const_0_to_1_operand, const_0_to_3_operand, const_0_to_4_operand, const_0_to_5_operand, const_0_to_7_operand, const_0_to_15_operand, const_0_to_31_operand, const_0_to_63_operand, const_0_to_127_operand, const_0_to_255_operand, const_0_to_255_mul_8_operand, const_1_to_31_operand, const_1_to_63_operand, const_2_to_3_operand, const_4_to_5_operand, const_4_to_7_operand, const_6_to_7_operand, const_8_to_9_operand, const_8_to_11_operand, const_8_to_15_operand, const_10_to_11_operand, const_12_to_13_operand, const_12_to_15_operand, const_14_to_15_operand, const_16_to_19_operand, const_16_to_31_operand, const_20_to_23_operand, const_24_to_27_operand and const_28_to_31_operand. * config/i386/mmx.md: Ditto. * config/i386/sse.md: Ditto. * config/i386/subst.md: Ditto. * config/i386/sync.md: Ditto. gcc/testsuite/ChangeLog: * gcc.target/i386/pr105624.c: New test.
2022-05-30x86: correct bmi2_umul<mode><dwi>3_1's MEM_P() usesJan Beulich1-1/+1
It's pretty clear that the operand numbers in the MEM_P() checks are off by one, perhaps due to a copy-and-paste oversight (unlike in most other places here we're dealing with two outputs). gcc/ * config/i386/i386.md (bmi2_umul<mode><dwi>3_1): Correct MEM_P() arguments.
2022-05-30[Ada] Fix spurious options being inserted in -fdiagnostics-format=json outputGhjuvan Lacambre1-1/+1
Without this patch, gnat would use `-gnatw?` as the default option for some of the default warnings. gcc/ada/ * erroutc.adb (Get_Warning_Option): Don't consider `?` as a valid option switch.
2022-05-30[Ada] Add "option" field to GNAT's -fdiagnostics-format=json outputGhjuvan Lacambre3-10/+41
This enables better integration with tools that handle GNAT's output. gcc/ada/ * erroutc.ads (Get_Warning_Option): New function returning the option responsible for a warning if it exists. * erroutc.adb (Get_Warning_Option): Likewise. (Get_Warning_Tag): Rely on Get_Warning_Option when possible. * errout.adb (Output_JSON_Message): Emit option field.
2022-05-30[Ada] Remove contract duplication in formal doubly linked listsJulien Bortolussi1-9/+1
Remove a minor duplication in Post of a function of formal doubly linked lists. gcc/ada/ * libgnat/a-cfdlli.ads (Insert): Remove the duplication.
2022-05-30[Ada] Fix expansion of structural subprogram variantsPiotr Trojanek1-7/+21
When implementing structural subprogram variants we ignored them in expansion of the pragma itself, but not in expansion of a recursive subprogram call. Now fixed. gcc/ada/ * exp_ch6.adb (Check_Subprogram_Variant): Ignore structural variants.
2022-05-30[Ada] Simplify construction of a path to filePiotr Trojanek1-5/+5
Code cleanup; semantics is unaffected. gcc/ada/ * osint.adb (Locate_File): Change variable to constant and initialize it by concatenation of directory, file name and NUL.
2022-05-30[Ada] Remove repeated description of support for Address clausesPiotr Trojanek2-14/+0
The GNAT behaviour regarding the Ada RM requirement to support Address clauses for imported subprograms was documented twice: in section about packed types (which was a mistake) and in section about address clauses (where it belongs). Cleanup related to the use of packed arrays for bitset operations to detect uses of uninitialized scalars in GNAT. gcc/ada/ * doc/gnat_rm/implementation_advice.rst (Packed Types): Remove duplicated and wrongly placed paragraph. * gnat_rm.texi: Regenerate.
2022-05-30[Ada] Add insertion character to Ineffective_Inline_Warnings messagesGhjuvan Lacambre1-2/+2
This enables tools that ingest GNAT's output to properly classify these messages. gcc/ada/ * inline.adb (Check_Package_Body_For_Inlining): Add insertion character.
2022-05-30[Ada] Add insertion character for overlay modification warningsGhjuvan Lacambre3-5/+5
This enables tools that ingest GNAT's output to properly classify these messages. gcc/ada/ * freeze.adb (Warn_Overlay): Add 'o' insertion character. * sem_ch13.adb (Analyze_Attribute_Definition_Clause): Likewise. * sem_util.adb (Note_Possible_Modifications): Likewise.
2022-05-30[Ada] Fix Warn_On_All_Unread_Out_Parameters not being properly taggedGhjuvan Lacambre1-1/+1
This caused tools ingesting GNAT's output to mislabel these messages. gcc/ada/ * sem_warn.adb (Warn_On_Useless_Assignment): Fix insertion character.
2022-05-30[Ada] Fix Warn_On_Late_Primitives messages not being properly taggedGhjuvan Lacambre1-1/+1
This caused tools ingesting GNAT's output to mislabel these messages. gcc/ada/ * sem_disp.adb (Warn_On_Late_Primitive_After_Private_Extension): Fix insertion character.