aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2022-10-26Check if varying may also be non-negative.Andrew MacLeod1-0/+8
When using strict enums, we can sometimes turn varying into a better range. * gimple-range-fold.cc (fold_using_range::fold_stmt): Check if stmt is non-negative and adjust the range.
2022-10-26i386: add reset_cpu_featureMartin Liska1-5/+33
gcc/ChangeLog: * common/config/i386/cpuinfo.h (has_cpu_feature): Add comment. (reset_cpu_feature): New. (get_zhaoxin_cpu): Use reset_cpu_feature.
2022-10-26RISC-V: Fix epilogue generation for barrier.Ju-Zhe Zhong1-2/+2
I noticed that I have made a mistake in previous patch: https://patchwork.sourceware.org/project/gcc/patch/20220817071950.271762-1-juzhe.zhong@rivai.ai/ The previous statement before this patch: bool need_barrier_p = (get_frame_size () + cfun->machine->frame.arg_pointer_offset) != 0; However, I changed it in the previous patch: bool need_barrier_p = known_ne (get_frame_size (), cfun->machine->frame.arg_pointer_offset); This is incorrect. Now, I correct this statement in this patch. gcc/ChangeLog: * config/riscv/riscv.cc (riscv_expand_epilogue): Fix statement.
2022-10-26RISC-V: ADJUST_NUNITS according to -march.Ju-Zhe Zhong5-53/+50
This patch fixed PR107357: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107357 gcc/ChangeLog: PR target/107357 * config/riscv/riscv-modes.def (VECTOR_BOOL_MODE): Set to minimum size. (ADJUST_NUNITS): Adjust according to -march. (ADJUST_BYTESIZE): Ditto. * config/riscv/riscv-protos.h (riscv_v_ext_enabled_vector_mode_p): Remove. (riscv_v_ext_vector_mode_p): Change function implementation. * config/riscv/riscv-vector-builtins.cc (rvv_switcher::rvv_switcher): Change to riscv_v_ext_vector_mode_p. (register_builtin_type): Ditto. * config/riscv/riscv.cc (riscv_v_ext_vector_mode_p): Change to enabled modes. (ENTRY): Ditto. (riscv_v_ext_enabled_vector_mode_p): Remove. (riscv_v_adjust_nunits): New function. (riscv_vector_mode_supported_p): Use riscv_v_ext_vector_mode_p instead. * config/riscv/riscv.h (riscv_v_adjust_nunits): New function.
2022-10-26RISC-V: Support load/store in mov<mode> pattern for RVV modes.Ju-Zhe Zhong25-28/+2421
gcc/ChangeLog: * config.gcc (riscv*): Add riscv-v.o to extra_objs. * config/riscv/constraints.md (vu): New constraint. (vi): Ditto. (Wc0): Ditto. (Wc1): Ditto. * config/riscv/predicates.md (vector_length_operand): New. (reg_or_mem_operand): Ditto. (vector_move_operand): Ditto. (vector_mask_operand): Ditto. (vector_merge_operand): Ditto. * config/riscv/riscv-protos.h (riscv_regmode_natural_size) New. (riscv_vector::const_vec_all_same_in_range_p): Ditto. (riscv_vector::legitimize_move): Ditto. (tail_policy): Ditto. (mask_policy): Ditto. * config/riscv/riscv-v.cc: New. * config/riscv/riscv-vector-builtins-bases.cc (vsetvl::expand): Refactor how LMUL encoding. * config/riscv/riscv.cc (riscv_print_operand): Update how LMUL print and mask operand print. (riscv_regmode_natural_size): New. * config/riscv/riscv.h (REGMODE_NATURAL_SIZE): New. * config/riscv/riscv.md (mode): Add vector modes. * config/riscv/t-riscv (riscv-v.o) New. * config/riscv/vector-iterators.md: New. * config/riscv/vector.md (vundefined<mode>): New. (mov<mode>): New. (*mov<mode>): New. (@vsetvl<mode>_no_side_effects): New. (@pred_mov<mode>): New. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/mov-1.c: New. * gcc.target/riscv/rvv/base/mov-10.c: New. * gcc.target/riscv/rvv/base/mov-11.c: New. * gcc.target/riscv/rvv/base/mov-12.c: New. * gcc.target/riscv/rvv/base/mov-13.c: New. * gcc.target/riscv/rvv/base/mov-2.c: New. * gcc.target/riscv/rvv/base/mov-3.c: New. * gcc.target/riscv/rvv/base/mov-4.c: New. * gcc.target/riscv/rvv/base/mov-5.c: New. * gcc.target/riscv/rvv/base/mov-6.c: New. * gcc.target/riscv/rvv/base/mov-7.c: New. * gcc.target/riscv/rvv/base/mov-8.c: New. * gcc.target/riscv/rvv/base/mov-9.c: New.
2022-10-26RISC-V: Recognized Svinval and Svnapot extensionsMonk Chiang5-0/+109
gcc/ChangeLog: * common/config/riscv/riscv-common.cc (riscv_ext_version_table): Add svinval and svnapot extension. (riscv_ext_flag_table): Ditto. * config/riscv/riscv-opts.h (MASK_SVINVAL): New. (MASK_SVNAPOT): Ditto. (TARGET_SVINVAL): Ditto. (TARGET_SVNAPOT): Ditto. * config/riscv/riscv.opt (riscv_sv_subext): New. gcc/testsuite/ChangeLog: * gcc.target/riscv/predef-24.c:New. * gcc.target/riscv/predef-25.c:New.
2022-10-26RISC-V: Adjust table indentation in commnet for riscv-modes.defJu-Zhe Zhong1-23/+23
gcc/ChangeLog: * config/riscv/riscv-modes.def: Adjust table indentation in commnet.
2022-10-26gcc/configure: regenerateMartin Liska1-2/+2
gcc/ChangeLog: * configure: Regenerate.
2022-10-26Convert flag_finite_math_only uses in frange to HONOR_*.Aldy Hernandez2-9/+9
As mentioned earlier, we should be using HONOR_* on types rather than flag_finite_math_only. gcc/ChangeLog: * value-range.cc (frange::set): Use HONOR_*. (frange::verify_range): Same. * value-range.h (frange_val_min): Same. (frange_val_max): Same.
2022-10-26rs6000: cannot_force_const_mem for HIGH code rtx[PR106460]Jiufu Guo2-2/+17
As the issue in PR106460, a rtx 'high:DI (symbol_ref:DI ("var_48")' is tried to store into constant pool and ICE occur. But actually, this rtx represents partial incomplete address and can not be put into a .rodata section. This patch updates rs6000_cannot_force_const_mem to return true for rtx(s) with HIGH code, because these rtx(s) indicate part of address and are not ok for constant pool. Below are some examples: (high:DI (const:DI (plus:DI (symbol_ref:DI ("xx") (const_int 12 [0xc]))))) (high:DI (symbol_ref:DI ("var_1")..))) PR target/106460 gcc/ChangeLog: * config/rs6000/rs6000.cc (rs6000_cannot_force_const_mem): Return true for HIGH code rtx. gcc/testsuite/ChangeLog: * gcc.target/powerpc/pr106460.c: New test.
2022-10-26RISC-V: Add h extension supportKito Cheng4-16/+77
`h` was the prefix of multi-letter extension name, but it become a extension in later RISC-V isa spec. Fortunately we don't have any extension really defined is prefixed with `h`, so we can just change that. gcc/ChangeLog: * common/config/riscv/riscv-common.cc (riscv_ext_version_table): Add `h`. (riscv_supported_std_ext): Ditto. (multi_letter_subset_rank): Remove `h`. (riscv_subset_list::parse_std_ext): Handle `h` as single letter extension. (riscv_subset_list::parse): Ditto. gcc/testsuite/ChangeLog: * gcc.target/riscv/arch-18.c: New. * gcc.target/riscv/arch-5.c: Remove test for prefixed with `h`. * gcc.target/riscv/predef-23.c: New.
2022-10-25Don't force DWARF4 for AutoFDO testsEugene Rozenfeld1-1/+1
Support for DWARF5 was added to create_gcov in https://github.com/google/autofdo so we no longer need to force DWARF4 for AutoFDO tests. Tested on x86_64-pc-linux-gnu. gcc/testsuite/ChangeLog: * lib/profopt.exp: Don't force DWARF4 for AutoFDO tests
2022-10-26Daily bump.GCC Administrator4-1/+279
2022-10-25Start using discriminators in AutoFDO.Eugene Rozenfeld1-2/+3
Tested on x86_64-pc-linux-gnu. gcc/ChangeLog: * auto-profile.cc (get_combined_location): Include discriminator in the returned combined location. (read_function_instance): Read discriminators from profiles.
2022-10-25c++: Adjust synthetic template parm creationNathan Sidwell1-11/+15
We intend to mark synthetic template parameters (coming from use of auto parms), as DECL_VIRTUAL_P. The API of process_template_parm is awkwardly confusing, and we were marking the previous template parm (unless this was the first parm). process_template_parm returns the list of parms, when most (all?) users really want the newly-added final node. That's a bigger change, so let's not do it right now. With this, we correctly mark such synthetic parms DECL_VIRTUAL_P. gcc/cp/ * parser.cc (synthesize_implicit_template_parm): Fix thinko about mark the new parm DECL_VIRTUAL_P. Avoid unneccessary tree_last call.
2022-10-25c++: remove use_default_args parm of coerce_template_parmsPatrick Palka3-85/+32
The parameter use_default_args of coerce_template_parms, introduced way back in r110693, is effectively unused ever since r7-5536-g3c75aaa3d884ef removed the last 'coerce_template_parms (..., true, false)' call. So this patch aims to simplify this function's API by getting rid of this parameter. In passing, I noticed we currently define wrapper overloads of coerce_template_parms that act as defacto default arguments for complain and require_all_args. It seems cleaner however to just specify real default arguments for the main overload instead. And I suppose we should also give c_innermost_t_p the same defaults. But I'm not sure about defaulting complain to tf_none, which is inconsistent with how we default it in other places to either tf_error or tf_warning_or_error (as a convenience for non-SFINAE callers). And since in general it's probably better to not default complain as that's a source of SFINAE bugs, and only a handful of callers use this defacto complain=tf_none default, this patch gets rid of this complain default (but keeps the require_all_args default). gcc/cp/ChangeLog: * constraint.cc (resolve_function_concept_overload): Explicitly pass complain=tf_none to coerce_template_parms. (resolve_concept_check): Likewise. (normalize_concept_check): Likewise. * cp-tree.h (coerce_template_parms): Declare the main overload and default its last parameter to true. Remove wrapper overloads. * pt.cc (determine_specialization): Adjust calls to coerce_template_parms and coerce_innermost_template_parms after removing their last parameter. (coerce_template_args_for_ttp): Likewise. (coerce_ttp_args_for_tta): Likewise. (coerce_template_template_parms): Likewise. (coerce_template_parms): Remove use_default_args parameter and adjust function comment. Document default argument. Remove wrapper overloads. No longer static. (coerce_innermost_template_parms): Remove use_default_args parameter. Default require_all_args to true. (lookup_template_class): As with determine_specialization. (finish_template_variable): Likewise. (tsubst_decl): Likewise. (instantiate_alias_template): Likewise. (fn_type_unification): Likewise. (resolve_overloaded_unification): Likewise. (resolve_nondeduced_context): Likewise. (get_partial_spec_bindings): Likewise.
2022-10-25c++: correct fold_operand changeJason Merrill1-1/+2
Still want the conversion to bool. gcc/cp/ChangeLog: * constexpr.cc (find_failing_clause_r): Re-add the call to contextual_conv_bool.
2022-10-25c++ modules: enum TYPE_MIN/MAX_VALUE streaming [PR106848]Patrick Palka7-15/+67
In the frontend, the TYPE_MIN/MAX_VALUE of ENUMERAL_TYPE is the same as that of the enum's underlying type (see start_enum). And the underlying type of an enum is always known, even for an opaque enum that lacks a definition. But currently, we stream TYPE_MIN/MAX_VALUE of an enum only as part of its definition. So if the enum is declared but never defined, the ENUMERAL_TYPE we stream in will have empty TYPE_MIN/MAX_VALUE fields despite these fields being non-empty on stream out. And even if the enum is defined, read_enum_def updates these fields only on the main variant of the enum type, so for other variants (that we may have streamed in earlier) these fields remain empty. That these fields are unexpectedly empty for some ENUMERAL_TYPEs is ultimately the cause of the below two PRs. This patch fixes this by making us stream TYPE_MIN/MAX_VALUE directly for each ENUMERAL_TYPE rather than as part of the enum's definition, so that we naturally also stream these fields for opaque enums (and each enum type variant). PR c++/106848 PR c++/102600 gcc/cp/ChangeLog: * module.cc (trees_out::core_vals): Stream TYPE_MAX_VALUE and TYPE_MIN_VALUE of ENUMERAL_TYPE. (trees_in::core_vals): Likewise. (trees_out::write_enum_def): Don't stream them here. (trees_in::read_enum_def): Likewise. gcc/testsuite/ChangeLog: * g++.dg/modules/enum-9_a.H: New test. * g++.dg/modules/enum-9_b.C: New test. * g++.dg/modules/enum-10_a.H: New test. * g++.dg/modules/enum-10_b.C: New test. * g++.dg/modules/enum-11_a.H: New test. * g++.dg/modules/enum-11_b.C: New test.
2022-10-25Always use TYPE_MODE instead of DECL_MODE for vector fieldH.J. Lu2-2/+40
e034c5c8957 re PR target/78643 (ICE in convert_move, at expr.c:230) fixed the case where DECL_MODE of a vector field is BLKmode and its TYPE_MODE is a vector mode because of target attribute. Remove the BLKmode check for the case where DECL_MODE of a vector field is a vector mode and its TYPE_MODE isn't a vector mode because of target attribute. gcc/ PR target/107304 * expr.cc (get_inner_reference): Always use TYPE_MODE for vector field with vector raw mode. gcc/testsuite/ PR target/107304 * gcc.target/i386/pr107304.c: New test.
2022-10-25c++: constexpr-evaluate more assumesJason Merrill3-44/+133
The initial [[assume]] support avoided evaluating assumes with TREE_SIDE_EFFECTS set, such as calls, because we don't want any side-effects that change the constexpr state. This patch allows us to evaluate expressions with that flag set by tracking which variables the evaluation is allowed to modify, and giving up if it tries to touch any others. I considered allowing changes to other variables and then rolling them back, but that seems like a rare enough situation that it doesn't seem worth working to handle nicely at this point. gcc/cp/ChangeLog: * constexpr.cc (class constexpr_global_ctx): Add modifiable field, get_value, get_value_ptr, put_value, remove_value, flush_modifiable member functions. (class modifiable_tracker): New. (cxx_eval_internal_function): Use it. (diagnose_failing_condition): Strip CLEANUP_POINT_EXPR. gcc/testsuite/ChangeLog: * g++.dg/cpp23/attr-assume9.C: New test. * g++.dg/cpp23/attr-assume10.C: New test.
2022-10-25c++: improve failed constexpr assume diagnosticJason Merrill4-44/+55
I noticed that we were printing "the comparison reduces to (x == 42)" when we should be able to give the value of x. Fixed by doing the same evaluation in diagnose_failing_condition that we already do in find_failing_clause. gcc/cp/ChangeLog: * constexpr.cc (fold_operand): New function. (find_failing_clause_r): Add const. (find_failing_clause): Add const. (diagnose_failing_condition): Add ctx parameter. (cxx_eval_internal_function): Pass it. * semantics.cc (diagnose_failing_condition): Move to constexpr.cc. * cp-tree.h: Adjust. gcc/testsuite/ChangeLog: * g++.dg/cpp23/attr-assume2.C: Expect constant values.
2022-10-25rs6000: Add CCANY; replace <un>signed by <mode:CCANY>Segher Boessenkool3-20/+19
This is in preparation for adding CCFP, and maybe CCEQ, and whatever other CC mode we may want later. CCANY is used for CC mode consumers that actually can take any of the four CR field bits. 2022-10-25 Segher Boessenkool <segher@kernel.crashing.org> * config/rs6000/rs6000.md (CCEITHER): Delete. (CCANY): New. (un): Delete. (isel_<un>signed_<GPR:mode>): Rename to... (isel_<CCANY:mode>_<GPR:mode>): ... this. Adjust. (*isel_reversed_<un>signed_<GPR:mode>): Rename to... (*isel_reversed_<CCANY:mode>_<GPR:mode>): ... this. Adjust. (setbc_<un>signed_<GPR:mode>): Rename to... (setbc_<CCANY:mode>_<GPR:mode>C): ... this. Adjust." (*setbcr_<un>signed_<GPR:mode>): Rename to ... (*setbcr_<CCANY:mode>_<GPR:mode>): ... this. Adjust. (*setnbc_<un>signed_<GPR:mode>): Rename to ... (*setnbc_<CCANY:mode>_<GPR:mode>): ... this. Adjust. (*setnbcr_<un>signed_<GPR:mode>): Rename to ... (*setnbcr_<CCANY:mode>_<GPR:mode>): ... this. Adjust. (eq<mode>3 for GPR): Adjust. (ne<mode>3 for GPR): Adjust. * config/rs6000/rs6000-string.cc (do_isel): Adjust. * config/rs6000/rs6000.cc (rs6000_emit_int_cmove): Adjust.
2022-10-25tree-optimization/107176 - SCEV analysis association issueRichard Biener2-157/+185
The following fixes a wrong-code issue caused by SCEV analysis associating an addition due trying to use tail-recursion in follow_ssa_edge_expr. That causes us to apply a conversion at the wrong point and thus miscompute the scalar evolution of an induction variable. This reverts the PR66375 fix and revisits the PR42512 fix by keeping the evolution symbolic up to the point we process the first linear function when we then can check for the supported cases and substitute the whole symbolic expression with the built chrec substituting the proper initial value. To simplify passing around things and to clarify scoping of the involved functions this change wraps the SCEV DFS walking code into a class. PR tree-optimization/107176 PR tree-optimization/66375 PR tree-optimization/42512 * tree-scalar-evolution.cc (follow_ssa_edge_expr): Revert the PR66375 fix, do not not associate PLUS_EXPR to be able to use tail-recursion. (follow_ssa_edge_binary): Likewise. (interpret_loop_phi): Revert PR42512 fix, do not throw away analyze_evolution_in_loop result after the fact. (follow_ssa_edge_expr): When reaching halting_phi initalize the evolution to the symbolic value of the PHI result. (add_to_evolution_1): When adding the first evolution verify we can handle the expression wrapping the symbolic evolution and replace that in full using the initial condition. (class scev_dfs): New, contains ... (follow_ssa_edge_expr, follow_ssa_edge_binary, follow_ssa_edge_in_condition_phi_branch, follow_ssa_edge_in_condition_phi, follow_ssa_edge_inner_loop_phi, add_to_evolution, add_to_evolution_1): ... these with loop and halting_phi arguments in class data. (scev_dfs::get_ev): New toplevel DFS entry, start with a chrec_dont_know evolution. (analyze_evolution_in_loop): Use scev_dfs. * gcc.dg/torture/pr107176.c: New testcase.
2022-10-25Relax assertion in profilerEric Botcazou4-5/+20
This assertion in branch_prob: if (bb == ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb) { location_t loc = DECL_SOURCE_LOCATION (current_function_decl); gcc_checking_assert (!RESERVED_LOCATION_P (loc)); had been correct until the fix for PR debug/101598 was installed. gcc/ * profile.cc (branch_prob): Be prepared for ignored functions with DECL_SOURCE_LOCATION set to UNKNOWN_LOCATION. gcc/testsuite: * gnat.dg/specs/coverage1.ads: New test. * gnat.dg/specs/variant_part.ads: Minor tweak. * gnat.dg/specs/weak1.ads: Add dg directive.
2022-10-25Move NOP stripping in SCEV analysisRichard Biener1-2/+4
The following moves a pair of STRIP_USELESS_TYPE_CONVERSIONS to where it belongs and adds a comment on why we handle GENERIC there at all. * tree-scalar-evolution.cc (follow_ssa_edge_expr): Move STRIP_USELESS_TYPE_CONVERSIONS to where it matters.
2022-10-25Remove znver4 instruction reservationsTejas Joshi2-814/+37
This reverts the changes made to znver.md in: commit bf3b532b524ecacb3202ab2c8af419ffaaab7cff 2022-10-21 Tejas Joshi <TejasSanjay.Joshi@amd.com> gcc/ChangeLog: * common/config/i386/i386-common.cc (processor_alias_table): Use CPU_ZNVER3 for znver4. * config/i386/znver.md: Remove znver4 reservations.
2022-10-25gimplify: Fix comment typosJakub Jelinek1-1/+1
While looking at gimple_boolify for PR107368, I've noticed 2 comment typos. 2022-10-25 Jakub Jelinek <jakub@redhat.com> * gimplify.cc (gimple_boolify): Fix comment typos, prduce -> produce and There -> These.
2022-10-25gimplify: Call gimple_boolify on IFN_ASSUME argument [PR107368]Jakub Jelinek2-1/+11
The following testcase ICEs in C, because assume attribute condition has int type rather than bool and the gimplification into GIMPLE_ASSUME assigns it into a bool variable. Fixed by calling gimple_boolify. 2022-10-25 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/107368 * gimplify.cc (gimplify_call_expr): For complex IFN_ASSUME conditions call gimple_boolify on the condition. * gcc.dg/attr-assume-5.c: New test.
2022-10-25MIPS: add builtime option for -mcompact-branchesYunQiang Su3-3/+32
For R6+ target, it allows to configure gcc to use compact branches only if avaiable. gcc/ChangeLog: * config.gcc: add -with-compact-branches=policy build option. * doc/install.texi: Likewise. * config/mips/mips.h: Likewise.
2022-10-25MIPS: Not trigger error for pre-R6 and -mcompact-branches=alwaysYunQiang Su7-23/+43
For MIPSr6, we may wish to use compact-branches only. Currently, we have to use `always' option, while it is mark as conflict with pre-R6. cc1: error: unsupported combination: ‘mips32r2’ -mcompact-branches=always Just ignore -mcompact-branches=always for pre-R6. This patch also defines __mips_compact_branches_never __mips_compact_branches_always __mips_compact_branches_optimal predefined macros gcc/ChangeLog: * config/mips/mips.cc (mips_option_override): not trigger error for compact-branches=always for pre-R6. * config/mips/mips.h (TARGET_RTP_PIC): not trigger error for compact-branches=always for pre-R6. (TARGET_CB_NEVER): Likewise. (TARGET_CB_ALWAYS): Likewise. (struct mips_cpu_info): define macros for compact branch policy. * doc/invoke.texi: Document "always" with pre-R6. gcc/testsuite/ChangeLog: * gcc.target/mips/compact-branches-1.c: add isa_rev>=6. * gcc.target/mips/mips.exp: don't add -mipsXXr6 option for -mcompact-branches=always. It is usable for pre-R6 now. * gcc.target/mips/compact-branches-8.c: New test. * gcc.target/mips/compact-branches-9.c: New test.
2022-10-25gimplify: Don't add GIMPLE_ASSUME if errors were seen [PR107369]Jakub Jelinek3-1/+25
The FEs emit errors about jumps into assume attribute conditions, but when we add GIMPLE_ASSUME for the condition which is reachable through those jumps, we can run into cfg verification diagnostics. Fixed by throwing the IFN_ASSUME away during gimplification if seen_error () - like we already do for -O0. GIMPLE_ASSUME in the middle-end is a pure optimization thing and if errors were reported, the optimizations will not be beneficial for anything. 2022-10-25 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/107369 * gimplify.cc (gimplify_call_expr): If seen_error, handle complex IFN_ASSUME the same as for -O0. * gcc.dg/attr-assume-4.c: New test. * g++.dg/cpp23/attr-assume8.C: New test.
2022-10-25MIPS: fix building on multiarch platformYunQiang Su5-1/+35
On platforms that support multiarch, such as Debian, the filesystem hierarchy doesn't fellow the old Irix style: lib & lib/<multiarch> for native lib64 for N64 on N32/O32 systems lib32 for N32 on N64/O32 systems libo32 for O32 on N64/N32 systems Thus we cannot #define STANDARD_STARTFILE_PREFIX_1 #define STANDARD_STARTFILE_PREFIX_2 on N32 or N64 systems, else collect2 won't look for libraries on /lib/<multiarch>. gcc/ChangeLog: * configure.ac: AC_DEFINE(ENABLE_MULTIARCH, 1) * configure: Regenerated. * config.in: Regenerated. * config/mips/mips.h: don't define STANDARD_STARTFILE_PREFIX_1 if ENABLE_MULTIARCH is defined. * config/mips/t-linux64: define correct multiarch path when multiarch is enabled.
2022-10-25tree-optimization/100756 - niter analysis and foldingRichard Biener2-0/+16
niter analysis, specifically the part trying to simplify the computed maybe_zero condition against the loop header copying condition, is confused by us now simplifying _15 = n_8(D) * 4; if (_15 > 0) to _15 = n_8(D) * 4; if (n_8(D) > 0) which is perfectly sound at the point we do this transform. One solution might be to involve ranger in this simplification, another is to be more aggressive when expanding expressions - the condition we try to simplify is _15 > 0, so all we need is expanding that to n_8(D) * 4 > 0. The following does just that. PR tree-optimization/100756 * tree-ssa-loop-niter.cc (expand_simple_operations): Also expand multiplications by invariants. * gcc.dg/vect/pr100756.c: New testcase.
2022-10-25rs6000/test: Support vect_long_long effective targetKewen Lin1-1/+4
Currently effective target vect_long_long doesn't have power specific check, I think it's an oversight. This is to add the support which checks for has_arch_pwr8, since we set rs6000_vector_unit[V2DImode] as: (TARGET_P8_VECTOR) ? VECTOR_P8_VECTOR : VECTOR_NONE; it means its full support starts from ISA 2.07. Although ISA 2.06 has some instructions like lxvd2x and stxvd2x etc., it's used for testing, checking for ISA 2.07 is more sensitive. gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_effective_target_vect_long_long): Add support for powerpc*-*-*.
2022-10-25vect: Fix wrong shift_n after widening on BE [PR107338]Kewen Lin1-6/+11
As PR107338 shows, with the use of widening loads, the container_type can become a wider type, it causes us to get wrong shift_n since the BIT_FIELD_REF offset actually becomes bigger on BE. Taking the case in PR107338 as example, at the beginning the container type is short and BIT_FIELD_REF offset is 8 and size is 4, with unpacking to wider type int, the high 16 bits are zero, by viewing it as type int, its offset actually becomes to 24. So the shift_n should be 4 (32 - 24 - 4) instead of 20 (32 - 8 - 4). I noticed that if we move shift_n calculation early before the adjustments for widening loads (container type change), it's based on all the stuffs of the original container, the shfit_n calculated there is exactly what we want, it can be independent of widening. Besides, I add prec adjustment together with the current adjustments for widening loads, although prec's subsequent uses don't require this change for now, since the container type gets changed, we should keep the corresponding prec consistent. PR tree-optimization/107338 gcc/ChangeLog: * tree-vect-patterns.cc (vect_recog_bitfield_ref_pattern): Move shfit_n calculation before the adjustments for widening loads.
2022-10-25riscv: fix cross compilerMartin Liska1-4/+4
Move riscv_get_valid_option_values out of Fixes: riscv/riscv-common.cc:1748:40: error: ‘riscv_get_valid_option_values’ was not declared in this scope gcc/ChangeLog: * common/config/riscv/riscv-common.cc (riscv_get_valid_option_values): Get out of ifdef.
2022-10-25i386: fix pedantic warningMartin Liska1-1/+1
PR target/107364 gcc/ChangeLog: * common/config/i386/i386-cpuinfo.h (enum processor_vendor): Fix pedantic warning.
2022-10-25Daily bump.GCC Administrator6-1/+294
2022-10-24analyzer: fix ICE on va_copy [PR107349]David Malcolm4-3/+20
gcc/analyzer/ChangeLog: PR analyzer/107349 * varargs.cc (get_va_copy_arg): Fix the non-pointer case. gcc/testsuite/ChangeLog: PR analyzer/107349 * gcc.dg/analyzer/stdarg-1-ms_abi.c (pr107349): New. * gcc.dg/analyzer/stdarg-1-sysv_abi.c (pr107349): New. * gcc.dg/analyzer/stdarg-1.c (pr107349): New. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-10-24diagnostics: fix ICE in sarif output with NULL filename [PR107366]Martin Liska2-1/+21
gcc/ChangeLog: PR analyzer/107366 * diagnostic-format-sarif.cc (sarif_builder::maybe_make_physical_location_object): Gracefully reject locations with NULL filename. gcc/testsuite/ChangeLog: PR analyzer/107366 * gcc.dg/analyzer/sarif-pr107366.c: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-10-24analyzer: handle (NULL == &VAR) [PR107345]David Malcolm2-3/+29
gcc/analyzer/ChangeLog: PR analyzer/107345 * region-model.cc (region_model::eval_condition_without_cm): Ensure that constants are on the right-hand side before checking for them. gcc/testsuite/ChangeLog: PR analyzer/107345 * gcc.dg/analyzer/pr107345.c: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-10-24analyzer: simplify sm_state_map lookupDavid Malcolm3-92/+48
gcc/analyzer/ChangeLog: * engine.cc (impl_region_model_context::get_malloc_map): Replace with... (impl_region_model_context::get_state_map_by_name): ...this. (impl_region_model_context::get_fd_map): Delete. (impl_region_model_context::get_taint_map): Delete. * exploded-graph.h (impl_region_model_context::get_fd_map): Delete. (impl_region_model_context::get_malloc_map): Delete. (impl_region_model_context::get_taint_map): Delete. (impl_region_model_context::get_state_map_by_name): New. * region-model.h (region_model_context::get_state_map_by_name): New vfunc. (region_model_context::get_fd_map): Convert from vfunc to function. (region_model_context::get_malloc_map): Likewise. (region_model_context::get_taint_map): Likewise. (noop_region_model_context::get_state_map_by_name): New. (noop_region_model_context::get_fd_map): Delete. (noop_region_model_context::get_malloc_map): Delete. (noop_region_model_context::get_taint_map): Delete. (region_model_context_decorator::get_state_map_by_name): New. (region_model_context_decorator::get_fd_map): Delete. (region_model_context_decorator::get_malloc_map): Delete. (region_model_context_decorator::get_taint_map): Delete. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-10-24analyzer: handle "pipe" and "pipe2" [PR106300]David Malcolm11-9/+420
gcc/analyzer/ChangeLog: PR analyzer/106300 * engine.cc (impl_region_model_context::get_fd_map): New. * exploded-graph.h (impl_region_model_context::get_fd_map): New decl. * region-model-impl-calls.cc (region_model::impl_call_pipe): New. * region-model.cc (region_model::update_for_int_cst_return): New, based on... (region_model::update_for_zero_return): ...this. Reimplement in terms of the former. (region_model::on_call_pre): Handle "pipe" and "pipe2". (region_model::on_call_post): Likewise. * region-model.h (region_model::impl_call_pipe): New decl. (region_model::update_for_int_cst_return): New decl. (region_model::mark_as_valid_fd): New decl. (region_model_context::get_fd_map): New pure virtual fn. (noop_region_model_context::get_fd_map): New. (region_model_context_decorator::get_fd_map): New. * sm-fd.cc: Include "analyzer/program-state.h". (fd_state_machine::describe_state_change): Handle transitions from start state to valid states. (fd_state_machine::mark_as_valid_fd): New. (fd_state_machine::on_stmt): Add missing return for "creat". (region_model::mark_as_valid_fd): New. gcc/ChangeLog: PR analyzer/106300 * doc/invoke.texi (Static Analyzer Options): Add "pipe" and "pipe2" to the list of functions the analyzer has hardcoded knowledge of. gcc/testsuite/ChangeLog: PR analyzer/106300 * gcc.dg/analyzer/pipe-1.c: New test. * gcc.dg/analyzer/pipe-glibc.c: New test. * gcc.dg/analyzer/pipe-manpages.c: New test. * gcc.dg/analyzer/pipe2-1.c: New test. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
2022-10-24tree: add build_string_literal overloadsJason Merrill6-38/+21
Simplify several calls to build_string_literal by not requiring redundant strlen or IDENTIFIER_* in the caller. I also corrected a wrong comment on IDENTIFIER_LENGTH. gcc/ChangeLog: * tree.h (build_string_literal): New one-argument overloads that take tree (identifier) and const char *. * builtins.cc (fold_builtin_FILE) (fold_builtin_FUNCTION) * gimplify.cc (gimple_add_init_for_auto_var) * vtable-verify.cc (verify_bb_vtables): Simplify calls. gcc/cp/ChangeLog: * cp-gimplify.cc (fold_builtin_source_location) * vtable-class-hierarchy.cc (register_all_pairs): Simplify calls to build_string_literal. (build_string_from_id): Remove.
2022-10-24x86: fix VENDOR_MAX enum valueMartin Liska1-1/+3
PR target/107364 gcc/ChangeLog: * common/config/i386/i386-cpuinfo.h (enum processor_vendor): Reorder enum values as BUILTIN_VENDOR_MAX should not point in the middle of the valid enum values.
2022-10-24c++: ICE with invalid structured bindings [PR107276]Marek Polacek3-2/+15
This test ICEs in C++23 because we reach the new code in do_auto_deduction: 30468 if (cxx_dialect >= cxx23 30469 && context == adc_return_type 30470 && (!AUTO_IS_DECLTYPE (auto_node) 30471 || !unparenthesized_id_or_class_member_access_p (init)) 30472 && (r = treat_lvalue_as_rvalue_p (maybe_undo_parenthesized_ref (init), 30473 /*return*/true))) where 'init' is "VIEW_CONVERT_EXPR<<<< error >>>>(y)", and then the move in treat_lvalue_as_rvalue_p returns error_mark_node whereupon set_implicit_rvalue_p crashes. I don't think such V_C_Es are useful so let's not create them. But that won't fix the ICE so I'm checking the return value of move. A structured bindings decl can have an error type, that is set in cp_finish_decomp: 8908 TREE_TYPE (first) = error_mark_node; therefore I think treat_lvalue_as_rvalue_p just needs to cope. PR c++/107276 gcc/cp/ChangeLog: * typeck.cc (treat_lvalue_as_rvalue_p): Check the return value of move. gcc/ChangeLog: * tree.cc (maybe_wrap_with_location): Don't create a location wrapper when the type is erroneous. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/decomp4.C: New test.
2022-10-24c, c++: Fix up excess precision handling of scalar_to_vector conversion ↵Jakub Jelinek4-5/+38
[PR107358] As mentioned earlier in the C++ excess precision support mail, the following testcase is broken with excess precision both in C and C++ (though just in C++ it was triggered in real-world code). scalar_to_vector is called in both FEs after the excess precision promotions (or stripping of EXCESS_PRECISION_EXPR), so we can then get invalid diagnostics that say float vector + float involves truncation (on ia32 from long double to float). The following patch fixes that by calling scalar_to_vector on the operands before the excess precision promotions, let scalar_to_vector just do the diagnostics (it does e.g. fold_for_warn so it will fold EXCESS_PRECISION_EXPR around REAL_CST to constants etc.) but will then do the actual conversions using the excess precision promoted operands (so say if we have vector double + (float + float) we don't actually do vector double + (float) ((long double) float + (long double) float) but vector double + (double) ((long double) float + (long double) float) 2022-10-24 Jakub Jelinek <jakub@redhat.com> PR c++/107358 gcc/c/ * c-typeck.cc (build_binary_op): Pass operands before excess precision promotions to scalar_to_vector call. gcc/cp/ * typeck.cc (cp_build_binary_op): Pass operands before excess precision promotions to scalar_to_vector call. gcc/testsuite/ * c-c++-common/pr107358.c: New test. * g++.dg/cpp1y/pr68180.C: Remove -fexcess-precision=fast from dg-options.
2022-10-24[AArch64] Improve immediate expansion [PR106583]Wilco Dijkstra2-225/+301
Improve immediate expansion of immediates which can be created from a bitmask immediate and 2 MOVKs. Simplify, refactor and improve efficiency of bitmask checks. Move various immediate handling functions together to avoid forward declarations. This reduces the number of 4-instruction immediates in SPECINT/FP by 10-15%. gcc/ PR target/106583 * config/aarch64/aarch64.cc (aarch64_internal_mov_immediate) Add support for a bitmask immediate with 2 MOVKs. (aarch64_check_bitmask): New function after refactorization. (aarch64_bitmask_imm): Simplify replication of small modes. Split function into 64-bit only version for efficiency. (aarch64_move_imm): Move near other immediate functions. (aarch64_uimm12_shift): Likewise. (aarch64_clamp_to_uimm12_shift): Likewise. (aarch64_movk_shift): Likewise. (aarch64_replicate_bitmask_imm): Likewise. (aarch64_and_split_imm1): Likewise. (aarch64_and_split_imm2): Likewise. (aarch64_and_bitmask_imm): Likewise. (aarch64_movw_imm): Likewise. gcc/testsuite/ PR target/106583 * gcc.target/aarch64/pr106583.c: Add new test.
2022-10-24c++: Fix up constexpr handling of char/signed char/short pre/post ↵Jakub Jelinek2-0/+27
inc/decrement [PR105774] signed char, char or short int pre/post inc/decrement are represented by normal {PRE,POST}_{INC,DEC}REMENT_EXPRs in the FE and only gimplification ensures that the {PLUS,MINUS}_EXPR is done in unsigned version of those types: case PREINCREMENT_EXPR: case PREDECREMENT_EXPR: case POSTINCREMENT_EXPR: case POSTDECREMENT_EXPR: { tree type = TREE_TYPE (TREE_OPERAND (*expr_p, 0)); if (INTEGRAL_TYPE_P (type) && c_promoting_integer_type_p (type)) { if (!TYPE_OVERFLOW_WRAPS (type)) type = unsigned_type_for (type); return gimplify_self_mod_expr (expr_p, pre_p, post_p, 1, type); } break; } This means during constant evaluation we need to do it similarly (either using unsigned_type_for or using widening to integer_type_node). The following patch does the latter. 2022-10-24 Jakub Jelinek <jakub@redhat.com> PR c++/105774 * constexpr.cc (cxx_eval_increment_expression): For signed types that promote to int, evaluate PLUS_EXPR or MINUS_EXPR in int type. * g++.dg/cpp1y/constexpr-105774.C: New test.
2022-10-24c-family: Implicitly return zero from main even on freestandingArsen Arsenović9-18/+41
... unless marked noreturn. This should not get in anyone's way, but should permit the use of main() in freestanding more easily, especially for writing test cases that should work both in freestanding and hosted modes. gcc/c/ChangeLog: * c-decl.cc (finish_function): Ignore hosted when deciding whether to implicitly return zero, but check noreturn. * c-objc-common.cc (c_missing_noreturn_ok_p): Loosen the requirements to just MAIN_NAME_P when hosted, or `int main' otherwise. gcc/cp/ChangeLog: * cp-tree.h (DECL_MAIN_P): Move most logic, besides the hosted check, from here... (DECL_MAIN_ANY_P): ... to here, so that it can be reused ... (DECL_MAIN_FREESTANDING_P): ... here, with an additional constraint on (hosted OR return type == int) * decl.cc (finish_function): Use DECL_MAIN_FREESTANDING_P instead of DECL_MAIN_P, to loosen the hosted requirement, but check noreturn, before adding implicit returns. gcc/testsuite/ChangeLog: * gcc.dg/noreturn-4.c: Removed. * g++.dg/freestanding-main.C: New test. * g++.dg/freestanding-nonint-main.C: New test. * gcc.dg/freestanding-main.c: New test. * gcc.dg/freestanding-nonint-main.c: New test.