platform/upstream/gcc.git
5 years ago[AArch64][SVE] Utilize ASRD instruction for division and remainder
Yuliang Wang [Mon, 30 Sep 2019 16:55:45 +0000 (16:55 +0000)]
[AArch64][SVE] Utilize ASRD instruction for division and remainder

2019-09-30  Yuliang Wang  <yuliang.wang@arm.com>

gcc/
* config/aarch64/aarch64-sve.md (sdiv_pow2<mode>3):
New pattern for ASRD.
* config/aarch64/iterators.md (UNSPEC_ASRD): New unspec.
* internal-fn.def (IFN_DIV_POW2): New internal function.
* optabs.def (sdiv_pow2_optab): New optab.
* tree-vect-patterns.c (vect_recog_divmod_pattern):
Modify pattern to support new operation.
* doc/md.texi (sdiv_pow2$var{m3}): Documentation for the above.
* doc/sourcebuild.texi (vect_sdiv_pow2_si):
Document new target selector.

gcc/testsuite/
* gcc.dg/vect/vect-sdiv-pow2-1.c: New test.
* gcc.target/aarch64/sve/asrdiv_1.c: As above.
* lib/target-supports.exp (check_effective_target_vect_sdiv_pow2_si):
Return true for AArch64 with SVE.

From-SVN: r276343

5 years ago[AArch64] Make more use of function_abi
Richard Sandiford [Mon, 30 Sep 2019 16:47:39 +0000 (16:47 +0000)]
[AArch64] Make more use of function_abi

This patch makes more use of the function_abi infrastructure.
We can then avoid checking specifically for the vector PCS in
a few places, and can test it more directly otherwise.

Specifically: we no longer need to call df_set_regs_ever_live
for the extra call-saved registers, since IRA now does that for us.
We also don't need to handle the vector PCS specially in
aarch64_epilogue_uses, because DF now marks the registers
as live on exit.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* config/aarch64/aarch64.c (aarch64_layout_frame): Use crtl->abi
to test whether we're compiling a vector PCS function and to test
whether the function needs to save a particular register.
Remove the vector PCS handling of df_set_regs_ever_live.
(aarch64_components_for_bb): Use crtl->abi to test whether
the function needs to save a particular register.
(aarch64_process_components): Use crtl->abi to test whether
we're compiling a vector PCS function.
(aarch64_expand_prologue, aarch64_expand_epilogue): Likewise.
(aarch64_epilogue_uses): Remove handling of vector PCS functions.

From-SVN: r276341

5 years ago[AArch64] Allow shrink-wrapping of non-leaf vector PCS functions
Richard Sandiford [Mon, 30 Sep 2019 16:47:21 +0000 (16:47 +0000)]
[AArch64] Allow shrink-wrapping of non-leaf vector PCS functions

With the function ABI stuff, we can now support shrink-wrapping of
non-leaf vector PCS functions.  This is particularly useful if the
vector PCS function calls an ordinary function on an error path,
since we can then keep the extra saves and restores specific to
that path too.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* config/aarch64/aarch64-protos.h (aarch64_use_simple_return_insn_p):
Delete.
* config/aarch64/aarch64.c (aarch64_components_for_bb): Check
whether the block calls a function that clobbers more registers
than the current function is allowed to.
(aarch64_use_simple_return_insn_p): Delete.
* config/aarch64/aarch64.md (simple_return): Remove condition.

gcc/testsuite/
* gcc.target/aarch64/torture/simd-abi-9.c: New test.

From-SVN: r276340

5 years agoMake ira call df_set_regs_ever_live for extra call-clobbered regs
Richard Sandiford [Mon, 30 Sep 2019 16:39:38 +0000 (16:39 +0000)]
Make ira call df_set_regs_ever_live for extra call-clobbered regs

If we support multiple ABIs in the same translation unit, it can
sometimes be the case that a callee clobbers more registers than
its caller is allowed to.  We need to call df_set_regs_ever_live
on these extra registers so that the prologue and epilogue code
can handle them appropriately.

This patch does that in IRA.  I wanted to avoid another full
instruction walk just for this, so I combined it with the existing
set_paradoxical_subreg walk.  This happens before the first
calculation of elimination offsets.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* function-abi.h (function_abi_aggregator): New class.
* function-abi.cc (function_abi_aggregator::caller_save_regs): New
function.
* ira.c (update_equiv_regs_prescan): New function.  Call
set_paradoxical_subreg here rather than...
(update_equiv_regs): ...here.
(ira): Call update_equiv_regs_prescan.

From-SVN: r276339

5 years agoHide regs_invalidated_by_call etc.
Richard Sandiford [Mon, 30 Sep 2019 16:21:49 +0000 (16:21 +0000)]
Hide regs_invalidated_by_call etc.

The previous patches removed all target-independent uses of
regs_invalidated_by_call, call_used_or_fixed_regs and
call_used_or_fixed_reg_p.  This patch therefore restricts
them to target-specific code (and reginfo.c, which sets them up).

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* hard-reg-set.h (regs_invalidated_by_call): Only define if
IN_TARGET_CODE.
(call_used_or_fixed_regs): Likewise.
(call_used_or_fixed_reg_p): Likewise.
* reginfo.c (regs_invalidated_by_call): New macro.

From-SVN: r276338

5 years agoRemove global call sets: shrink-wrap.c
Richard Sandiford [Mon, 30 Sep 2019 16:21:44 +0000 (16:21 +0000)]
Remove global call sets: shrink-wrap.c

This is a straight replacement of "calls we can clobber without saving
them first".

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* shrink-wrap.c: Include function-abi.h.
(requires_stack_frame_p): Use crtl->abi to test whether the
current function can use a register without saving it first.

From-SVN: r276337

5 years agoRemove global call sets: sel-sched.c
Richard Sandiford [Mon, 30 Sep 2019 16:21:39 +0000 (16:21 +0000)]
Remove global call sets: sel-sched.c

The main change here is to replace a crosses_call boolean with
a bitmask of the ABIs used by the crossed calls.  For space reasons,
I didn't also add a HARD_REG_SET that tracks the set of registers
that are actually clobbered, which means that this is the one part
of the series that doesn't benefit from -fipa-ra.  The existing
FIXME suggests that the current structures aren't the preferred
way of representing this anyhow, and the pass already makes
conservative assumptions about call-crossing registers.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* sel-sched-ir.h (_def::crosses_call): Replace with...
(_def::crossed_call_abis): ..this new field.
(def_list_add): Take a mask of ABIs instead of a crosses_call
boolean.
* sel-sched-ir.c (def_list_add): Likewise.  Update initialization
of _def accordingly.
* sel-sched.c: Include function-abi.h.
(hard_regs_data::regs_for_call_clobbered): Delete.
(reg_rename::crosses_call): Replace with...
(reg_rename::crossed_call_abis): ...this new field.
(fur_static_params::crosses_call): Replace with...
(fur_static_params::crossed_call_abis): ...this new field.
(init_regs_for_mode): Don't initialize sel_hrd.regs_for_call_clobbered.
(init_hard_regs_data): Use crtl->abi to test which registers the
current function would need to save before it uses them.
(mark_unavailable_hard_regs): Update handling of call-clobbered
registers, using call_clobbers_in_region to find out which registers
might be call-clobbered (but without taking -fipa-ra into account
for now).  Remove separate handling of partially call-clobbered
registers.
(verify_target_availability): Use crossed_call_abis instead of
crosses_call.
(get_spec_check_type_for_insn, find_used_regs): Likewise.
(fur_orig_expr_found, fur_on_enter, fur_orig_expr_not_found): Likewise.

From-SVN: r276336

5 years agoRemove global call sets: sched-deps.c
Richard Sandiford [Mon, 30 Sep 2019 16:21:34 +0000 (16:21 +0000)]
Remove global call sets: sched-deps.c

This is a straight replacement of an existing "full or partial"
call-clobber check.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* sched-deps.c (deps_analyze_insn): Use the ABI of the target
function to test whether a register is fully or partly clobbered.

From-SVN: r276335

5 years agoRemove global call sets: rtlanal.c
Richard Sandiford [Mon, 30 Sep 2019 16:21:28 +0000 (16:21 +0000)]
Remove global call sets: rtlanal.c

The reg_set_p part is simple, since the caller is asking about
a specific REG rtx, with a known register number and mode.

The find_all_hard_reg_sets part emphasises that the "implicit"
behaviour was always a bit suspect, since it includes fully-clobbered
registers but not partially-clobbered registers.  The only current
user of this path is the c6x-specific scheduler predication code,
and c6x doesn't have partly call-clobbered registers, so in practice
it's fine.  I've added a comment to try to disuade future users.
(The !implicit path is OK and useful though.)

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* rtlanal.c: Include function-abi.h.
(reg_set_p): Use insn_callee_abi to get the ABI of the called
function and clobbers_reg_p to test whether the register
is call-clobbered.
(find_all_hard_reg_sets): When implicit is true, use insn_callee_abi
to get the ABI of the called function and full_reg_clobbers to
get the set of fully call-clobbered registers.  Warn about the
pitfalls of using this mode.

From-SVN: r276334

5 years agoRemove global call sets: reload.c
Richard Sandiford [Mon, 30 Sep 2019 16:21:23 +0000 (16:21 +0000)]
Remove global call sets: reload.c

The inheritance code in find_equiv_reg can use clobbers_reg_p
to test whether a call clobbers either of the equivalent registers.

reload and find_reg use crtl->abi to test whether a register needs
to be saved in the prologue before use.

reload_as_needed can use full_and_partial_reg_clobbers and thus
avoid needing to keep its own record of which registers are part
call-clobbered.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* reload.c: Include function-abi.h.
(find_equiv_reg): Use clobbers_reg_p to test whether either
of the equivalent registers is clobbered by a call.
* reload1.c: Include function-abi.h.
(reg_reloaded_call_part_clobbered): Delete.
(reload): Use crtl->abi to test which registers would need
saving in the prologue before use.
(find_reg): Likewise.
(emit_reload_insns): Remove code for reg_reloaded_call_part_clobbered.
(reload_as_needed): Likewise.  Use full_and_partial_reg_clobbers
instead of call_used_or_fixed_regs | reg_reloaded_call_part_clobbered.

From-SVN: r276333

5 years agoRemove global call sets: regrename.c
Richard Sandiford [Mon, 30 Sep 2019 16:21:19 +0000 (16:21 +0000)]
Remove global call sets: regrename.c

This patch makes regrename use a similar mask-and-clobber-set
pair to IRA when tracking whether registers are clobbered by
calls in a region.  Testing for a nonzero ABI mask is equivalent
to testing for a register that crosses a call.

Since AArch64 and c6x use regrename.h, they need to be updated
to include function-abi.h first.  AIUI this is preferred over
including function-abi.h in regrename.h.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* regrename.h (du_head::call_clobber_mask): New field.
(du_head::need_caller_save_reg): Replace with...
(du_head::call_abis): ...this new field.
* regrename.c: Include function-abi.h.
(call_clobbered_in_chain_p): New function.
(check_new_reg_p): Use crtl->abi when deciding whether a register
is free for use after RA.  Use call_clobbered_in_chain_p to test
whether a candidate register would be clobbered by a call.
(find_rename_reg): Don't add call-clobber conflicts here.
(rename_chains): Check call_abis instead of need_caller_save_reg.
(merge_chains): Update for changes to du_head.
(build_def_use): Use insn_callee_abi to get the ABI of the call insn
target.  Record the ABI identifier in call_abis and the set of
fully or partially clobbered registers in call_clobber_mask.
Add fully-clobbered registers to hard_conflicts here rather
than in find_rename_reg.
* config/aarch64/cortex-a57-fma-steering.c: Include function-abi.h.
(rename_single_chain): Check call_abis instead of need_caller_save_reg.
* config/aarch64/falkor-tag-collision-avoidance.c: Include
function-abi.h.
* config/c6x/c6x.c: Likewise.

From-SVN: r276332

5 years agoRemove global call sets: regcprop.c
Richard Sandiford [Mon, 30 Sep 2019 16:21:14 +0000 (16:21 +0000)]
Remove global call sets: regcprop.c

This is a direct replacement of an existing test for fully and
partially clobbered registers.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* regcprop.c (copyprop_hardreg_forward_1): Use the recorded
mode of the register when deciding whether it is no longer
available after a call.

From-SVN: r276331

5 years agoRemove global call sets: recog.c
Richard Sandiford [Mon, 30 Sep 2019 16:21:10 +0000 (16:21 +0000)]
Remove global call sets: recog.c

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* recog.c: Include function-abi.h.
(peep2_find_free_register): Use crtl->abi when deciding whether
a register is free for use after RA.

From-SVN: r276330

5 years agoRemove global call sets: postreload-gcse.c
Richard Sandiford [Mon, 30 Sep 2019 16:21:07 +0000 (16:21 +0000)]
Remove global call sets: postreload-gcse.c

This is another case in which we should conservatively treat
partial kills as full kills.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* postreload-gcse.c: Include regs.h and function-abi.h.
(record_opr_changes): Use insn_callee_abi to get the ABI of the
call insn target.  Conservatively assume that partially-clobbered
registers are altered.

From-SVN: r276329

5 years agoRemove global call sets: postreload.c
Richard Sandiford [Mon, 30 Sep 2019 16:21:03 +0000 (16:21 +0000)]
Remove global call sets: postreload.c

The "|= fixed_regs" in reload_combine isn't necessary, since the
set is only used to determine which values have changed (rather than,
for example, which registers are available for use).

In reload_cse_move2add we can be accurate about which registers
are still available.  BLKmode indicates a continuation of the
previous register, and since clobbers_reg_p handles multi-register
values, it's enough to skip over BLKmode entries and just test the
start register.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* postreload.c (reload_combine_recognize_pattern): Use crtl->abi
when deciding whether a register is free for use after RA.
(reload_combine): Remove unnecessary use of fixed_reg_set.
(reload_cse_move2add): Use insn_callee_abi to get the ABI of the
call insn target.  Use reg_mode when testing whether a register
is no longer available.

From-SVN: r276328

5 years agoRemove global call sets: LRA
Richard Sandiford [Mon, 30 Sep 2019 16:21:00 +0000 (16:21 +0000)]
Remove global call sets: LRA

lra_reg has an actual_call_used_reg_set field that is only used during
inheritance.  This in turn required a special lra_create_live_ranges
pass for flag_ipa_ra to set up this field.  This patch instead makes
the inheritance code do its own live register tracking, using the
same ABI-mask-and-clobber-set pair as for IRA.

Tracking ABIs simplifies (and cheapens) the logic in lra-lives.c and
means we no longer need a separate path for -fipa-ra.  It also means
we can remove TARGET_RETURN_CALL_WITH_MAX_CLOBBERS.

The patch also strengthens the sanity check in lra_assigns so that
we check that reg_renumber is consistent with the whole conflict set,
not just the call-clobbered registers.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* target.def (return_call_with_max_clobbers): Delete.
* doc/tm.texi.in (TARGET_RETURN_CALL_WITH_MAX_CLOBBERS): Delete.
* doc/tm.texi: Regenerate.
* config/aarch64/aarch64.c (aarch64_return_call_with_max_clobbers)
(TARGET_RETURN_CALL_WITH_MAX_CLOBBERS): Delete.
* lra-int.h (lra_reg::actual_call_used_reg_set): Delete.
(lra_reg::call_insn): Delete.
* lra.c: Include function-abi.h.
(initialize_lra_reg_info_element): Don't initialize the fields above.
(lra): Use crtl->abi to test whether the current function needs to
save a register in the prologue.  Remove special pre-inheritance
lra_create_live_ranges pass for flag_ipa_ra.
* lra-assigns.c: Include function-abi.h
(find_hard_regno_for_1): Use crtl->abi to test whether the current
function needs to save a register in the prologue.
(lra_assign): Assert that registers aren't allocated to a
conflicting register, rather than checking only for overlaps
with call_used_or_fixed_regs.  Do this even for flag_ipa_ra,
and for registers that are not live across a call.
* lra-constraints.c (last_call_for_abi): New variable.
(full_and_partial_call_clobbers): Likewise.
(setup_next_usage_insn): Remove the register from
full_and_partial_call_clobbers.
(need_for_call_save_p): Use call_clobbered_in_region_p to test
whether the register needs a caller save.
(need_for_split_p): Use full_and_partial_reg_clobbers instead
of call_used_or_fixed_regs.
(inherit_in_ebb): Initialize and maintain last_call_for_abi and
full_and_partial_call_clobbers.
* lra-lives.c (check_pseudos_live_through_calls): Replace
last_call_used_reg_set and call_insn arguments with an abi argument.
Remove handling of lra_reg::call_insn.  Use function_abi::mode_clobbers
as the set of conflicting registers.
(calls_have_same_clobbers_p): Delete.
(process_bb_lives): Track the ABI of the last call instead of an
insn/HARD_REG_SET pair.  Update calls to
check_pseudos_live_through_calls.  Use eh_edge_abi to calculate
the set of registers that could be clobbered by an EH edge.
Include partially-clobbered as well as fully-clobbered registers.
(lra_create_live_ranges_1): Don't initialize lra_reg::call_insn.
* lra-remat.c: Include function-abi.h.
(call_used_regs_arr_len, call_used_regs_arr): Delete.
(set_bb_regs): Use insn_callee_abi to get the set of call-clobbered
registers and bitmap_view to combine them into dead_regs.
(call_used_input_regno_present_p): Take a function_abi argument
and use it to test whether a register is call-clobbered.
(calculate_gen_cands): Use insn_callee_abi to get the ABI of the
call insn target.  Update tje call to call_used_input_regno_present_p.
(do_remat): Likewise.
(lra_remat): Remove the initialization of call_used_regs_arr_len
and call_used_regs_arr.

From-SVN: r276327

5 years agoRemove global call sets: loop-iv.c
Richard Sandiford [Mon, 30 Sep 2019 16:20:56 +0000 (16:20 +0000)]
Remove global call sets: loop-iv.c

Similar idea to the combine.c and gcse.c patches.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* loop-iv.c: Include regs.h and function-abi.h.
(simplify_using_initial_values): Use insn_callee_abi to get the
ABI of the call insn target.  Conservatively assume that
partially-clobbered registers are altered.

From-SVN: r276326

5 years agoRemove global call sets: IRA
Richard Sandiford [Mon, 30 Sep 2019 16:20:52 +0000 (16:20 +0000)]
Remove global call sets: IRA

For -fipa-ra, IRA already keeps track of which specific registers
are call-clobbered in a region, rather than using global information.
The patch generalises this so that it tracks which ABIs are used
by calls in the region.

We can then use the new ABI descriptors to handle partially-clobbered
registers in the same way as fully-clobbered registers, without having
special code for targetm.hard_regno_call_part_clobbered.  This in turn
makes -fipa-ra work for partially-clobbered registers too.

A side-effect of allowing multiple ABIs is that we no longer have
an obvious set of conflicting registers for the self-described
"fragile hack" in ira-constraints.c.  This code kicks in for
user-defined registers that aren't live across a call at -O0,
and it tries to avoid allocating a call-clobbered register to them.
Here I've used the set of call-clobbered registers in the current
function's ABI, applying on top of any registers that are clobbered by
called functions.  This is enough to keep gcc.dg/debug/dwarf2/pr5948.c
happy.

The handling of GENERIC_STACK_CHECK in do_reload seemed to have
a reversed condition:

      for (int i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (df_regs_ever_live_p (i)
    && !fixed_regs[i]
    && call_used_or_fixed_reg_p (i))
  size += UNITS_PER_WORD;

The final part of the condition counts registers that don't need to be
saved in the prologue, but I think the opposite was intended.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* function-abi.h (call_clobbers_in_region): Declare.
(call_clobbered_in_region_p): New function.
* function-abi.cc (call_clobbers_in_region): Likewise.
* ira-int.h: Include function-abi.h.
(ira_allocno::crossed_calls_abis): New field.
(ALLOCNO_CROSSED_CALLS_ABIS): New macro.
(ira_need_caller_save_regs): New function.
(ira_need_caller_save_p): Likewise.
* ira.c (setup_reg_renumber): Use ira_need_caller_save_p instead
of call_used_or_fixed_regs.
(do_reload): Use crtl->abi to test whether the current function
needs to save a register in the prologue.  Count registers that
need to be saved rather than registers that don't.
* ira-build.c (create_cap_allocno): Copy ALLOCNO_CROSSED_CALLS_ABIS.
Remove unnecessary | from ALLOCNO_CROSSED_CALLS_CLOBBERED_REGS.
(propagate_allocno_info): Merge ALLOCNO_CROSSED_CALLS_ABIS too.
(propagate_some_info_from_allocno): Likewise.
(copy_info_to_removed_store_destinations): Likewise.
(ira_flattening): Say that ALLOCNO_CROSSED_CALLS_ABIS and
ALLOCNO_CROSSED_CALLS_CLOBBERED_REGS are handled conservatively.
(ira_build): Use ira_need_caller_save_regs instead of
call_used_or_fixed_regs.
* ira-color.c (calculate_saved_nregs): Use crtl->abi to test
whether the current function would need to save a register
before using it.
(calculate_spill_cost): Likewise.
(allocno_reload_assign): Use ira_need_caller_save_regs and
ira_need_caller_save_p instead of call_used_or_fixed_regs.
* ira-conflicts.c (ira_build_conflicts): Use
ira_need_caller_save_regs rather than call_used_or_fixed_regs
as the set of call-clobbered registers.  Remove the
call_used_or_fixed_regs mask from the calculation of
temp_hard_reg_set and mask its use instead.  Remove special
handling of partially-clobbered registers.
* ira-costs.c (ira_tune_allocno_costs): Use ira_need_caller_save_p.
* ira-lives.c (process_bb_node_lives): Use mode_clobbers to
calculate the set of conflicting registers for calls that
can throw.  Record the ABIs of calls in ALLOCNO_CROSSED_CALLS_ABIS.
Use full_and_partial_reg_clobbers rather than full_reg_clobbers
for the calculation of ALLOCNO_CROSSED_CALLS_CLOBBERED_REGS.
Use eh_edge_abi to calculate the set of registers that could
be clobbered by an EH edge.  Include partially-clobbered as
well as fully-clobbered registers.

From-SVN: r276325

5 years agoRemove global call sets: haifa-sched.c
Richard Sandiford [Mon, 30 Sep 2019 16:20:48 +0000 (16:20 +0000)]
Remove global call sets: haifa-sched.c

The code patched here is counting how many registers the current
function would need to save in the prologue before it uses them.
The code is called per function, so using crtl is OK.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* haifa-sched.c: Include function-abi.h.
(alloc_global_sched_pressure_data): Use crtl->abi to check whether
the function would need to save a register before using it.

From-SVN: r276324

5 years agoRemove global call sets: gcse.c
Richard Sandiford [Mon, 30 Sep 2019 16:20:44 +0000 (16:20 +0000)]
Remove global call sets: gcse.c

This is another case in which we can conservatively treat partial
kills as full kills.  Again this is in principle a bug fix for
TARGET_HARD_REGNO_CALL_PART_CLOBBERED targets, but in practice
it probably doesn't make a difference.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* gcse.c: Include function-abi.h.
(compute_hash_table_work): Use insn_callee_abi to get the ABI of
the call insn target.  Invalidate partially call-clobbered
registers as well as fully call-clobbered ones.

From-SVN: r276323

5 years agoRemove global call sets: function.c
Richard Sandiford [Mon, 30 Sep 2019 16:20:41 +0000 (16:20 +0000)]
Remove global call sets: function.c

Whatever the rights and wrongs of the way aggregate_value_p
handles call-preserved registers, it's a de facto part of the ABI,
so we shouldn't change it.  The patch simply extends the current
approach to whatever call-preserved set the function happens to
be using.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* function.c (aggregate_value_p): Work out which ABI the
function is using before testing which registers are at least
partly preserved by a call.

From-SVN: r276322

5 years agoRemove global call sets: early-remat.c
Richard Sandiford [Mon, 30 Sep 2019 16:20:37 +0000 (16:20 +0000)]
Remove global call sets: early-remat.c

This pass previously excluded rematerialisation candidates if they
clobbered a call-preserved register, on the basis that it then
wouldn't be safe to add new instances of the candidate instruction
after a call.  This patch instead makes the decision on a call-by-call
basis.

The second emit_remat_insns_for_block hunk probably isn't needed,
but it seems safer and more consistent to have it, so that every call
to emit_remat_insns is preceded by a check for invalid clobbers.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* early-remat.c: Include regs.h and function-abi.h.
(early_remat::maybe_add_candidate): Don't check for call-clobbered
registers here.
(early_remat::restrict_remat_for_unavail_regs): New function.
(early_remat::restrict_remat_for_call): Likewise.
(early_remat::process_block): Before calling emit_remat_insns
for a previous call in the block, invalidate any candidates
that would clobber call-preserved registers.
(early_remat::emit_remat_insns_for_block): Likewise for the
final call in a block.  Do the same thing for live-in registers
when calling emit_remat_insns at the head of a block.

From-SVN: r276321

5 years agoRemove global call sets: DF (entry/exit defs)
Richard Sandiford [Mon, 30 Sep 2019 16:20:34 +0000 (16:20 +0000)]
Remove global call sets: DF (entry/exit defs)

The code patched here is seeing whether the current function
needs to save at least part of a register before using it.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* df-scan.c (df_get_entry_block_def_set): Use crtl->abi to test
whether the current function needs to save at least part of a
register before using it.
(df_get_exit_block_use_set): Likewise for epilogue restores.

From-SVN: r276320

5 years agoRemove global call sets: DF (EH edges)
Richard Sandiford [Mon, 30 Sep 2019 16:20:30 +0000 (16:20 +0000)]
Remove global call sets: DF (EH edges)

The DF dense_invalidated_by_call and sparse_invalidated_by_call
sets are actually only used on EH edges, and so are more the set
of registers that are invalidated by a taken EH edge.  Under the
new order, that means that they describe eh_edge_abi.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* df-problems.c: Include regs.h and function-abi.h.
(df_rd_problem_data): Rename sparse_invalidated_by_call to
sparse_invalidated_by_eh and dense_invalidated_by_call to
dense_invalidated_by_eh.
(df_print_bb_index): Update accordingly.
(df_rd_alloc, df_rd_start_dump, df_rd_confluence_n): Likewise.
(df_lr_confluence_n): Use eh_edge_abi to get the set of registers
that are clobbered by an EH edge.  Clobber partially-clobbered
registers as well as fully-clobbered ones.
(df_md_confluence_n): Likewise.
(df_rd_local_compute): Likewise.  Update for changes to
df_rd_problem_data.
* df-scan.c (df_scan_start_dump): Use eh_edge_abi to get the set
of registers that are clobbered by an EH edge.  Includde partially-
clobbered registers as well as fully-clobbered ones.

From-SVN: r276319

5 years agoRemove global call sets: cselib.c
Richard Sandiford [Mon, 30 Sep 2019 16:20:26 +0000 (16:20 +0000)]
Remove global call sets: cselib.c

cselib_invalidate_regno is a no-op if REG_VALUES (i) is null,
so we can check that first.  Then, if we know what mode the register
currently has, we can check whether it's clobbered in that mode.

Using GET_MODE (values->elt->val_rtx) to get the mode of the last
set is taken from cselib_reg_set_mode.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* cselib.c (cselib_process_insn): If we know what mode a
register was set in, check whether it is clobbered in that
mode by a call.  Only fall back to reg_raw_mode if that fails.

From-SVN: r276318

5 years agoRemove global call sets: cse.c
Richard Sandiford [Mon, 30 Sep 2019 16:20:23 +0000 (16:20 +0000)]
Remove global call sets: cse.c

Like with the combine.c patch, this one keeps things simple by
invalidating values in partially-clobbered registers, rather than
trying to tell whether the value in a partially-clobbered register
is actually clobbered or not.  Again, this is in principle a bug fix,
but probably never matters in practice.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* cse.c: Include regs.h and function-abi.h.
(invalidate_for_call): Take the call insn as an argument.
Use insn_callee_abi to get the ABI of the call and invalidate
partially clobbered registers as well as fully clobbered ones.
(cse_insn): Update call accordingly.

From-SVN: r276317

5 years agoRemove global call sets: combine.c
Richard Sandiford [Mon, 30 Sep 2019 16:20:19 +0000 (16:20 +0000)]
Remove global call sets: combine.c

There shouldn't be many cases in which a useful hard register is
live across a call before RA, so we might as well keep things simple
and invalidate partially-clobbered registers here, in case the values
they hold leak into the call-clobbered part.  In principle this is
a bug fix for TARGET_HARD_REGNO_CALL_PART_CLOBBERED targets,
but in practice it probably doesn't make a difference.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* combine.c: Include function-abi.h.
(record_dead_and_set_regs): Use insn_callee_abi to get the ABI
of the target of call insns.  Invalidate partially-clobbered
registers as well as fully-clobbered ones.

From-SVN: r276316

5 years agoRemove global call sets: cfgloopanal.c
Richard Sandiford [Mon, 30 Sep 2019 16:20:15 +0000 (16:20 +0000)]
Remove global call sets: cfgloopanal.c

...or rather, make the use of the default ABI explicit.  That seems
OK if not ideal for this heuristic.

In practical terms, the code patched here is counting GENERAL_REGS,
which are treated in the same way by all concurrent ABI variants
on AArch64.  It might give bad results if used for interrupt
handlers though.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* cfgloopanal.c: Include regs.h and function-abi.h.
(init_set_costs): Use default_function_abi to test whether
a general register is call-clobbered.

From-SVN: r276315

5 years agoRemove global call sets: cfgcleanup.c
Richard Sandiford [Mon, 30 Sep 2019 16:20:12 +0000 (16:20 +0000)]
Remove global call sets: cfgcleanup.c

old_insns_match_p just tests whether two instructions are
similar enough to merge.  With insn_callee_abi it makes more
sense to compare the ABIs directly.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* cfgcleanup.c (old_insns_match_p): Compare the ABIs of calls
instead of the call-clobbered sets.

From-SVN: r276314

5 years agoRemove global call sets: caller-save.c
Richard Sandiford [Mon, 30 Sep 2019 16:20:08 +0000 (16:20 +0000)]
Remove global call sets: caller-save.c

All caller-save.c uses of "|= fixed_reg_set" added in a previous patch
were redundant, since the sets are later ANDed with ~fixed_reg_set.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* caller-save.c (setup_save_areas): Remove redundant |s of
fixed_reg_set.
(save_call_clobbered_regs): Likewise.  Use the call ABI rather
than call_used_or_fixed_regs to decide whether a REG_RETURNED
value is useful.

From-SVN: r276313

5 years agoPass an ABI to choose_hard_reg_mode
Richard Sandiford [Mon, 30 Sep 2019 16:20:04 +0000 (16:20 +0000)]
Pass an ABI to choose_hard_reg_mode

choose_hard_reg_mode previously took a boolean saying whether the
mode needed to be call-preserved.  This patch replaces it with an
optional ABI pointer instead, so that the function can use that
to test whether a value is call-saved.

default_dwarf_frame_reg_mode uses eh_edge_abi because that's the
ABI that matters for unwinding.  Targets need to override the hook
if they want something different.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* rtl.h (predefined_function_abi): Declare.
(choose_hard_reg_mode): Take a pointer to a predefined_function_abi
instead of a boolean call_save flag.
* config/gcn/gcn.c (gcn_hard_regno_caller_save_mode): Update call
accordingly.
* config/i386/i386.h (HARD_REGNO_CALLER_SAVE_MODE): Likewise.
* config/ia64/ia64.h (HARD_REGNO_CALLER_SAVE_MODE): Likewise.
* config/mips/mips.c (mips_hard_regno_caller_save_mode): Likewise.
* config/msp430/msp430.h (HARD_REGNO_CALLER_SAVE_MODE): Likewise.
* config/rs6000/rs6000.h (HARD_REGNO_CALLER_SAVE_MODE): Likewise.
* config/sh/sh.c (sh_hard_regno_caller_save_mode): Likewise.
* reginfo.c (init_reg_modes_target): Likewise.
(choose_hard_reg_mode): Take a pointer to a predefined_function_abi
instead of a boolean call_save flag.
* targhooks.c: Include function-abi.h.
(default_dwarf_frame_reg_mode): Update call to choose_hard_reg_mode,
using eh_edge_abi to choose the mode.

From-SVN: r276312

5 years agoPass an ABI identifier to hard_regno_call_part_clobbered
Richard Sandiford [Mon, 30 Sep 2019 16:19:59 +0000 (16:19 +0000)]
Pass an ABI identifier to hard_regno_call_part_clobbered

This patch replaces the rtx_insn argument to
targetm.hard_regno_call_part_clobbered with an ABI identifier, since
call insns are now just one possible way of getting an ABI handle.
This in turn allows predefined_function_abi::initialize to do the
right thing for non-default ABIs.

The horrible ?: in need_for_call_save_p goes away in a later patch,
with the series as a whole removing most direct calls to the hook in
favour of function_abi operations.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* target.def (hard_regno_call_part_clobbered): Take an ABI
identifier instead of an rtx_insn.
* doc/tm.texi: Regenerate.
* hooks.h (hook_bool_insn_uint_mode_false): Delete.
(hook_bool_uint_uint_mode_false): New function.
* hooks.c (hook_bool_insn_uint_mode_false): Delete.
(hook_bool_uint_uint_mode_false): New function.
* config/aarch64/aarch64.c (aarch64_hard_regno_call_part_clobbered):
Take an ABI identifier instead of an rtx_insn.
* config/avr/avr.c (avr_hard_regno_call_part_clobbered): Likewise.
* config/i386/i386.c (ix86_hard_regno_call_part_clobbered): Likewise.
* config/mips/mips.c (mips_hard_regno_call_part_clobbered): Likewise.
* config/pru/pru.c (pru_hard_regno_call_part_clobbered): Likewise.
* config/rs6000/rs6000.c (rs6000_hard_regno_call_part_clobbered):
Likewise.
* config/s390/s390.c (s390_hard_regno_call_part_clobbered): Likewise.
* cselib.c: Include function-abi.h.
(cselib_process_insn): Update call to
targetm.hard_regno_call_part_clobbered, using insn_callee_abi
to get the appropriate ABI identifier.
* function-abi.cc (predefined_function_abi::initialize): Update call
to targetm.hard_regno_call_part_clobbered.
* ira-conflicts.c (ira_build_conflicts): Likewise.
* ira-costs.c (ira_tune_allocno_costs): Likewise.
* lra-constraints.c: Include function-abi.h.
(need_for_call_save_p): Update call to
targetm.hard_regno_call_part_clobbered, using insn_callee_abi
to get the appropriate ABI identifier.
* lra-lives.c (check_pseudos_live_through_calls): Likewise.
* regcprop.c (copyprop_hardreg_forward_1): Update call
to targetm.hard_regno_call_part_clobbered.
* reginfo.c (choose_hard_reg_mode): Likewise.
* regrename.c (check_new_reg_p): Likewise.
* reload.c (find_equiv_reg): Likewise.
* reload1.c (emit_reload_insns): Likewise.
* sched-deps.c: Include function-abi.h.
(deps_analyze_insn): Update call to
targetm.hard_regno_call_part_clobbered, using insn_callee_abi
to get the appropriate ABI identifier.
* sel-sched.c (init_regs_for_mode, mark_unavailable_hard_regs): Update
call to targetm.hard_regno_call_part_clobbered.
* targhooks.c (default_dwarf_frame_reg_mode): Likewise.

From-SVN: r276311

5 years ago[x86] Robustify vzeroupper handling across calls
Richard Sandiford [Mon, 30 Sep 2019 16:19:52 +0000 (16:19 +0000)]
[x86] Robustify vzeroupper handling across calls

One of the effects of the function_abi series is to make -fipa-ra
work for partially call-clobbered registers.  E.g. if a call preserves
only the low 32 bits of a register R, we handled the partial clobber
separately from -fipa-ra, and so treated the upper bits of R as
clobbered even if we knew that the target function doesn't touch R.

"Fixing" this caused problems for the vzeroupper handling on x86.
The pass that inserts the vzerouppers assumes that no 256-bit or 512-bit
values are live across a call unless the call takes a 256-bit or 512-bit
argument:

      /* Needed mode is set to AVX_U128_CLEAN if there are
 no 256bit or 512bit modes used in function arguments. */

This implicitly relies on:

/* Implement TARGET_HARD_REGNO_CALL_PART_CLOBBERED.  The only ABI that
   saves SSE registers across calls is Win64 (thus no need to check the
   current ABI here), and with AVX enabled Win64 only guarantees that
   the low 16 bytes are saved.  */

static bool
ix86_hard_regno_call_part_clobbered (rtx_insn *insn ATTRIBUTE_UNUSED,
     unsigned int regno, machine_mode mode)
{
  return SSE_REGNO_P (regno) && GET_MODE_SIZE (mode) > 16;
}

The comment suggests that this code is only needed for Win64 and that
not testing for Win64 is just a simplification.  But in practice it was
needed for correctness on GNU/Linux and other targets too, since without
it the RA would be able to keep 256-bit and 512-bit values in SSE
registers across calls that are known not to clobber them.

This patch conservatively treats calls as AVX_U128_ANY if the RA can see
that some SSE registers are not touched by a call.  There are then no
regressions if the ix86_hard_regno_call_part_clobbered check is disabled
for GNU/Linux (not something we should do, was just for testing).

If in fact we want -fipa-ra to pretend that all functions clobber
SSE registers above 128 bits, it'd certainly be possible to arrange
that.  But IMO that would be an optimisation decision, whereas what
the patch is fixing is a correctness decision.  So I think we should
have this check even so.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* config/i386/i386.c: Include function-abi.h.
(ix86_avx_u128_mode_needed): Treat function calls as AVX_U128_ANY
if they preserve some 256-bit or 512-bit SSE registers.

From-SVN: r276310

5 years agoAdd a function for getting the ABI of a call insn target
Richard Sandiford [Mon, 30 Sep 2019 16:19:49 +0000 (16:19 +0000)]
Add a function for getting the ABI of a call insn target

This patch replaces get_call_reg_set_usage with insn_callee_abi,
which returns the ABI of the target of a call insn.  The ABI's
full_reg_clobbers corresponds to regs_invalidated_by_call,
whereas many callers instead passed call_used_or_fixed_regs, i.e.:

  (regs_invalidated_by_call | fixed_reg_set)

The patch slavishly preserves the "| fixed_reg_set" for these callers;
later patches will clean this up.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* target.def (insn_callee_abi): New hook.
(remove_extra_call_preserved_regs): Delete.
* doc/tm.texi.in (TARGET_INSN_CALLEE_ABI): New macro.
(TARGET_REMOVE_EXTRA_CALL_PRESERVED_REGS): Delete.
* doc/tm.texi: Regenerate.
* targhooks.h (default_remove_extra_call_preserved_regs): Delete.
* targhooks.c (default_remove_extra_call_preserved_regs): Delete.
* config/aarch64/aarch64.c (aarch64_simd_call_p): Constify the
insn argument.
(aarch64_remove_extra_call_preserved_regs): Delete.
(aarch64_insn_callee_abi): New function.
(TARGET_REMOVE_EXTRA_CALL_PRESERVED_REGS): Delete.
(TARGET_INSN_CALLEE_ABI): New macro.
* rtl.h (get_call_fndecl): Declare.
(cgraph_rtl_info): Fix formatting.  Tweak comment for
function_used_regs.  Remove function_used_regs_valid.
* rtlanal.c (get_call_fndecl): Moved from final.c
* function-abi.h (insn_callee_abi): Declare.
(target_function_abi_info): Mention insn_callee_abi.
* function-abi.cc (fndecl_abi): Handle flag_ipa_ra in a similar
way to get_call_reg_set_usage did.
(insn_callee_abi): New function.
* regs.h (get_call_reg_set_usage): Delete.
* final.c: Include function-abi.h.
(collect_fn_hard_reg_usage): Add fixed and stack registers to
function_used_regs before the main loop rather than afterwards.
Use insn_callee_abi instead of get_call_reg_set_usage.  Exit early
if function_used_regs ends up not being useful.
(get_call_fndecl): Move to rtlanal.c
(get_call_cgraph_rtl_info, get_call_reg_set_usage): Delete.
* caller-save.c: Include function-abi.h.
(setup_save_areas, save_call_clobbered_regs): Use insn_callee_abi
instead of get_call_reg_set_usage.
* cfgcleanup.c: Include function-abi.h.
(old_insns_match_p): Use insn_callee_abi instead of
get_call_reg_set_usage.
* cgraph.h (cgraph_node::rtl_info): Take a const_tree instead of
a tree.
* cgraph.c (cgraph_node::rtl_info): Likewise.  Initialize
function_used_regs.
* df-scan.c: Include function-abi.h.
(df_get_call_refs): Use insn_callee_abi instead of
get_call_reg_set_usage.
* ira-lives.c: Include function-abi.h.
(process_bb_node_lives): Use insn_callee_abi instead of
get_call_reg_set_usage.
* lra-lives.c: Include function-abi.h.
(process_bb_lives): Use insn_callee_abi instead of
get_call_reg_set_usage.
* postreload.c: Include function-abi.h.
(reload_combine): Use insn_callee_abi instead of
get_call_reg_set_usage.
* regcprop.c: Include function-abi.h.
(copyprop_hardreg_forward_1): Use insn_callee_abi instead of
get_call_reg_set_usage.
* resource.c: Include function-abi.h.
(mark_set_resources, mark_target_live_regs): Use insn_callee_abi
instead of get_call_reg_set_usage.
* var-tracking.c: Include function-abi.h.
(dataflow_set_clear_at_call): Use insn_callee_abi instead of
get_call_reg_set_usage.

From-SVN: r276309

5 years agoAdd a target hook for getting an ABI from a function type
Richard Sandiford [Mon, 30 Sep 2019 16:19:43 +0000 (16:19 +0000)]
Add a target hook for getting an ABI from a function type

This patch adds a target hook that allows targets to return
the ABI associated with a particular function type.  Generally,
when multiple ABIs are in use, it must be possible to tell from
a function type and its attributes which ABI it is using.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* target.def (fntype_abi): New target hook.
* doc/tm.texi.in (TARGET_FNTYPE_ABI): Likewise.
* doc/tm.texi: Regenerate.
* target.h (predefined_function_abi): Declare.
* function-abi.cc (fntype_abi): Call targetm.calls.fntype_abi,
if defined.
* config/aarch64/aarch64.h (ARM_PCS_SIMD): New arm_pcs value.
* config/aarch64/aarch64.c: Include function-abi.h.
(aarch64_simd_abi, aarch64_fntype_abi): New functions.
(TARGET_FNTYPE_ABI): Define.

From-SVN: r276308

5 years agoAdd function_abi.{h,cc}
Richard Sandiford [Mon, 30 Sep 2019 16:19:38 +0000 (16:19 +0000)]
Add function_abi.{h,cc}

This patch adds new structures and functions for handling
multiple ABIs in a translation unit.  The structures are:

- predefined_function_abi: describes a static, predefined ABI
- function_abi: describes either a predefined ABI or a local
  variant of one (e.g. taking -fipa-ra into account)

The patch adds functions for getting the ABI from a given type
or decl; a later patch will also add a function for getting the
ABI of the target of a call insn.

Although ABIs are about much more than call-clobber/saved choices,
I wanted to keep the name general in case we add more ABI-related
information in future.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* Makefile.in (OBJS): Add function-abi.o.
(GTFILES): Add function-abi.h.
* function-abi.cc: New file.
* function-abi.h: Likewise.
* emit-rtl.h (rtl_data::abi): New field.
* function.c: Include function-abi.h.
(prepare_function_start): Initialize crtl->abi.
* read-rtl-function.c: Include regs.h and function-abi.h.
(read_rtl_function_body): Initialize crtl->abi.
(read_rtl_function_body_from_file_range): Likewise.
* reginfo.c: Include function-abi.h.
(init_reg_sets_1): Initialize default_function_abi.
(globalize_reg): Call add_full_reg_clobber for each predefined ABI
when making a register global.
* target-globals.h (this_target_function_abi_info): Declare.
(target_globals::function_abi_info): New field.
(restore_target_globals): Copy it.
* target-globals.c: Include function-abi.h.
(default_target_globals): Initialize the function_abi_info field.
(target_globals): Allocate it.
(save_target_globals): Free it.

From-SVN: r276307

5 years agoFix compile time warning about building the FRV backend by adding missing break state...
Nick Clifton [Mon, 30 Sep 2019 15:27:14 +0000 (15:27 +0000)]
Fix compile time warning about building the FRV backend by adding missing break statements to the switches in frv_register_move_cost.

PR target/85978
* config/frv/frv.c (frv_register_move_cost): Add break statements
to avoid falling through to the wrong cases.  Tidy code.

From-SVN: r276306

5 years ago[AArch64] Strengthen aarch64_hard_regno_call_part_clobbered
Richard Sandiford [Mon, 30 Sep 2019 15:23:30 +0000 (15:23 +0000)]
[AArch64] Strengthen aarch64_hard_regno_call_part_clobbered

The aarch64_vector_pcs handling in aarch64_hard_regno_call_part_clobbered
checks whether the mode might be bigger than 16 bytes, since on SVE
targets the (non-SVE) vector PCS only guarantees that the low 16 bytes
are preserved.  But for multi-register modes, we should instead test
whether each single-register part might be bigger than 16 bytes.
(The size is always divided evenly between registers.)

The testcase uses XImode as an example where this helps.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* config/aarch64/aarch64.c (aarch64_hard_regno_call_part_clobbered):
For multi-registers modes, test how big each register part is.

gcc/testsuite/
* gcc.target/aarch64/torture/simd-abi-8.c: New test.

From-SVN: r276305

5 years agoRemove the iq2000_select_section function the iq2000 backend - it never provided...
Nick Clifton [Mon, 30 Sep 2019 15:18:14 +0000 (15:18 +0000)]
Remove the iq2000_select_section function the iq2000 backend - it never provided any useful functionality.

PR target/59205
* config/iq2000/iq2000.c (iq2000_select_section): Delete.
(TARGET_ASM_SELECT_SECTION): Remove definition.
(TARGET_HAVE_SWITCHABLE_BSS_SECTIONS): Allow definition.

From-SVN: r276304

5 years agoIntroduce rtx_alloca, alloca_raw_REG and alloca_rtx_fmt_*
Ilya Leoshkevich [Mon, 30 Sep 2019 14:56:33 +0000 (14:56 +0000)]
Introduce rtx_alloca, alloca_raw_REG and alloca_rtx_fmt_*

When one passes short-lived fake rtxes to backends in order to test
their capabilities, it might be beneficial to allocate these rtxes on
stack in order to reduce the load on GC.

Provide macro counterparts of some of the gen_* functions for that
purpose.

gcc/ChangeLog:

2019-09-30  Ilya Leoshkevich  <iii@linux.ibm.com>

* emit-rtl.c (init_raw_REG): New function.
(gen_raw_REG): Use init_raw_REG.
* gengenrtl.c (gendef): Emit init_* functions and alloca_*
macros.
* rtl.c (rtx_alloc_stat_v): Use rtx_init.
* rtl.h (rtx_init): New function.
(rtx_alloca): New function.
(init_raw_REG): New function.
(alloca_raw_REG): New macro.

From-SVN: r276303

5 years ago[C] Print ", ..." rather than ", ..." in diagnostics
Richard Sandiford [Mon, 30 Sep 2019 14:49:07 +0000 (14:49 +0000)]
[C] Print ", ..." rather than ",  ..." in diagnostics

pp_separate_with inserts a space after the separator, so there's
no need to add whitespace before "..." as well.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/c-family/
* c-pretty-print.c (pp_c_parameter_type_list): Avoid printing
two spaces between a comma and "...".

gcc/testsuite/
* gcc.dg/Wincompatible-pointer-types-1.c (f1): Expect only one
space between the comma and "...".

From-SVN: r276302

5 years agolibgomp_g.h: Include stdint.h instead of gstdint.h.
Kwok Cheung Yeung [Mon, 30 Sep 2019 14:16:34 +0000 (14:16 +0000)]
libgomp_g.h: Include stdint.h instead of gstdint.h.

2019-09-30  Kwok Cheung Yeung  <kcy@codesourcery.com>

        * libgomp_g.h: Include stdint.h instead of gstdint.h.

From-SVN: r276301

5 years agoAdd initial support for prefixed/PC-relative addressing.
Michael Meissner [Mon, 30 Sep 2019 13:49:13 +0000 (13:49 +0000)]
Add initial support for prefixed/PC-relative addressing.

2019-09-30  Michael Meissner  <meissner@linux.ibm.com>

* config/rs6000/predicates.md (pcrel_address): Delete predicate.
(pcrel_local_address): Replace pcrel_address predicate, use the
new function address_to_insn_form.
(pcrel_external_address): Replace with new implementation using
address_to_insn_form..
(prefixed_mem_operand): Delete predicate which is now unused.
(pcrel_external_mem_operand): Delete predicate which is now
unused.
* config/rs6000/rs6000-protos.h (enum insn_form): New
enumeration.
(enum non_prefixed): New enumeration.
(address_to_insn_form): New declaration.
(prefixed_load_p): New declaration.
(prefixed_store_p): New declaration.
(prefixed_paddi_p): New declaration.
(rs6000_asm_output_opcode): New declaration.
(rs6000_final_prescan_insn): Move declaration and update calling
signature.
(address_is_prefixed): New helper inline function.
* config/rs6000/rs6000.c(print_operand_address): Check for either
PC-relative local symbols or PC-relative external symbols.
(rs6000_emit_move): Support loading PC-relative addresses.
(mode_supports_prefixed_address_p): Delete, no longer used.
(rs6000_prefixed_address_mode_p): Delete, no longer used.
(address_to_insn_form): New function to decode an address format.
(reg_to_non_prefixed): New function to identify what the
non-prefixed memory instruction format is for a register.
(prefixed_load_p): New function to identify prefixed loads.
(prefixed_store_p): New function to identify prefixed stores.
(prefixed_paddi_p): New function to identify prefixed load
immediates.
(next_insn_prefixed_p): New static state variable.
(rs6000_final_prescan_insn): New function to determine if an insn
uses a prefixed instruction.
(rs6000_asm_output_opcode): New function to emit 'p' in front of a
prefixed instruction.
* config/rs6000/rs6000.h (FINAL_PRESCAN_INSN): New target hook.
(ASM_OUTPUT_OPCODE): New target hook.
* config/rs6000/rs6000.md (prefixed): New insn attribute for
prefixed instructions.
(prefixed_length): New insn attribute for the size of prefixed
instructions.
(non_prefixed_length): New insn attribute for the size of
non-prefixed instructions.
(pcrel_local_addr): New insn to load up a local PC-relative
address.
(pcrel_extern_addr): New insn to load up an external PC-relative
address.
(mov<mode>_64bit_dm): Split the alternatives for loading 0.0 to a
GPR and loading a 128-bit floating point type to a GPR.

From-SVN: r276300

5 years agogimple.c (gimple_get_lhs): For PHIs return the result.
Richard Biener [Mon, 30 Sep 2019 11:59:16 +0000 (11:59 +0000)]
gimple.c (gimple_get_lhs): For PHIs return the result.

2019-09-30  Richard Biener  <rguenther@suse.de>

* gimple.c (gimple_get_lhs): For PHIs return the result.
* tree-vectorizer.h (vectorizable_live_operation): Also get the
SLP instance as argument.
* tree-vect-loop.c (vect_analyze_loop_operations): Also handle
double-reduction PHIs with vectorizable_lc_phi.
(vect_analyze_loop_operations): Adjust.
(vect_create_epilog_for_reduction): Remove all code not dealing
with reduction LC PHI or epilogue generation.
(vectorizable_live_operation): Call vect_create_epilog_for_reduction
for live stmts of reductions.
* tree-vect-stmts.c (vectorizable_condition): When !for_reduction
do not handle defs that are not vect_internal_def.
(can_vectorize_live_stmts): Adjust.
(vect_analyze_stmt): When the vectorized stmt defined a value
used on backedges adjust the backedge uses of vectorized PHIs.

From-SVN: r276299

5 years agoImplement LWG 3255 for std::span constructors
Jonathan Wakely [Mon, 30 Sep 2019 11:52:08 +0000 (12:52 +0100)]
Implement LWG 3255 for std::span constructors

Also fix the constraints on span(Container&) and span(const Container&)
constructors so that they aren't used for const spans or const arrays.

* include/std/span (span(element_type(&)[N]))
(span(array<value_type, N>&), span(const array<value_type, N>&)):
Deduce array element type to allow safe const conversions (LWG 3255).
[!_GLIBCXX_P1394] (span(Container&), span(const Container&)): Use
remove_cv_t on arguments to __is_std_span and __is_std_array.
* testsuite/23_containers/span/lwg3255.cc: New test.

From-SVN: r276298

5 years agoPR libstdc++/77936 remove unused variable
Jonathan Wakely [Mon, 30 Sep 2019 11:52:01 +0000 (12:52 +0100)]
PR libstdc++/77936 remove unused variable

PR libstdc++/77936
* include/parallel/checkers.h (__is_sorted): Remove unused variable.

From-SVN: r276297

5 years ago[PR 91853] Prevent IPA-SRA ICEs on type-mismatched calls
Martin Jambor [Mon, 30 Sep 2019 08:18:59 +0000 (10:18 +0200)]
[PR 91853] Prevent IPA-SRA ICEs on type-mismatched calls

2019-09-30  Martin Jambor  <mjambor@suse.cz>

PR ipa/91853
* tree-inline.c (force_value_to_type): New function.
(setup_one_parameter): Use force_value_to_type to convert type.
* tree-inline.c (force_value_to_type): Declare.
* ipa-param-manipulation.c (ipa_param_adjustments::modify_call): Deal
with register type mismatches.

testsuite/
* gcc.dg/ipa/pr91853.c: New test.

From-SVN: r276296

5 years agoconfig.gcc: Use the secure-plt on FreeBSD 13 and upwards for 32-bit PowerPC.
Andreas Tobler [Mon, 30 Sep 2019 07:54:52 +0000 (09:54 +0200)]
config.gcc: Use the secure-plt on FreeBSD 13 and upwards for 32-bit PowerPC.

2019-09-30  Andreas Tobler  <andreast@gcc.gnu.org>

* config.gcc: Use the secure-plt on FreeBSD 13 and upwards for
32-bit PowerPC.
Define TARGET_FREEBSD32_SECURE_PLT for 64-bit PowerPC.
* config/rs6000/t-freebsd64: Make use of the above define and build
the 32-bit libraries with secure-plt.

From-SVN: r276295

5 years agore PR target/91931 (ICE in decompose, at rtl.h:2277)
Jakub Jelinek [Mon, 30 Sep 2019 07:26:58 +0000 (09:26 +0200)]
re PR target/91931 (ICE in decompose, at rtl.h:2277)

PR target/91931
* config/i386/i386-expand.c (ix86_expand_adjust_ufix_to_sfix_si): Use
gen_int_mode instead of GEN_INT.

* gcc.target/i386/pr91931.c: New test.

From-SVN: r276294

5 years agoDaily bump.
GCC Administrator [Mon, 30 Sep 2019 00:16:51 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r276276

5 years agore PR fortran/91641 (ICE in gfc_conv_is_contiguous_expr, at fortran/trans-intrinsic...
Steven G. Kargl [Sun, 29 Sep 2019 19:12:08 +0000 (19:12 +0000)]
re PR fortran/91641 (ICE in gfc_conv_is_contiguous_expr, at fortran/trans-intrinsic.c:2857)

2019-09-29  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/91641
* check.c (gfc_check_is_contiguous): null() cannot be an actual
argument to is_contiguous().

2019-09-29  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/91641
* gfortran.dg/pr91641.f90: New test.

From-SVN: r276272

5 years ago[Darwin, PPC, Mode Iterators 5/n] Update macho_low.
Iain Sandoe [Sun, 29 Sep 2019 19:09:13 +0000 (19:09 +0000)]
[Darwin, PPC, Mode Iterators 5/n] Update macho_low.

Replace the define_expand and two define_insns with a single
@macho_low_<mode> and update callers.

gcc/ChangeLog:

2019-09-29  Iain Sandoe  <iain@sandoe.co.uk>

* config/darwin.c (gen_macho_low):Amend to include the mode
argument.
(machopic_indirect_data_reference): Amend gen_macho_low call
to include mode argument
* config/rs6000/rs6000.c (emit_move): Likewise. Amend a comment.
* config/rs6000/darwin.md (@macho_low_<mode>): New, replaces
the macho_high expander and two define_insn entries.

From-SVN: r276271

5 years agore PR fortran/91714 (Accepts type statement without delimiter in free form)
Steven G. Kargl [Sun, 29 Sep 2019 16:19:58 +0000 (16:19 +0000)]
re PR fortran/91714 (Accepts type statement without delimiter in free form)

2019-09-29  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/91714
* decl.c (gfc_match_decl_type_spec):  Issue errors for a few
mangled types.

2019-09-29  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/91714
* gfortran.dg/dec_type_print_3.f90: Update dg-error regex.
* gfortran.dg/pr91714.f90: New test.

From-SVN: r276270

5 years agore PR fortran/91726 (ICE in gfc_conv_array_ref, at fortran/trans-array.c:3612)
Paul Thomas [Sun, 29 Sep 2019 10:12:42 +0000 (10:12 +0000)]
re PR fortran/91726 (ICE in gfc_conv_array_ref, at fortran/trans-array.c:3612)

2019-09-29  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/91726
* resolve.c (gfc_expr_to_initialize): Bail out with a copy of
the original expression if the array ref is a scalar and the
array_spec has corank.
* trans-array.c (gfc_conv_array_ref): Such expressions are OK
even if the array ref codimen is zero.
* trans-expr.c (gfc_get_class_from_expr): New function taken
from gfc_get_vptr_from_expr.
(gfc_get_vptr_from_expr): Call new function.
* trans-stmt.c (trans_associate_var): If one of these is a
target expression, extract the class expression from the target
and copy its fields to a new target variable.
* trans.h : Add prototype for gfc_get_class_from_expr.

2019-09-29  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/91726
* gfortran.dg/coarray_poly_9.f90 : New test.

From-SVN: r276269

5 years agore PR bootstrap/90543 (Build failure on MINGW for gcc-9.1.0)
Jakub Jelinek [Sun, 29 Sep 2019 10:06:40 +0000 (12:06 +0200)]
re PR bootstrap/90543 (Build failure on MINGW for gcc-9.1.0)

PR bootstrap/90543
* optc-save-gen.awk: Fix up printing string option differences.

From-SVN: r276268

5 years agovec_perm cost to 1 for non-Power7 VSX architectures
Kewen Lin [Sun, 29 Sep 2019 09:18:22 +0000 (09:18 +0000)]
vec_perm cost to 1 for non-Power7 VSX architectures

gcc/ChangeLog

2019-09-29  Kewen Lin  <linkw@gcc.gnu.org>

    * config/rs6000/rs6000.c (rs6000_builtin_vectorization_cost): Lower
    vec_perm cost to 1 for non-Power7 VSX architectures.

From-SVN: r276267

5 years agoThis patch is to add the support for float from/to long conversion
Kewen Lin [Sun, 29 Sep 2019 05:08:14 +0000 (05:08 +0000)]
This patch is to add the support for float from/to long conversion
vectorization on port rs6000.

gcc/ChangeLog

2019-09-29  Kewen Lin  <linkw@gcc.gnu.org>

    * config/rs6000/vsx.md (vec_pack[su]_float_v2di): New define_expand.
    (vec_unpack_[su]fix_trunc_hi_v4sf): Likewise.
    (vec_unpack_[su]fix_trunc_lo_v4sf): Likewise.

gcc/testsuite/ChangeLog

2019-09-29  Kewen Lin  <linkw@gcc.gnu.org>

    * gcc.target/powerpc/conv-vectorize-1.c: New test.
    * gcc.target/powerpc/conv-vectorize-2.c: New test.

From-SVN: r276266

5 years agore PR fortran/91802 (ICE in mio_name_expr_t, at fortran/module.c:2141)
Jerry DeLisle [Sun, 29 Sep 2019 02:35:58 +0000 (02:35 +0000)]
re PR fortran/91802 (ICE in mio_name_expr_t, at fortran/module.c:2141)

2019-09-28  Jerry DeLisle  <jvdelisle@gcc.ngu.org>

PR fortran/91802
* decl.c (attr_decl1): Return MATCH_ERROR without free to avoid
bad expression type in free_expr0() ICE in rank+corank check.

From-SVN: r276265

5 years agoDaily bump.
GCC Administrator [Sun, 29 Sep 2019 00:16:32 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r276264

5 years agostl_algo.h (merge): Fix documentation.
François Dumont [Sat, 28 Sep 2019 21:11:55 +0000 (21:11 +0000)]
stl_algo.h (merge): Fix documentation.

2019-09-28  François Dumont  <fdumont@gcc.gnu.org>

* include/bits/stl_algo.h (merge): Fix documentation.
* include/debug/functions.h (__check_sorted_aux): Add C++20 constexpr.
(__check_sorted): Likewise and remove nested irreflexive check.
(__check_sorted_set_aux, __check_sorted_set): Add C++20 constexpr.
(__check_partitioned_lower, __check_partitioned_upper): Likewise.
(_Irreflexive_checker::_S_is_valid): Likewise.
(__is_irreflexive, __is_irreflexive_pred): Likewise.
* include/debug/helper_functions.h (__get_distance): Add constexpr.
(__valid_range_aux): Add C++20 constexpr.
(__valid_range(_Iter, _Iter, _Distance_traits<_Iter>::__type&)):
Likewise and add std::is_constant_evaluated check.
(__valid_range_aux(_Iter, _Iter, std::input_iterator_tag)): New.
(__valid_range_aux(_Iter, _Iter, std::random_accss_iterator_tag)): New.
(__valid_range_aux(_Integral, _Integral, std::__true_type)): New,
use latter.
(__valid_range(_Iter, _Iter)): Adapt to use latter, add constexpr and
__builtin_is_contant_evaludated check..
(__can_advance, __base): Add constexpr.
* include/debug/macros.h [_GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED]
(_GLIBCXX_DEBUG_VERIFY_COND_AT): New.
(__glibcxx_check_sorted): Use __glibcxx_check_irreflexive.
(__glibcxx_check_sorted_pred): Use __glibcxx_check_irreflexive_pred.
* testsuite/25_algorithms/binary_search/constexpr.cc: Use irreflexive
std::less.
* testsuite/25_algorithms/is_sorted/constexpr.cc: Likewise.
* testsuite/25_algorithms/merge/constexpr.cc: Fix order in camm. Fix
lambda to be irreflexive.

From-SVN: r276260

5 years ago[Darwin, PPC, Mode Iterators 4/n] Update macho_high.
Iain Sandoe [Sat, 28 Sep 2019 19:32:31 +0000 (19:32 +0000)]
[Darwin, PPC, Mode Iterators 4/n] Update macho_high.

Drop the expander and use a mode iterator on the define_insn
for @macho_high_<mode> instead.

gcc/ChangeLog:

2019-09-28  Iain Sandoe  <iain@sandoe.co.uk>

* config/darwin.c (gen_macho_high): Amend to include the mode
argument.
(machopic_indirect_data_reference): Amend gen_macho_high call
to include mode argument.
(machopic_legitimize_pic_address): Likewise.
* config/rs6000/rs6000.c (rs6000_legitimize_address):
* config/rs6000/darwin.md (@macho_high_<mode>): New, replaces
the macho_high expander and two define_insn entries.

From-SVN: r276256

5 years agore PR libfortran/91593 (Implicit enum conversions in libgfortran/io/transfer.c)
Jerry DeLisle [Sat, 28 Sep 2019 19:14:47 +0000 (19:14 +0000)]
re PR libfortran/91593 (Implicit enum conversions in libgfortran/io/transfer.c)

2019-09-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR libfortran/91593
* io/io.h: Add gcc_unreachable().
* io/transfer.c (file_mode, current_mode,
formatted_transfer_scalar_read, formatted_transfer_scalar_write,
pre_position, next_record_r, next_record_w): Add and use
FORMATTED_UNSPECIFIED to enumeration.

From-SVN: r276255

5 years agore PR fortran/91802 (ICE in mio_name_expr_t, at fortran/module.c:2141)
Steven G. Kargl [Sat, 28 Sep 2019 17:10:34 +0000 (17:10 +0000)]
re PR fortran/91802 (ICE in mio_name_expr_t, at fortran/module.c:2141)

2019-09-28  Steven G. Kargl  <kargl@gcc.ngu.org>

PR fortran/91802
* decl.c (attr_decl1): Check if rank+corank > 15.

2019-09-28  Steven G. Kargl  <kargl@gcc.ngu.org>

PR fortran/91802
* gfortran.dg/pr91802.f90: New test.

From-SVN: r276254

5 years agore PR fortran/91864 (ICE in gfc_check_do_variable, at fortran/parse.c:4405)
Steven G. Kargl [Sat, 28 Sep 2019 16:26:43 +0000 (16:26 +0000)]
re PR fortran/91864 (ICE in gfc_check_do_variable, at fortran/parse.c:4405)

2019-09-28  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/91864
* gcc/fortran/io.c (match_io_element): An inquiry parameter cannot be
read into.
* gcc/fortran/match.c (gfc_match_allocate): An inquiry parameter
can be neither an allocate-object nor stat variable.
(gfc_match_deallocate): An inquiry parameter cannot be deallocated.

2019-09-28  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/91864
* gcc/testsuite/gfortran.dg/pr91864.f90

From-SVN: r276253

5 years agoPR c++/91889 - follow-up fix for DR 2352.
Marek Polacek [Sat, 28 Sep 2019 15:35:37 +0000 (15:35 +0000)]
PR c++/91889 - follow-up fix for DR 2352.

* call.c (involves_qualification_conversion_p): New function.
(direct_reference_binding): Build a ck_qual if the conversion
would involve a qualification conversion.
(convert_like_real): Strip the conversion created by the ck_qual
in direct_reference_binding.

* g++.dg/cpp0x/ref-bind3.C: Add dg-error.
* g++.dg/cpp0x/ref-bind4.C: New test.
* g++.dg/cpp0x/ref-bind5.C: New test.
* g++.dg/cpp0x/ref-bind6.C: New test.
* g++.old-deja/g++.pt/spec35.C: Revert earlier change.

From-SVN: r276251

5 years agoPR c++/91921 - stray warning with -Woverloaded-virtual.
Marek Polacek [Sat, 28 Sep 2019 11:46:33 +0000 (11:46 +0000)]
PR c++/91921 - stray warning with -Woverloaded-virtual.

* class.c (warn_hidden): Only emit the second part of
-Woverloaded-virtual if the first part was issued.  Use inform instead
warning_at.

* g++.dg/warn/Woverloaded-2.C: New.
* g++.dg/warn/Woverloaded-2.h: New.
* g++.dg/warn/pr61945.C: Turn dg-warning into dg-message.
* g++.old-deja/g++.mike/warn6.C: Likewise.
* g++.old-deja/g++.warn/virt1.C: Likewise.

From-SVN: r276249

5 years agoPR c++/91923 - failure-to-SFINAE with class type NTTP in C++17.
Marek Polacek [Sat, 28 Sep 2019 11:36:36 +0000 (11:36 +0000)]
PR c++/91923 - failure-to-SFINAE with class type NTTP in C++17.

* pt.c (invalid_nontype_parm_type_p): Only emit errors when
tf_error.

* g++.dg/cpp0x/nontype5.C: New test.

From-SVN: r276248

5 years agore PR target/86805 (sh port needs updating for CVE-2017-5753)
Oleg Endo [Sat, 28 Sep 2019 08:53:27 +0000 (08:53 +0000)]
re PR target/86805 (sh port needs updating for CVE-2017-5753)

gcc/
2019-09-28  Oleg Endo  <olegendo@gcc.gnu.org>

PR target/86805
* config/sh/sh.c (TARGET_HAVE_SPECULATION_SAFE_VALUE): Define.

From-SVN: r276244

5 years agore PR target/80672 (gcc/config/sh/sh.c:716: prefer compare to find.)
Oleg Endo [Sat, 28 Sep 2019 08:33:31 +0000 (08:33 +0000)]
re PR target/80672 (gcc/config/sh/sh.c:716: prefer compare to find.)

gcc/
2019-09-28  Oleg Endo  <olegendo@gcc.gnu.org>

PR target/80672
* config/sh/sh.c (parse_validate_atomic_model_option): Use
std::string::compare instead of std::string::find.

From-SVN: r276240

5 years agoFix endian issue in pr91656 testcases
Alan Modra [Sat, 28 Sep 2019 07:12:14 +0000 (16:42 +0930)]
Fix endian issue in pr91656 testcases

PR testsuite/91676
PR rtl-optimization/91656
* gcc.dg/torture/pr91656-1.c: Correct for big and pdp endian.
* gcc.dg/torture/pr91656-2.c: Likewise.
* gcc.dg/torture/pr91656-3.c: Likewise.

From-SVN: r276236

5 years agocompiler: resolve importing ambiguity for more complex function calls
Ian Lance Taylor [Sat, 28 Sep 2019 00:16:57 +0000 (00:16 +0000)]
compiler: resolve importing ambiguity for more complex function calls

    Tweak the exporter for inlinable function bodies to work around a
    problem with importing of function calls whose function expressions
    are not simple function names. In the bug in question, the function
    body exporter was writing out a function call of the form

           (*(*FuncTyp)(var))(arg)

    which produced an export data representation of

           *$convert(<type 5>, var)(x)

    which is hard to parse unambiguously. Fix: change the export data
    emitter to introduce parens around the function expression for more
    complex calls.

    Testcase for this bug is in CL 197217.

    Fixes golang/go#34503.

    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/197122

From-SVN: r276228

5 years agoDaily bump.
GCC Administrator [Sat, 28 Sep 2019 00:16:24 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r276227

5 years agoRegenerate `configure' scripts for `uclinuxfdpiceabi' libtool.m4 update
Maciej W. Rozycki [Fri, 27 Sep 2019 21:24:42 +0000 (21:24 +0000)]
Regenerate `configure' scripts for `uclinuxfdpiceabi' libtool.m4 update

A change made with r275564 ("[ARM/FDPIC v6 02/24] [ARM] FDPIC: Handle
arm*-*-uclinuxfdpiceabi in configure scripts") to libtool.m4 has not
regenerated all the `configure' scripts affected.  Fix it.

gcc/
* configure: Regenerate.

libatomic/
* configure: Regenerate.

libbacktrace/
* configure: Regenerate.

libcc1/
* configure: Regenerate.

libffi/
* configure: Regenerate.

libgfortran/
* configure: Regenerate.

libgomp/
* configure: Regenerate.

libhsail-rt/
* configure: Regenerate.

libitm/
* configure: Regenerate.

libobjc/
* configure: Regenerate.

liboffloadmic/
* configure: Regenerate.

libphobos/
* configure: Regenerate.

libquadmath/
* configure: Regenerate.

libsanitizer/
* configure: Regenerate.

libssp/
* configure: Regenerate.

libstdc++-v3/
* configure: Regenerate.

libvtv/
* configure: Regenerate.

lto-plugin/
* configure: Regenerate.

zlib/
* configure: Regenerate.

From-SVN: r276213

5 years agore PR c++/88203 (assert does not compile with OpenMP's pragma omp parallel for defaul...
Jakub Jelinek [Fri, 27 Sep 2019 20:14:24 +0000 (22:14 +0200)]
re PR c++/88203 (assert does not compile with OpenMP's pragma omp parallel for default(none))

PR c++/88203
c-family/
* c-common.h (c_omp_predefined_variable): Declare.
* c-omp.c (c_omp_predefined_variable): New function.
(c_omp_predetermined_sharing): Return OMP_CLAUSE_DEFAULT_SHARED
for predefined variables.
c/
* c-parser.c (c_parser_predefined_identifier): New function.
(c_parser_postfix_expression): Use it.
(c_parser_omp_variable_list): Parse predefined identifiers.
* c-typeck.c (c_finish_omp_clauses): Allow predefined variables
in shared and firstprivate clauses, even when they are predetermined
shared.
cp/
* parser.c (cp_parser_omp_var_list_no_open): Parse predefined
variables.
* semantics.c (finish_omp_clauses): Allow predefined variables in
shared and firstprivate clauses, even when they are predetermined
shared.
* cp-gimplify.c (cxx_omp_predetermined_sharing_1): Return
OMP_CLAUSE_DEFAULT_SHARED for predefined variables.
testsuite/
* c-c++-common/gomp/pr88203-1.c: New test.
* c-c++-common/gomp/pr88203-2.c: New test.
* c-c++-common/gomp/pr88203-3.c: New test.

From-SVN: r276212

5 years agore PR middle-end/91920 (ggc 9.2.0 failing openmp compile on ppc64le)
Jakub Jelinek [Fri, 27 Sep 2019 20:13:00 +0000 (22:13 +0200)]
re PR middle-end/91920 (ggc 9.2.0 failing openmp compile on ppc64le)

PR middle-end/91920
* gimplify.c (omp_default_clause): Predetermine DECL_IN_CONSTANT_POOL
variables as shared.

* c-c++-common/gomp/pr91920.c: New test.

From-SVN: r276211

5 years ago[Darwin, PPC, Mode Iterators 3/n] Update macho_correct_pic.
Iain Sandoe [Fri, 27 Sep 2019 19:23:39 +0000 (19:23 +0000)]
[Darwin, PPC, Mode Iterators 3/n] Update macho_correct_pic.

Drop the expander and use a mode expander on the define_insn
for macho_correct_pic instead.

gcc/ChangeLog:

2019-09-27  Iain Sandoe  <iain@sandoe.co.uk>

* config/rs6000/darwin.md (@macho_correct_pic_<mode>): New,
replaces the expander and two define_insn entries.
(@reload_macho_picbase_<mode>): Update gen_macho_correct_pic
call.
* config/rs6000/rs6000.md (builtin_setjmp_receiver): Likewise.

From-SVN: r276196

5 years agoConst-correctness fixes for fibonacci_heap.h
David Malcolm [Fri, 27 Sep 2019 18:24:44 +0000 (18:24 +0000)]
Const-correctness fixes for fibonacci_heap.h

gcc/ChangeLog:
* fibonacci_heap.h (fibonacci_heap::empty): Make const.
(fibonacci_heap::nodes): Likewise.
(fibonacci_heap::min_key): Likewise.
(fibonacci_heap::min): Likewise.

From-SVN: r276193

5 years agoconstexpr.c (cxx_fold_indirect_ref): Use similar_type_p.
Jason Merrill [Fri, 27 Sep 2019 18:23:10 +0000 (14:23 -0400)]
constexpr.c (cxx_fold_indirect_ref): Use similar_type_p.

* constexpr.c (cxx_fold_indirect_ref): Use similar_type_p.

Merging the similar_type_p change to the concepts branch broke a cmcstl2
testcase; investigating led me to this small testcase which has always
failed on trunk.

(cxx_eval_indirect_ref): Likewise.  Improve error location.

From-SVN: r276192

5 years agocp-tree.h (class iloc_sentinel): New.
Jason Merrill [Fri, 27 Sep 2019 18:19:55 +0000 (14:19 -0400)]
cp-tree.h (class iloc_sentinel): New.

* cp-tree.h (class iloc_sentinel): New.

We didn't already have a sentinel for input_location, and while
temp_override would work, it would also happily set input_location to 0,
which breaks things that try to look up the associated filename.

* decl.c (grokdeclarator, finish_enum_value_list): Use it.
* mangle.c (mangle_decl_string): Use it.
* pt.c (perform_typedefs_access_check): Use it.

From-SVN: r276191

5 years agoMake cgraph_node::get_fun const
David Malcolm [Fri, 27 Sep 2019 18:12:56 +0000 (18:12 +0000)]
Make cgraph_node::get_fun const

gcc/ChangeLog:
* cgraph.c (cgraph_node::get_fun): Make const.
* cgraph.h (cgraph_node::get_fun): Likewise.

From-SVN: r276190

5 years agocompiler: don't read known type, simplify Import::finalize_methods
Ian Lance Taylor [Fri, 27 Sep 2019 17:51:43 +0000 (17:51 +0000)]
compiler: don't read known type, simplify Import::finalize_methods

    With the current export format, if we already know the type, we don't
    have to read and parse the definition.

    We only use the finalizer in Import::finalize_methods, so make it a
    local variable.  To match Finalize_methods::type, only put struct
    types into real_for_named.

    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/197700

From-SVN: r276188

5 years agocompiler: only check whether struct or array types are big
Ian Lance Taylor [Fri, 27 Sep 2019 17:34:58 +0000 (17:34 +0000)]
compiler: only check whether struct or array types are big

    Fetching the size of a type typically involves a hash table lookup,
    and is generally non-trivial.  The escape analysis code calls is_big
    more than one might expect.  So only fetch the size if we need it.

    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/197699

From-SVN: r276187

5 years agocompiler: fix brace formatting
Ian Lance Taylor [Fri, 27 Sep 2019 17:32:27 +0000 (17:32 +0000)]
compiler: fix brace formatting

    Just happened to notice this one.

    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/197698

From-SVN: r276186

5 years agoPR libstdc++/91910 fix data race in Debug Mode destructors
Jonathan Wakely [Fri, 27 Sep 2019 16:20:40 +0000 (17:20 +0100)]
PR libstdc++/91910 fix data race in Debug Mode destructors

Fix data race when _Safe_iterator_base::_M_detach() runs concurrently with
the _Safe_container_base destructor.

PR libstdc++/91910
* src/c++11/debug.cc (_Safe_iterator_base::_M_detach()): Load pointer
atomically and lock the mutex before accessing the sequence.
(_Safe_local_iterator_base::_M_detach()): Likewise.
(_Safe_iterator_base::_M_reset()): Clear _M_sequence atomically.

From-SVN: r276184

5 years agore PR target/91919 (arm-linux-eabi ICE with building kernel)
Jakub Jelinek [Fri, 27 Sep 2019 15:48:51 +0000 (17:48 +0200)]
re PR target/91919 (arm-linux-eabi ICE with building kernel)

PR target/91919
* config/arm/arm.md (<US>mlal): Remove SE wrappers around operands
of SImode MULT.

* gcc.c-torture/compile/pr91919.c: New.test

From-SVN: r276183

5 years agotree-vectorizer.h (_stmt_vec_info::reduc_fn): New.
Richard Biener [Fri, 27 Sep 2019 13:19:58 +0000 (13:19 +0000)]
tree-vectorizer.h (_stmt_vec_info::reduc_fn): New.

2019-09-27  Richard Biener  <rguenther@suse.de>

* tree-vectorizer.h (_stmt_vec_info::reduc_fn): New.
(STMT_VINFO_REDUC_FN): Likewise.
* tree-vectorizer.c (vec_info::new_stmt_vec_info): Initialize
STMT_VINFO_REDUC_FN.
* tree-vect-loop.c (vect_is_simple_reduction): Fix STMT_VINFO_REDUC_IDX
for condition reductions.
(vect_create_epilog_for_reduction): Compute all required state
from the stmt to be vectorized.
(vectorizable_reduction): Simplify vect_create_epilog_for_reduction
invocation and remove then dead code.  For single def-use chains
record only a single vector stmt.

From-SVN: r276180

5 years agoassociate_48.f90: Fix a dg directive.
Manfred Schwarb [Fri, 27 Sep 2019 12:53:23 +0000 (14:53 +0200)]
associate_48.f90: Fix a dg directive.

2019-09-27  Manfred Schwarb  <manfred99@gmx.ch>

        * gfortran.dg/associate_48.f90: Fix a dg directive.
        * gfortran.dg/auto_in_equiv_1.f90: Ditto.
        * gfortran.dg/auto_in_equiv_2.f90: Ditto.
        * gfortran.dg/lto/pr87689_0.f: Ditto.

From-SVN: r276179

5 years agore PR tree-optimization/91885 (ICE when compiling SPEC 2017 blender benchmark with...
Jakub Jelinek [Fri, 27 Sep 2019 10:28:48 +0000 (12:28 +0200)]
re PR tree-optimization/91885 (ICE when compiling SPEC 2017 blender benchmark with -O3 -fprofile-generate)

PR tree-optimization/91885
* gcc.dg/pr91885.c (__int64_t): Change from long to long long.
(__uint64_t): Change from unsigned long to unsigned long long.

From-SVN: r276178

5 years ago[AArch64] Split built-in function codes into major and minor codes
Richard Sandiford [Fri, 27 Sep 2019 08:47:21 +0000 (08:47 +0000)]
[AArch64] Split built-in function codes into major and minor codes

It was easier to add the SVE ACLE support without enumerating every
function at build time.  This in turn meant that it was easier if the
SVE builtins occupied a distinct numberspace from the existing AArch64
ones, which *are* enumerated at build time.  This patch therefore
divides the built-in functions codes into "major" and "minor" codes.
At present the major code is just "general", but the SVE patch will add
"SVE" as well.

Also, it was convenient to put the SVE ACLE support in its own file,
so the patch makes aarch64.c provide the frontline target hooks directly,
forwarding to the other files for the real work.

The reason for organising the files this way is that aarch64.c needs
to define the target hook macros whatever happens, and having aarch64.c
macros forward to aarch64-builtins.c functions and aarch64-bulitins.c
functions forward to the SVE file seemed a bit indirect.  Doing things
the way the patch does them puts aarch64-builtins.c and the SVE code on
more of an equal footing.

The aarch64_(general_)gimple_fold_builtin change is mostly just
reindentation.

2019-09-27  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* config/aarch64/aarch64-protos.h (aarch64_builtin_class): New enum.
(AARCH64_BUILTIN_SHIFT, AARCH64_BUILTIN_CLASS): New constants.
(aarch64_gimple_fold_builtin, aarch64_mangle_builtin_type)
(aarch64_fold_builtin, aarch64_init_builtins, aarch64_expand_builtin):
(aarch64_builtin_decl, aarch64_builtin_rsqrt): Delete.
(aarch64_general_mangle_builtin_type, aarch64_general_init_builtins):
(aarch64_general_fold_builtin, aarch64_general_gimple_fold_builtin):
(aarch64_general_expand_builtin, aarch64_general_builtin_decl):
(aarch64_general_builtin_rsqrt): Declare.
* config/aarch64/aarch64-builtins.c (aarch64_general_add_builtin):
New function.
(aarch64_mangle_builtin_type): Rename to...
(aarch64_general_mangle_builtin_type): ...this.
(aarch64_init_fcmla_laneq_builtins, aarch64_init_simd_builtins)
(aarch64_init_crc32_builtins, aarch64_init_builtin_rsqrt)
(aarch64_init_pauth_hint_builtins, aarch64_init_tme_builtins): Use
aarch64_general_add_builtin instead of add_builtin_function.
(aarch64_init_builtins): Rename to...
(aarch64_general_init_builtins): ...this.  Use
aarch64_general_add_builtin instead of add_builtin_function.
(aarch64_builtin_decl): Rename to...
(aarch64_general_builtin_decl): ...this and remove the unused
arguments.
(aarch64_expand_builtin): Rename to...
(aarch64_general_expand_builtin): ...this and remove the unused
arguments.
(aarch64_builtin_rsqrt): Rename to...
(aarch64_general_builtin_rsqrt): ...this.
(aarch64_fold_builtin): Rename to...
(aarch64_general_fold_builtin): ...this.  Take the function subcode
and return type as arguments.  Remove the "ignored" argument.
(aarch64_gimple_fold_builtin): Rename to...
(aarch64_general_gimple_fold_builtin): ...this.  Take the function
subcode and gcall as arguments, and return the new function call.
* config/aarch64/aarch64.c (aarch64_init_builtins)
(aarch64_fold_builtin, aarch64_gimple_fold_builtin)
(aarch64_expand_builtin, aarch64_builtin_decl): New functions.
(aarch64_builtin_reciprocal): Call aarch64_general_builtin_rsqrt
instead of aarch64_builtin_rsqrt.
(aarch64_mangle_type): Call aarch64_general_mangle_builtin_type
instead of aarch64_mangle_builtin_type.

From-SVN: r276177

5 years ago[C][C++] Allow targets to check calls to BUILT_IN_MD functions
Richard Sandiford [Fri, 27 Sep 2019 08:39:16 +0000 (08:39 +0000)]
[C][C++] Allow targets to check calls to BUILT_IN_MD functions

For SVE, we'd like the frontends to check calls to target-specific
built-in functions in the same way that they already do for "normal"
builtins.  This patch adds a target hook for that and extends
check_builtin_function_arguments accordingly.

A slight complication is that when TARGET_RESOLVE_OVERLOADED_BUILTIN
has resolved an overload, it can use build_function_call_vec to build
the call to the underlying non-overloaded function decl.  This in
turn coerces the arguments to the function type and then calls
check_builtin_function_arguments to check the final call.  If the
target does find a problem in this final call, it can be useful
to refer to the original overloaded function decl in diagnostics,
since that's what the user wrote.

The patch therefore passes the original decl as a final optional
parameter to build_function_call_vec.

2019-09-27  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* target.def (check_builtin_call): New target hook.
* doc/tm.texi.in (TARGET_CHECK_BUILTIN_CALL): New @hook.
* doc/tm.texi: Regenerate.

gcc/c-family/
* c-common.h (build_function_call_vec): Take the original
function decl as an optional final parameter.
(check_builtin_function_arguments): Take the original function decl.
* c-common.c (check_builtin_function_arguments): Likewise.
Handle all built-in functions, not just BUILT_IN_NORMAL ones.
Use targetm.check_builtin_call to check BUILT_IN_MD functions.

gcc/c/
* c-typeck.c (build_function_call_vec): Take the original function
decl as an optional final parameter.  Pass all built-in calls to
check_builtin_function_arguments.

gcc/cp/
* cp-tree.h (build_cxx_call): Take the original function decl
as an optional final parameter.
(cp_build_function_call_vec): Likewise.
* call.c (build_cxx_call): Likewise.  Pass all built-in calls to
check_builtin_function_arguments.
* typeck.c (build_function_call_vec): Take the original function
decl as an optional final parameter and pass it to
cp_build_function_call_vec.
(cp_build_function_call_vec): Take the original function
decl as an optional final parameter and pass it to build_cxx_call.

From-SVN: r276176

5 years agoFix reduc_index==1 handling for COND_REDUCTION (PR91909)
Richard Sandiford [Fri, 27 Sep 2019 08:21:37 +0000 (08:21 +0000)]
Fix reduc_index==1 handling for COND_REDUCTION (PR91909)

The then/else order of the VEC_COND_EXPRs created by
vect_create_epilog_for_reduction meeds to line up with the
main VEC_COND_EXPR.

2019-09-27  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
PR tree-optimization/91909
* tree-vect-loop.c (vect_create_epilog_for_reduction): Take a
reduc_index parameter.  When handling COND_REDUCTION, make sure
that the reduction phi operand is in the correct arm of the
VEC_COND_EXPR.
(vectorizable_reduction): Pass reduc_index to the above.

From-SVN: r276175

5 years ago[AArch64][SVE2] Shift-Right Accumulate combine patterns
Yuliang Wang [Fri, 27 Sep 2019 08:10:30 +0000 (08:10 +0000)]
[AArch64][SVE2] Shift-Right Accumulate combine patterns

This patch adds combining support for SVE2's shift-right accumulate
instructions.

2019-09-27  Yuliang Wang  <yuliang.wang@arm.com>

gcc/
* config/aarch64/aarch64-sve2.md (aarch64_sve2_sra<mode>):
New combine pattern.

gcc/testsuite/
* gcc.target/aarch64/sve2/shracc_1.c: New test.

From-SVN: r276174

5 years agoset DECL_SIZE_UNIT for zero-sized fields
Alexandre Oliva [Fri, 27 Sep 2019 01:59:55 +0000 (01:59 +0000)]
set DECL_SIZE_UNIT for zero-sized fields

Zero-sized fields do not get processed by finish_record_type: they're
removed from the field list before and reinserted after, so their
DECL_SIZE_UNIT remains unset, causing the translation of assignment
statements with use_memset_p, in quite unusual circumstances, to use a
NULL_TREE as the memset length.  This patch sets DECL_SIZE_UNIT for
the zero-sized fields, that don't go through language-independent
layout, in language-specific layout.

for  gcc/ada/ChangeLog

* gcc-interface/decl.c (components_to_record): Set
DECL_SIZE_UNIT for zero-sized fields.

From-SVN: r276173

5 years agoDaily bump.
GCC Administrator [Fri, 27 Sep 2019 00:16:20 +0000 (00:16 +0000)]
Daily bump.

From-SVN: r276172

5 years agore PR libbacktrace/91908 (New libbacktrace tests fail to build)
Ian Lance Taylor [Thu, 26 Sep 2019 22:19:47 +0000 (22:19 +0000)]
re PR libbacktrace/91908 (New libbacktrace tests fail to build)

PR libbacktrace/91908
* pecoff.c (backtrace_initialize): Explicitly cast unchecked
__sync_bool_compare_and_swap to void.
* xcoff.c (backtrace_initialize): Likewise.

From-SVN: r276168

5 years agocharset.c (UCS_LIMIT): New macro.
Eric Botcazou [Thu, 26 Sep 2019 21:43:51 +0000 (21:43 +0000)]
charset.c (UCS_LIMIT): New macro.

* charset.c (UCS_LIMIT): New macro.
(ucn_valid_in_identifier): Use it instead of a hardcoded constant.
(_cpp_valid_ucn): Issue a pedantic warning for UCNs larger than
UCS_LIMIT outside of identifiers in C and in C++2a or later.

From-SVN: r276167

5 years agoxtensa: fix PR target/91880
Max Filippov [Thu, 26 Sep 2019 20:51:27 +0000 (20:51 +0000)]
xtensa: fix PR target/91880

Xtensa hwloop_optimize segfaults when zero overhead loop is about to be
inserted as the first instruction of the function.
Insert zero overhead loop instruction into new basic block before the
loop when basic block that precedes the loop is empty.

2019-09-26  Max Filippov  <jcmvbkbc@gmail.com>
gcc/
* config/xtensa/xtensa.c (hwloop_optimize): Insert zero overhead
loop instruction into new basic block before the loop when basic
block that precedes the loop is empty.

gcc/testsuite/
* gcc.target/xtensa/pr91880.c: New test case.
* gcc.target/xtensa/xtensa.exp: New test suite.

From-SVN: r276166

5 years agofunction.c (gimplify_parameters): Use build_clobber function.
Jakub Jelinek [Thu, 26 Sep 2019 20:03:12 +0000 (22:03 +0200)]
function.c (gimplify_parameters): Use build_clobber function.

* function.c (gimplify_parameters): Use build_clobber function.
* tree-ssa.c (execute_update_addresses_taken): Likewise.
* tree-inline.c (expand_call_inline): Likewise.
* tree-sra.c (clobber_subtree): Likewise.
* tree-ssa-ccp.c (insert_clobber_before_stack_restore): Likewise.
* omp-low.c (lower_rec_simd_input_clauses, lower_rec_input_clauses,
lower_omp_single, lower_depend_clauses, lower_omp_taskreg,
lower_omp_target): Likewise.
* omp-expand.c (expand_omp_for_generic): Likewise.
* omp-offload.c (ompdevlow_adjust_simt_enter): Likewise.

From-SVN: r276165

5 years agoCO_BROADCAST for derived types with allocatable components
Alessandro Fanfarillo [Thu, 26 Sep 2019 19:59:00 +0000 (13:59 -0600)]
CO_BROADCAST for derived types with allocatable components

From-SVN: r276164

5 years agors6000-builtin.def: (LVSL...
Will Schmidt [Thu, 26 Sep 2019 19:19:47 +0000 (19:19 +0000)]
rs6000-builtin.def: (LVSL...

[gcc]

2019-09-26  Will Schmidt <will_schmidt@vnet.ibm.com>
* config/rs6000/rs6000-builtin.def: (LVSL, LVSR, LVEBX, LVEHX,
LVEWX, LVXL, LVXL_V2DF, LVXL_V2DI, LVXL_V4SF, LVXL_V4SI, LVXL_V8HI,
LVXL_V16QI, LVX, LVX_V1TI, LVX_V2DF, LVX_V2DI, LVX_V4SF, LVX_V4SI,
LVX_V8HI, LVX_V16QI, LVLX, LVLXL, LVRX, LVRXL, LXSDX, LXVD2X_V1TI,
LXVD2X_V2DF, LXVD2X_V2DI, LXVDSX, LXVW4X_V4SF, LXVW4X_V4SI,
LXVW4X_V8HI, LXVW4X_V16QI, LD_ELEMREV_V1TI, LD_ELEMREV_V2DF,
LD_ELEMREV_V2DI, LD_ELEMREV_V4SF, LD_ELEMREV_V4SI, LD_ELEMREV_V8HI,
LD_ELEMREV_V16QI): Use the PURE attribute.

[testsuite]

2019-09-26  Will Schmidt <will_schmidt@vnet.ibm.com>
* gcc.target/powerpc/pure-builtin-redundant-load.c:  New.

From-SVN: r276163