[AArch64] Fix sve/extract_[12].c for big-endian SVE
[platform/upstream/gcc.git] / gcc / ChangeLog
1 2018-01-30  Richard Sandiford  <richard.sandiford@linaro.org>
2
3         * config/aarch64/aarch64-sve.md (*vec_extract<mode><Vel>_0): New
4         pattern.
5         (*vec_extract<mode><Vel>_v128): Require a nonzero lane number.
6         Use gen_rtx_REG rather than gen_lowpart.
7
8 2018-01-30  Richard Sandiford  <richard.sandiford@linaro.org>
9
10         * lra-constraints.c (match_reload): Use subreg_lowpart_offset
11         rather than 0 when creating partial subregs.
12
13 2018-01-30  Richard Sandiford  <richard.sandiford@linaro.org>
14
15         * vec-perm-indices.c (vec_perm_indices::series_p): Give examples
16         of usage.
17
18 2018-01-29  Michael Meissner  <meissner@linux.vnet.ibm.com>
19
20         PR target/81550
21         * config/rs6000/rs6000.c (rs6000_setup_reg_addr_masks): If DFmode
22         and SFmode can go in Altivec registers (-mcpu=power7 for DFmode,
23         -mcpu=power8 for SFmode) don't set the PRE_INCDEC or PRE_MODIFY
24         flags.  This restores the settings used before the 2017-07-24.
25         Turning off pre increment/decrement/modify allows IVOPTS to
26         optimize DF/SF loops where the index is an int.
27
28 2018-01-29  Richard Biener <rguenther@suse.de>
29             Kelvin Nilsen  <kelvin@gcc.gnu.org>
30
31         PR bootstrap/80867
32         * tree-vect-stmts.c (vectorizable_call): Don't call
33         targetm.vectorize_builtin_md_vectorized_function if callee is
34         NULL.
35
36 2018-01-22 Carl Love <cel@us.ibm.com>
37
38         * doc/extend.tex: Fix typo in second arg in
39         __builtin_bcdadd_{lt|eq|gt|ov} and __builtin_bcdsub_{lt|eq|gt|ov}.
40
41 2018-01-29  Richard Biener  <rguenther@suse.de>
42
43         PR tree-optimization/84086
44         * tree-ssanames.c: Include cfgloop.h and tree-scalar-evolution.h.
45         (flush_ssaname_freelist): When SSA names were released reset
46         the SCEV hash table.
47
48 2018-01-29  Richard Biener  <rguenther@suse.de>
49
50         PR tree-optimization/84057
51         * tree-ssa-loop-ivcanon.c (unloop_loops): Deal with already
52         removed paths when removing edges.
53
54 2018-01-27  H.J. Lu  <hongjiu.lu@intel.com>
55
56         * doc/invoke.texi: Replace -mfunction-return==@var{choice} with
57         -mfunction-return=@var{choice}.
58
59 2018-01-27  Bernd Edlinger  <bernd.edlinger@hotmail.de>
60
61         PR diagnostic/84034
62         * diagnostic-show-locus.c (get_line_width_without_trailing_whitespace):
63         Handle CR like TAB.
64         (layout::print_source_line): Likewise.
65         (test_get_line_width_without_trailing_whitespace): Add test cases.
66
67 2018-01-27  Jakub Jelinek  <jakub@redhat.com>
68
69         PR middle-end/84040
70         * sched-deps.c (sched_macro_fuse_insns): Return immediately for
71         debug insns.
72
73 2018-01-26  Jim Wilson  <jimw@sifive.com>
74
75         * config/riscv/riscv.h (MAX_FIXED_MODE_SIZE): New.
76
77         * config/riscv/elf.h (LIB_SPEC): Don't include -lgloss when nosys.specs
78         specified.
79
80 2018-01-26  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
81
82         * config/aarch64/aarch64.md: Add peepholes for CMP + SUB -> SUBS
83         and CMP + SUB-immediate -> SUBS.
84
85 2018-01-26  Martin Sebor  <msebor@redhat.com>
86
87         PR tree-optimization/83896
88         * tree-ssa-strlen.c (get_string_len): Rename...
89         (get_string_cst_length): ...to this.  Return HOST_WIDE_INT.
90         Avoid assuming length is constant.
91         (handle_char_store): Use HOST_WIDE_INT for string length.
92
93 2018-01-26  Uros Bizjak  <ubizjak@gmail.com>
94
95         PR target/81763
96         * config/i386/i386.md (*andndi3_doubleword): Add earlyclobber
97         to (=&r,r,rm) alternative. Add (=r,0,rm) and (=r,r,0) alternatives.
98
99 2018-01-26  Richard Biener  <rguenther@suse.de>
100
101         PR rtl-optimization/84003
102         * dse.c (record_store): Only record redundant stores when
103         the earlier store aliases at least all accesses the later one does.
104
105 2018-01-26  Jakub Jelinek  <jakub@redhat.com>
106
107         PR rtl-optimization/83985
108         * dce.c (deletable_insn_p): Return false for separate shrink wrapping
109         REG_CFA_RESTORE insns.
110         (delete_unmarked_insns): Don't ignore separate shrink wrapping
111         REG_CFA_RESTORE insns here.
112
113         PR c/83989
114         * gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref): Don't
115         use SSA_NAME_VAR as base for SSA_NAMEs with non-NULL SSA_NAME_VAR.
116
117 2018-01-26  Claudiu Zissulescu  <claziss@synopsys.com>
118
119         * config/arc/arc-arch.h (arc_tune_attr): Add ARC_TUNE_CORE_3.
120         * config/arc/arc.c (arc_sched_issue_rate): Use ARC_TUNE_... .
121         (arc_init): Likewise.
122         (arc_override_options): Likewise.
123         (arc_file_start): Choose Tag_ARC_CPU_variation based on arc_tune
124         value.
125         (hwloop_fail): Use TARGET_DBNZ when we want to check for dbnz insn
126         support.
127         * config/arc/arc.h (TARGET_DBNZ): Define.
128         * config/arc/arc.md (attr tune): Add core_3, use ARC_TUNE_... to
129         properly set the tune attribute.
130         (dbnz): Use TARGET_DBNZ guard.
131         * config/arc/arc.opt (mtune): Add core3 option.
132
133 2018-01-26  Claudiu Zissulescu  <claziss@synopsys.com>
134
135         * config/arc/arc.c (arc_delegitimize_address_0): Refactored to
136         recognize new pic like addresses.
137         (arc_delegitimize_address): Clean up.
138
139 2018-01-26  Claudiu Zissulescu  <claziss@synopsys.com>
140
141         * config/arc/arc-arches.def: Option mrf16 valid for all
142         architectures.
143         * config/arc/arc-c.def (__ARC_RF16__): New predefined macro.
144         * config/arc/arc-cpus.def (em_mini): New cpu with rf16 on.
145         * config/arc/arc-options.def (FL_RF16): Add mrf16 option.
146         * config/arc/arc-tables.opt: Regenerate.
147         * config/arc/arc.c (arc_conditional_register_usage): Handle
148         reduced register file case.
149         (arc_file_start): Set must have build attributes.
150         * config/arc/arc.h (MAX_ARC_PARM_REGS): Conditional define using
151         mrf16 option value.
152         * config/arc/arc.opt (mrf16): Add new option.
153         * config/arc/elf.h (ATTRIBUTE_PCS): Define.
154         * config/arc/genmultilib.awk: Handle new mrf16 option.
155         * config/arc/linux.h (ATTRIBUTE_PCS): Define.
156         * config/arc/t-multilib: Regenerate.
157         * doc/invoke.texi (ARC Options): Document mrf16 option.
158
159 2018-01-26  Claudiu Zissulescu  <claziss@synopsys.com>
160
161         * config/arc/arc-protos.h: Add arc_is_secure_call_p proto.
162         * config/arc/arc.c (arc_handle_secure_attribute): New function.
163         (arc_attribute_table): Add 'secure_call' attribute.
164         (arc_print_operand): Print secure call operand.
165         (arc_function_ok_for_sibcall): Don't optimize tail calls when
166         secure.
167         (arc_is_secure_call_p): New function.  * config/arc/arc.md
168         (call_i): Add support for sjli instruction.
169         (call_value_i): Likewise.
170         * config/arc/constraints.md (Csc): New constraint.
171
172 2018-01-26  Claudiu Zissulescu  <claziss@synopsys.com>
173             John Eric Martin <John.Martin@emmicro-us.com>
174
175         * config/arc/arc-protos.h: Add arc_is_jli_call_p proto.
176         * config/arc/arc.c (_arc_jli_section): New struct.
177         (arc_jli_section): New type.
178         (rc_jli_sections): New static variable.
179         (arc_handle_jli_attribute): New function.
180         (arc_attribute_table): Add jli_always and jli_fixed attribute.
181         (arc_file_end): New function.
182         (TARGET_ASM_FILE_END): Define.
183         (arc_print_operand): Reuse 'S' letter for JLI output instruction.
184         (arc_add_jli_section): New function.
185         (jli_call_scan): Likewise.
186         (arc_reorg): Call jli_call_scan.
187         (arc_output_addsi): Remove 'S' from printing asm operand.
188         (arc_is_jli_call_p): New function.
189         * config/arc/arc.md (movqi_insn): Remove 'S' from printing asm
190         operand.
191         (movhi_insn): Likewise.
192         (movsi_insn): Likewise.
193         (movsi_set_cc_insn): Likewise.
194         (loadqi_update): Likewise.
195         (load_zeroextendqisi_update): Likewise.
196         (load_signextendqisi_update): Likewise.
197         (loadhi_update): Likewise.
198         (load_zeroextendhisi_update): Likewise.
199         (load_signextendhisi_update): Likewise.
200         (loadsi_update): Likewise.
201         (loadsf_update): Likewise.
202         (movsicc_insn): Likewise.
203         (bset_insn): Likewise.
204         (bxor_insn): Likewise.
205         (bclr_insn): Likewise.
206         (bmsk_insn): Likewise.
207         (bicsi3_insn): Likewise.
208         (cmpsi_cc_c_insn): Likewise.
209         (movsi_ne): Likewise.
210         (movsi_cond_exec): Likewise.
211         (clrsbsi2): Likewise.
212         (norm_f): Likewise.
213         (normw): Likewise.
214         (swap): Likewise.
215         (divaw): Likewise.
216         (flag): Likewise.
217         (sr): Likewise.
218         (kflag): Likewise.
219         (ffs): Likewise.
220         (ffs_f): Likewise.
221         (fls): Likewise.
222         (call_i): Remove 'S' asm letter, add jli instruction.
223         (call_value_i): Likewise.
224         * config/arc/arc.op (mjli-always): New option.
225         * config/arc/constraints.md (Cji): New constraint.
226         * config/arc/fpx.md (addsf3_fpx): Remove 'S' from printing asm
227         operand.
228         (subsf3_fpx): Likewise.
229         (mulsf3_fpx): Likewise.
230         * config/arc/simdext.md (vendrec_insn): Remove 'S' from printing
231         asm operand.
232         * doc/extend.texi (ARC): Document 'jli-always' and 'jli-fixed'
233         function attrbutes.
234         * doc/invoke.texi (ARC): Document mjli-always option.
235
236 2018-01-26  Sebastian Perta  <sebastian.perta@renesas.com>
237
238         * config/rl78/rl78.c: if operand 2 is const avoid addition with 0
239         and use incw and decw where possible
240         * testsuite/gcc.target/rl78/test_addsi3_internal.c: new file
241
242 2018-01-26  Richard Biener  <rguenther@suse.de>
243
244         PR tree-optimization/81082
245         * fold-const.c (fold_plusminus_mult_expr): Do not perform the
246         association if it requires casting to unsigned.
247         * match.pd ((A * C) +- (B * C) -> (A+-B)): New patterns derived
248         from fold_plusminus_mult_expr to catch important cases late when
249         range info is available.
250
251 2018-01-26  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
252
253         * config/i386/sol2.h (USE_HIDDEN_LINKONCE): Remove.
254         * configure.ac (hidden_linkonce): New test.
255         * configure: Regenerate.
256         * config.in: Regenerate.
257
258 2018-01-26  Julia Koval  <julia.koval@intel.com>
259
260         * config/i386/avx512bitalgintrin.h (_mm512_bitshuffle_epi64_mask,
261         _mm512_mask_bitshuffle_epi64_mask, _mm256_bitshuffle_epi64_mask,
262         _mm256_mask_bitshuffle_epi64_mask, _mm_bitshuffle_epi64_mask,
263         _mm_mask_bitshuffle_epi64_mask): Fix type.
264         * config/i386/i386-builtin-types.def (UHI_FTYPE_V2DI_V2DI_UHI,
265         USI_FTYPE_V4DI_V4DI_USI): Remove.
266         * config/i386/i386-builtin.def (__builtin_ia32_vpshufbitqmb512_mask,
267         __builtin_ia32_vpshufbitqmb256_mask,
268         __builtin_ia32_vpshufbitqmb128_mask): Fix types.
269         * config/i386/i386.c (ix86_expand_args_builtin): Remove old types.
270         * config/i386/sse.md (VI1_AVX512VLBW): Change types.
271
272 2018-01-26  Alan Modra  <amodra@gmail.com>
273
274         PR target/84033
275         * config/rs6000/rs6000-p8swap.c (rtx_is_swappable_p): Exclude
276         UNSPEC_VBPERMQ.  Sort other unspecs.
277
278 2018-01-25  David Edelsohn  <dje.gcc@gmail.com>
279
280         * doc/invoke.texi (PowerPC Options): Document 'native' cpu type.
281
282 2018-01-25  Jan Hubicka  <hubicka@ucw.cz>
283
284         PR middle-end/83055
285         * predict.c (drop_profile): Do not push/pop cfun; update also
286         node->count.
287         (handle_missing_profiles): Fix logic looking for zero profiles.
288
289 2018-01-25  Jakub Jelinek  <jakub@redhat.com>
290
291         PR middle-end/83977
292         * ipa-fnsummary.c (compute_fn_summary): Clear can_change_signature
293         on functions with #pragma omp declare simd or functions with simd
294         attribute.
295         * omp-simd-clone.c (expand_simd_clones): Revert 2018-01-24 change.
296         * config/i386/i386.c (ix86_simd_clone_compute_vecsize_and_simdlen):
297         Remove trailing \n from warning_at calls.
298
299 2018-01-25  Tom de Vries  <tom@codesourcery.com>
300
301         PR target/84028
302         * config/nvptx/nvptx.c (nvptx_single): Add exit insn after noreturn call
303         for neutered workers.
304
305 2018-01-24  Joseph Myers  <joseph@codesourcery.com>
306
307         PR target/68467
308         * config/m68k/m68k.c (m68k_promote_function_mode): New function.
309         (TARGET_PROMOTE_FUNCTION_MODE): New macro.
310
311 2017-01-08  Jeff Law  <law@redhat.com>
312
313         PR target/83994
314         * i386.c (get_probe_interval): Move to earlier point.
315         (ix86_compute_frame_layout): If -fstack-clash-protection and
316         the frame is larger than the probe interval, then use pushes
317         to save registers rather than reg->mem moves.
318         (ix86_expand_prologue): Remove conditional for int_registers_saved
319         assertion.
320
321 2018-01-24  Vladimir Makarov  <vmakarov@redhat.com>
322
323         PR target/84014
324         * ira-build.c (setup_min_max_allocno_live_range_point): Set up
325         min/max for never referenced object.
326
327 2018-01-24  Jakub Jelinek  <jakub@redhat.com>
328
329         PR middle-end/83977
330         * tree.c (free_lang_data_in_decl): Don't clear DECL_ABSTRACT_ORIGIN
331         here.
332         * omp-low.c (create_omp_child_function): Remove "omp declare simd"
333         attributes from DECL_ATTRIBUTES (decl) without affecting
334         DECL_ATTRIBUTES (current_function_decl).
335         * omp-simd-clone.c (expand_simd_clones): Ignore DECL_ARTIFICIAL
336         functions with non-NULL DECL_ABSTRACT_ORIGIN.
337
338 2018-01-24  Richard Sandiford  <richard.sandiford@linaro.org>
339
340         PR tree-optimization/83979
341         * fold-const.c (fold_comparison): Use constant_boolean_node
342         instead of boolean_{true,false}_node.
343
344 2018-01-24  Jan Hubicka  <hubicka@ucw.cz>
345
346         * ipa-profile.c (ipa_propagate_frequency_1): Fix logic skipping calls
347         with zero counts.
348
349 2018-01-24  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
350
351         * config/rs6000/rs6000.md (*call_indirect_nonlocal_sysv<mode>):
352         Simplify the clause that sets the length attribute.
353         (*call_value_indirect_nonlocal_sysv<mode>): Likewise.
354         (*sibcall_nonlocal_sysv<mode>): Clean up code block; simplify the
355         clause that sets the length attribute.
356         (*sibcall_value_nonlocal_sysv<mode>): Likewise.
357
358 2018-01-24  Tom de Vries  <tom@codesourcery.com>
359
360         PR target/83589
361         * config/nvptx/nvptx.c (WORKAROUND_PTXJIT_BUG_2): Define to 1.
362         (nvptx_pc_set, nvptx_condjump_label): New function. Copy from jump.c.
363         Add strict parameter.
364         (prevent_branch_around_nothing): Insert dummy insn between branch to
365         label and label with no ptx insn inbetween.
366         * config/nvptx/nvptx.md (define_insn "fake_nop"): New insn.
367
368 2018-01-24  Tom de Vries  <tom@codesourcery.com>
369
370         PR target/81352
371         * config/nvptx/nvptx.c (nvptx_single): Add exit insn after noreturn call
372         for neutered threads in warp.
373         * config/nvptx/nvptx.md (define_insn "exit"): New insn.
374
375 2018-01-24  Richard Biener  <rguenther@suse.de>
376
377         PR tree-optimization/83176
378         * tree-chrec.c (chrec_fold_plus_1): Handle (signed T){(T) .. }
379         operands.
380
381 2018-01-24  Richard Biener  <rguenther@suse.de>
382
383         PR tree-optimization/82819
384         * graphite-isl-ast-to-gimple.c (binary_op_to_tree): Avoid
385         code generating pluses that are no-ops in the target precision.
386
387 2018-01-24  Richard Biener  <rguenther@suse.de>
388
389         PR middle-end/84000
390         * tree-cfg.c (replace_loop_annotate): Handle annot_expr_parallel_kind.
391
392 2018-01-23  Jan Hubicka  <hubicka@ucw.cz>
393
394         * cfgcleanup.c (try_crossjump_to_edge): Use combine_with_count
395         to merge probabilities.
396         * predict.c (probably_never_executed): Also mark as cold functions
397         with global 0 profile and guessed local profile.
398         * profile-count.c (profile_probability::combine_with_count): New
399         member function.
400         * profile-count.h (profile_probability::operator*,
401         profile_probability::operator*=, profile_probability::operator/,
402         profile_probability::operator/=): Reduce precision to adjusted
403         and set value to guessed on contradictory divisions.
404         (profile_probability::combine_with_freq): Remove.
405         (profile_probability::combine_wiht_count): Declare.
406         (profile_count::force_nonzero):: Set to adjusted.
407         (profile_count::probability_in):: Set quality to adjusted.
408         * tree-ssa-tail-merge.c (replace_block_by): Use
409         combine_with_count.
410
411 2018-01-23  Andrew Waterman  <andrew@sifive.com>
412             Jim Wilson  <jimw@sifive.com>
413
414         * config/riscv/riscv.c (riscv_stack_boundary): New.
415         (riscv_option_override): Set riscv_stack_boundary.  Handle
416         riscv_preferred_stack_boundary_arg.
417         * config/riscv/riscv.h (MIN_STACK_BOUNDARY, ABI_STACK_BOUNDARY): New.
418         (BIGGEST_ALIGNMENT): Set to STACK_BOUNDARY.
419         (STACK_BOUNDARY): Set to riscv_stack_boundary.
420         (RISCV_STACK_ALIGN): Use STACK_BOUNDARY.
421         * config/riscv/riscv.opt (mpreferred-stack-boundary): New.
422         * doc/invoke.tex (RISC-V Options): Add -mpreferred-stack-boundary.
423
424 2018-01-23  H.J. Lu  <hongjiu.lu@intel.com>
425
426         PR target/83905
427         * config/i386/i386.c (ix86_expand_prologue): Use cost reference
428         of struct ix86_frame.
429         (ix86_expand_epilogue): Likewise.  Add a local variable for
430         the reg_save_offset field in struct ix86_frame.
431
432 2018-01-23  Bin Cheng  <bin.cheng@arm.com>
433
434         PR tree-optimization/82604
435         * tree-loop-distribution.c (enum partition_kind): New enum item
436         PKIND_PARTIAL_MEMSET.
437         (partition_builtin_p): Support above new enum item.
438         (generate_code_for_partition): Ditto.
439         (compute_access_range): Differentiate cases that equality can be
440         proven at all loops, the innermost loops or no loops.
441         (classify_builtin_st, classify_builtin_ldst): Adjust call to above
442         function.  Set PKIND_PARTIAL_MEMSET for partition appropriately.
443         (finalize_partitions, distribute_loop): Don't fuse partition of
444         PKIND_PARTIAL_MEMSET kind when distributing 3-level loop nest.
445         (prepare_perfect_loop_nest): Distribute 3-level loop nest only if
446         parloop is enabled.
447
448 2018-01-23  Martin Liska  <mliska@suse.cz>
449
450         * predict.def (PRED_INDIR_CALL): Set probability to PROB_EVEN in
451         order to ignore the predictor.
452         (PRED_POLYMORPHIC_CALL): Likewise.
453         (PRED_RECURSIVE_CALL): Likewise.
454
455 2018-01-23  Martin Liska  <mliska@suse.cz>
456
457         * tree-profile.c (tree_profiling): Print function header to
458         aware reader which function we are working on.
459         * value-prof.c (gimple_find_values_to_profile): Do not print
460         not interesting value histograms.
461
462 2018-01-23  Martin Liska  <mliska@suse.cz>
463
464         * profile-count.h (enum profile_quality): Add
465         profile_uninitialized as the first value. Do not number values
466         as they are zero based.
467         (profile_count::verify): Update sanity check.
468         (profile_probability::verify): Likewise.
469
470 2018-01-23  Nathan Sidwell  <nathan@acm.org>
471
472         * doc/invoke.texi (ffor-scope): Deprecate.
473
474 2018-01-23  David Malcolm  <dmalcolm@redhat.com>
475
476         PR tree-optimization/83510
477         * domwalk.c (set_all_edges_as_executable): New function.
478         (dom_walker::dom_walker): Convert bool param
479         "skip_unreachable_blocks" to enum reachability.  Move setup of
480         edge flags to set_all_edges_as_executable and only do it when
481         reachability is REACHABLE_BLOCKS.
482         * domwalk.h (enum dom_walker::reachability): New enum.
483         (dom_walker::dom_walker): Convert bool param
484         "skip_unreachable_blocks" to enum reachability.
485         (set_all_edges_as_executable): New decl.
486         * graphite-scop-detection.c  (gather_bbs::gather_bbs): Convert
487         from false for "skip_unreachable_blocks" to ALL_BLOCKS for
488         "reachability".
489         * tree-ssa-dom.c (dom_opt_dom_walker::dom_opt_dom_walker): Likewise,
490         but converting true to REACHABLE_BLOCKS.
491         * tree-ssa-sccvn.c (sccvn_dom_walker::sccvn_dom_walker): Likewise.
492         * tree-vrp.c
493         (check_array_bounds_dom_walker::check_array_bounds_dom_walker):
494         Likewise, but converting it to REACHABLE_BLOCKS_PRESERVING_FLAGS.
495         (vrp_dom_walker::vrp_dom_walker): Likewise, but converting it to
496         REACHABLE_BLOCKS.
497         (vrp_prop::vrp_finalize): Call set_all_edges_as_executable
498         if check_all_array_refs will be called.
499
500 2018-01-23  David Malcolm  <dmalcolm@redhat.com>
501
502         * tree.c (selftest::test_location_wrappers): Add more test
503         coverage.
504
505 2018-01-23  David Malcolm  <dmalcolm@redhat.com>
506
507         * sbitmap.c (selftest::test_set_range): Fix memory leaks.
508         (selftest::test_bit_in_range): Likewise.
509
510 2018-01-23  Richard Sandiford  <richard.sandiford@linaro.org>
511
512         PR testsuite/83888
513         * doc/sourcebuild.texi (vect_float): Say that the selector
514         only describes the situation when -funsafe-math-optimizations is on.
515         (vect_float_strict): Document.
516
517 2018-01-23  Richard Sandiford  <richard.sandiford@linaro.org>
518
519         PR tree-optimization/83965
520         * tree-vect-patterns.c (vect_reassociating_reduction_p): New function.
521         (vect_recog_dot_prod_pattern, vect_recog_sad_pattern): Use it
522         instead of checking only for a reduction.
523         (vect_recog_widen_sum_pattern): Likewise.
524
525 2018-01-23  Jan Hubicka  <hubicka@ucw.cz>
526
527         * predict.c (probably_never_executed): Only use precise profile info.
528         (compute_function_frequency): Skip after inlining hack since we now
529         have quality checking.
530
531 2018-01-23  Jan Hubicka  <hubicka@ucw.cz>
532
533         * profile-count.h (profile_probability::very_unlikely,
534         profile_probability::unlikely, profile_probability::even): Set
535         precision to guessed.
536
537 2018-01-23  Richard Biener  <rguenther@suse.de>
538
539         PR tree-optimization/83963
540         * graphite-scop-detection.c (scop_detection::harmful_loop_in_region):
541         Properly terminate dominator walk when crossing the exit edge not
542         when visiting its source block.
543
544 2018-01-23  Jakub Jelinek  <jakub@redhat.com>
545
546         PR c++/83918
547         * tree.c (maybe_wrap_with_location): Use NON_LVALUE_EXPR rather than
548         VIEW_CONVERT_EXPR to wrap CONST_DECLs.
549
550 2018-01-22  Jakub Jelinek  <jakub@redhat.com>
551
552         PR tree-optimization/83957
553         * omp-expand.c (expand_omp_for_generic): Ignore virtual PHIs.  Remove
554         semicolon after for body surrounded by braces.
555
556         PR tree-optimization/83081
557         * profile-count.h (profile_probability::split): New method.
558         * dojump.c (do_jump_1) <case TRUTH_ANDIF_EXPR, case TRUTH_ORIF_EXPR>:
559         Use profile_probability::split.
560         (do_compare_rtx_and_jump): Fix adjustment of probabilities
561         when splitting a single conditional jump into 2.
562
563 2018-01-22  David Malcolm  <dmalcolm@redhat.com>
564
565         PR tree-optimization/69452
566         * tree-ssa-loop-im.c (class move_computations_dom_walker): Remove
567         decl.
568
569 2018-01-22  Sebastian Perta  <sebastian.perta@renesas.com>
570
571         * config/rl78/rl78-expand.md: New define_expand "bswaphi2"
572         * config/rl78/rl78-virt.md: New define_insn "*bswaphi2_virt"
573         * config/rl78/rl78-real.md: New define_insn "*bswaphi2_real"
574
575 2018-01-22  Sebastian Perta  <sebastian.perta@renesas.com>
576
577         * config/rl78/rl78-protos.h: New function declaration rl78_split_movdi
578         * config/rl78/rl78.md: New define_expand "movdi"
579         * config/rl78/rl78.c: New function definition rl78_split_movdi
580
581 2018-01-22  Michael Meissner  <meissner@linux.vnet.ibm.com>
582
583         PR target/83862
584         * config/rs6000/rs6000-protos.h (rs6000_split_signbit): Delete,
585         no longer used.
586         * config/rs6000/rs6000.c (rs6000_split_signbit): Likewise.
587         * config/rs6000/rs6000.md (signbit<mode>2): Change code for IEEE
588         128-bit to produce an UNSPEC move to get the double word with the
589         signbit and then a shift directly to do signbit.
590         (signbit<mode>2_dm): Replace old IEEE 128-bit signbit
591         implementation with a new version that just does either a direct
592         move or a regular move.  Move memory interface to separate insns.
593         Move insns so they are next to the expander.
594         (signbit<mode>2_dm_mem_be): New combiner insns to combine load
595         with signbit move.  Split big and little endian case.
596         (signbit<mode>2_dm_mem_le): Likewise.
597         (signbit<mode>2_dm_<su>ext): Delete, no longer used.
598         (signbit<mode>2_dm2): Likewise.
599
600 2018-01-22  Sebastian Perta  <sebastian.perta@renesas.com>
601
602         * config/rl78/rl78.md: New define_expand "anddi3".
603
604 2018-01-22  Sebastian Perta  <sebastian.perta@renesas.com>
605
606         * config/rl78/rl78.md: New define_expand "umindi3".
607
608 2018-01-22  Sebastian Perta  <sebastian.perta@renesas.com>
609
610         * config/rl78/rl78.md: New define_expand "smindi3".
611
612 2018-01-22  Sebastian Perta  <sebastian.perta@renesas.com>
613
614         * config/rl78/rl78.md: New define_expand "smaxdi3".
615
616 2018-01-22 Carl Love <cel@us.ibm.com>
617
618         * config/rs6000/rs6000-builtin.def (ST_ELEMREV_V1TI, LD_ELEMREV_V1TI,
619         LVX_V1TI): Add macro expansion.
620         * config/rs6000/rs6000-c.c (altivec_builtin_types): Add argument
621         definitions for VSX_BUILTIN_VEC_XST_BE, VSX_BUILTIN_VEC_ST,
622         VSX_BUILTIN_VEC_XL, LD_ELEMREV_V1TI builtins.
623         * config/rs6000/rs6000-p8swap.c (insn_is_swappable_p);
624         Change check to determine if the instruction is a byte reversing
625         entry.  Fix typo in comment.
626         * config/rs6000/rs6000.c (altivec_expand_builtin): Add case entry
627         for VSX_BUILTIN_ST_ELEMREV_V1TI and VSX_BUILTIN_LD_ELEMREV_V1TI.
628         Add def_builtin calls for new builtins.
629         * config/rs6000/vsx.md (vsx_st_elemrev_v1ti, vsx_ld_elemrev_v1ti):
630         Add define_insn expansion.
631
632 2018-01-22  Sebastian Perta  <sebastian.perta@renesas.com>
633
634         * config/rl78/rl78.md: New define_expand "umaxdi3".
635
636 2018-01-22  Sebastian Perta  <sebastian.perta@renesas.com>
637
638         * config/rl78/rl78.c (rl78_note_reg_set): fixed dead reg check
639         for non-QImode registers
640
641 2018-01-22  Richard Biener  <rguenther@suse.de>
642
643         PR tree-optimization/83963
644         * graphite-scop-detection.c (scop_detection::get_sese): Delay
645         including the loop exit block.
646         (scop_detection::merge_sese): Likewise.
647         (scop_detection::add_scop): Do it here instead.
648
649 2018-01-22  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
650
651         * doc/sourcebuild.texi (arm_softfloat): Document.
652
653 2018-01-21  John David Anglin  <danglin@gcc.gnu.org>
654
655         PR gcc/77734
656         * config/pa/pa.c (pa_function_ok_for_sibcall): Use
657         targetm.binds_local_p instead of TREE_PUBLIC to check local binding.
658         Move TARGET_PORTABLE_RUNTIME check after TARGET_64BIT check.
659
660 2018-01-21  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
661             David Edelsohn <dje.gcc@gmail.com>
662
663         PR target/83946
664         * config/rs6000/rs6000.md (*call_indirect_nonlocal_sysv<mode>):
665         Change "crset eq" to "crset 2".
666         (*call_value_indirect_nonlocal_sysv<mode>): Likewise.
667         (*call_indirect_aix<mode>_nospec): Likewise.
668         (*call_value_indirect_aix<mode>_nospec): Likewise.
669         (*call_indirect_elfv2<mode>_nospec): Likewise.
670         (*call_value_indirect_elfv2<mode>_nospec): Likewise.
671         (*sibcall_nonlocal_sysv<mode>): Change "crset eq" to "crset 2";
672         change assembly output from . to $.
673         (*sibcall_value_nonlocal_sysv<mode>): Likewise.
674         (indirect_jump<mode>_nospec): Change assembly output from . to $.
675         (*tablejump<mode>_internal1_nospec): Likewise.
676
677 2018-01-21  Oleg Endo  <olegendo@gcc.gnu.org>
678
679         PR target/80870
680         * config/sh/sh_optimize_sett_clrt.cc:
681         Use INCLUDE_ALGORITHM and INCLUDE_VECTOR instead of direct includes.
682
683 2018-01-20  Richard Sandiford  <richard.sandiford@linaro.org>
684
685         PR tree-optimization/83940
686         * tree-vect-stmts.c (vect_truncate_gather_scatter_offset): Set
687         offset_dt to vect_constant_def rather than vect_unknown_def_type.
688         (vect_check_load_store_mask): Add a mask_dt_out parameter and
689         use it to pass back the definition type.
690         (vect_check_store_rhs): Likewise rhs_dt_out.
691         (vect_build_gather_load_calls): Add a mask_dt argument and use
692         it instead of a call to vect_is_simple_use.
693         (vectorizable_store): Update calls to vect_check_load_store_mask
694         and vect_check_store_rhs.  Use the dt returned by the latter instead
695         of scatter_src_dt.  Use the cached mask_dt and gs_info.offset_dt
696         instead of calls to vect_is_simple_use.  Pass the scalar rather
697         than the vector operand to vect_is_simple_use when handling
698         second and subsequent copies of an rhs value.
699         (vectorizable_load): Update calls to vect_check_load_store_mask
700         and vect_build_gather_load_calls.  Use the cached mask_dt and
701         gs_info.offset_dt instead of calls to vect_is_simple_use.
702
703 2018-01-20  Jakub Jelinek  <jakub@redhat.com>
704
705         PR middle-end/83945
706         * tree-emutls.c: Include gimplify.h.
707         (lower_emutls_2): New function.
708         (lower_emutls_1): If ADDR_EXPR is a gimple invariant and walk_tree
709         with lower_emutls_2 callback finds some TLS decl in it, unshare_expr
710         it before further processing.
711
712         PR target/83930
713         * simplify-rtx.c (simplify_binary_operation_1) <case UMOD>: Use
714         UINTVAL (trueop1) instead of INTVAL (op1).
715
716 2018-01-19  Jakub Jelinek  <jakub@redhat.com>
717
718         PR debug/81570
719         PR debug/83728
720         * dwarf2cfi.c (DEFAULT_INCOMING_FRAME_SP_OFFSET): Define to
721         INCOMING_FRAME_SP_OFFSET if not defined.
722         (scan_trace): Add ENTRY argument.  If true and
723         DEFAULT_INCOMING_FRAME_SP_OFFSET != INCOMING_FRAME_SP_OFFSET,
724         emit a note to adjust the CFA offset.
725         (create_cfi_notes): Adjust scan_trace callers.
726         (create_cie_data): Use DEFAULT_INCOMING_FRAME_SP_OFFSET rather than
727         INCOMING_FRAME_SP_OFFSET in the CIE.
728         * config/i386/i386.h (DEFAULT_INCOMING_FRAME_SP_OFFSET): Define.
729         * config/stormy16/stormy16.h (DEFAULT_INCOMING_FRAME_SP_OFFSET):
730         Likewise.
731         * doc/tm.texi.in (DEFAULT_INCOMING_FRAME_SP_OFFSET): Document.
732         * doc/tm.texi: Regenerated.
733
734 2018-01-19  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
735
736         PR rtl-optimization/83147
737         * lra-constraints.c (remove_inheritance_pseudos): Use
738         lra_substitute_pseudo_within_insn.
739
740 2018-01-19  Tom de Vries  <tom@codesourcery.com>
741             Cesar Philippidis  <cesar@codesourcery.com>
742
743         PR target/83920
744         * config/nvptx/nvptx.c (nvptx_single): Fix jit workaround.
745
746 2018-01-19  Cesar Philippidis  <cesar@codesourcery.com>
747
748         PR target/83790
749         * config/nvptx/nvptx.c (output_init_frag): Don't use generic address
750         spaces for function labels.
751
752 2018-01-19  Martin Liska  <mliska@suse.cz>
753
754         * predict.def (PRED_LOOP_EXIT): Change from 85 to 89.
755         (PRED_LOOP_EXIT_WITH_RECURSION): Change from 72 to 78.
756         (PRED_LOOP_EXTRA_EXIT): Change from 83 to 67.
757         (PRED_OPCODE_POSITIVE): Change from 64 to 59.
758         (PRED_TREE_OPCODE_POSITIVE): Change from 64 to 59.
759         (PRED_CONST_RETURN): Change from 69 to 65.
760         (PRED_NULL_RETURN): Change from 91 to 71.
761         (PRED_LOOP_IV_COMPARE_GUESS): Change from 98 to 64.
762         (PRED_LOOP_GUARD): Change from 66 to 73.
763
764 2018-01-19  Martin Liska  <mliska@suse.cz>
765
766         * predict.c (predict_insn_def): Add new assert.
767         (struct branch_predictor): Change type to signed integer.
768         (test_prediction_value_range): Amend test to cover
769         PROB_UNINITIALIZED.
770         * predict.def (PRED_LOOP_ITERATIONS): Use the new constant.
771         (PRED_LOOP_ITERATIONS_GUESSED): Likewise.
772         (PRED_LOOP_ITERATIONS_MAX): Likewise.
773         (PRED_LOOP_IV_COMPARE): Likewise.
774         * predict.h (PROB_UNINITIALIZED): Define new constant.
775
776 2018-01-19  Martin Liska  <mliska@suse.cz>
777
778         * predict.c (dump_prediction): Add new format for
779         analyze_brprob.py script which is enabled with -details
780         suboption.
781         * profile-count.h (precise_p): New function.
782
783 2018-01-19  Richard Sandiford  <richard.sandiford@linaro.org>
784
785         PR tree-optimization/83922
786         * tree-vect-loop.c (vect_verify_full_masking): Return false if
787         there are no statements that need masking.
788         (vect_active_double_reduction_p): New function.
789         (vect_analyze_loop_operations): Use it when handling phis that
790         are not in the loop header.
791
792 2018-01-19  Richard Sandiford  <richard.sandiford@linaro.org>
793
794         PR tree-optimization/83914
795         * tree-vect-loop.c (vectorizable_induction): Don't convert
796         init_expr or apply the peeling adjustment for inductions
797         that are nested within the vectorized loop.
798
799 2018-01-19  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
800
801         * config/arm/thumb2.md (*thumb2_negsi2_short): Use RSB mnemonic
802         instead of NEG.
803
804 2018-01-18  Jakub Jelinek  <jakub@redhat.com>
805
806         PR sanitizer/81715
807         PR testsuite/83882
808         * function.h (gimplify_parameters): Add gimple_seq * argument.
809         * function.c: Include gimple.h and options.h.
810         (gimplify_parameters): Add cleanup argument, add CLOBBER stmts
811         for the added local temporaries if needed.
812         * gimplify.c (gimplify_body): Adjust gimplify_parameters caller,
813         if there are any parameter cleanups, wrap whole body into a
814         try/finally with the cleanups.
815
816 2018-01-18  Wilco Dijkstra  <wdijkstr@arm.com>
817
818         PR target/82964
819         * config/aarch64/aarch64.c (aarch64_legitimate_constant_p):
820         Use GET_MODE_CLASS for scalar floating point.
821
822 2018-01-18  Jan Hubicka  <hubicka@ucw.cz>
823
824         PR ipa/82256
825         patch by PaX Team
826         * cgraphclones.c (cgraph_node::create_version_clone_with_body):
827         Fix call of call_cgraph_insertion_hooks.
828
829 2018-01-18  Martin Sebor  <msebor@redhat.com>
830
831         * doc/invoke.texi (-Wclass-memaccess): Tweak text.
832
833 2018-01-18  Jan Hubicka  <hubicka@ucw.cz>
834
835         PR ipa/83619
836         * cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Update edge
837         frequencies.
838
839 2018-01-18  Boris Kolpackov  <boris@codesynthesis.com>
840
841         PR other/70268
842         * common.opt: (-ffile-prefix-map): New option.
843         * opts.c (common_handle_option): Defer it.
844         * opts-global.c (handle_common_deferred_options): Handle it.
845         * debug.h (remap_debug_filename, add_debug_prefix_map): Move to...
846         * file-prefix-map.h: New file.
847         (remap_debug_filename, add_debug_prefix_map): ...here.
848         (add_macro_prefix_map, add_file_prefix_map, remap_macro_filename): New.
849         * final.c (debug_prefix_map, add_debug_prefix_map
850         remap_debug_filename): Move to...
851         * file-prefix-map.c: New file.
852         (file_prefix_map, add_prefix_map, remap_filename) ...here and rename,
853         generalize, get rid of alloca(), use strrchr() instead of strchr().
854         (add_macro_prefix_map, add_debug_prefix_map, add_file_prefix_map):
855         Implement in terms of add_prefix_map().
856         (remap_macro_filename, remap_debug_filename): Implement in term of
857         remap_filename().
858         * Makefile.in (OBJS, PLUGIN_HEADERS): Add new files.
859         * builtins.c (fold_builtin_FILE): Call remap_macro_filename().
860         * dbxout.c: Include file-prefix-map.h.
861         * varasm.c: Likewise.
862         * vmsdbgout.c: Likewise.
863         * xcoffout.c: Likewise.
864         * dwarf2out.c: Likewise plus omit new options from DW_AT_producer.
865         * doc/cppopts.texi (-fmacro-prefix-map): Document.
866         * doc/invoke.texi (-ffile-prefix-map): Document.
867         (-fdebug-prefix-map): Update description.
868
869 2018-01-18  Martin Liska  <mliska@suse.cz>
870
871         * config/i386/i386.c (indirect_thunk_name): Document that also
872         lfence is emitted.
873         (output_indirect_thunk): Document why both instructions
874         (pause and lfence) are generated.
875
876 2018-01-18  Richard Biener  <rguenther@suse.de>
877
878         PR tree-optimization/83887
879         * graphite-scop-detection.c
880         (scop_detection::get_nearest_dom_with_single_entry): Remove.
881         (scop_detection::get_nearest_pdom_with_single_exit): Likewise.
882         (scop_detection::merge_sese): Re-implement with a flood-fill
883         algorithm that properly finds a SESE region if it exists.
884
885 2018-01-18  Jakub Jelinek  <jakub@redhat.com>
886
887         PR c/61240
888         * match.pd ((P + A) - P, P - (P + A), (P + A) - (P + B)): For
889         pointer_diff optimizations use view_convert instead of convert.
890
891 2018-01-17  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
892
893         * config/rs6000/rs6000.md (*call_indirect_nonlocal_sysv<mode>):
894         Generate different code for -mno-speculate-indirect-jumps.
895         (*call_value_indirect_nonlocal_sysv<mode>): Likewise.
896         (*call_indirect_aix<mode>): Disable for
897         -mno-speculate-indirect-jumps.
898         (*call_indirect_aix<mode>_nospec): New define_insn.
899         (*call_value_indirect_aix<mode>): Disable for
900         -mno-speculate-indirect-jumps.
901         (*call_value_indirect_aix<mode>_nospec): New define_insn.
902         (*sibcall_nonlocal_sysv<mode>): Generate different code for
903         -mno-speculate-indirect-jumps.
904         (*sibcall_value_nonlocal_sysv<mode>): Likewise.
905
906 2018-01-17  Michael Meissner  <meissner@linux.vnet.ibm.com>
907
908         * config/rs6000/rs6000.c (rs6000_emit_move): If we load or store a
909         long double type, set the flags for noting the default long double
910         type, even if we don't pass or return a long double type.
911
912 2018-01-17  Jan Hubicka  <hubicka@ucw.cz>
913
914         PR ipa/83051
915         * ipa-inline.c (flatten_function): Do not overwrite final inlining
916         failure.
917
918 2018-01-17  Will Schmidt  <will_schmidt@vnet.ibm.com>
919
920         * config/rs6000/rs6000.c (rs6000_gimple_builtin): Add gimple folding
921         support for merge[hl].
922         (fold_mergehl_helper): New helper function.
923         (tree-vector-builder.h): New #include for tree_vector_builder usage.
924         * config/rs6000/altivec.md (altivec_vmrghw_direct): Add xxmrghw insn.
925         (altivec_vmrglw_direct): Add xxmrglw insn.
926
927 2018-01-17  Andrew Waterman  <andrew@sifive.com>
928
929         * config/riscv/riscv.c (riscv_conditional_register_usage): If
930         UNITS_PER_FP_ARG is 0, set call_used_regs to 1 for all FP regs.
931
932 2018-01-17  David Malcolm  <dmalcolm@redhat.com>
933
934         PR lto/83121
935         * ipa-devirt.c (add_type_duplicate): When comparing memory layout,
936         call the lto_location_cache before reading the
937         DECL_SOURCE_LOCATION of the types.
938
939 2018-01-17  Wilco Dijkstra  <wdijkstr@arm.com>
940             Richard Sandiford  <richard.sandiford@linaro.org>
941
942         * config/aarch64/aarch64.md (movti_aarch64): Use Uti constraint.
943         * config/aarch64/aarch64.c (aarch64_mov128_immediate): New function.
944         (aarch64_legitimate_constant_p): Just support CONST_DOUBLE
945         SF/DF/TF mode to avoid creating illegal CONST_WIDE_INT immediates.
946         * config/aarch64/aarch64-protos.h (aarch64_mov128_immediate):
947         Add declaration.
948         * config/aarch64/constraints.md (aarch64_movti_operand):
949         Limit immediates.
950         * config/aarch64/predicates.md (Uti): Add new constraint.
951
952 2018-01-17 Carl Love  <cel@us.ibm.com>
953         * config/rs6000/vsx.md (define_expand xl_len_r,
954         define_expand stxvl, define_expand *stxvl): Add match_dup argument.
955         (define_insn): Add, match_dup 1 argument to define_insn stxvll and
956         lxvll.
957         (define_expand, define_insn): Move the shift left from  the
958         define_insn to the define_expand for lxvl and stxvl instructions.
959         * config/rs6000/rs6000-builtin.def (BU_P9V_64BIT_VSX_2): Change LXVL
960         and XL_LEN_R definitions to PURE.
961
962 2018-01-17  Uros Bizjak  <ubizjak@gmail.com>
963
964         * config/i386/i386.c (indirect_thunk_name): Declare regno
965         as unsigned int.  Compare regno with INVALID_REGNUM.
966         (output_indirect_thunk): Ditto.
967         (output_indirect_thunk_function): Ditto.
968         (ix86_code_end): Declare regno as unsigned int.  Use INVALID_REGNUM
969         in the call to output_indirect_thunk_function.
970
971 2018-01-17  Richard Sandiford  <richard.sandiford@linaro.org>
972
973         PR middle-end/83884
974         * expr.c (expand_expr_real_1): Use the size of GET_MODE (op0)
975         rather than the size of inner_type to determine the stack slot size
976         when handling VIEW_CONVERT_EXPRs on strict-alignment targets.
977
978 2018-01-16  Sebastian Peryt  <sebastian.peryt@intel.com>
979
980         PR target/83546
981         * config/i386/i386.c (ix86_option_override_internal): Add PTA_RDRND
982         to PTA_SILVERMONT.
983
984 2018-01-16  Michael Meissner  <meissner@linux.vnet.ibm.com>
985
986         * config.gcc (powerpc*-linux*-*): Add support for 64-bit little
987         endian Linux systems to optionally enable multilibs for selecting
988         the long double type if the user configured an explicit type.
989         * config/rs6000/rs6000.h (TARGET_IEEEQUAD_MULTILIB): Indicate we
990         have no long double multilibs if not defined.
991         * config/rs6000/rs6000.c (rs6000_option_override_internal): Do not
992         warn if the user used -mabi={ieee,ibm}longdouble and we built
993         multilibs for long double.
994         * config/rs6000/linux64.h (MULTILIB_DEFAULTS_IEEE): Define as the
995         appropriate multilib option.
996         (MULTILIB_DEFAULTS): Add MULTILIB_DEFAULTS_IEEE to the default
997         multilib options.
998         * config/rs6000/t-ldouble-linux64le-ibm: New configuration files
999         for building long double multilibs.
1000         * config/rs6000/t-ldouble-linux64le-ieee: Likewise.
1001
1002 2018-01-16  John David Anglin  <danglin@gcc.gnu.org>
1003
1004         * config.gcc (hppa*-*-linux*): Change callee copies ABI to caller
1005         copies.
1006
1007         * config/pa.h (MALLOC_ABI_ALIGNMENT): Set 32-bit alignment default to
1008         64 bits.
1009         * config/pa/pa32-linux.h (MALLOC_ABI_ALIGNMENT): Set alignment to
1010         128 bits.
1011
1012         * config/pa/som.h (ASM_DECLARE_FUNCTION_NAME): Cleanup type and mode
1013         variables.
1014
1015         * config/pa/pa.c (pa_function_arg_size): Apply CEIL to GET_MODE_SIZE
1016         return value.
1017
1018 2018-01-16  Eric Botcazou  <ebotcazou@adacore.com>
1019
1020         * gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref): For an
1021         ADDR_EXPR, do not count the offset of a COMPONENT_REF twice.
1022
1023 2018-01-16  Kelvin Nilsen  <kelvin@gcc.gnu.org>
1024
1025         * config/rs6000/rs6000-p8swap.c (rs6000_gen_stvx): Generate
1026         different rtl trees depending on TARGET_64BIT.
1027         (rs6000_gen_lvx): Likewise.
1028
1029 2018-01-16  Eric Botcazou  <ebotcazou@adacore.com>
1030
1031         * config/visium/visium.md (nop): Tweak comment.
1032         (hazard_nop): Likewise.
1033
1034 2018-01-16  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
1035
1036         * config/rs6000/rs6000.c (rs6000_opt_vars): Add entry for
1037         -mspeculate-indirect-jumps.
1038         * config/rs6000/rs6000.md (*call_indirect_elfv2<mode>): Disable
1039         for -mno-speculate-indirect-jumps.
1040         (*call_indirect_elfv2<mode>_nospec): New define_insn.
1041         (*call_value_indirect_elfv2<mode>): Disable for
1042         -mno-speculate-indirect-jumps.
1043         (*call_value_indirect_elfv2<mode>_nospec): New define_insn.
1044         (indirect_jump): Emit different RTL for
1045         -mno-speculate-indirect-jumps.
1046         (*indirect_jump<mode>): Disable for
1047         -mno-speculate-indirect-jumps.
1048         (*indirect_jump<mode>_nospec): New define_insn.
1049         (tablejump): Emit different RTL for
1050         -mno-speculate-indirect-jumps.
1051         (tablejumpsi): Disable for -mno-speculate-indirect-jumps.
1052         (tablejumpsi_nospec): New define_expand.
1053         (tablejumpdi): Disable for -mno-speculate-indirect-jumps.
1054         (tablejumpdi_nospec): New define_expand.
1055         (*tablejump<mode>_internal1): Disable for
1056         -mno-speculate-indirect-jumps.
1057         (*tablejump<mode>_internal1_nospec): New define_insn.
1058         * config/rs6000/rs6000.opt (mspeculate-indirect-jumps): New
1059         option.
1060
1061 2018-01-16  Artyom Skrobov tyomitch@gmail.com
1062
1063         * caller-save.c (insert_save): Drop unnecessary parameter.  All
1064         callers updated.
1065
1066 2018-01-16  Jakub Jelinek  <jakub@redhat.com>
1067             Richard Biener  <rguenth@suse.de>
1068
1069         PR libgomp/83590
1070         * gimplify.c (gimplify_one_sizepos): For is_gimple_constant (expr)
1071         return early, inline manually is_gimple_sizepos.  Make sure if we
1072         call gimplify_expr we don't end up with a gimple constant.
1073         * tree.c (variably_modified_type_p): Don't return true for
1074         is_gimple_constant (_t).  Inline manually is_gimple_sizepos.
1075         * gimplify.h (is_gimple_sizepos): Remove.
1076
1077 2018-01-16  Richard Sandiford  <richard.sandiford@linaro.org>
1078
1079         PR tree-optimization/83857
1080         * tree-vect-loop.c (vect_analyze_loop_operations): Don't call
1081         vectorizable_live_operation for pure SLP statements.
1082         (vectorizable_live_operation): Handle PHIs.
1083
1084 2018-01-16  Richard Biener  <rguenther@suse.de>
1085
1086         PR tree-optimization/83867
1087         * tree-vect-stmts.c (vect_transform_stmt): Precompute
1088         nested_in_vect_loop_p since the scalar stmt may get invalidated.
1089
1090 2018-01-16  Jakub Jelinek  <jakub@redhat.com>
1091
1092         PR c/83844
1093         * stor-layout.c (handle_warn_if_not_align): Use byte_position and
1094         multiple_of_p instead of unchecked tree_to_uhwi and UHWI check.
1095         If off is not INTEGER_CST, issue a may not be aligned warning
1096         rather than isn't aligned.  Use isn%'t rather than isn't.
1097         * fold-const.c (multiple_of_p) <case BIT_AND_EXPR>: Don't fall through
1098         into MULT_EXPR.
1099         <case MULT_EXPR>: Improve the case when bottom and one of the
1100         MULT_EXPR operands are INTEGER_CSTs and bottom is multiple of that
1101         operand, in that case check if the other operand is multiple of
1102         bottom divided by the INTEGER_CST operand.
1103
1104 2018-01-16  Richard Sandiford  <richard.sandiford@linaro.org>
1105
1106         PR target/83858
1107         * config/pa/pa.h (FUNCTION_ARG_SIZE): Delete.
1108         * config/pa/pa-protos.h (pa_function_arg_size): Declare.
1109         * config/pa/som.h (ASM_DECLARE_FUNCTION_NAME): Use
1110         pa_function_arg_size instead of FUNCTION_ARG_SIZE.
1111         * config/pa/pa.c (pa_function_arg_advance): Likewise.
1112         (pa_function_arg, pa_arg_partial_bytes): Likewise.
1113         (pa_function_arg_size): New function.
1114
1115 2018-01-16  Richard Sandiford  <richard.sandiford@linaro.org>
1116
1117         * fold-const.c (fold_ternary_loc): Construct the vec_perm_indices
1118         in a separate statement.
1119
1120 2018-01-16  Richard Sandiford  <richard.sandiford@linaro.org>
1121
1122         PR tree-optimization/83847
1123         * tree-vect-data-refs.c (vect_analyze_data_ref_accesses): Don't
1124         group gathers and scatters.
1125
1126 2018-01-16  Jakub Jelinek  <jakub@redhat.com>
1127
1128         PR rtl-optimization/86620
1129         * params.def (max-sched-ready-insns): Bump minimum value to 1.
1130
1131         PR rtl-optimization/83213
1132         * recog.c (peep2_attempt): Copy over CROSSING_JUMP_P from peepinsn
1133         to last if both are JUMP_INSNs.
1134
1135         PR tree-optimization/83843
1136         * gimple-ssa-store-merging.c
1137         (imm_store_chain_info::output_merged_store): Handle bit_not_p on
1138         store_immediate_info for bswap/nop orig_stores.
1139
1140 2018-01-15  Andrew Waterman  <andrew@sifive.com>
1141
1142         * config/riscv/riscv.c (riscv_rtx_costs) <MULT>: Increase cost if
1143         !TARGET_MUL.
1144         <UDIV>: Increase cost if !TARGET_DIV.
1145
1146 2018-01-15  Segher Boessenkool  <segher@kernel.crashing.org>
1147
1148         * config/rs6000/rs6000.md (define_attr "type"): Remove delayed_cr.
1149         (define_attr "cr_logical_3op"): New.
1150         (cceq_ior_compare): Adjust.
1151         (cceq_ior_compare_complement): Adjust.
1152         (*cceq_rev_compare): Adjust.
1153         * config/rs6000/rs6000.c (rs6000_adjust_cost): Adjust.
1154         (is_cracked_insn): Adjust.
1155         (insn_must_be_first_in_group): Adjust.
1156         * config/rs6000/40x.md: Adjust.
1157         * config/rs6000/440.md: Adjust.
1158         * config/rs6000/476.md: Adjust.
1159         * config/rs6000/601.md: Adjust.
1160         * config/rs6000/603.md: Adjust.
1161         * config/rs6000/6xx.md: Adjust.
1162         * config/rs6000/7450.md: Adjust.
1163         * config/rs6000/7xx.md: Adjust.
1164         * config/rs6000/8540.md: Adjust.
1165         * config/rs6000/cell.md: Adjust.
1166         * config/rs6000/e300c2c3.md: Adjust.
1167         * config/rs6000/e500mc.md: Adjust.
1168         * config/rs6000/e500mc64.md: Adjust.
1169         * config/rs6000/e5500.md: Adjust.
1170         * config/rs6000/e6500.md: Adjust.
1171         * config/rs6000/mpc.md: Adjust.
1172         * config/rs6000/power4.md: Adjust.
1173         * config/rs6000/power5.md: Adjust.
1174         * config/rs6000/power6.md: Adjust.
1175         * config/rs6000/power7.md: Adjust.
1176         * config/rs6000/power8.md: Adjust.
1177         * config/rs6000/power9.md: Adjust.
1178         * config/rs6000/rs64.md: Adjust.
1179         * config/rs6000/titan.md: Adjust.
1180
1181 2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>
1182
1183         * config/i386/predicates.md (indirect_branch_operand): Rewrite
1184         ix86_indirect_branch_register logic.
1185
1186 2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>
1187
1188         * config/i386/constraints.md (Bs): Update
1189         ix86_indirect_branch_register check.  Don't check
1190         ix86_indirect_branch_register with GOT_memory_operand.
1191         (Bw): Likewise.
1192         * config/i386/predicates.md (GOT_memory_operand): Don't check
1193         ix86_indirect_branch_register here.
1194         (GOT32_symbol_operand): Likewise.
1195
1196 2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>
1197
1198         * config/i386/predicates.md (constant_call_address_operand):
1199         Rewrite ix86_indirect_branch_register logic.
1200         (sibcall_insn_operand): Likewise.
1201
1202 2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>
1203
1204         * config/i386/constraints.md (Bs): Replace
1205         ix86_indirect_branch_thunk_register with
1206         ix86_indirect_branch_register.
1207         (Bw): Likewise.
1208         * config/i386/i386.md (indirect_jump): Likewise.
1209         (tablejump): Likewise.
1210         (*sibcall_memory): Likewise.
1211         (*sibcall_value_memory): Likewise.
1212         Peepholes of indirect call and jump via memory: Likewise.
1213         * config/i386/i386.opt: Likewise.
1214         * config/i386/predicates.md (indirect_branch_operand): Likewise.
1215         (GOT_memory_operand): Likewise.
1216         (call_insn_operand): Likewise.
1217         (sibcall_insn_operand): Likewise.
1218         (GOT32_symbol_operand): Likewise.
1219
1220 2018-01-15  Jakub Jelinek  <jakub@redhat.com>
1221
1222         PR middle-end/83837
1223         * omp-expand.c (expand_omp_atomic_pipeline): Use loaded_val
1224         type rather than type addr's type points to.
1225         (expand_omp_atomic_mutex): Likewise.
1226         (expand_omp_atomic): Likewise.
1227
1228 2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>
1229
1230         PR target/83839
1231         * config/i386/i386.c (output_indirect_thunk_function): Use
1232         ASM_OUTPUT_LABEL, instead of ASM_OUTPUT_DEF, for TARGET_MACHO
1233         for  __x86_return_thunk.
1234
1235 2018-01-15  Richard Biener  <rguenther@suse.de>
1236
1237         PR middle-end/83850
1238         * expmed.c (extract_bit_field_1): Fix typo.
1239
1240 2018-01-15  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
1241
1242         PR target/83687
1243         * config/arm/iterators.md (VF): New mode iterator.
1244         * config/arm/neon.md (neon_vabd<mode>_2): Use the above.
1245         Remove integer-related logic from pattern.
1246         (neon_vabd<mode>_3): Likewise.
1247
1248 2018-01-15  Jakub Jelinek  <jakub@redhat.com>
1249
1250         PR middle-end/82694
1251         * common.opt (fstrict-overflow): No longer an alias.
1252         (fwrapv-pointer): New option.
1253         * tree.h (TYPE_OVERFLOW_WRAPS, TYPE_OVERFLOW_UNDEFINED): Define
1254         also for pointer types based on flag_wrapv_pointer.
1255         * opts.c (common_handle_option) <case OPT_fstrict_overflow>: Set
1256         opts->x_flag_wrap[pv] to !value, clear opts->x_flag_trapv if
1257         opts->x_flag_wrapv got set.
1258         * fold-const.c (fold_comparison, fold_binary_loc): Revert 2017-08-01
1259         changes, just use TYPE_OVERFLOW_UNDEFINED on pointer type instead of
1260         POINTER_TYPE_OVERFLOW_UNDEFINED.
1261         * match.pd: Likewise in address comparison pattern.
1262         * doc/invoke.texi: Document -fwrapv and -fstrict-overflow.
1263
1264 2018-01-15  Richard Biener  <rguenther@suse.de>
1265
1266         PR lto/83804
1267         * tree.c (free_lang_data_in_type): Always unlink TYPE_DECLs
1268         from TYPE_FIELDS.  Free TYPE_BINFO if not used by devirtualization.
1269         Reset type names to their identifier if their TYPE_DECL doesn't
1270         have linkage (and thus is used for ODR and devirt).
1271         (save_debug_info_for_decl): Remove.
1272         (save_debug_info_for_type): Likewise.
1273         (add_tree_to_fld_list): Adjust.
1274         * tree-pretty-print.c (dump_generic_node): Make dumping of
1275         type names more robust.
1276
1277 2018-01-15  Richard Biener  <rguenther@suse.de>
1278
1279         * BASE-VER: Bump to 8.0.1.
1280
1281 2018-01-14  Martin Sebor  <msebor@redhat.com>
1282
1283         PR other/83508
1284         * builtins.c (check_access): Avoid warning when the no-warning bit
1285         is set.
1286
1287 2018-01-14  Cory Fields  <cory-nospam-@coryfields.com>
1288
1289         * tree-ssa-loop-im.c (sort_bbs_in_loop_postorder_cmp): Stabilize sort.
1290         * ira-color (allocno_hard_regs_compare): Likewise.
1291
1292 2018-01-14  Nathan Rossi  <nathan@nathanrossi.com>
1293
1294         PR target/83013
1295         * config/microblaze/microblaze.c (microblaze_asm_output_ident):
1296         Use .pushsection/.popsection.
1297
1298 2018-01-14  Martin Sebor  <msebor@redhat.com>
1299
1300         PR c++/81327
1301         * doc/invoke.texi (-Wlass-memaccess): Document suppression by casting.
1302
1303 2018-01-14  Jakub Jelinek  <jakub@redhat.com>
1304
1305         * config.gcc (i[34567]86-*-*): Remove one duplicate gfniintrin.h
1306         entry from extra_headers.
1307         (x86_64-*-*): Remove two duplicate gfniintrin.h entries from
1308         extra_headers, make the list bitwise identical to the i?86-*-* one.
1309
1310 2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>
1311
1312         * config/i386/i386.c (ix86_set_indirect_branch_type): Disallow
1313         -mcmodel=large with -mindirect-branch=thunk,
1314         -mindirect-branch=thunk-extern, -mfunction-return=thunk and
1315         -mfunction-return=thunk-extern.
1316         * doc/invoke.texi: Document -mcmodel=large is incompatible with
1317         -mindirect-branch=thunk, -mindirect-branch=thunk-extern,
1318         -mfunction-return=thunk and -mfunction-return=thunk-extern.
1319
1320 2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>
1321
1322         * config/i386/i386.c (print_reg): Print the name of the full
1323         integer register without '%'.
1324         (ix86_print_operand): Handle 'V'.
1325          * doc/extend.texi: Document 'V' modifier.
1326
1327 2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>
1328
1329         * config/i386/constraints.md (Bs): Disallow memory operand for
1330         -mindirect-branch-register.
1331         (Bw): Likewise.
1332         * config/i386/predicates.md (indirect_branch_operand): Likewise.
1333         (GOT_memory_operand): Likewise.
1334         (call_insn_operand): Likewise.
1335         (sibcall_insn_operand): Likewise.
1336         (GOT32_symbol_operand): Likewise.
1337         * config/i386/i386.md (indirect_jump): Call convert_memory_address
1338         for -mindirect-branch-register.
1339         (tablejump): Likewise.
1340         (*sibcall_memory): Likewise.
1341         (*sibcall_value_memory): Likewise.
1342         Disallow peepholes of indirect call and jump via memory for
1343         -mindirect-branch-register.
1344         (*call_pop): Replace m with Bw.
1345         (*call_value_pop): Likewise.
1346         (*sibcall_pop_memory): Replace m with Bs.
1347         * config/i386/i386.opt (mindirect-branch-register): New option.
1348         * doc/invoke.texi: Document -mindirect-branch-register option.
1349
1350 2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>
1351
1352         * config/i386/i386-protos.h (ix86_output_function_return): New.
1353         * config/i386/i386.c (ix86_set_indirect_branch_type): Also
1354         set function_return_type.
1355         (indirect_thunk_name): Add ret_p to indicate thunk for function
1356         return.
1357         (output_indirect_thunk_function): Pass false to
1358         indirect_thunk_name.
1359         (ix86_output_indirect_branch_via_reg): Likewise.
1360         (ix86_output_indirect_branch_via_push): Likewise.
1361         (output_indirect_thunk_function): Create alias for function
1362         return thunk if regno < 0.
1363         (ix86_output_function_return): New function.
1364         (ix86_handle_fndecl_attribute): Handle function_return.
1365         (ix86_attribute_table): Add function_return.
1366         * config/i386/i386.h (machine_function): Add
1367         function_return_type.
1368         * config/i386/i386.md (simple_return_internal): Use
1369         ix86_output_function_return.
1370         (simple_return_internal_long): Likewise.
1371         * config/i386/i386.opt (mfunction-return=): New option.
1372         (indirect_branch): Mention -mfunction-return=.
1373         * doc/extend.texi: Document function_return function attribute.
1374         * doc/invoke.texi: Document -mfunction-return= option.
1375
1376 2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>
1377
1378         * config/i386/i386-opts.h (indirect_branch): New.
1379         * config/i386/i386-protos.h (ix86_output_indirect_jmp): Likewise.
1380         * config/i386/i386.c (ix86_using_red_zone): Disallow red-zone
1381         with local indirect jump when converting indirect call and jump.
1382         (ix86_set_indirect_branch_type): New.
1383         (ix86_set_current_function): Call ix86_set_indirect_branch_type.
1384         (indirectlabelno): New.
1385         (indirect_thunk_needed): Likewise.
1386         (indirect_thunk_bnd_needed): Likewise.
1387         (indirect_thunks_used): Likewise.
1388         (indirect_thunks_bnd_used): Likewise.
1389         (INDIRECT_LABEL): Likewise.
1390         (indirect_thunk_name): Likewise.
1391         (output_indirect_thunk): Likewise.
1392         (output_indirect_thunk_function): Likewise.
1393         (ix86_output_indirect_branch_via_reg): Likewise.
1394         (ix86_output_indirect_branch_via_push): Likewise.
1395         (ix86_output_indirect_branch): Likewise.
1396         (ix86_output_indirect_jmp): Likewise.
1397         (ix86_code_end): Call output_indirect_thunk_function if needed.
1398         (ix86_output_call_insn): Call ix86_output_indirect_branch if
1399         needed.
1400         (ix86_handle_fndecl_attribute): Handle indirect_branch.
1401         (ix86_attribute_table): Add indirect_branch.
1402         * config/i386/i386.h (machine_function): Add indirect_branch_type
1403         and has_local_indirect_jump.
1404         * config/i386/i386.md (indirect_jump): Set has_local_indirect_jump
1405         to true.
1406         (tablejump): Likewise.
1407         (*indirect_jump): Use ix86_output_indirect_jmp.
1408         (*tablejump_1): Likewise.
1409         (simple_return_indirect_internal): Likewise.
1410         * config/i386/i386.opt (mindirect-branch=): New option.
1411         (indirect_branch): New.
1412         (keep): Likewise.
1413         (thunk): Likewise.
1414         (thunk-inline): Likewise.
1415         (thunk-extern): Likewise.
1416         * doc/extend.texi: Document indirect_branch function attribute.
1417         * doc/invoke.texi: Document -mindirect-branch= option.
1418
1419 2018-01-14  Jan Hubicka  <hubicka@ucw.cz>
1420
1421         PR ipa/83051
1422         * ipa-inline.c (edge_badness): Tolerate roundoff errors.
1423
1424 2018-01-14  Richard Sandiford  <richard.sandiford@linaro.org>
1425
1426         * ipa-inline.c (want_inline_small_function_p): Return false if
1427         inlining has already failed with CIF_FINAL_ERROR.
1428         (update_caller_keys): Call want_inline_small_function_p before
1429         can_inline_edge_p.
1430         (update_callee_keys): Likewise.
1431
1432 2018-01-10  Kelvin Nilsen  <kelvin@gcc.gnu.org>
1433
1434         * config/rs6000/rs6000-p8swap.c (rs6000_sum_of_two_registers_p):
1435         New function.
1436         (rs6000_quadword_masked_address_p): Likewise.
1437         (quad_aligned_load_p): Likewise.
1438         (quad_aligned_store_p): Likewise.
1439         (const_load_sequence_p): Add comment to describe the outer-most loop.
1440         (mimic_memory_attributes_and_flags): New function.
1441         (rs6000_gen_stvx): Likewise.
1442         (replace_swapped_aligned_store): Likewise.
1443         (rs6000_gen_lvx): Likewise.
1444         (replace_swapped_aligned_load): Likewise.
1445         (replace_swapped_load_constant): Capitalize argument name in
1446         comment describing this function.
1447         (rs6000_analyze_swaps): Add a third pass to search for vector loads
1448         and stores that access quad-word aligned addresses and replace
1449         with stvx or lvx instructions when appropriate.
1450         * config/rs6000/rs6000-protos.h (rs6000_sum_of_two_registers_p):
1451         New function prototype.
1452         (rs6000_quadword_masked_address_p): Likewise.
1453         (rs6000_gen_lvx): Likewise.
1454         (rs6000_gen_stvx): Likewise.
1455         * config/rs6000/vsx.md (*vsx_le_perm_load_<mode>): For modes
1456         VSX_D (V2DF, V2DI), modify this split to select lvx instruction
1457         when memory address is aligned.
1458         (*vsx_le_perm_load_<mode>): For modes VSX_W (V4SF, V4SI), modify
1459         this split to select lvx instruction when memory address is aligned.
1460         (*vsx_le_perm_load_v8hi): Modify this split to select lvx
1461         instruction when memory address is aligned.
1462         (*vsx_le_perm_load_v16qi): Likewise.
1463         (four unnamed splitters): Modify to select the stvx instruction
1464         when memory is aligned.
1465
1466 2018-01-13  Jan Hubicka  <hubicka@ucw.cz>
1467
1468         * predict.c (determine_unlikely_bbs): Handle correctly BBs
1469         which appears in the queue multiple times.
1470
1471 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1472             Alan Hayward  <alan.hayward@arm.com>
1473             David Sherwood  <david.sherwood@arm.com>
1474
1475         * tree-vectorizer.h (vec_lower_bound): New structure.
1476         (_loop_vec_info): Add check_nonzero and lower_bounds.
1477         (LOOP_VINFO_CHECK_NONZERO): New macro.
1478         (LOOP_VINFO_LOWER_BOUNDS): Likewise.
1479         (LOOP_REQUIRES_VERSIONING_FOR_ALIAS): Check lower_bounds too.
1480         * tree-data-ref.h (dr_with_seg_len): Add access_size and align
1481         fields.  Make seg_len the distance travelled, not including the
1482         access size.
1483         (dr_direction_indicator): Declare.
1484         (dr_zero_step_indicator): Likewise.
1485         (dr_known_forward_stride_p): Likewise.
1486         * tree-data-ref.c: Include stringpool.h, tree-vrp.h and
1487         tree-ssanames.h.
1488         (runtime_alias_check_p): Allow runtime alias checks with
1489         variable strides.
1490         (operator ==): Compare access_size and align.
1491         (prune_runtime_alias_test_list): Rework for new distinction between
1492         the access_size and seg_len.
1493         (create_intersect_range_checks_index): Likewise.  Cope with polynomial
1494         segment lengths.
1495         (get_segment_min_max): New function.
1496         (create_intersect_range_checks): Use it.
1497         (dr_step_indicator): New function.
1498         (dr_direction_indicator): Likewise.
1499         (dr_zero_step_indicator): Likewise.
1500         (dr_known_forward_stride_p): Likewise.
1501         * tree-loop-distribution.c (data_ref_segment_size): Return
1502         DR_STEP * (niters - 1).
1503         (compute_alias_check_pairs): Update call to the dr_with_seg_len
1504         constructor.
1505         * tree-vect-data-refs.c (vect_check_nonzero_value): New function.
1506         (vect_preserves_scalar_order_p): New function, split out from...
1507         (vect_analyze_data_ref_dependence): ...here.  Check for zero steps.
1508         (vect_vfa_segment_size): Return DR_STEP * (length_factor - 1).
1509         (vect_vfa_access_size): New function.
1510         (vect_vfa_align): Likewise.
1511         (vect_compile_time_alias): Take access_size_a and access_b arguments.
1512         (dump_lower_bound): New function.
1513         (vect_check_lower_bound): Likewise.
1514         (vect_small_gap_p): Likewise.
1515         (vectorizable_with_step_bound_p): Likewise.
1516         (vect_prune_runtime_alias_test_list): Ignore cross-iteration
1517         depencies if the vectorization factor is 1.  Convert the checks
1518         for nonzero steps into checks on the bounds of DR_STEP.  Try using
1519         a bunds check for variable steps if the minimum required step is
1520         relatively small. Update calls to the dr_with_seg_len
1521         constructor and to vect_compile_time_alias.
1522         * tree-vect-loop-manip.c (vect_create_cond_for_lower_bounds): New
1523         function.
1524         (vect_loop_versioning): Call it.
1525         * tree-vect-loop.c (vect_analyze_loop_2): Clear LOOP_VINFO_LOWER_BOUNDS
1526         when retrying.
1527         (vect_estimate_min_profitable_iters): Account for any bounds checks.
1528
1529 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1530             Alan Hayward  <alan.hayward@arm.com>
1531             David Sherwood  <david.sherwood@arm.com>
1532
1533         * doc/sourcebuild.texi (vect_scatter_store): Document.
1534         * optabs.def (scatter_store_optab, mask_scatter_store_optab): New
1535         optabs.
1536         * doc/md.texi (scatter_store@var{m}, mask_scatter_store@var{m}):
1537         Document.
1538         * genopinit.c (main): Add supports_vec_scatter_store and
1539         supports_vec_scatter_store_cached to target_optabs.
1540         * gimple.h (gimple_expr_type): Handle IFN_SCATTER_STORE and
1541         IFN_MASK_SCATTER_STORE.
1542         * internal-fn.def (SCATTER_STORE, MASK_SCATTER_STORE): New internal
1543         functions.
1544         * internal-fn.h (internal_store_fn_p): Declare.
1545         (internal_fn_stored_value_index): Likewise.
1546         * internal-fn.c (scatter_store_direct): New macro.
1547         (expand_scatter_store_optab_fn): New function.
1548         (direct_scatter_store_optab_supported_p): New macro.
1549         (internal_store_fn_p): New function.
1550         (internal_gather_scatter_fn_p): Handle IFN_SCATTER_STORE and
1551         IFN_MASK_SCATTER_STORE.
1552         (internal_fn_mask_index): Likewise.
1553         (internal_fn_stored_value_index): New function.
1554         (internal_gather_scatter_fn_supported_p): Adjust operand numbers
1555         for scatter stores.
1556         * optabs-query.h (supports_vec_scatter_store_p): Declare.
1557         * optabs-query.c (supports_vec_scatter_store_p): New function.
1558         * tree-vectorizer.h (vect_get_store_rhs): Declare.
1559         * tree-vect-data-refs.c (vect_analyze_data_ref_access): Return
1560         true for scatter stores.
1561         (vect_gather_scatter_fn_p): Handle scatter stores too.
1562         (vect_check_gather_scatter): Consider using scatter stores if
1563         supports_vec_scatter_store_p.
1564         * tree-vect-patterns.c (vect_try_gather_scatter_pattern): Handle
1565         scatter stores too.
1566         * tree-vect-stmts.c (exist_non_indexing_operands_for_use_p): Use
1567         internal_fn_stored_value_index.
1568         (check_load_store_masking): Handle scatter stores too.
1569         (vect_get_store_rhs): Make public.
1570         (vectorizable_call): Use internal_store_fn_p.
1571         (vectorizable_store): Handle scatter store internal functions.
1572         (vect_transform_stmt): Compare GROUP_STORE_COUNT with GROUP_SIZE
1573         when deciding whether the end of the group has been reached.
1574         * config/aarch64/aarch64.md (UNSPEC_ST1_SCATTER): New unspec.
1575         * config/aarch64/aarch64-sve.md (scatter_store<mode>): New expander.
1576         (mask_scatter_store<mode>): New insns.
1577
1578 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1579             Alan Hayward  <alan.hayward@arm.com>
1580             David Sherwood  <david.sherwood@arm.com>
1581
1582         * tree-vectorizer.h (vect_gather_scatter_fn_p): Declare.
1583         * tree-vect-data-refs.c (vect_gather_scatter_fn_p): Make public.
1584         * tree-vect-stmts.c (vect_truncate_gather_scatter_offset): New
1585         function.
1586         (vect_use_strided_gather_scatters_p): Take a masked_p argument.
1587         Use vect_truncate_gather_scatter_offset if we can't treat the
1588         operation as a normal gather load or scatter store.
1589         (get_group_load_store_type): Take the gather_scatter_info
1590         as argument.  Try using a gather load or scatter store for
1591         single-element groups.
1592         (get_load_store_type): Update calls to get_group_load_store_type
1593         and vect_use_strided_gather_scatters_p.
1594
1595 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1596             Alan Hayward  <alan.hayward@arm.com>
1597             David Sherwood  <david.sherwood@arm.com>
1598
1599         * tree-vectorizer.h (vect_create_data_ref_ptr): Take an extra
1600         optional tree argument.
1601         * tree-vect-data-refs.c (vect_check_gather_scatter): Check for
1602         null target hooks.
1603         (vect_create_data_ref_ptr): Take the iv_step as an optional argument,
1604         but continue to use the current value as a fallback.
1605         (bump_vector_ptr): Use operand_equal_p rather than tree_int_cst_compare
1606         to compare the updates.
1607         * tree-vect-stmts.c (vect_use_strided_gather_scatters_p): New function.
1608         (get_load_store_type): Use it when handling a strided access.
1609         (vect_get_strided_load_store_ops): New function.
1610         (vect_get_data_ptr_increment): Likewise.
1611         (vectorizable_load): Handle strided gather loads.  Always pass
1612         a step to vect_create_data_ref_ptr and bump_vector_ptr.
1613
1614 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1615             Alan Hayward  <alan.hayward@arm.com>
1616             David Sherwood  <david.sherwood@arm.com>
1617
1618         * doc/md.texi (gather_load@var{m}): Document.
1619         (mask_gather_load@var{m}): Likewise.
1620         * genopinit.c (main): Add supports_vec_gather_load and
1621         supports_vec_gather_load_cached to target_optabs.
1622         * optabs-tree.c (init_tree_optimization_optabs): Use
1623         ggc_cleared_alloc to allocate target_optabs.
1624         * optabs.def (gather_load_optab, mask_gather_laod_optab): New optabs.
1625         * internal-fn.def (GATHER_LOAD, MASK_GATHER_LOAD): New internal
1626         functions.
1627         * internal-fn.h (internal_load_fn_p): Declare.
1628         (internal_gather_scatter_fn_p): Likewise.
1629         (internal_fn_mask_index): Likewise.
1630         (internal_gather_scatter_fn_supported_p): Likewise.
1631         * internal-fn.c (gather_load_direct): New macro.
1632         (expand_gather_load_optab_fn): New function.
1633         (direct_gather_load_optab_supported_p): New macro.
1634         (direct_internal_fn_optab): New function.
1635         (internal_load_fn_p): Likewise.
1636         (internal_gather_scatter_fn_p): Likewise.
1637         (internal_fn_mask_index): Likewise.
1638         (internal_gather_scatter_fn_supported_p): Likewise.
1639         * optabs-query.c (supports_at_least_one_mode_p): New function.
1640         (supports_vec_gather_load_p): Likewise.
1641         * optabs-query.h (supports_vec_gather_load_p): Declare.
1642         * tree-vectorizer.h (gather_scatter_info): Add ifn, element_type
1643         and memory_type field.
1644         (NUM_PATTERNS): Bump to 15.
1645         * tree-vect-data-refs.c: Include internal-fn.h.
1646         (vect_gather_scatter_fn_p): New function.
1647         (vect_describe_gather_scatter_call): Likewise.
1648         (vect_check_gather_scatter): Try using internal functions for
1649         gather loads.  Recognize existing calls to a gather load function.
1650         (vect_analyze_data_refs): Consider using gather loads if
1651         supports_vec_gather_load_p.
1652         * tree-vect-patterns.c (vect_get_load_store_mask): New function.
1653         (vect_get_gather_scatter_offset_type): Likewise.
1654         (vect_convert_mask_for_vectype): Likewise.
1655         (vect_add_conversion_to_patterm): Likewise.
1656         (vect_try_gather_scatter_pattern): Likewise.
1657         (vect_recog_gather_scatter_pattern): New pattern recognizer.
1658         (vect_vect_recog_func_ptrs): Add it.
1659         * tree-vect-stmts.c (exist_non_indexing_operands_for_use_p): Use
1660         internal_fn_mask_index and internal_gather_scatter_fn_p.
1661         (check_load_store_masking): Take the gather_scatter_info as an
1662         argument and handle gather loads.
1663         (vect_get_gather_scatter_ops): New function.
1664         (vectorizable_call): Check internal_load_fn_p.
1665         (vectorizable_load): Likewise.  Handle gather load internal
1666         functions.
1667         (vectorizable_store): Update call to check_load_store_masking.
1668         * config/aarch64/aarch64.md (UNSPEC_LD1_GATHER): New unspec.
1669         * config/aarch64/iterators.md (SVE_S, SVE_D): New mode iterators.
1670         * config/aarch64/predicates.md (aarch64_gather_scale_operand_w)
1671         (aarch64_gather_scale_operand_d): New predicates.
1672         * config/aarch64/aarch64-sve.md (gather_load<mode>): New expander.
1673         (mask_gather_load<mode>): New insns.
1674
1675 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1676             Alan Hayward  <alan.hayward@arm.com>
1677             David Sherwood  <david.sherwood@arm.com>
1678
1679         * optabs.def (fold_left_plus_optab): New optab.
1680         * doc/md.texi (fold_left_plus_@var{m}): Document.
1681         * internal-fn.def (IFN_FOLD_LEFT_PLUS): New internal function.
1682         * internal-fn.c (fold_left_direct): Define.
1683         (expand_fold_left_optab_fn): Likewise.
1684         (direct_fold_left_optab_supported_p): Likewise.
1685         * fold-const-call.c (fold_const_fold_left): New function.
1686         (fold_const_call): Use it to fold CFN_FOLD_LEFT_PLUS.
1687         * tree-parloops.c (valid_reduction_p): New function.
1688         (gather_scalar_reductions): Use it.
1689         * tree-vectorizer.h (FOLD_LEFT_REDUCTION): New vect_reduction_type.
1690         (vect_finish_replace_stmt): Declare.
1691         * tree-vect-loop.c (fold_left_reduction_fn): New function.
1692         (needs_fold_left_reduction_p): New function, split out from...
1693         (vect_is_simple_reduction): ...here.  Accept reductions that
1694         forbid reassociation, but give them type FOLD_LEFT_REDUCTION.
1695         (vect_force_simple_reduction): Also store the reduction type in
1696         the assignment's STMT_VINFO_REDUC_TYPE.
1697         (vect_model_reduction_cost): Handle FOLD_LEFT_REDUCTION.
1698         (merge_with_identity): New function.
1699         (vect_expand_fold_left): Likewise.
1700         (vectorize_fold_left_reduction): Likewise.
1701         (vectorizable_reduction): Handle FOLD_LEFT_REDUCTION.  Leave the
1702         scalar phi in place for it.  Check for target support and reject
1703         cases that would reassociate the operation.  Defer the transform
1704         phase to vectorize_fold_left_reduction.
1705         * config/aarch64/aarch64.md (UNSPEC_FADDA): New unspec.
1706         * config/aarch64/aarch64-sve.md (fold_left_plus_<mode>): New expander.
1707         (*fold_left_plus_<mode>, *pred_fold_left_plus_<mode>): New insns.
1708
1709 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1710
1711         * tree-if-conv.c (predicate_mem_writes): Remove redundant
1712         call to ifc_temp_var.
1713
1714 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1715             Alan Hayward  <alan.hayward@arm.com>
1716             David Sherwood  <david.sherwood@arm.com>
1717
1718         * target.def (legitimize_address_displacement): Take the original
1719         offset as a poly_int.
1720         * targhooks.h (default_legitimize_address_displacement): Update
1721         accordingly.
1722         * targhooks.c (default_legitimize_address_displacement): Likewise.
1723         * doc/tm.texi: Regenerate.
1724         * lra-constraints.c (base_plus_disp_to_reg): Take the displacement
1725         as an argument, moving assert of ad->disp == ad->disp_term to...
1726         (process_address_1): ...here.  Update calls to base_plus_disp_to_reg.
1727         Try calling targetm.legitimize_address_displacement before expanding
1728         the address rather than afterwards, and adjust for the new interface.
1729         * config/aarch64/aarch64.c (aarch64_legitimize_address_displacement):
1730         Match the new hook interface.  Handle SVE addresses.
1731         * config/sh/sh.c (sh_legitimize_address_displacement): Make the
1732         new hook interface.
1733
1734 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1735
1736         * Makefile.in (OBJS): Add early-remat.o.
1737         * target.def (select_early_remat_modes): New hook.
1738         * doc/tm.texi.in (TARGET_SELECT_EARLY_REMAT_MODES): New hook.
1739         * doc/tm.texi: Regenerate.
1740         * targhooks.h (default_select_early_remat_modes): Declare.
1741         * targhooks.c (default_select_early_remat_modes): New function.
1742         * timevar.def (TV_EARLY_REMAT): New timevar.
1743         * passes.def (pass_early_remat): New pass.
1744         * tree-pass.h (make_pass_early_remat): Declare.
1745         * early-remat.c: New file.
1746         * config/aarch64/aarch64.c (aarch64_select_early_remat_modes): New
1747         function.
1748         (TARGET_SELECT_EARLY_REMAT_MODES): Define.
1749
1750 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1751             Alan Hayward  <alan.hayward@arm.com>
1752             David Sherwood  <david.sherwood@arm.com>
1753
1754         * tree-vect-loop-manip.c (vect_gen_scalar_loop_niters): Replace
1755         vfm1 with a bound_epilog parameter.
1756         (vect_do_peeling): Update calls accordingly, and move the prologue
1757         call earlier in the function.  Treat the base bound_epilog as 0 for
1758         fully-masked loops and retain vf - 1 for other loops.  Add 1 to
1759         this base when peeling for gaps.
1760         * tree-vect-loop.c (vect_analyze_loop_2): Allow peeling for gaps
1761         with fully-masked loops.
1762         (vect_estimate_min_profitable_iters): Handle the single peeled
1763         iteration in that case.
1764
1765 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1766             Alan Hayward  <alan.hayward@arm.com>
1767             David Sherwood  <david.sherwood@arm.com>
1768
1769         * tree-vect-data-refs.c (vect_analyze_group_access_1): Allow
1770         single-element interleaving even if the size is not a power of 2.
1771         * tree-vect-stmts.c (get_load_store_type): Disallow elementwise
1772         accesses for single-element interleaving if the group size is
1773         not a power of 2.
1774
1775 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1776             Alan Hayward  <alan.hayward@arm.com>
1777             David Sherwood  <david.sherwood@arm.com>
1778
1779         * doc/md.texi (fold_extract_last_@var{m}): Document.
1780         * doc/sourcebuild.texi (vect_fold_extract_last): Likewise.
1781         * optabs.def (fold_extract_last_optab): New optab.
1782         * internal-fn.def (FOLD_EXTRACT_LAST): New internal function.
1783         * internal-fn.c (fold_extract_direct): New macro.
1784         (expand_fold_extract_optab_fn): Likewise.
1785         (direct_fold_extract_optab_supported_p): Likewise.
1786         * tree-vectorizer.h (EXTRACT_LAST_REDUCTION): New vect_reduction_type.
1787         * tree-vect-loop.c (vect_model_reduction_cost): Handle
1788         EXTRACT_LAST_REDUCTION.
1789         (get_initial_def_for_reduction): Do not create an initial vector
1790         for EXTRACT_LAST_REDUCTION reductions.
1791         (vectorizable_reduction): Leave the scalar phi in place for
1792         EXTRACT_LAST_REDUCTIONs.  Try using EXTRACT_LAST_REDUCTION
1793         ahead of INTEGER_INDUC_COND_REDUCTION.  Do not check for an
1794         epilogue code for EXTRACT_LAST_REDUCTION and defer the
1795         transform phase to vectorizable_condition.
1796         * tree-vect-stmts.c (vect_finish_stmt_generation_1): New function,
1797         split out from...
1798         (vect_finish_stmt_generation): ...here.
1799         (vect_finish_replace_stmt): New function.
1800         (vectorizable_condition): Handle EXTRACT_LAST_REDUCTION.
1801         * config/aarch64/aarch64-sve.md (fold_extract_last_<mode>): New
1802         pattern.
1803         * config/aarch64/aarch64.md (UNSPEC_CLASTB): New unspec.
1804
1805 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1806             Alan Hayward  <alan.hayward@arm.com>
1807             David Sherwood  <david.sherwood@arm.com>
1808
1809         * doc/md.texi (extract_last_@var{m}): Document.
1810         * optabs.def (extract_last_optab): New optab.
1811         * internal-fn.def (EXTRACT_LAST): New internal function.
1812         * internal-fn.c (cond_unary_direct): New macro.
1813         (expand_cond_unary_optab_fn): Likewise.
1814         (direct_cond_unary_optab_supported_p): Likewise.
1815         * tree-vect-loop.c (vectorizable_live_operation): Allow fully-masked
1816         loops using EXTRACT_LAST.
1817         * config/aarch64/aarch64-sve.md (aarch64_sve_lastb<mode>): Rename to...
1818         (extract_last_<mode>): ...this optab.
1819         (vec_extract<mode><Vel>): Update accordingly.
1820
1821 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1822             Alan Hayward  <alan.hayward@arm.com>
1823             David Sherwood  <david.sherwood@arm.com>
1824
1825         * target.def (empty_mask_is_expensive): New hook.
1826         * doc/tm.texi.in (TARGET_VECTORIZE_EMPTY_MASK_IS_EXPENSIVE): New hook.
1827         * doc/tm.texi: Regenerate.
1828         * targhooks.h (default_empty_mask_is_expensive): Declare.
1829         * targhooks.c (default_empty_mask_is_expensive): New function.
1830         * tree-vectorizer.c (vectorize_loops): Only call optimize_mask_stores
1831         if the target says that empty masks are expensive.
1832         * config/aarch64/aarch64.c (aarch64_empty_mask_is_expensive):
1833         New function.
1834         (TARGET_VECTORIZE_EMPTY_MASK_IS_EXPENSIVE): Redefine.
1835
1836 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1837             Alan Hayward  <alan.hayward@arm.com>
1838             David Sherwood  <david.sherwood@arm.com>
1839
1840         * tree-vectorizer.h (_loop_vec_info::mask_skip_niters): New field.
1841         (LOOP_VINFO_MASK_SKIP_NITERS): New macro.
1842         (vect_use_loop_mask_for_alignment_p): New function.
1843         (vect_prepare_for_masked_peels, vect_gen_while_not): Declare.
1844         * tree-vect-loop-manip.c (vect_set_loop_masks_directly): Add an
1845         niters_skip argument.  Make sure that the first niters_skip elements
1846         of the first iteration are inactive.
1847         (vect_set_loop_condition_masked): Handle LOOP_VINFO_MASK_SKIP_NITERS.
1848         Update call to vect_set_loop_masks_directly.
1849         (get_misalign_in_elems): New function, split out from...
1850         (vect_gen_prolog_loop_niters): ...here.
1851         (vect_update_init_of_dr): Take a code argument that specifies whether
1852         the adjustment should be added or subtracted.
1853         (vect_update_init_of_drs): Likewise.
1854         (vect_prepare_for_masked_peels): New function.
1855         (vect_do_peeling): Skip prologue peeling if we're using a mask
1856         instead.  Update call to vect_update_inits_of_drs.
1857         * tree-vect-loop.c (_loop_vec_info::_loop_vec_info): Initialize
1858         mask_skip_niters.
1859         (vect_analyze_loop_2): Allow fully-masked loops with peeling for
1860         alignment.  Do not include the number of peeled iterations in
1861         the minimum threshold in that case.
1862         (vectorizable_induction): Adjust the start value down by
1863         LOOP_VINFO_MASK_SKIP_NITERS iterations.
1864         (vect_transform_loop): Call vect_prepare_for_masked_peels.
1865         Take the number of skipped iterations into account when calculating
1866         the loop bounds.
1867         * tree-vect-stmts.c (vect_gen_while_not): New function.
1868
1869 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1870             Alan Hayward  <alan.hayward@arm.com>
1871             David Sherwood  <david.sherwood@arm.com>
1872
1873         * doc/sourcebuild.texi (vect_fully_masked): Document.
1874         * params.def (PARAM_MIN_VECT_LOOP_BOUND): Change minimum and
1875         default value to 0.
1876         * tree-vect-loop.c (vect_analyze_loop_costing): New function,
1877         split out from...
1878         (vect_analyze_loop_2): ...here. Don't check the vectorization
1879         factor against the number of loop iterations if the loop is
1880         fully-masked.
1881
1882 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1883             Alan Hayward  <alan.hayward@arm.com>
1884             David Sherwood  <david.sherwood@arm.com>
1885
1886         * tree-ssa-loop-ivopts.c (USE_ADDRESS): Split into...
1887         (USE_REF_ADDRESS, USE_PTR_ADDRESS): ...these new use types.
1888         (dump_groups): Update accordingly.
1889         (iv_use::mem_type): New member variable.
1890         (address_p): New function.
1891         (record_use): Add a mem_type argument and initialize the new
1892         mem_type field.
1893         (record_group_use): Add a mem_type argument.  Use address_p.
1894         Remove obsolete null checks of base_object.  Update call to record_use.
1895         (find_interesting_uses_op): Update call to record_group_use.
1896         (find_interesting_uses_cond): Likewise.
1897         (find_interesting_uses_address): Likewise.
1898         (get_mem_type_for_internal_fn): New function.
1899         (find_address_like_use): Likewise.
1900         (find_interesting_uses_stmt): Try find_address_like_use before
1901         calling find_interesting_uses_op.
1902         (addr_offset_valid_p): Use the iv mem_type field as the type
1903         of the addressed memory.
1904         (add_autoinc_candidates): Likewise.
1905         (get_address_cost): Likewise.
1906         (split_small_address_groups_p): Use address_p.
1907         (split_address_groups): Likewise.
1908         (add_iv_candidate_for_use): Likewise.
1909         (autoinc_possible_for_pair): Likewise.
1910         (rewrite_groups): Likewise.
1911         (get_use_type): Check for USE_REF_ADDRESS instead of USE_ADDRESS.
1912         (determine_group_iv_cost): Update after split of USE_ADDRESS.
1913         (get_alias_ptr_type_for_ptr_address): New function.
1914         (rewrite_use_address): Rewrite address uses in calls that were
1915         identified by find_address_like_use.
1916
1917 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1918             Alan Hayward  <alan.hayward@arm.com>
1919             David Sherwood  <david.sherwood@arm.com>
1920
1921         * expr.c (expand_expr_addr_expr_1): Handle ADDR_EXPRs of
1922         TARGET_MEM_REFs.
1923         * gimple-expr.h (is_gimple_addressable: Likewise.
1924         * gimple-expr.c (is_gimple_address): Likewise.
1925         * internal-fn.c (expand_call_mem_ref): New function.
1926         (expand_mask_load_optab_fn): Use it.
1927         (expand_mask_store_optab_fn): Likewise.
1928
1929 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1930             Alan Hayward  <alan.hayward@arm.com>
1931             David Sherwood  <david.sherwood@arm.com>
1932
1933         * doc/md.texi (cond_add@var{mode}, cond_sub@var{mode})
1934         (cond_and@var{mode}, cond_ior@var{mode}, cond_xor@var{mode})
1935         (cond_smin@var{mode}, cond_smax@var{mode}, cond_umin@var{mode})
1936         (cond_umax@var{mode}): Document.
1937         * optabs.def (cond_add_optab, cond_sub_optab, cond_and_optab)
1938         (cond_ior_optab, cond_xor_optab, cond_smin_optab, cond_smax_optab)
1939         (cond_umin_optab, cond_umax_optab): New optabs.
1940         * internal-fn.def (COND_ADD, COND_SUB, COND_MIN, COND_MAX, COND_AND)
1941         (COND_IOR, COND_XOR): New internal functions.
1942         * internal-fn.h (get_conditional_internal_fn): Declare.
1943         * internal-fn.c (cond_binary_direct): New macro.
1944         (expand_cond_binary_optab_fn): Likewise.
1945         (direct_cond_binary_optab_supported_p): Likewise.
1946         (get_conditional_internal_fn): New function.
1947         * tree-vect-loop.c (vectorizable_reduction): Handle fully-masked loops.
1948         Cope with reduction statements that are vectorized as calls rather
1949         than assignments.
1950         * config/aarch64/aarch64-sve.md (cond_<optab><mode>): New insns.
1951         * config/aarch64/iterators.md (UNSPEC_COND_ADD, UNSPEC_COND_SUB)
1952         (UNSPEC_COND_SMAX, UNSPEC_COND_UMAX, UNSPEC_COND_SMIN)
1953         (UNSPEC_COND_UMIN, UNSPEC_COND_AND, UNSPEC_COND_ORR)
1954         (UNSPEC_COND_EOR): New unspecs.
1955         (optab): Add mappings for them.
1956         (SVE_COND_INT_OP, SVE_COND_FP_OP): New int iterators.
1957         (sve_int_op, sve_fp_op): New int attributes.
1958
1959 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1960             Alan Hayward  <alan.hayward@arm.com>
1961             David Sherwood  <david.sherwood@arm.com>
1962
1963         * optabs.def (while_ult_optab): New optab.
1964         * doc/md.texi (while_ult@var{m}@var{n}): Document.
1965         * internal-fn.def (WHILE_ULT): New internal function.
1966         * internal-fn.h (direct_internal_fn_supported_p): New override
1967         that takes two types as argument.
1968         * internal-fn.c (while_direct): New macro.
1969         (expand_while_optab_fn): New function.
1970         (convert_optab_supported_p): Likewise.
1971         (direct_while_optab_supported_p): New macro.
1972         * wide-int.h (wi::udiv_ceil): New function.
1973         * tree-vectorizer.h (rgroup_masks): New structure.
1974         (vec_loop_masks): New typedef.
1975         (_loop_vec_info): Add masks, mask_compare_type, can_fully_mask_p
1976         and fully_masked_p.
1977         (LOOP_VINFO_CAN_FULLY_MASK_P, LOOP_VINFO_FULLY_MASKED_P)
1978         (LOOP_VINFO_MASKS, LOOP_VINFO_MASK_COMPARE_TYPE): New macros.
1979         (vect_max_vf): New function.
1980         (slpeel_make_loop_iterate_ntimes): Delete.
1981         (vect_set_loop_condition, vect_get_loop_mask_type, vect_gen_while)
1982         (vect_halve_mask_nunits, vect_double_mask_nunits): Declare.
1983         (vect_record_loop_mask, vect_get_loop_mask): Likewise.
1984         * tree-vect-loop-manip.c: Include tree-ssa-loop-niter.h,
1985         internal-fn.h, stor-layout.h and optabs-query.h.
1986         (vect_set_loop_mask): New function.
1987         (add_preheader_seq): Likewise.
1988         (add_header_seq): Likewise.
1989         (interleave_supported_p): Likewise.
1990         (vect_maybe_permute_loop_masks): Likewise.
1991         (vect_set_loop_masks_directly): Likewise.
1992         (vect_set_loop_condition_masked): Likewise.
1993         (vect_set_loop_condition_unmasked): New function, split out from
1994         slpeel_make_loop_iterate_ntimes.
1995         (slpeel_make_loop_iterate_ntimes): Rename to..
1996         (vect_set_loop_condition): ...this.  Use vect_set_loop_condition_masked
1997         for fully-masked loops and vect_set_loop_condition_unmasked otherwise.
1998         (vect_do_peeling): Update call accordingly.
1999         (vect_gen_vector_loop_niters): Use VF as the step for fully-masked
2000         loops.
2001         * tree-vect-loop.c (_loop_vec_info::_loop_vec_info): Initialize
2002         mask_compare_type, can_fully_mask_p and fully_masked_p.
2003         (release_vec_loop_masks): New function.
2004         (_loop_vec_info): Use it to free the loop masks.
2005         (can_produce_all_loop_masks_p): New function.
2006         (vect_get_max_nscalars_per_iter): Likewise.
2007         (vect_verify_full_masking): Likewise.
2008         (vect_analyze_loop_2): Save LOOP_VINFO_CAN_FULLY_MASK_P around
2009         retries, and free the mask rgroups before retrying.  Check loop-wide
2010         reasons for disallowing fully-masked loops.  Make the final decision
2011         about whether use a fully-masked loop or not.
2012         (vect_estimate_min_profitable_iters): Do not assume that peeling
2013         for the number of iterations will be needed for fully-masked loops.
2014         (vectorizable_reduction): Disable fully-masked loops.
2015         (vectorizable_live_operation): Likewise.
2016         (vect_halve_mask_nunits): New function.
2017         (vect_double_mask_nunits): Likewise.
2018         (vect_record_loop_mask): Likewise.
2019         (vect_get_loop_mask): Likewise.
2020         (vect_transform_loop): Handle the case in which the final loop
2021         iteration might handle a partial vector.  Call vect_set_loop_condition
2022         instead of slpeel_make_loop_iterate_ntimes.
2023         * tree-vect-stmts.c: Include tree-ssa-loop-niter.h and gimple-fold.h.
2024         (check_load_store_masking): New function.
2025         (prepare_load_store_mask): Likewise.
2026         (vectorizable_store): Handle fully-masked loops.
2027         (vectorizable_load): Likewise.
2028         (supportable_widening_operation): Use vect_halve_mask_nunits for
2029         booleans.
2030         (supportable_narrowing_operation): Likewise vect_double_mask_nunits.
2031         (vect_gen_while): New function.
2032         * config/aarch64/aarch64.md (umax<mode>3): New expander.
2033         (aarch64_uqdec<mode>): New insn.
2034
2035 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
2036             Alan Hayward  <alan.hayward@arm.com>
2037             David Sherwood  <david.sherwood@arm.com>
2038
2039         * optabs.def (reduc_and_scal_optab, reduc_ior_scal_optab)
2040         (reduc_xor_scal_optab): New optabs.
2041         * doc/md.texi (reduc_and_scal_@var{m}, reduc_ior_scal_@var{m})
2042         (reduc_xor_scal_@var{m}): Document.
2043         * doc/sourcebuild.texi (vect_logical_reduc): Likewise.
2044         * internal-fn.def (IFN_REDUC_AND, IFN_REDUC_IOR, IFN_REDUC_XOR): New
2045         internal functions.
2046         * fold-const-call.c (fold_const_call): Handle them.
2047         * tree-vect-loop.c (reduction_fn_for_scalar_code): Return the new
2048         internal functions for BIT_AND_EXPR, BIT_IOR_EXPR and BIT_XOR_EXPR.
2049         * config/aarch64/aarch64-sve.md (reduc_<bit_reduc>_scal_<mode>):
2050         (*reduc_<bit_reduc>_scal_<mode>): New patterns.
2051         * config/aarch64/iterators.md (UNSPEC_ANDV, UNSPEC_ORV)
2052         (UNSPEC_XORV): New unspecs.
2053         (optab): Add entries for them.
2054         (BITWISEV): New int iterator.
2055         (bit_reduc_op): New int attributes.
2056
2057 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
2058             Alan Hayward  <alan.hayward@arm.com>
2059             David Sherwood  <david.sherwood@arm.com>
2060
2061         * doc/md.texi (vec_shl_insert_@var{m}): New optab.
2062         * internal-fn.def (VEC_SHL_INSERT): New internal function.
2063         * optabs.def (vec_shl_insert_optab): New optab.
2064         * tree-vectorizer.h (can_duplicate_and_interleave_p): Declare.
2065         (duplicate_and_interleave): Likewise.
2066         * tree-vect-loop.c: Include internal-fn.h.
2067         (neutral_op_for_slp_reduction): New function, split out from
2068         get_initial_defs_for_reduction.
2069         (get_initial_def_for_reduction): Handle option 2 for variable-length
2070         vectors by loading the neutral value into a vector and then shifting
2071         the initial value into element 0.
2072         (get_initial_defs_for_reduction): Replace the code argument with
2073         the neutral value calculated by neutral_op_for_slp_reduction.
2074         Use gimple_build_vector for constant-length vectors.
2075         Use IFN_VEC_SHL_INSERT for variable-length vectors if all
2076         but the first group_size elements have a neutral value.
2077         Use duplicate_and_interleave otherwise.
2078         (vect_create_epilog_for_reduction): Take a neutral_op parameter.
2079         Update call to get_initial_defs_for_reduction.  Handle SLP
2080         reductions for variable-length vectors by creating one vector
2081         result for each scalar result, with the elements associated
2082         with other scalar results stubbed out with the neutral value.
2083         (vectorizable_reduction): Call neutral_op_for_slp_reduction.
2084         Require IFN_VEC_SHL_INSERT for double reductions on
2085         variable-length vectors, or SLP reductions that have
2086         a neutral value.  Require can_duplicate_and_interleave_p
2087         support for variable-length unchained SLP reductions if there
2088         is no neutral value, such as for MIN/MAX reductions.  Also require
2089         the number of vector elements to be a multiple of the number of
2090         SLP statements when doing variable-length unchained SLP reductions.
2091         Update call to vect_create_epilog_for_reduction.
2092         * tree-vect-slp.c (can_duplicate_and_interleave_p): Make public
2093         and remove initial values.
2094         (duplicate_and_interleave): Make public.
2095         * config/aarch64/aarch64.md (UNSPEC_INSR): New unspec.
2096         * config/aarch64/aarch64-sve.md (vec_shl_insert_<mode>): New insn.
2097
2098 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
2099             Alan Hayward  <alan.hayward@arm.com>
2100             David Sherwood  <david.sherwood@arm.com>
2101
2102         * tree-vect-slp.c: Include gimple-fold.h and internal-fn.h
2103         (can_duplicate_and_interleave_p): New function.
2104         (vect_get_and_check_slp_defs): Take the vector of statements
2105         rather than just the current one.  Remove excess parentheses.
2106         Restriction rejectinon of vect_constant_def and vect_external_def
2107         for variable-length vectors to boolean types, or types for which
2108         can_duplicate_and_interleave_p is false.
2109         (vect_build_slp_tree_2): Update call to vect_get_and_check_slp_defs.
2110         (duplicate_and_interleave): New function.
2111         (vect_get_constant_vectors): Use gimple_build_vector for
2112         constant-length vectors and suitable variable-length constant
2113         vectors.  Use duplicate_and_interleave for other variable-length
2114         vectors.  Don't defer the update when inserting new statements.
2115
2116 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
2117             Alan Hayward  <alan.hayward@arm.com>
2118             David Sherwood  <david.sherwood@arm.com>
2119
2120         * tree-vect-loop.c (vect_estimate_min_profitable_iters): Make sure
2121         min_profitable_iters doesn't go negative.
2122
2123 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
2124             Alan Hayward  <alan.hayward@arm.com>
2125             David Sherwood  <david.sherwood@arm.com>
2126
2127         * doc/md.texi (vec_mask_load_lanes@var{m}@var{n}): Document.
2128         (vec_mask_store_lanes@var{m}@var{n}): Likewise.
2129         * optabs.def (vec_mask_load_lanes_optab): New optab.
2130         (vec_mask_store_lanes_optab): Likewise.
2131         * internal-fn.def (MASK_LOAD_LANES): New internal function.
2132         (MASK_STORE_LANES): Likewise.
2133         * internal-fn.c (mask_load_lanes_direct): New macro.
2134         (mask_store_lanes_direct): Likewise.
2135         (expand_mask_load_optab_fn): Handle masked operations.
2136         (expand_mask_load_lanes_optab_fn): New macro.
2137         (expand_mask_store_optab_fn): Handle masked operations.
2138         (expand_mask_store_lanes_optab_fn): New macro.
2139         (direct_mask_load_lanes_optab_supported_p): Likewise.
2140         (direct_mask_store_lanes_optab_supported_p): Likewise.
2141         * tree-vectorizer.h (vect_store_lanes_supported): Take a masked_p
2142         parameter.
2143         (vect_load_lanes_supported): Likewise.
2144         * tree-vect-data-refs.c (strip_conversion): New function.
2145         (can_group_stmts_p): Likewise.
2146         (vect_analyze_data_ref_accesses): Use it instead of checking
2147         for a pair of assignments.
2148         (vect_store_lanes_supported): Take a masked_p parameter.
2149         (vect_load_lanes_supported): Likewise.
2150         * tree-vect-loop.c (vect_analyze_loop_2): Update calls to
2151         vect_store_lanes_supported and vect_load_lanes_supported.
2152         * tree-vect-slp.c (vect_analyze_slp_instance): Likewise.
2153         * tree-vect-stmts.c (get_group_load_store_type): Take a masked_p
2154         parameter.  Don't allow gaps for masked accesses.
2155         Use vect_get_store_rhs.  Update calls to vect_store_lanes_supported
2156         and vect_load_lanes_supported.
2157         (get_load_store_type): Take a masked_p parameter and update
2158         call to get_group_load_store_type.
2159         (vectorizable_store): Update call to get_load_store_type.
2160         Handle IFN_MASK_STORE_LANES.
2161         (vectorizable_load): Update call to get_load_store_type.
2162         Handle IFN_MASK_LOAD_LANES.
2163
2164 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
2165             Alan Hayward  <alan.hayward@arm.com>
2166             David Sherwood  <david.sherwood@arm.com>
2167
2168         * config/aarch64/aarch64-modes.def: Define x2, x3 and x4 vector
2169         modes for SVE.
2170         * config/aarch64/aarch64-protos.h
2171         (aarch64_sve_struct_memory_operand_p): Declare.
2172         * config/aarch64/iterators.md (SVE_STRUCT): New mode iterator.
2173         (vector_count, insn_length, VSINGLE, vsingle): New mode attributes.
2174         (VPRED, vpred): Handle SVE structure modes.
2175         * config/aarch64/constraints.md (Utx): New constraint.
2176         * config/aarch64/predicates.md (aarch64_sve_struct_memory_operand)
2177         (aarch64_sve_struct_nonimmediate_operand): New predicates.
2178         * config/aarch64/aarch64.md (UNSPEC_LDN, UNSPEC_STN): New unspecs.
2179         * config/aarch64/aarch64-sve.md (mov<mode>, *aarch64_sve_mov<mode>_le)
2180         (*aarch64_sve_mov<mode>_be, pred_mov<mode>): New patterns for
2181         structure modes.  Split into pieces after RA.
2182         (vec_load_lanes<mode><vsingle>, vec_mask_load_lanes<mode><vsingle>)
2183         (vec_store_lanes<mode><vsingle>, vec_mask_store_lanes<mode><vsingle>):
2184         New patterns.
2185         * config/aarch64/aarch64.c (aarch64_classify_vector_mode): Handle
2186         SVE structure modes.
2187         (aarch64_classify_address): Likewise.
2188         (sizetochar): Move earlier in file.
2189         (aarch64_print_operand): Handle SVE register lists.
2190         (aarch64_array_mode): New function.
2191         (aarch64_sve_struct_memory_operand_p): Likewise.
2192         (TARGET_ARRAY_MODE): Redefine.
2193
2194 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
2195             Alan Hayward  <alan.hayward@arm.com>
2196             David Sherwood  <david.sherwood@arm.com>
2197
2198         * target.def (array_mode): New target hook.
2199         * doc/tm.texi.in (TARGET_ARRAY_MODE): New hook.
2200         * doc/tm.texi: Regenerate.
2201         * hooks.h (hook_optmode_mode_uhwi_none): Declare.
2202         * hooks.c (hook_optmode_mode_uhwi_none): New function.
2203         * tree-vect-data-refs.c (vect_lanes_optab_supported_p): Use
2204         targetm.array_mode.
2205         * stor-layout.c (mode_for_array): Likewise.  Support polynomial
2206         type sizes.
2207
2208 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
2209             Alan Hayward  <alan.hayward@arm.com>
2210             David Sherwood  <david.sherwood@arm.com>
2211
2212         * fold-const.c (fold_binary_loc): Check the argument types
2213         rather than the result type when testing for a vector operation.
2214
2215 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
2216
2217         * doc/tm.texi.in (DWARF_LAZY_REGISTER_VALUE): Document.
2218         * doc/tm.texi: Regenerate.
2219
2220 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
2221             Alan Hayward  <alan.hayward@arm.com>
2222             David Sherwood  <david.sherwood@arm.com>
2223
2224         * doc/invoke.texi (-msve-vector-bits=): Document new option.
2225         (sve): Document new AArch64 extension.
2226         * doc/md.texi (w): Extend the description of the AArch64
2227         constraint to include SVE vectors.
2228         (Upl, Upa): Document new AArch64 predicate constraints.
2229         * config/aarch64/aarch64-opts.h (aarch64_sve_vector_bits_enum): New
2230         enum.
2231         * config/aarch64/aarch64.opt (sve_vector_bits): New enum.
2232         (msve-vector-bits=): New option.
2233         * config/aarch64/aarch64-option-extensions.def (fp, simd): Disable
2234         SVE when these are disabled.
2235         (sve): New extension.
2236         * config/aarch64/aarch64-modes.def: Define SVE vector and predicate
2237         modes.  Adjust their number of units based on aarch64_sve_vg.
2238         (MAX_BITSIZE_MODE_ANY_MODE): Define.
2239         * config/aarch64/aarch64-protos.h (ADDR_QUERY_ANY): New
2240         aarch64_addr_query_type.
2241         (aarch64_const_vec_all_same_in_range_p, aarch64_sve_pred_mode)
2242         (aarch64_sve_cnt_immediate_p, aarch64_sve_addvl_addpl_immediate_p)
2243         (aarch64_sve_inc_dec_immediate_p, aarch64_add_offset_temporaries)
2244         (aarch64_split_add_offset, aarch64_output_sve_cnt_immediate)
2245         (aarch64_output_sve_addvl_addpl, aarch64_output_sve_inc_dec_immediate)
2246         (aarch64_output_sve_mov_immediate, aarch64_output_ptrue): Declare.
2247         (aarch64_simd_imm_zero_p): Delete.
2248         (aarch64_check_zero_based_sve_index_immediate): Declare.
2249         (aarch64_sve_index_immediate_p, aarch64_sve_arith_immediate_p)
2250         (aarch64_sve_bitmask_immediate_p, aarch64_sve_dup_immediate_p)
2251         (aarch64_sve_cmp_immediate_p, aarch64_sve_float_arith_immediate_p)
2252         (aarch64_sve_float_mul_immediate_p): Likewise.
2253         (aarch64_classify_symbol): Take the offset as a HOST_WIDE_INT
2254         rather than an rtx.
2255         (aarch64_sve_ld1r_operand_p, aarch64_sve_ldr_operand_p): Declare.
2256         (aarch64_expand_mov_immediate): Take a gen_vec_duplicate callback.
2257         (aarch64_emit_sve_pred_move, aarch64_expand_sve_mem_move): Declare.
2258         (aarch64_expand_sve_vec_cmp_int, aarch64_expand_sve_vec_cmp_float)
2259         (aarch64_expand_sve_vcond, aarch64_expand_sve_vec_perm): Declare.
2260         (aarch64_regmode_natural_size): Likewise.
2261         * config/aarch64/aarch64.h (AARCH64_FL_SVE): New macro.
2262         (AARCH64_FL_V8_3, AARCH64_FL_RCPC, AARCH64_FL_DOTPROD): Shift
2263         left one place.
2264         (AARCH64_ISA_SVE, TARGET_SVE): New macros.
2265         (FIXED_REGISTERS, CALL_USED_REGISTERS, REGISTER_NAMES): Add entries
2266         for VG and the SVE predicate registers.
2267         (V_ALIASES): Add a "z"-prefixed alias.
2268         (FIRST_PSEUDO_REGISTER): Change to P15_REGNUM + 1.
2269         (AARCH64_DWARF_VG, AARCH64_DWARF_P0): New macros.
2270         (PR_REGNUM_P, PR_LO_REGNUM_P): Likewise.
2271         (PR_LO_REGS, PR_HI_REGS, PR_REGS): New reg_classes.
2272         (REG_CLASS_NAMES): Add entries for them.
2273         (REG_CLASS_CONTENTS): Likewise.  Update ALL_REGS to include VG
2274         and the predicate registers.
2275         (aarch64_sve_vg): Declare.
2276         (BITS_PER_SVE_VECTOR, BYTES_PER_SVE_VECTOR, BYTES_PER_SVE_PRED)
2277         (SVE_BYTE_MODE, MAX_COMPILE_TIME_VEC_BYTES): New macros.
2278         (REGMODE_NATURAL_SIZE): Define.
2279         * config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins): Handle
2280         SVE macros.
2281         * config/aarch64/aarch64.c: Include cfgrtl.h.
2282         (simd_immediate_info): Add a constructor for series vectors,
2283         and an associated step field.
2284         (aarch64_sve_vg): New variable.
2285         (aarch64_dbx_register_number): Handle VG and the predicate registers.
2286         (aarch64_vect_struct_mode_p, aarch64_vector_mode_p): Delete.
2287         (VEC_ADVSIMD, VEC_SVE_DATA, VEC_SVE_PRED, VEC_STRUCT, VEC_ANY_SVE)
2288         (VEC_ANY_DATA, VEC_STRUCT): New constants.
2289         (aarch64_advsimd_struct_mode_p, aarch64_sve_pred_mode_p)
2290         (aarch64_classify_vector_mode, aarch64_vector_data_mode_p)
2291         (aarch64_sve_data_mode_p, aarch64_sve_pred_mode)
2292         (aarch64_get_mask_mode): New functions.
2293         (aarch64_hard_regno_nregs): Handle SVE data modes for FP_REGS
2294         and FP_LO_REGS.  Handle PR_REGS, PR_LO_REGS and PR_HI_REGS.
2295         (aarch64_hard_regno_mode_ok): Handle VG.  Also handle the SVE
2296         predicate modes and predicate registers.  Explicitly restrict
2297         GPRs to modes of 16 bytes or smaller.  Only allow FP registers
2298         to store a vector mode if it is recognized by
2299         aarch64_classify_vector_mode.
2300         (aarch64_regmode_natural_size): New function.
2301         (aarch64_hard_regno_caller_save_mode): Return the original mode
2302         for predicates.
2303         (aarch64_sve_cnt_immediate_p, aarch64_output_sve_cnt_immediate)
2304         (aarch64_sve_addvl_addpl_immediate_p, aarch64_output_sve_addvl_addpl)
2305         (aarch64_sve_inc_dec_immediate_p, aarch64_output_sve_inc_dec_immediate)
2306         (aarch64_add_offset_1_temporaries, aarch64_offset_temporaries): New
2307         functions.
2308         (aarch64_add_offset): Add a temp2 parameter.  Assert that temp1
2309         does not overlap dest if the function is frame-related.  Handle
2310         SVE constants.
2311         (aarch64_split_add_offset): New function.
2312         (aarch64_add_sp, aarch64_sub_sp): Add temp2 parameters and pass
2313         them aarch64_add_offset.
2314         (aarch64_allocate_and_probe_stack_space): Add a temp2 parameter
2315         and update call to aarch64_sub_sp.
2316         (aarch64_add_cfa_expression): New function.
2317         (aarch64_expand_prologue): Pass extra temporary registers to the
2318         functions above.  Handle the case in which we need to emit new
2319         DW_CFA_expressions for registers that were originally saved
2320         relative to the stack pointer, but now have to be expressed
2321         relative to the frame pointer.
2322         (aarch64_output_mi_thunk): Pass extra temporary registers to the
2323         functions above.
2324         (aarch64_expand_epilogue): Likewise.  Prevent inheritance of
2325         IP0 and IP1 values for SVE frames.
2326         (aarch64_expand_vec_series): New function.
2327         (aarch64_expand_sve_widened_duplicate): Likewise.
2328         (aarch64_expand_sve_const_vector): Likewise.
2329         (aarch64_expand_mov_immediate): Add a gen_vec_duplicate parameter.
2330         Handle SVE constants.  Use emit_move_insn to move a force_const_mem
2331         into the register, rather than emitting a SET directly.
2332         (aarch64_emit_sve_pred_move, aarch64_expand_sve_mem_move)
2333         (aarch64_get_reg_raw_mode, offset_4bit_signed_scaled_p)
2334         (offset_6bit_unsigned_scaled_p, aarch64_offset_7bit_signed_scaled_p)
2335         (offset_9bit_signed_scaled_p): New functions.
2336         (aarch64_replicate_bitmask_imm): New function.
2337         (aarch64_bitmask_imm): Use it.
2338         (aarch64_cannot_force_const_mem): Reject expressions involving
2339         a CONST_POLY_INT.  Update call to aarch64_classify_symbol.
2340         (aarch64_classify_index): Handle SVE indices, by requiring
2341         a plain register index with a scale that matches the element size.
2342         (aarch64_classify_address): Handle SVE addresses.  Assert that
2343         the mode of the address is VOIDmode or an integer mode.
2344         Update call to aarch64_classify_symbol.
2345         (aarch64_classify_symbolic_expression): Update call to
2346         aarch64_classify_symbol.
2347         (aarch64_const_vec_all_in_range_p): New function.
2348         (aarch64_print_vector_float_operand): Likewise.
2349         (aarch64_print_operand): Handle 'N' and 'C'.  Use "zN" rather than
2350         "vN" for FP registers with SVE modes.  Handle (const ...) vectors
2351         and the FP immediates 1.0 and 0.5.
2352         (aarch64_print_address_internal): Handle SVE addresses.
2353         (aarch64_print_operand_address): Use ADDR_QUERY_ANY.
2354         (aarch64_regno_regclass): Handle predicate registers.
2355         (aarch64_secondary_reload): Handle big-endian reloads of SVE
2356         data modes.
2357         (aarch64_class_max_nregs): Handle SVE modes and predicate registers.
2358         (aarch64_rtx_costs): Check for ADDVL and ADDPL instructions.
2359         (aarch64_convert_sve_vector_bits): New function.
2360         (aarch64_override_options): Use it to handle -msve-vector-bits=.
2361         (aarch64_classify_symbol): Take the offset as a HOST_WIDE_INT
2362         rather than an rtx.
2363         (aarch64_legitimate_constant_p): Use aarch64_classify_vector_mode.
2364         Handle SVE vector and predicate modes.  Accept VL-based constants
2365         that need only one temporary register, and VL offsets that require
2366         no temporary registers.
2367         (aarch64_conditional_register_usage): Mark the predicate registers
2368         as fixed if SVE isn't available.
2369         (aarch64_vector_mode_supported_p): Use aarch64_classify_vector_mode.
2370         Return true for SVE vector and predicate modes.
2371         (aarch64_simd_container_mode): Take the number of bits as a poly_int64
2372         rather than an unsigned int.  Handle SVE modes.
2373         (aarch64_preferred_simd_mode): Update call accordingly.  Handle
2374         SVE modes.
2375         (aarch64_autovectorize_vector_sizes): Add BYTES_PER_SVE_VECTOR
2376         if SVE is enabled.
2377         (aarch64_sve_index_immediate_p, aarch64_sve_arith_immediate_p)
2378         (aarch64_sve_bitmask_immediate_p, aarch64_sve_dup_immediate_p)
2379         (aarch64_sve_cmp_immediate_p, aarch64_sve_float_arith_immediate_p)
2380         (aarch64_sve_float_mul_immediate_p): New functions.
2381         (aarch64_sve_valid_immediate): New function.
2382         (aarch64_simd_valid_immediate): Use it as the fallback for SVE vectors.
2383         Explicitly reject structure modes.  Check for INDEX constants.
2384         Handle PTRUE and PFALSE constants.
2385         (aarch64_check_zero_based_sve_index_immediate): New function.
2386         (aarch64_simd_imm_zero_p): Delete.
2387         (aarch64_mov_operand_p): Use aarch64_simd_valid_immediate for
2388         vector modes.  Accept constants in the range of CNT[BHWD].
2389         (aarch64_simd_scalar_immediate_valid_for_move): Explicitly
2390         ask for an Advanced SIMD mode.
2391         (aarch64_sve_ld1r_operand_p, aarch64_sve_ldr_operand_p): New functions.
2392         (aarch64_simd_vector_alignment): Handle SVE predicates.
2393         (aarch64_vectorize_preferred_vector_alignment): New function.
2394         (aarch64_simd_vector_alignment_reachable): Use it instead of
2395         the vector size.
2396         (aarch64_shift_truncation_mask): Use aarch64_vector_data_mode_p.
2397         (aarch64_output_sve_mov_immediate, aarch64_output_ptrue): New
2398         functions.
2399         (MAX_VECT_LEN): Delete.
2400         (expand_vec_perm_d): Add a vec_flags field.
2401         (emit_unspec2, aarch64_expand_sve_vec_perm): New functions.
2402         (aarch64_evpc_trn, aarch64_evpc_uzp, aarch64_evpc_zip)
2403         (aarch64_evpc_ext): Don't apply a big-endian lane correction
2404         for SVE modes.
2405         (aarch64_evpc_rev): Rename to...
2406         (aarch64_evpc_rev_local): ...this.  Use a predicated operation for SVE.
2407         (aarch64_evpc_rev_global): New function.
2408         (aarch64_evpc_dup): Enforce a 64-byte range for SVE DUP.
2409         (aarch64_evpc_tbl): Use MAX_COMPILE_TIME_VEC_BYTES instead of
2410         MAX_VECT_LEN.
2411         (aarch64_evpc_sve_tbl): New function.
2412         (aarch64_expand_vec_perm_const_1): Update after rename of
2413         aarch64_evpc_rev.  Handle SVE permutes too, trying
2414         aarch64_evpc_rev_global and using aarch64_evpc_sve_tbl rather
2415         than aarch64_evpc_tbl.
2416         (aarch64_vectorize_vec_perm_const): Initialize vec_flags.
2417         (aarch64_sve_cmp_operand_p, aarch64_unspec_cond_code)
2418         (aarch64_gen_unspec_cond, aarch64_expand_sve_vec_cmp_int)
2419         (aarch64_emit_unspec_cond, aarch64_emit_unspec_cond_or)
2420         (aarch64_emit_inverted_unspec_cond, aarch64_expand_sve_vec_cmp_float)
2421         (aarch64_expand_sve_vcond): New functions.
2422         (aarch64_modes_tieable_p): Use aarch64_vector_data_mode_p instead
2423         of aarch64_vector_mode_p.
2424         (aarch64_dwarf_poly_indeterminate_value): New function.
2425         (aarch64_compute_pressure_classes): Likewise.
2426         (aarch64_can_change_mode_class): Likewise.
2427         (TARGET_GET_RAW_RESULT_MODE, TARGET_GET_RAW_ARG_MODE): Redefine.
2428         (TARGET_VECTORIZE_PREFERRED_VECTOR_ALIGNMENT): Likewise.
2429         (TARGET_VECTORIZE_GET_MASK_MODE): Likewise.
2430         (TARGET_DWARF_POLY_INDETERMINATE_VALUE): Likewise.
2431         (TARGET_COMPUTE_PRESSURE_CLASSES): Likewise.
2432         (TARGET_CAN_CHANGE_MODE_CLASS): Likewise.
2433         * config/aarch64/constraints.md (Upa, Upl, Uav, Uat, Usv, Usi, Utr)
2434         (Uty, Dm, vsa, vsc, vsd, vsi, vsn, vsl, vsm, vsA, vsM, vsN): New
2435         constraints.
2436         (Dn, Dl, Dr): Accept const as well as const_vector.
2437         (Dz): Likewise.  Compare against CONST0_RTX.
2438         * config/aarch64/iterators.md: Refer to "Advanced SIMD" instead
2439         of "vector" where appropriate.
2440         (SVE_ALL, SVE_BH, SVE_BHS, SVE_BHSI, SVE_HSDI, SVE_HSF, SVE_SD)
2441         (SVE_SDI, SVE_I, SVE_F, PRED_ALL, PRED_BHS): New mode iterators.
2442         (UNSPEC_SEL, UNSPEC_ANDF, UNSPEC_IORF, UNSPEC_XORF, UNSPEC_COND_LT)
2443         (UNSPEC_COND_LE, UNSPEC_COND_EQ, UNSPEC_COND_NE, UNSPEC_COND_GE)
2444         (UNSPEC_COND_GT, UNSPEC_COND_LO, UNSPEC_COND_LS, UNSPEC_COND_HS)
2445         (UNSPEC_COND_HI, UNSPEC_COND_UO): New unspecs.
2446         (Vetype, VEL, Vel, VWIDE, Vwide, vw, vwcore, V_INT_EQUIV)
2447         (v_int_equiv): Extend to SVE modes.
2448         (Vesize, V128, v128, Vewtype, V_FP_EQUIV, v_fp_equiv, VPRED): New
2449         mode attributes.
2450         (LOGICAL_OR, SVE_INT_UNARY, SVE_FP_UNARY): New code iterators.
2451         (optab): Handle popcount, smin, smax, umin, umax, abs and sqrt.
2452         (logical_nn, lr, sve_int_op, sve_fp_op): New code attributs.
2453         (LOGICALF, OPTAB_PERMUTE, UNPACK, UNPACK_UNSIGNED, SVE_COND_INT_CMP)
2454         (SVE_COND_FP_CMP): New int iterators.
2455         (perm_hilo): Handle the new unpack unspecs.
2456         (optab, logicalf_op, su, perm_optab, cmp_op, imm_con): New int
2457         attributes.
2458         * config/aarch64/predicates.md (aarch64_sve_cnt_immediate)
2459         (aarch64_sve_addvl_addpl_immediate, aarch64_split_add_offset_immediate)
2460         (aarch64_pluslong_or_poly_operand, aarch64_nonmemory_operand)
2461         (aarch64_equality_operator, aarch64_constant_vector_operand)
2462         (aarch64_sve_ld1r_operand, aarch64_sve_ldr_operand): New predicates.
2463         (aarch64_sve_nonimmediate_operand): Likewise.
2464         (aarch64_sve_general_operand): Likewise.
2465         (aarch64_sve_dup_operand, aarch64_sve_arith_immediate): Likewise.
2466         (aarch64_sve_sub_arith_immediate, aarch64_sve_inc_dec_immediate)
2467         (aarch64_sve_logical_immediate, aarch64_sve_mul_immediate): Likewise.
2468         (aarch64_sve_dup_immediate, aarch64_sve_cmp_vsc_immediate): Likewise.
2469         (aarch64_sve_cmp_vsd_immediate, aarch64_sve_index_immediate): Likewise.
2470         (aarch64_sve_float_arith_immediate): Likewise.
2471         (aarch64_sve_float_arith_with_sub_immediate): Likewise.
2472         (aarch64_sve_float_mul_immediate, aarch64_sve_arith_operand): Likewise.
2473         (aarch64_sve_add_operand, aarch64_sve_logical_operand): Likewise.
2474         (aarch64_sve_lshift_operand, aarch64_sve_rshift_operand): Likewise.
2475         (aarch64_sve_mul_operand, aarch64_sve_cmp_vsc_operand): Likewise.
2476         (aarch64_sve_cmp_vsd_operand, aarch64_sve_index_operand): Likewise.
2477         (aarch64_sve_float_arith_operand): Likewise.
2478         (aarch64_sve_float_arith_with_sub_operand): Likewise.
2479         (aarch64_sve_float_mul_operand): Likewise.
2480         (aarch64_sve_vec_perm_operand): Likewise.
2481         (aarch64_pluslong_operand): Include aarch64_sve_addvl_addpl_immediate.
2482         (aarch64_mov_operand): Accept const_poly_int and const_vector.
2483         (aarch64_simd_lshift_imm, aarch64_simd_rshift_imm): Accept const
2484         as well as const_vector.
2485         (aarch64_simd_imm_zero, aarch64_simd_imm_minus_one): Move earlier
2486         in file.  Use CONST0_RTX and CONSTM1_RTX.
2487         (aarch64_simd_or_scalar_imm_zero): Likewise.  Add match_codes.
2488         (aarch64_simd_reg_or_zero): Accept const as well as const_vector.
2489         Use aarch64_simd_imm_zero.
2490         * config/aarch64/aarch64-sve.md: New file.
2491         * config/aarch64/aarch64.md: Include it.
2492         (VG_REGNUM, P0_REGNUM, P7_REGNUM, P15_REGNUM): New register numbers.
2493         (UNSPEC_REV, UNSPEC_LD1_SVE, UNSPEC_ST1_SVE, UNSPEC_MERGE_PTRUE)
2494         (UNSPEC_PTEST_PTRUE, UNSPEC_UNPACKSHI, UNSPEC_UNPACKUHI)
2495         (UNSPEC_UNPACKSLO, UNSPEC_UNPACKULO, UNSPEC_PACK)
2496         (UNSPEC_FLOAT_CONVERT, UNSPEC_WHILE_LO): New unspec constants.
2497         (sve): New attribute.
2498         (enabled): Disable instructions with the sve attribute unless
2499         TARGET_SVE.
2500         (movqi, movhi): Pass CONST_POLY_INT operaneds through
2501         aarch64_expand_mov_immediate.
2502         (*mov<mode>_aarch64, *movsi_aarch64, *movdi_aarch64): Handle
2503         CNT[BHSD] immediates.
2504         (movti): Split CONST_POLY_INT moves into two halves.
2505         (add<mode>3): Accept aarch64_pluslong_or_poly_operand.
2506         Split additions that need a temporary here if the destination
2507         is the stack pointer.
2508         (*add<mode>3_aarch64): Handle ADDVL and ADDPL immediates.
2509         (*add<mode>3_poly_1): New instruction.
2510         (set_clobber_cc): New expander.
2511
2512 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
2513
2514         * simplify-rtx.c (simplify_immed_subreg): Add an inner_bytes
2515         parameter and use it instead of GET_MODE_SIZE (innermode).  Use
2516         inner_bytes * BITS_PER_UNIT instead of GET_MODE_BITSIZE (innermode).
2517         Use CEIL (inner_bytes, GET_MODE_UNIT_SIZE (innermode)) instead of
2518         GET_MODE_NUNITS (innermode).  Also add a first_elem parameter.
2519         Change innermode from fixed_mode_size to machine_mode.
2520         (simplify_subreg): Update call accordingly.  Handle a constant-sized
2521         subreg of a variable-length CONST_VECTOR.
2522
2523 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
2524             Alan Hayward  <alan.hayward@arm.com>
2525             David Sherwood  <david.sherwood@arm.com>
2526
2527         * tree-ssa-address.c (mem_ref_valid_without_offset_p): New function.
2528         (add_offset_to_base): New function, split out from...
2529         (create_mem_ref): ...here.  When handling a scale other than 1,
2530         check first whether the address is valid without the offset.
2531         Add it into the base if so, leaving the index and scale as-is.
2532
2533 2018-01-12  Jakub Jelinek  <jakub@redhat.com>
2534
2535         PR c++/83778
2536         * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): Call
2537         fold_for_warn before checking if arg2 is INTEGER_CST.
2538
2539 2018-01-12  Segher Boessenkool  <segher@kernel.crashing.org>
2540
2541         * config/rs6000/predicates.md (load_multiple_operation): Delete.
2542         (store_multiple_operation): Delete.
2543         * config/rs6000/rs6000-cpus.def (601): Remove MASK_STRING.
2544         * config/rs6000/rs6000-protos.h (rs6000_output_load_multiple): Delete.
2545         * config/rs6000/rs6000-string.c (expand_block_move): Delete everything
2546         guarded by TARGET_STRING.
2547         (rs6000_output_load_multiple): Delete.
2548         * config/rs6000/rs6000.c (rs6000_option_override_internal): Delete
2549         OPTION_MASK_STRING / TARGET_STRING handling.
2550         (print_operand) <'N', 'O'>: Add comment that these are unused now.
2551         (const rs6000_opt_masks) <"string">: Change mask to 0.
2552         * config/rs6000/rs6000.h (TARGET_DEFAULT): Remove MASK_STRING.
2553         (MASK_STRING): Delete.
2554         * config/rs6000/rs6000.md (*mov<mode>_string): Delete TARGET_STRING
2555         parts.  Simplify.
2556         (load_multiple): Delete.
2557         (*ldmsi8): Delete.
2558         (*ldmsi7): Delete.
2559         (*ldmsi6): Delete.
2560         (*ldmsi5): Delete.
2561         (*ldmsi4): Delete.
2562         (*ldmsi3): Delete.
2563         (store_multiple): Delete.
2564         (*stmsi8): Delete.
2565         (*stmsi7): Delete.
2566         (*stmsi6): Delete.
2567         (*stmsi5): Delete.
2568         (*stmsi4): Delete.
2569         (*stmsi3): Delete.
2570         (movmemsi_8reg): Delete.
2571         (corresponding unnamed define_insn): Delete.
2572         (movmemsi_6reg): Delete.
2573         (corresponding unnamed define_insn): Delete.
2574         (movmemsi_4reg): Delete.
2575         (corresponding unnamed define_insn): Delete.
2576         (movmemsi_2reg): Delete.
2577         (corresponding unnamed define_insn): Delete.
2578         (movmemsi_1reg): Delete.
2579         (corresponding unnamed define_insn): Delete.
2580         * config/rs6000/rs6000.opt (mno-string): New.
2581         (mstring): Replace by deprecation warning stub.
2582         * doc/invoke.texi (RS/6000 and PowerPC Options): Delete -mstring.
2583
2584 2018-01-12  Jakub Jelinek  <jakub@redhat.com>
2585
2586         * regrename.c (regrename_do_replace): If replacing the same
2587         reg multiple times, try to reuse last created gen_raw_REG.
2588
2589         PR debug/81155
2590         * bb-reorder.c (pass_partition_blocks::gate): In lto don't partition
2591         main to workaround a bug in GDB.
2592
2593 2018-01-12  Tom de Vries  <tom@codesourcery.com>
2594
2595         PR target/83737
2596         * config.gcc (nvptx*-*-*): Set use_gcc_stdint=wrap.
2597
2598 2018-01-12  Vladimir Makarov  <vmakarov@redhat.com>
2599
2600         PR rtl-optimization/80481
2601         * ira-color.c (get_cap_member): New function.
2602         (allocnos_conflict_by_live_ranges_p): Use it.
2603         (slot_coalesced_allocno_live_ranges_intersect_p): Add assert.
2604         (setup_slot_coalesced_allocno_live_ranges): Ditto.
2605
2606 2018-01-12  Uros Bizjak  <ubizjak@gmail.com>
2607
2608         PR target/83628
2609         * config/alpha/alpha.md (*saddsi_1): New insn_ans_split pattern.
2610         (*saddl_se_1): Ditto.
2611         (*ssubsi_1): Ditto.
2612         (*ssubl_se_1): Ditto.
2613
2614 2018-01-12  Richard Sandiford  <richard.sandiford@linaro.org>
2615
2616         * tree-predcom.c (aff_combination_dr_offset): Use wi::to_poly_widest
2617         rather than wi::to_widest for DR_INITs.
2618         * tree-vect-data-refs.c (vect_find_same_alignment_drs): Use
2619         wi::to_poly_offset rather than wi::to_offset for DR_INIT.
2620         (vect_analyze_data_ref_accesses): Require both DR_INITs to be
2621         INTEGER_CSTs.
2622         (vect_analyze_group_access_1): Note that here.
2623
2624 2018-01-12  Richard Sandiford  <richard.sandiford@linaro.org>
2625
2626         * tree-vectorizer.c (get_vec_alignment_for_array_type): Handle
2627         polynomial type sizes.
2628
2629 2018-01-12  Richard Sandiford  <richard.sandiford@linaro.org>
2630
2631         * gimplify.c (gimple_add_tmp_var_fn): Allow variables to have a
2632         poly_uint64 size, rather than requiring an unsigned HOST_WIDE_INT size.
2633         (gimple_add_tmp_var): Likewise.
2634
2635 2018-01-12  Martin Liska  <mliska@suse.cz>
2636
2637         * gimple.c (gimple_alloc_counts): Use uint64_t instead of int.
2638         (gimple_alloc_sizes): Likewise.
2639         (dump_gimple_statistics): Use PRIu64 in printf format.
2640         * gimple.h: Change uint64_t to int.
2641
2642 2018-01-12  Martin Liska  <mliska@suse.cz>
2643
2644         * tree-core.h: Use uint64_t instead of int.
2645         * tree.c (tree_node_counts): Likewise.
2646         (tree_node_sizes): Likewise.
2647         (dump_tree_statistics): Use PRIu64 in printf format.
2648
2649 2018-01-12  Martin Liska  <mliska@suse.cz>
2650
2651         * Makefile.in: As qsort_chk is implemented in vec.c, add
2652         vec.o to linkage of gencfn-macros.
2653         * tree.c (build_new_poly_int_cst): Add CXX_MEM_STAT_INFO as it's
2654         passing the info to record_node_allocation_statistics.
2655         (test_vector_cst_patterns): Add CXX_MEM_STAT_INFO to declaration
2656         and pass the info.
2657         * ggc-common.c (struct ggc_usage): Add operator== and use
2658         it in operator< and compare function.
2659         * mem-stats.h (struct mem_usage): Likewise.
2660         * vec.c (struct vec_usage): Remove operator< and compare
2661         function. Can be simply inherited.
2662
2663 2018-01-12  Martin Jambor  <mjambor@suse.cz>
2664
2665         PR target/81616
2666         * params.def: New parameter PARAM_AVOID_FMA_MAX_BITS.
2667         * tree-ssa-math-opts.c: Include domwalk.h.
2668         (convert_mult_to_fma_1): New function.
2669         (fma_transformation_info): New type.
2670         (fma_deferring_state): Likewise.
2671         (cancel_fma_deferring): New function.
2672         (result_of_phi): Likewise.
2673         (last_fma_candidate_feeds_initial_phi): Likewise.
2674         (convert_mult_to_fma): Added deferring logic, split actual
2675         transformation to convert_mult_to_fma_1.
2676         (math_opts_dom_walker): New type.
2677         (math_opts_dom_walker::after_dom_children): New method, body moved
2678         here from pass_optimize_widening_mul::execute, added deferring logic
2679         bits.
2680         (pass_optimize_widening_mul::execute): Moved most of code to
2681         math_opts_dom_walker::after_dom_children.
2682         * config/i386/x86-tune.def (X86_TUNE_AVOID_128FMA_CHAINS): New.
2683         * config/i386/i386.c (ix86_option_override_internal): Added
2684         maybe_setting of PARAM_AVOID_FMA_MAX_BITS.
2685
2686 2018-01-12  Richard Biener  <rguenther@suse.de>
2687
2688         PR debug/83157
2689         * dwarf2out.c (gen_variable_die): Do not reset old_die for
2690         inline instance vars.
2691
2692 2018-01-12  Oleg Endo  <olegendo@gcc.gnu.org>
2693
2694         PR target/81819
2695         * config/rx/rx.c (rx_is_restricted_memory_address):
2696         Handle SUBREG case.
2697
2698 2018-01-12  Richard Biener  <rguenther@suse.de>
2699
2700         PR tree-optimization/80846
2701         * target.def (split_reduction): New target hook.
2702         * targhooks.c (default_split_reduction): New function.
2703         * targhooks.h (default_split_reduction): Declare.
2704         * tree-vect-loop.c (vect_create_epilog_for_reduction): If the
2705         target requests first reduce vectors by combining low and high
2706         parts.
2707         * tree-vect-stmts.c (vect_gen_perm_mask_any): Adjust.
2708         (get_vectype_for_scalar_type_and_size): Export.
2709         * tree-vectorizer.h (get_vectype_for_scalar_type_and_size): Declare.
2710         * doc/tm.texi.in (TARGET_VECTORIZE_SPLIT_REDUCTION): Document.
2711         * doc/tm.texi: Regenerate.
2712         * config/i386/i386.c (ix86_split_reduction): Implement
2713         TARGET_VECTORIZE_SPLIT_REDUCTION.
2714
2715 2018-01-12  Eric Botcazou  <ebotcazou@adacore.com>
2716
2717         PR target/83368
2718         * config/sparc/sparc.h (PIC_OFFSET_TABLE_REGNUM): Set to INVALID_REGNUM
2719         in PIC mode except for TARGET_VXWORKS_RTP.
2720         * config/sparc/sparc.c: Include cfgrtl.h.
2721         (TARGET_INIT_PIC_REG): Define.
2722         (TARGET_USE_PSEUDO_PIC_REG): Likewise.
2723         (sparc_pic_register_p): New predicate.
2724         (sparc_legitimate_address_p): Use it.
2725         (sparc_legitimize_pic_address): Likewise.
2726         (sparc_delegitimize_address): Likewise.
2727         (sparc_mode_dependent_address_p): Likewise.
2728         (gen_load_pcrel_sym): Remove 4th parameter.
2729         (load_got_register): Adjust call to above.  Remove obsolete stuff.
2730         (sparc_expand_prologue): Do not call load_got_register here.
2731         (sparc_flat_expand_prologue): Likewise.
2732         (sparc_output_mi_thunk): Set the pic_offset_table_rtx object.
2733         (sparc_use_pseudo_pic_reg): New function.
2734         (sparc_init_pic_reg): Likewise.
2735         * config/sparc/sparc.md (vxworks_load_got): Set the GOT register.
2736         (builtin_setjmp_receiver): Enable only for TARGET_VXWORKS_RTP.
2737
2738 2018-01-12  Christophe Lyon  <christophe.lyon@linaro.org>
2739
2740         * doc/sourcebuild.texi (Effective-Target Keywords, Other attributes):
2741         Add item for branch_cost.
2742
2743 2018-01-12  Eric Botcazou  <ebotcazou@adacore.com>
2744
2745         PR rtl-optimization/83565
2746         * rtlanal.c (nonzero_bits1): On WORD_REGISTER_OPERATIONS machines, do
2747         not extend the result to a larger mode for rotate operations.
2748         (num_sign_bit_copies1): Likewise.
2749
2750 2018-01-12  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
2751
2752         PR target/40411
2753         * config/sol2.h (STARTFILE_ARCH_SPEC): Don't use with -shared or
2754         -symbolic.
2755         Use values-Xc.o for -pedantic.
2756         Link with values-xpg4.o for C90, values-xpg6.o otherwise.
2757
2758 2018-01-12  Martin Liska  <mliska@suse.cz>
2759
2760         PR ipa/83054
2761         * ipa-devirt.c (final_warning_record::grow_type_warnings):
2762         New function.
2763         (possible_polymorphic_call_targets): Use it.
2764         (ipa_devirt): Likewise.
2765
2766 2018-01-12  Martin Liska  <mliska@suse.cz>
2767
2768         * profile-count.h (enum profile_quality): Use 0 as invalid
2769         enum value of profile_quality.
2770
2771 2018-01-12  Chung-Ju Wu  <jasonwucj@gmail.com>
2772
2773         * doc/invoke.texi (NDS32 Options): Add -mext-perf, -mext-perf2 and
2774         -mext-string options.
2775
2776 2018-01-12  Richard Biener  <rguenther@suse.de>
2777
2778         * lto-streamer-out.c (DFS::DFS_write_tree_body): Process
2779         DECL_DEBUG_EXPR conditional on DECL_HAS_DEBUG_EXPR_P.
2780         * tree-streamer-in.c (lto_input_ts_decl_common_tree_pointers):
2781         Likewise.
2782         * tree-streamer-out.c (write_ts_decl_common_tree_pointers): Likewise.
2783
2784 2018-01-11  Michael Meissner  <meissner@linux.vnet.ibm.com>
2785
2786         * configure.ac (--with-long-double-format): Add support for the
2787         configuration option to change the default long double format on
2788         PowerPC systems.
2789         * config.gcc (powerpc*-linux*-*): Likewise.
2790         * configure: Regenerate.
2791         * config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): If long
2792         double is IEEE, define __KC__ and __KF__ to allow floatn.h to be
2793         used without modification.
2794
2795 2018-01-11  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
2796
2797         * config/rs6000/rs6000-builtin.def (BU_P7_MISC_X): New #define.
2798         (SPEC_BARRIER): New instantiation of BU_P7_MISC_X.
2799         * config/rs6000/rs6000.c (rs6000_expand_builtin): Handle
2800         MISC_BUILTIN_SPEC_BARRIER.
2801         (rs6000_init_builtins): Likewise.
2802         * config/rs6000/rs6000.md (UNSPECV_SPEC_BARRIER): New UNSPECV
2803         enum value.
2804         (speculation_barrier): New define_insn.
2805         * doc/extend.texi: Document __builtin_speculation_barrier.
2806
2807 2018-01-11  Jakub Jelinek  <jakub@redhat.com>
2808
2809         PR target/83203
2810         * config/i386/i386.c (ix86_expand_vector_init_one_nonzero): If one_var
2811         is 0, for V{8,16}S[IF] and V[48]D[IF]mode use gen_vec_set<mode>_0.
2812         * config/i386/sse.md (VI8_AVX_AVX512F, VI4F_256_512): New mode
2813         iterators.
2814         (ssescalarmodesuffix): Add 512-bit vectors.  Use "d" or "q" for
2815         integral modes instead of "ss" and "sd".
2816         (vec_set<mode>_0): New define_insns for 256-bit and 512-bit
2817         vectors with 32-bit and 64-bit elements.
2818         (vecdupssescalarmodesuffix): New mode attribute.
2819         (vec_dup<mode>): Use it.
2820
2821 2018-01-11  H.J. Lu  <hongjiu.lu@intel.com>
2822
2823         PR target/83330
2824         * config/i386/i386.c (ix86_compute_frame_layout): Align stack
2825         frame if argument is passed on stack.
2826
2827 2018-01-11  Jakub Jelinek  <jakub@redhat.com>
2828
2829         PR target/82682
2830         * ree.c (combine_reaching_defs): Optimize also
2831         reg2=exp; reg1=reg2; reg2=any_extend(reg1); into
2832         reg2=any_extend(exp); reg1=reg2;, formatting fix.
2833
2834 2018-01-11  Jan Hubicka  <hubicka@ucw.cz>
2835
2836         PR middle-end/83189
2837         * gimple-ssa-isolate-paths.c (isolate_path): Fix profile update.
2838
2839 2018-01-11  Jan Hubicka  <hubicka@ucw.cz>
2840
2841         PR middle-end/83718
2842         * tree-inline.c (copy_cfg_body): Adjust num&den for scaling
2843         after they are computed.
2844
2845 2018-01-11  Bin Cheng  <bin.cheng@arm.com>
2846
2847         PR tree-optimization/83695
2848         * gimple-loop-linterchange.cc
2849         (tree_loop_interchange::interchange_loops): Call scev_reset_htab to
2850         reset cached scev information after interchange.
2851         (pass_linterchange::execute): Remove call to scev_reset_htab.
2852
2853 2018-01-11  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
2854
2855         * config/arm/arm_neon.h (vfmlal_lane_low_u32, vfmlal_lane_high_u32,
2856         vfmlalq_laneq_low_u32, vfmlalq_lane_low_u32, vfmlal_laneq_low_u32,
2857         vfmlalq_laneq_high_u32, vfmlalq_lane_high_u32, vfmlal_laneq_high_u32,
2858         vfmlsl_lane_low_u32, vfmlsl_lane_high_u32, vfmlslq_laneq_low_u32,
2859         vfmlslq_lane_low_u32, vfmlsl_laneq_low_u32, vfmlslq_laneq_high_u32,
2860         vfmlslq_lane_high_u32, vfmlsl_laneq_high_u32): Define.
2861         * config/arm/arm_neon_builtins.def (vfmal_lane_low,
2862         vfmal_lane_lowv4hf, vfmal_lane_lowv8hf, vfmal_lane_high,
2863         vfmal_lane_highv4hf, vfmal_lane_highv8hf, vfmsl_lane_low,
2864         vfmsl_lane_lowv4hf, vfmsl_lane_lowv8hf, vfmsl_lane_high,
2865         vfmsl_lane_highv4hf, vfmsl_lane_highv8hf): New sets of builtins.
2866         * config/arm/iterators.md (VFMLSEL2, vfmlsel2): New mode attributes.
2867         (V_lane_reg): Likewise.
2868         * config/arm/neon.md (neon_vfm<vfml_op>l_lane_<vfml_half><VCVTF:mode>):
2869         New define_expand.
2870         (neon_vfm<vfml_op>l_lane_<vfml_half><vfmlsel2><mode>): Likewise.
2871         (vfmal_lane_low<mode>_intrinsic,
2872         vfmal_lane_low<vfmlsel2><mode>_intrinsic,
2873         vfmal_lane_high<vfmlsel2><mode>_intrinsic,
2874         vfmal_lane_high<mode>_intrinsic, vfmsl_lane_low<mode>_intrinsic,
2875         vfmsl_lane_low<vfmlsel2><mode>_intrinsic,
2876         vfmsl_lane_high<vfmlsel2><mode>_intrinsic,
2877         vfmsl_lane_high<mode>_intrinsic): New define_insns.
2878
2879 2018-01-11  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
2880
2881         * config/arm/arm-cpus.in (fp16fml): New feature.
2882         (ALL_SIMD): Add fp16fml.
2883         (armv8.2-a): Add fp16fml as an option.
2884         (armv8.3-a): Likewise.
2885         (armv8.4-a): Add fp16fml as part of fp16.
2886         * config/arm/arm.h (TARGET_FP16FML): Define.
2887         * config/arm/arm-c.c (arm_cpu_builtins): Define __ARM_FEATURE_FP16_FML
2888         when appropriate.
2889         * config/arm/arm-modes.def (V2HF): Define.
2890         * config/arm/arm_neon.h (vfmlal_low_u32, vfmlsl_low_u32,
2891         vfmlal_high_u32, vfmlsl_high_u32, vfmlalq_low_u32,
2892         vfmlslq_low_u32, vfmlalq_high_u32, vfmlslq_high_u32): Define.
2893         * config/arm/arm_neon_builtins.def (vfmal_low, vfmal_high,
2894         vfmsl_low, vfmsl_high): New set of builtins.
2895         * config/arm/iterators.md (PLUSMINUS): New code iterator.
2896         (vfml_op): New code attribute.
2897         (VFMLHALVES): New int iterator.
2898         (VFML, VFMLSEL): New mode attributes.
2899         (V_reg): Define mapping for V2HF.
2900         (V_hi, V_lo): New mode attributes.
2901         (VF_constraint): Likewise.
2902         (vfml_half, vfml_half_selector): New int attributes.
2903         * config/arm/neon.md (neon_vfm<vfml_op>l_<vfml_half><mode>): New
2904         define_expand.
2905         (vfmal_low<mode>_intrinsic, vfmsl_high<mode>_intrinsic,
2906         vfmal_high<mode>_intrinsic, vfmsl_low<mode>_intrinsic):
2907         New define_insn.
2908         * config/arm/t-arm-elf (v8_fps): Add fp16fml.
2909         * config/arm/t-multilib (v8_2_a_simd_variants): Add fp16fml.
2910         * config/arm/unspecs.md (UNSPEC_VFML_LO, UNSPEC_VFML_HI): New unspecs.
2911         * doc/invoke.texi (ARM Options): Document fp16fml.  Update armv8.4-a
2912         documentation.
2913         * doc/sourcebuild.texi (arm_fp16fml_neon_ok, arm_fp16fml_neon):
2914         Document new effective target and option set.
2915
2916 2017-01-11  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
2917
2918         * config/arm/arm-cpus.in (armv8_4): New feature.
2919         (ARMv8_4a): New fgroup.
2920         (armv8.4-a): New arch.
2921         * config/arm/arm-tables.opt: Regenerate.
2922         * config/arm/t-aprofile: Add matching rules for -march=armv8.4-a.
2923         * config/arm/t-arm-elf (all_v8_archs): Add armv8.4-a.
2924         * config/arm/t-multilib (v8_4_a_simd_variants): New variable.
2925         Add matching rules for -march=armv8.4-a and extensions.
2926         * doc/invoke.texi (ARM Options): Document -march=armv8.4-a.
2927
2928 2018-01-11  Oleg Endo  <olegendo@gcc.gnu.org>
2929
2930         PR target/81821
2931         * config/rx/rx.md (BW): New mode attribute.
2932         (sync_lock_test_and_setsi): Add mode suffix to insn output.
2933
2934 2018-01-11  Richard Biener  <rguenther@suse.de>
2935
2936         PR tree-optimization/83435
2937         * graphite.c (canonicalize_loop_form): Ignore fake loop exit edges.
2938         * graphite-scop-detection.c (scop_detection::get_sese): Likewise.
2939         * tree-vrp.c (add_assert_info): Drop TREE_OVERFLOW if they appear.
2940
2941 2018-01-11  Richard Sandiford  <richard.sandiford@linaro.org>
2942             Alan Hayward  <alan.hayward@arm.com>
2943             David Sherwood  <david.sherwood@arm.com>
2944
2945         * config/aarch64/aarch64.c (aarch64_address_info): Add a const_offset
2946         field.
2947         (aarch64_classify_address): Initialize it.  Track polynomial offsets.
2948         (aarch64_print_address_internal): Use it to check for a zero offset.
2949
2950 2018-01-11  Richard Sandiford  <richard.sandiford@linaro.org>
2951             Alan Hayward  <alan.hayward@arm.com>
2952             David Sherwood  <david.sherwood@arm.com>
2953
2954         * config/aarch64/aarch64-modes.def (NUM_POLY_INT_COEFFS): Set to 2.
2955         * config/aarch64/aarch64-protos.h (aarch64_initial_elimination_offset):
2956         Return a poly_int64 rather than a HOST_WIDE_INT.
2957         (aarch64_offset_7bit_signed_scaled_p): Take the offset as a poly_int64
2958         rather than a HOST_WIDE_INT.
2959         * config/aarch64/aarch64.h (aarch64_frame): Protect with
2960         HAVE_POLY_INT_H rather than HOST_WIDE_INT.  Change locals_offset,
2961         hard_fp_offset, frame_size, initial_adjust, callee_offset and
2962         final_offset from HOST_WIDE_INT to poly_int64.
2963         * config/aarch64/aarch64-builtins.c (aarch64_simd_expand_args): Use
2964         to_constant when getting the number of units in an Advanced SIMD
2965         mode.
2966         (aarch64_builtin_vectorized_function): Check for a constant number
2967         of units.
2968         * config/aarch64/aarch64-simd.md (mov<mode>): Handle polynomial
2969         GET_MODE_SIZE.
2970         (aarch64_ld<VSTRUCT:nregs>_lane<VALLDIF:mode>): Use the nunits
2971         attribute instead of GET_MODE_NUNITS.
2972         * config/aarch64/aarch64.c (aarch64_hard_regno_nregs)
2973         (aarch64_class_max_nregs): Use the constant_lowest_bound of the
2974         GET_MODE_SIZE for fixed-size registers.
2975         (aarch64_const_vec_all_same_in_range_p): Use const_vec_duplicate_p.
2976         (aarch64_hard_regno_call_part_clobbered, aarch64_classify_index)
2977         (aarch64_mode_valid_for_sched_fusion_p, aarch64_classify_address)
2978         (aarch64_legitimize_address_displacement, aarch64_secondary_reload)
2979         (aarch64_print_operand, aarch64_print_address_internal)
2980         (aarch64_address_cost, aarch64_rtx_costs, aarch64_register_move_cost)
2981         (aarch64_short_vector_p, aapcs_vfp_sub_candidate)
2982         (aarch64_simd_attr_length_rglist, aarch64_operands_ok_for_ldpstp):
2983         Handle polynomial GET_MODE_SIZE.
2984         (aarch64_hard_regno_caller_save_mode): Likewise.  Return modes
2985         wider than SImode without modification.
2986         (tls_symbolic_operand_type): Use strip_offset instead of split_const.
2987         (aarch64_pass_by_reference, aarch64_layout_arg, aarch64_pad_reg_upward)
2988         (aarch64_gimplify_va_arg_expr): Assert that we don't yet handle
2989         passing and returning SVE modes.
2990         (aarch64_function_value, aarch64_layout_arg): Use gen_int_mode
2991         rather than GEN_INT.
2992         (aarch64_emit_probe_stack_range): Take the size as a poly_int64
2993         rather than a HOST_WIDE_INT, but call sorry if it isn't constant.
2994         (aarch64_allocate_and_probe_stack_space): Likewise.
2995         (aarch64_layout_frame): Cope with polynomial offsets.
2996         (aarch64_save_callee_saves, aarch64_restore_callee_saves): Take the
2997         start_offset as a poly_int64 rather than a HOST_WIDE_INT.  Track
2998         polynomial offsets.
2999         (offset_9bit_signed_unscaled_p, offset_12bit_unsigned_scaled_p)
3000         (aarch64_offset_7bit_signed_scaled_p): Take the offset as a
3001         poly_int64 rather than a HOST_WIDE_INT.
3002         (aarch64_get_separate_components, aarch64_process_components)
3003         (aarch64_expand_prologue, aarch64_expand_epilogue)
3004         (aarch64_use_return_insn_p): Handle polynomial frame offsets.
3005         (aarch64_anchor_offset): New function, split out from...
3006         (aarch64_legitimize_address): ...here.
3007         (aarch64_builtin_vectorization_cost): Handle polynomial
3008         TYPE_VECTOR_SUBPARTS.
3009         (aarch64_simd_check_vect_par_cnst_half): Handle polynomial
3010         GET_MODE_NUNITS.
3011         (aarch64_simd_make_constant, aarch64_expand_vector_init): Get the
3012         number of elements from the PARALLEL rather than the mode.
3013         (aarch64_shift_truncation_mask): Use GET_MODE_UNIT_BITSIZE
3014         rather than GET_MODE_BITSIZE.
3015         (aarch64_evpc_trn, aarch64_evpc_uzp, aarch64_evpc_ext)
3016         (aarch64_evpc_rev, aarch64_evpc_dup, aarch64_evpc_zip)
3017         (aarch64_expand_vec_perm_const_1): Handle polynomial
3018         d->perm.length () and d->perm elements.
3019         (aarch64_evpc_tbl): Likewise.  Use nelt rather than GET_MODE_NUNITS.
3020         Apply to_constant to d->perm elements.
3021         (aarch64_simd_valid_immediate, aarch64_vec_fpconst_pow_of_2): Handle
3022         polynomial CONST_VECTOR_NUNITS.
3023         (aarch64_move_pointer): Take amount as a poly_int64 rather
3024         than an int.
3025         (aarch64_progress_pointer): Avoid temporary variable.
3026         * config/aarch64/aarch64.md (aarch64_<crc_variant>): Use
3027         the mode attribute instead of GET_MODE.
3028
3029 2018-01-11  Richard Sandiford  <richard.sandiford@linaro.org>
3030             Alan Hayward  <alan.hayward@arm.com>
3031             David Sherwood  <david.sherwood@arm.com>
3032
3033         * config/aarch64/aarch64.c (aarch64_force_temporary): Assert that
3034         x exists before using it.
3035         (aarch64_add_constant_internal): Rename to...
3036         (aarch64_add_offset_1): ...this.  Replace regnum with separate
3037         src and dest rtxes.  Handle the case in which they're different,
3038         including when the offset is zero.  Replace scratchreg with an rtx.
3039         Use 2 additions if there is no spare register into which we can
3040         move a 16-bit constant.
3041         (aarch64_add_constant): Delete.
3042         (aarch64_add_offset): Replace reg with separate src and dest
3043         rtxes.  Take a poly_int64 offset instead of a HOST_WIDE_INT.
3044         Use aarch64_add_offset_1.
3045         (aarch64_add_sp, aarch64_sub_sp): Take the scratch register as
3046         an rtx rather than an int.  Take the delta as a poly_int64
3047         rather than a HOST_WIDE_INT.  Use aarch64_add_offset.
3048         (aarch64_expand_mov_immediate): Update uses of aarch64_add_offset.
3049         (aarch64_expand_prologue): Update calls to aarch64_sub_sp,
3050         aarch64_allocate_and_probe_stack_space and aarch64_add_offset.
3051         (aarch64_expand_epilogue): Update calls to aarch64_add_offset
3052         and aarch64_add_sp.
3053         (aarch64_output_mi_thunk): Use aarch64_add_offset rather than
3054         aarch64_add_constant.
3055
3056 2018-01-11  Richard Sandiford  <richard.sandiford@linaro.org>
3057
3058         * config/aarch64/aarch64.c (aarch64_reinterpret_float_as_int):
3059         Use scalar_float_mode.
3060
3061 2018-01-11  Richard Sandiford  <richard.sandiford@linaro.org>
3062
3063         * config/aarch64/aarch64-simd.md
3064         (aarch64_fml<f16mac1>l<f16quad>_low<mode>): Avoid GET_MODE_NUNITS.
3065         (aarch64_fml<f16mac1>l<f16quad>_high<mode>): Likewise.
3066         (aarch64_fml<f16mac1>l_lane_lowv2sf): Likewise.
3067         (aarch64_fml<f16mac1>l_lane_highv2sf): Likewise.
3068         (aarch64_fml<f16mac1>lq_laneq_lowv4sf): Likewise.
3069         (aarch64_fml<f16mac1>lq_laneq_highv4sf): Likewise.
3070         (aarch64_fml<f16mac1>l_laneq_lowv2sf): Likewise.
3071         (aarch64_fml<f16mac1>l_laneq_highv2sf): Likewise.
3072         (aarch64_fml<f16mac1>lq_lane_lowv4sf): Likewise.
3073         (aarch64_fml<f16mac1>lq_lane_highv4sf): Likewise.
3074
3075 2018-01-11  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
3076
3077         PR target/83514
3078         * config/arm/arm.c (arm_declare_function_name): Set arch_to_print if
3079         targ_options->x_arm_arch_string is non NULL.
3080
3081 2018-01-11  Tamar Christina  <tamar.christina@arm.com>
3082
3083         * config/aarch64/aarch64.h
3084         (AARCH64_FL_FOR_ARCH8_4): Add  AARCH64_FL_DOTPROD.
3085
3086 2018-01-11  Sudakshina Das  <sudi.das@arm.com>
3087
3088         PR target/82096
3089         * expmed.c (emit_store_flag_force): Swap if const op0
3090         and change VOIDmode to mode of op0.
3091
3092 2018-01-11  Richard Sandiford  <richard.sandiford@linaro.org>
3093
3094         PR rtl-optimization/83761
3095         * caller-save.c (replace_reg_with_saved_mem): Pass bits rather
3096         than bytes to mode_for_size.
3097
3098 2018-01-10  Jan Hubicka  <hubicka@ucw.cz>
3099
3100         PR middle-end/83189
3101         * gfortran.fortran-torture/compile/pr83189.f90: New testcase.
3102         * tree-ssa-loop-manip.c (tree_transform_and_unroll_loop): Handle zero
3103         profile.
3104
3105 2018-01-10  Jan Hubicka  <hubicka@ucw.cz>
3106
3107         PR middle-end/83575
3108         * cfgrtl.c (rtl_verify_edges): Only verify fixability of partition
3109         when in layout mode.
3110         (cfg_layout_finalize): Do not verify cfg before we are out of layout.
3111         * cfgcleanup.c (try_optimize_cfg): Only verify flow info when doing
3112         partition fixup.
3113
3114 2018-01-10  Michael Collison  <michael.collison@arm.com>
3115
3116         * config/aarch64/aarch64-modes.def (V2HF): New VECTOR_MODE.
3117         * config/aarch64/aarch64-option-extension.def: Add
3118         AARCH64_OPT_EXTENSION of 'fp16fml'.
3119         * config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins):
3120         (__ARM_FEATURE_FP16_FML): Define if TARGET_F16FML is true.
3121         * config/aarch64/predicates.md (aarch64_lane_imm3): New predicate.
3122         * config/aarch64/constraints.md (Ui7): New constraint.
3123         * config/aarch64/iterators.md (VFMLA_W): New mode iterator.
3124         (VFMLA_SEL_W): Ditto.
3125         (f16quad): Ditto.
3126         (f16mac1): Ditto.
3127         (VFMLA16_LOW): New int iterator.
3128         (VFMLA16_HIGH): Ditto.
3129         (UNSPEC_FMLAL): New unspec.
3130         (UNSPEC_FMLSL): Ditto.
3131         (UNSPEC_FMLAL2): Ditto.
3132         (UNSPEC_FMLSL2): Ditto.
3133         (f16mac): New code attribute.
3134         * config/aarch64/aarch64-simd-builtins.def
3135         (aarch64_fmlal_lowv2sf): Ditto.
3136         (aarch64_fmlsl_lowv2sf): Ditto.
3137         (aarch64_fmlalq_lowv4sf): Ditto.
3138         (aarch64_fmlslq_lowv4sf): Ditto.
3139         (aarch64_fmlal_highv2sf): Ditto.
3140         (aarch64_fmlsl_highv2sf): Ditto.
3141         (aarch64_fmlalq_highv4sf): Ditto.
3142         (aarch64_fmlslq_highv4sf): Ditto.
3143         (aarch64_fmlal_lane_lowv2sf): Ditto.
3144         (aarch64_fmlsl_lane_lowv2sf): Ditto.
3145         (aarch64_fmlal_laneq_lowv2sf): Ditto.
3146         (aarch64_fmlsl_laneq_lowv2sf): Ditto.
3147         (aarch64_fmlalq_lane_lowv4sf): Ditto.
3148         (aarch64_fmlsl_lane_lowv4sf): Ditto.
3149         (aarch64_fmlalq_laneq_lowv4sf): Ditto.
3150         (aarch64_fmlsl_laneq_lowv4sf): Ditto.
3151         (aarch64_fmlal_lane_highv2sf): Ditto.
3152         (aarch64_fmlsl_lane_highv2sf): Ditto.
3153         (aarch64_fmlal_laneq_highv2sf): Ditto.
3154         (aarch64_fmlsl_laneq_highv2sf): Ditto.
3155         (aarch64_fmlalq_lane_highv4sf): Ditto.
3156         (aarch64_fmlsl_lane_highv4sf): Ditto.
3157         (aarch64_fmlalq_laneq_highv4sf): Ditto.
3158         (aarch64_fmlsl_laneq_highv4sf): Ditto.
3159         * config/aarch64/aarch64-simd.md:
3160         (aarch64_fml<f16mac1>l<f16quad>_low<mode>): New pattern.
3161         (aarch64_fml<f16mac1>l<f16quad>_high<mode>): Ditto.
3162         (aarch64_simd_fml<f16mac1>l<f16quad>_low<mode>): Ditto.
3163         (aarch64_simd_fml<f16mac1>l<f16quad>_high<mode>): Ditto.
3164         (aarch64_fml<f16mac1>l_lane_lowv2sf): Ditto.
3165         (aarch64_fml<f16mac1>l_lane_highv2sf): Ditto.
3166         (aarch64_simd_fml<f16mac>l_lane_lowv2sf): Ditto.
3167         (aarch64_simd_fml<f16mac>l_lane_highv2sf): Ditto.
3168         (aarch64_fml<f16mac1>lq_laneq_lowv4sf): Ditto.
3169         (aarch64_fml<f16mac1>lq_laneq_highv4sf): Ditto.
3170         (aarch64_simd_fml<f16mac>lq_laneq_lowv4sf): Ditto.
3171         (aarch64_simd_fml<f16mac>lq_laneq_highv4sf): Ditto.
3172         (aarch64_fml<f16mac1>l_laneq_lowv2sf): Ditto.
3173         (aarch64_fml<f16mac1>l_laneq_highv2sf): Ditto.
3174         (aarch64_simd_fml<f16mac>l_laneq_lowv2sf): Ditto.
3175         (aarch64_simd_fml<f16mac>l_laneq_highv2sf): Ditto.
3176         (aarch64_fml<f16mac1>lq_lane_lowv4sf): Ditto.
3177         (aarch64_fml<f16mac1>lq_lane_highv4sf): Ditto.
3178         (aarch64_simd_fml<f16mac>lq_lane_lowv4sf): Ditto.
3179         (aarch64_simd_fml<f16mac>lq_lane_highv4sf): Ditto.
3180         * config/aarch64/arm_neon.h (vfmlal_low_u32): New intrinsic.
3181         (vfmlsl_low_u32): Ditto.
3182         (vfmlalq_low_u32): Ditto.
3183         (vfmlslq_low_u32): Ditto.
3184         (vfmlal_high_u32): Ditto.
3185         (vfmlsl_high_u32): Ditto.
3186         (vfmlalq_high_u32): Ditto.
3187         (vfmlslq_high_u32): Ditto.
3188         (vfmlal_lane_low_u32): Ditto.
3189         (vfmlsl_lane_low_u32): Ditto.
3190         (vfmlal_laneq_low_u32): Ditto.
3191         (vfmlsl_laneq_low_u32): Ditto.
3192         (vfmlalq_lane_low_u32): Ditto.
3193         (vfmlslq_lane_low_u32): Ditto.
3194         (vfmlalq_laneq_low_u32): Ditto.
3195         (vfmlslq_laneq_low_u32): Ditto.
3196         (vfmlal_lane_high_u32): Ditto.
3197         (vfmlsl_lane_high_u32): Ditto.
3198         (vfmlal_laneq_high_u32): Ditto.
3199         (vfmlsl_laneq_high_u32): Ditto.
3200         (vfmlalq_lane_high_u32): Ditto.
3201         (vfmlslq_lane_high_u32): Ditto.
3202         (vfmlalq_laneq_high_u32): Ditto.
3203         (vfmlslq_laneq_high_u32): Ditto.
3204         * config/aarch64/aarch64.h (AARCH64_FL_F16SML): New flag.
3205         (AARCH64_FL_FOR_ARCH8_4): New.
3206         (AARCH64_ISA_F16FML): New ISA flag.
3207         (TARGET_F16FML): New feature flag for fp16fml.
3208         (doc/invoke.texi): Document new fp16fml option.
3209
3210 2018-01-10  Michael Collison  <michael.collison@arm.com>
3211
3212         * config/aarch64/aarch64-builtins.c:
3213         (aarch64_types_ternopu_imm_qualifiers, TYPES_TERNOPUI): New.
3214         * config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins):
3215         (__ARM_FEATURE_SHA3): Define if TARGET_SHA3 is true.
3216         * config/aarch64/aarch64.h (AARCH64_FL_SHA3): New flags.
3217         (AARCH64_ISA_SHA3): New ISA flag.
3218         (TARGET_SHA3): New feature flag for sha3.
3219         * config/aarch64/iterators.md (sha512_op): New int attribute.
3220         (CRYPTO_SHA512): New int iterator.
3221         (UNSPEC_SHA512H): New unspec.
3222         (UNSPEC_SHA512H2): Ditto.
3223         (UNSPEC_SHA512SU0): Ditto.
3224         (UNSPEC_SHA512SU1): Ditto.
3225         * config/aarch64/aarch64-simd-builtins.def
3226         (aarch64_crypto_sha512hqv2di): New builtin.
3227         (aarch64_crypto_sha512h2qv2di): Ditto.
3228         (aarch64_crypto_sha512su0qv2di): Ditto.
3229         (aarch64_crypto_sha512su1qv2di): Ditto.
3230         (aarch64_eor3qv8hi): Ditto.
3231         (aarch64_rax1qv2di): Ditto.
3232         (aarch64_xarqv2di): Ditto.
3233         (aarch64_bcaxqv8hi): Ditto.
3234         * config/aarch64/aarch64-simd.md:
3235         (aarch64_crypto_sha512h<sha512_op>qv2di): New pattern.
3236         (aarch64_crypto_sha512su0qv2di): Ditto.
3237         (aarch64_crypto_sha512su1qv2di): Ditto.
3238         (aarch64_eor3qv8hi): Ditto.
3239         (aarch64_rax1qv2di): Ditto.
3240         (aarch64_xarqv2di): Ditto.
3241         (aarch64_bcaxqv8hi): Ditto.
3242         * config/aarch64/arm_neon.h (vsha512hq_u64): New intrinsic.
3243         (vsha512h2q_u64): Ditto.
3244         (vsha512su0q_u64): Ditto.
3245         (vsha512su1q_u64): Ditto.
3246         (veor3q_u16): Ditto.
3247         (vrax1q_u64): Ditto.
3248         (vxarq_u64): Ditto.
3249         (vbcaxq_u16): Ditto.
3250         * config/arm/types.md (crypto_sha512): New type attribute.
3251         (crypto_sha3): Ditto.
3252         (doc/invoke.texi): Document new sha3 option.
3253
3254 2018-01-10  Michael Collison  <michael.collison@arm.com>
3255
3256         * config/aarch64/aarch64-builtins.c:
3257         (aarch64_types_quadopu_imm_qualifiers, TYPES_QUADOPUI): New.
3258         * config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins):
3259         (__ARM_FEATURE_SM3): Define if TARGET_SM4 is true.
3260         (__ARM_FEATURE_SM4): Define if TARGET_SM4 is true.
3261         * config/aarch64/aarch64.h (AARCH64_FL_SM4): New flags.
3262         (AARCH64_ISA_SM4): New ISA flag.
3263         (TARGET_SM4): New feature flag for sm4.
3264         * config/aarch64/aarch64-simd-builtins.def
3265         (aarch64_sm3ss1qv4si): Ditto.
3266         (aarch64_sm3tt1aq4si): Ditto.
3267         (aarch64_sm3tt1bq4si): Ditto.
3268         (aarch64_sm3tt2aq4si): Ditto.
3269         (aarch64_sm3tt2bq4si): Ditto.
3270         (aarch64_sm3partw1qv4si): Ditto.
3271         (aarch64_sm3partw2qv4si): Ditto.
3272         (aarch64_sm4eqv4si): Ditto.
3273         (aarch64_sm4ekeyqv4si): Ditto.
3274         * config/aarch64/aarch64-simd.md:
3275         (aarch64_sm3ss1qv4si): Ditto.
3276         (aarch64_sm3tt<sm3tt_op>qv4si): Ditto.
3277         (aarch64_sm3partw<sm3part_op>qv4si): Ditto.
3278         (aarch64_sm4eqv4si): Ditto.
3279         (aarch64_sm4ekeyqv4si): Ditto.
3280         * config/aarch64/iterators.md (sm3tt_op): New int iterator.
3281         (sm3part_op): Ditto.
3282         (CRYPTO_SM3TT): Ditto.
3283         (CRYPTO_SM3PART): Ditto.
3284         (UNSPEC_SM3SS1): New unspec.
3285         (UNSPEC_SM3TT1A): Ditto.
3286         (UNSPEC_SM3TT1B): Ditto.
3287         (UNSPEC_SM3TT2A): Ditto.
3288         (UNSPEC_SM3TT2B): Ditto.
3289         (UNSPEC_SM3PARTW1): Ditto.
3290         (UNSPEC_SM3PARTW2): Ditto.
3291         (UNSPEC_SM4E): Ditto.
3292         (UNSPEC_SM4EKEY): Ditto.
3293         * config/aarch64/constraints.md (Ui2): New constraint.
3294         * config/aarch64/predicates.md (aarch64_imm2): New predicate.
3295         * config/arm/types.md (crypto_sm3): New type attribute.
3296         (crypto_sm4): Ditto.
3297         * config/aarch64/arm_neon.h (vsm3ss1q_u32): New intrinsic.
3298         (vsm3tt1aq_u32): Ditto.
3299         (vsm3tt1bq_u32): Ditto.
3300         (vsm3tt2aq_u32): Ditto.
3301         (vsm3tt2bq_u32): Ditto.
3302         (vsm3partw1q_u32): Ditto.
3303         (vsm3partw2q_u32): Ditto.
3304         (vsm4eq_u32): Ditto.
3305         (vsm4ekeyq_u32): Ditto.
3306         (doc/invoke.texi): Document new sm4 option.
3307
3308 2018-01-10  Michael Collison  <michael.collison@arm.com>
3309
3310         * config/aarch64/aarch64-arches.def (armv8.4-a): New architecture.
3311         * config/aarch64/aarch64.h (AARCH64_ISA_V8_4): New ISA flag.
3312         (AARCH64_FL_FOR_ARCH8_4): New.
3313         (AARCH64_FL_V8_4): New flag.
3314         (doc/invoke.texi): Document new armv8.4-a option.
3315
3316 2018-01-10  Michael Collison  <michael.collison@arm.com>
3317
3318         * config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins):
3319         (__ARM_FEATURE_AES): Define if TARGET_AES is true.
3320         (__ARM_FEATURE_SHA2): Define if TARGET_SHA2 is true.
3321         * config/aarch64/aarch64-option-extension.def: Add
3322         AARCH64_OPT_EXTENSION of 'sha2'.
3323         (aes): Add AARCH64_OPT_EXTENSION of 'aes'.
3324         (crypto): Disable sha2 and aes if crypto disabled.
3325         (crypto): Enable aes and sha2 if enabled.
3326         (simd): Disable sha2 and aes if simd disabled.
3327         * config/aarch64/aarch64.h (AARCH64_FL_AES, AARCH64_FL_SHA2):
3328         New flags.
3329         (AARCH64_ISA_AES, AARCH64_ISA_SHA2): New ISA flags.
3330         (TARGET_SHA2): New feature flag for sha2.
3331         (TARGET_AES): New feature flag for aes.
3332         * config/aarch64/aarch64-simd.md:
3333         (aarch64_crypto_aes<aes_op>v16qi): Make pattern
3334         conditional on TARGET_AES.
3335         (aarch64_crypto_aes<aesmc_op>v16qi): Ditto.
3336         (aarch64_crypto_sha1hsi): Make pattern conditional
3337         on TARGET_SHA2.
3338         (aarch64_crypto_sha1hv4si): Ditto.
3339         (aarch64_be_crypto_sha1hv4si): Ditto.
3340         (aarch64_crypto_sha1su1v4si): Ditto.
3341         (aarch64_crypto_sha1<sha1_op>v4si): Ditto.
3342         (aarch64_crypto_sha1su0v4si): Ditto.
3343         (aarch64_crypto_sha256h<sha256_op>v4si): Ditto.
3344         (aarch64_crypto_sha256su0v4si): Ditto.
3345         (aarch64_crypto_sha256su1v4si): Ditto.
3346         (doc/invoke.texi): Document new aes and sha2 options.
3347
3348 2018-01-10  Martin Sebor  <msebor@redhat.com>
3349
3350         PR tree-optimization/83781
3351         * gimple-fold.c (get_range_strlen): Avoid treating arrays of pointers
3352         as string arrays.
3353
3354 2018-01-11  Martin Sebor  <msebor@gmail.com>
3355             Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
3356
3357         PR tree-optimization/83501
3358         PR tree-optimization/81703
3359
3360         * tree-ssa-strlen.c (get_string_cst): Rename...
3361         (get_string_len): ...to this.  Handle global constants.
3362         (handle_char_store): Adjust.
3363
3364 2018-01-10  Kito Cheng  <kito.cheng@gmail.com>
3365             Jim Wilson  <jimw@sifive.com>
3366
3367         * config/riscv/riscv-protos.h (riscv_output_return): New.
3368         * config/riscv/riscv.c (struct machine_function): New naked_p field.
3369         (riscv_attribute_table, riscv_output_return),
3370         (riscv_handle_fndecl_attribute, riscv_naked_function_p),
3371         (riscv_allocate_stack_slots_for_args, riscv_warn_func_return): New.
3372         (riscv_compute_frame_info): Only compute frame->mask if not a naked
3373         function.
3374         (riscv_expand_prologue): Add early return for naked function.
3375         (riscv_expand_epilogue): Likewise.
3376         (riscv_function_ok_for_sibcall): Return false for naked function.
3377         (riscv_set_current_function): New.
3378         (TARGET_SET_CURRENT_FUNCTION, TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS),
3379         (TARGET_ATTRIBUTE_TABLE, TARGET_WARN_FUNC_RETURN): New.
3380         * config/riscv/riscv.md (simple_return): Call riscv_output_return.
3381         * doc/extend.texi (RISC-V Function Attributes): New.
3382
3383 2018-01-10  Michael Meissner  <meissner@linux.vnet.ibm.com>
3384
3385         * config/rs6000/rs6000.c (is_complex_IBM_long_double): Explicitly
3386         check for 128-bit long double before checking TCmode.
3387         * config/rs6000/rs6000.h (FLOAT128_IEEE_P): Explicitly check for
3388         128-bit long doubles before checking TFmode or TCmode.
3389         (FLOAT128_IBM_P): Likewise.
3390
3391 2018-01-10  Martin Sebor  <msebor@redhat.com>
3392
3393         PR tree-optimization/83671
3394         * builtins.c (c_strlen): Unconditionally return zero for the empty
3395         string.
3396         Use -Warray-bounds for warnings.
3397         * gimple-fold.c (get_range_strlen): Handle non-constant lengths
3398         for non-constant array indices with COMPONENT_REF, arrays of
3399         arrays, and pointers to arrays.
3400         (gimple_fold_builtin_strlen): Determine and set length range for
3401         non-constant character arrays.
3402
3403 2018-01-10  Aldy Hernandez  <aldyh@redhat.com>
3404
3405         PR middle-end/81897
3406         * tree-ssa-uninit.c (convert_control_dep_chain_into_preds): Skip
3407         empty blocks.
3408
3409 2018-01-10  Eric Botcazou  <ebotcazou@adacore.com>
3410
3411         * dwarf2out.c (dwarf2out_var_location): Do not pass NULL to fprintf.
3412
3413 2018-01-10  Peter Bergner  <bergner@vnet.ibm.com>
3414
3415         PR target/83399
3416         * config/rs6000/rs6000.c (print_operand) <'y'>: Use
3417         VECTOR_MEM_ALTIVEC_OR_VSX_P.
3418         * config/rs6000/vsx.md (*vsx_le_perm_load_<mode> for VSX_D): Use
3419         indexed_or_indirect_operand predicate.
3420         (*vsx_le_perm_load_<mode> for VSX_W): Likewise.
3421         (*vsx_le_perm_load_v8hi): Likewise.
3422         (*vsx_le_perm_load_v16qi): Likewise.
3423         (*vsx_le_perm_store_<mode> for VSX_D): Likewise.
3424         (*vsx_le_perm_store_<mode> for VSX_W): Likewise.
3425         (*vsx_le_perm_store_v8hi): Likewise.
3426         (*vsx_le_perm_store_v16qi): Likewise.
3427         (eight unnamed splitters): Likewise.
3428
3429 2018-01-10  Peter Bergner  <bergner@vnet.ibm.com>
3430
3431         * config/rs6000/x86intrin.h: Change #warning to #error. Update message.
3432         * config/rs6000/emmintrin.h: Likewise.
3433         * config/rs6000/mmintrin.h: Likewise.
3434         * config/rs6000/xmmintrin.h: Likewise.
3435
3436 2018-01-10  David Malcolm  <dmalcolm@redhat.com>
3437
3438         PR c++/43486
3439         * tree-core.h: Document EXPR_LOCATION_WRAPPER_P's usage of
3440         "public_flag".
3441         * tree.c (tree_nop_conversion): Return true for location wrapper
3442         nodes.
3443         (maybe_wrap_with_location): New function.
3444         (selftest::check_strip_nops): New function.
3445         (selftest::test_location_wrappers): New function.
3446         (selftest::tree_c_tests): Call it.
3447         * tree.h (STRIP_ANY_LOCATION_WRAPPER): New macro.
3448         (maybe_wrap_with_location): New decl.
3449         (EXPR_LOCATION_WRAPPER_P): New macro.
3450         (location_wrapper_p): New inline function.
3451         (tree_strip_any_location_wrapper): New inline function.
3452
3453 2018-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3454
3455         PR target/83735
3456         * config/i386/i386.c (ix86_compute_frame_layout): Always adjust
3457         stack_realign_offset for the largest alignment of stack slot
3458         actually used.
3459         (ix86_find_max_used_stack_alignment): New function.
3460         (ix86_finalize_stack_frame_flags): Use it.  Set
3461         max_used_stack_alignment if we don't realign stack.
3462         * config/i386/i386.h (machine_function): Add
3463         max_used_stack_alignment.
3464
3465 2018-01-10  Christophe Lyon  <christophe.lyon@linaro.org>
3466
3467         * config/arm/arm.opt (-mbranch-cost): New option.
3468         * config/arm/arm.h (BRANCH_COST): Take arm_branch_cost into
3469         account.
3470
3471 2018-01-10  Segher Boessenkool  <segher@kernel.crashing.org>
3472
3473         PR target/83629
3474         * config/rs6000/rs6000.md (load_toc_v4_PIC_2, load_toc_v4_PIC_3b,
3475         load_toc_v4_PIC_3c): Wrap const term in CONST RTL.
3476
3477 2018-01-10  Richard Biener  <rguenther@suse.de>
3478
3479         PR debug/83765
3480         * dwarf2out.c (gen_subprogram_die): Hoist old_die && declaration
3481         early out so it also covers the case where we have a non-NULL
3482         origin.
3483
3484 2018-01-10  Richard Sandiford  <richard.sandiford@linaro.org>
3485
3486         PR tree-optimization/83753
3487         * tree-vect-stmts.c (get_group_load_store_type): Use VMAT_CONTIGUOUS
3488         for non-strided grouped accesses if the number of elements is 1.
3489
3490 2018-01-10  Jan Hubicka  <hubicka@ucw.cz>
3491
3492         PR target/81616
3493         * i386.c (ix86_vectorize_builtin_gather): Check TARGET_USE_GATHER.
3494         * i386.h (TARGET_USE_GATHER): Define.
3495         * x86-tune.def (X86_TUNE_USE_GATHER): New.
3496
3497 2018-01-10  Martin Liska  <mliska@suse.cz>
3498
3499         PR bootstrap/82831
3500         * basic-block.h (CLEANUP_NO_PARTITIONING): New define.
3501         * bb-reorder.c (pass_reorder_blocks::execute): Do not clean up
3502         partitioning.
3503         * cfgcleanup.c (try_optimize_cfg): Fix up partitioning if
3504         CLEANUP_NO_PARTITIONING is not set.
3505
3506 2018-01-10  Richard Sandiford  <richard.sandiford@linaro.org>
3507
3508         * doc/rtl.texi: Remove documentation of (const ...) wrappers
3509         for vectors, as a partial revert of r254296.
3510         * rtl.h (const_vec_p): Delete.
3511         (const_vec_duplicate_p): Don't test for vector CONSTs.
3512         (unwrap_const_vec_duplicate, const_vec_series_p): Likewise.
3513         * expmed.c (make_tree): Likewise.
3514
3515         Revert:
3516         * common.md (E, F): Use CONSTANT_P instead of checking for
3517         CONST_VECTOR.
3518         * emit-rtl.c (gen_lowpart_common): Use const_vec_p instead of
3519         checking for CONST_VECTOR.
3520
3521 2018-01-09  Jan Hubicka  <hubicka@ucw.cz>
3522
3523         PR middle-end/83575
3524         * predict.c (force_edge_cold): Handle in more sane way edges
3525         with no prediction.
3526
3527 2018-01-09  Carl Love  <cel@us.ibm.com>
3528
3529         * config/rs6002/altivec.md (p8_vmrgow): Add support for V2DI, V2DF,
3530         V4SI, V4SF types.
3531         (p8_vmrgew): Add support for V2DI, V2DF, V4SF types.
3532         * config/rs6000/rs6000-builtin.def: Add definitions for FLOAT2_V2DF,
3533         VMRGEW_V2DI, VMRGEW_V2DF, VMRGEW_V4SF, VMRGOW_V4SI, VMRGOW_V4SF,
3534         VMRGOW_V2DI, VMRGOW_V2DF.  Remove definition for VMRGOW.
3535         * config/rs6000/rs6000-c.c (VSX_BUILTIN_VEC_FLOAT2,
3536         P8V_BUILTIN_VEC_VMRGEW, P8V_BUILTIN_VEC_VMRGOW):  Add definitions.
3537         * config/rs6000/rs6000-protos.h: Add extern defition for
3538         rs6000_generate_float2_double_code.
3539         * config/rs6000/rs6000.c (rs6000_generate_float2_double_code): Add
3540         function.
3541         * config/rs6000/vsx.md (vsx_xvcdpsp): Add define_insn.
3542         (float2_v2df): Add define_expand.
3543
3544 2018-01-09  Uros Bizjak  <ubizjak@gmail.com>
3545
3546         PR target/83628
3547         * combine.c (force_int_to_mode) <case ASHIFT>: Use mode instead of
3548         op_mode in the force_to_mode call.
3549
3550 2018-01-09  Richard Sandiford  <richard.sandiford@linaro.org>
3551
3552         * config/aarch64/aarch64.c (aarch64_evpc_trn): Use d.perm.series_p
3553         instead of checking each element individually.
3554         (aarch64_evpc_uzp): Likewise.
3555         (aarch64_evpc_zip): Likewise.
3556         (aarch64_evpc_ext): Likewise.
3557         (aarch64_evpc_rev): Likewise.
3558         (aarch64_evpc_dup): Test the encoding for a single duplicated element,
3559         instead of checking each element individually.  Return true without
3560         generating rtl if
3561         (aarch64_vectorize_vec_perm_const): Use all_from_input_p to test
3562         whether all selected elements come from the same input, instead of
3563         checking each element individually.  Remove calls to gen_rtx_REG,
3564         start_sequence and end_sequence and instead assert that no rtl is
3565         generated.
3566
3567 2018-01-09  Richard Sandiford  <richard.sandiford@linaro.org>
3568
3569         * config/aarch64/aarch64.c (aarch64_legitimate_constant_p): Fix
3570         order of HIGH and CONST checks.
3571
3572 2018-01-09  Richard Sandiford  <richard.sandiford@linaro.org>
3573
3574         * tree-vect-stmts.c (permute_vec_elements): Create a fresh variable
3575         if the destination isn't an SSA_NAME.
3576
3577 2018-01-09  Richard Biener  <rguenther@suse.de>
3578
3579         PR tree-optimization/83668
3580         * graphite.c (canonicalize_loop_closed_ssa): Add edge argument,
3581         move prologue...
3582         (canonicalize_loop_form): ... here, renamed from ...
3583         (canonicalize_loop_closed_ssa_form): ... this and amended to
3584         swap successor edges for loop exit blocks to make us use
3585         the RPO order we need for initial schedule generation.
3586
3587 2018-01-09  Joseph Myers  <joseph@codesourcery.com>
3588
3589         PR tree-optimization/64811
3590         * match.pd: When optimizing comparisons with Inf, avoid
3591         introducing or losing exceptions from comparisons with NaN.
3592
3593 2018-01-09  Martin Liska  <mliska@suse.cz>
3594
3595         PR sanitizer/82517
3596         * asan.c (shadow_mem_size): Add gcc_assert.
3597
3598 2018-01-09  Georg-Johann Lay  <avr@gjlay.de>
3599
3600         Don't save registers in main().
3601
3602         PR target/83738
3603         * doc/invoke.texi (AVR Options) [-mmain-is-OS_task]: Document it.
3604         * config/avr/avr.opt (-mmain-is-OS_task): New target option.
3605         * config/avr/avr.c (avr_set_current_function): Don't error if
3606         naked, OS_task or OS_main are specified at the same time.
3607         (avr_function_ok_for_sibcall): Don't disable sibcalls for OS_task,
3608         OS_main.
3609         (avr_insert_attributes) [-mmain-is-OS_task] <main>: Add OS_task
3610         attribute.
3611         * common/config/avr/avr-common.c (avr_option_optimization_table):
3612         Switch on -mmain-is-OS_task for optimizing compilations.
3613
3614 2018-01-09  Richard Biener  <rguenther@suse.de>
3615
3616         PR tree-optimization/83572
3617         * graphite.c: Include cfganal.h.
3618         (graphite_transform_loops): Connect infinite loops to exit
3619         and remove fake edges at the end.
3620
3621 2018-01-09  Jan Hubicka  <hubicka@ucw.cz>
3622
3623         * ipa-inline.c (edge_badness): Revert accidental checkin.
3624
3625 2018-01-09  Jan Hubicka  <hubicka@ucw.cz>
3626
3627         PR ipa/80763
3628         * ipa-comdats.c (set_comdat_group): Only set comdat group of real
3629         symbols; not inline clones.
3630
3631 2018-01-09  Jakub Jelinek  <jakub@redhat.com>
3632
3633         PR target/83507
3634         * modulo-sched.c (schedule_reg_moves): Punt if we'd need to move
3635         hard registers.  Formatting fixes.
3636
3637         PR preprocessor/83722
3638         * gcc.c (try_generate_repro): Pass
3639         &temp_stderr_files[RETRY_ICE_ATTEMPTS - 1] rather than
3640         &temp_stdout_files[RETRY_ICE_ATTEMPTS - 1] as last argument to
3641         do_report_bug.
3642
3643 2018-01-08  Monk Chiang  <sh.chiang04@gmail.com>
3644             Kito Cheng  <kito.cheng@gmail.com>
3645
3646         * config/riscv/riscv.c (machine_function::is_leaf): Remove field.
3647         (riscv_leaf_function_p): Delete.
3648         (riscv_function_ok_for_sibcall): Return false when TARGET_SAVE_RESTORE.
3649
3650 2018-01-08  Aaron Sawdey  <acsawdey@linux.vnet.ibm.com>
3651
3652         * config/rs6000/rs6000-string.c (do_load_for_compare_from_addr): New
3653         function.
3654         (do_ifelse): New function.
3655         (do_isel): New function.
3656         (do_sub3): New function.
3657         (do_add3): New function.
3658         (do_load_mask_compare): New function.
3659         (do_overlap_load_compare): New function.
3660         (expand_compare_loop): New function.
3661         (expand_block_compare): Call expand_compare_loop() when appropriate.
3662         * config/rs6000/rs6000.opt (-mblock-compare-inline-limit): Change
3663         option description.
3664         (-mblock-compare-inline-loop-limit): New option.
3665
3666 2018-01-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
3667
3668         PR target/83677
3669         * config/rs6000/altivec.md (*altivec_vpermr_<mode>_internal):
3670         Reverse order of second and third operands in first alternative.
3671         * config/rs6000/rs6000.c (rs6000_expand_vector_set): Reverse order
3672         of first and second elements in UNSPEC_VPERMR vector.
3673         (altivec_expand_vec_perm_le): Likewise.
3674
3675 2017-01-08  Jeff Law  <law@redhat.com>
3676
3677         PR rtl-optimizatin/81308
3678         * tree-switch-conversion.c (cfg_altered): New file scoped static.
3679         (process_switch): If group_case_labels makes a change, then set
3680         cfg_altered.
3681         (pass_convert_switch::execute): If a switch is converted, then
3682         set cfg_altered.  Return TODO_cfg_cleanup if cfg_altered is true.
3683
3684         PR rtl-optimization/81308
3685         * recog.c (split_all_insns): Conditionally cleanup the CFG after
3686         splitting insns.
3687
3688 2018-01-08  Vidya Praveen  <vidyapraveen@arm.com>
3689
3690         PR target/83663 - Revert r255946
3691         * config/aarch64/aarch64.c (aarch64_expand_vector_init): Modify code
3692         generation for cases where splatting a value is not useful.
3693         * simplify-rtx.c (simplify_ternary_operation): Simplify vec_merge
3694         across a vec_duplicate and a paradoxical subreg forming a vector
3695         mode to a vec_concat.
3696
3697 2018-01-08  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
3698
3699         * config/arm/t-aprofile (MULTILIB_MATCHES): Add mapping rules for
3700         -march=armv8.3-a variants.
3701         * config/arm/t-multilib: Likewise.
3702         * config/arm/t-arm-elf: Likewise.  Handle dotprod extension.
3703
3704 2018-01-08  Aaron Sawdey  <acsawdey@linux.vnet.ibm.com>
3705
3706         * config/rs6000/rs6000.md (cceq_ior_compare): Remove * so I can use it
3707         to generate rtl.
3708         (cceq_ior_compare_complement): Give it a name so I can use it, and
3709         change boolean_or_operator predicate to boolean_operator so it can
3710         be used to generate a crand.
3711         (eqne): New code iterator.
3712         (bd/bd_neg): New code_attrs.
3713         (<bd>_<mode>): New name for ctr<mode>_internal[12] now combined into
3714         a single define_insn.
3715         (<bd>tf_<mode>): A new insn pattern for the conditional form branch
3716         decrement (bdnzt/bdnzf/bdzt/bdzf).
3717         * config/rs6000/rs6000.c (rs6000_legitimate_combined_insn): Updated
3718         with the new names of the branch decrement patterns, and added the
3719         names of the branch decrement conditional patterns.
3720
3721 2018-01-08  Richard Biener  <rguenther@suse.de>
3722
3723         PR tree-optimization/83563
3724         * graphite.c (canonicalize_loop_closed_ssa_form): Reset the SCEV
3725         cache.
3726
3727 2018-01-08  Richard Biener  <rguenther@suse.de>
3728
3729         PR middle-end/83713
3730         * convert.c (do_narrow): Properly guard TYPE_OVERFLOW_WRAPS checks.
3731
3732 2018-01-08  Richard Biener  <rguenther@suse.de>
3733
3734         PR tree-optimization/83685
3735         * tree-ssa-pre.c (create_expression_by_pieces): Do not insert
3736         references to abnormals.
3737
3738 2018-01-08  Richard Biener  <rguenther@suse.de>
3739
3740         PR lto/83719
3741         * dwarf2out.c (output_indirect_strings): Handle empty
3742         skeleton_debug_str_hash.
3743         (dwarf2out_early_finish): Index strings for -gsplit-dwarf.
3744
3745 2018-01-08  Claudiu Zissulescu  <claziss@synopsys.com>
3746
3747         * config/arc/arc.c (TARGET_TRAMPOLINE_ADJUST_ADDRESS): Delete.
3748         (emit_store_direct): Likewise.
3749         (arc_trampoline_adjust_address): Likewise.
3750         (arc_asm_trampoline_template): New function.
3751         (arc_initialize_trampoline): Use asm_trampoline_template.
3752         (TARGET_ASM_TRAMPOLINE_TEMPLATE): Define.
3753         * config/arc/arc.h (TRAMPOLINE_SIZE): Adjust to 16.
3754         * config/arc/arc.md (flush_icache): Delete pattern.
3755
3756 2018-01-08  Claudiu Zissulescu  <claziss@synopsys.com>
3757
3758         * config/arc/arc-c.def (__ARC_UNALIGNED__): New define.
3759         * config/arc/arc.h (STRICT_ALIGNMENT): Control this macro using
3760         munaligned-access.
3761
3762 2018-01-08  Sebastian Huber  <sebastian.huber@embedded-brains.de>
3763
3764         PR target/83681
3765         * config/epiphany/epiphany.h (make_pass_mode_switch_use): Guard
3766         by not USED_FOR_TARGET.
3767         (make_pass_resolve_sw_modes): Likewise.
3768
3769 2018-01-08  Sebastian Huber  <sebastian.huber@embedded-brains.de>
3770
3771         * config/nios2/nios2.h (nios2_section_threshold): Guard by not
3772         USED_FOR_TARGET.
3773
3774 2018-01-08  Richard Biener  <rguenther@suse.de>
3775
3776         PR middle-end/83580
3777         * tree-data-ref.c (split_constant_offset): Remove STRIP_NOPS.
3778
3779 2018-01-08  Richard Biener  <rguenther@suse.de>
3780
3781         PR middle-end/83517
3782         * match.pd ((t * 2) / 2) -> t): Add missing :c.
3783
3784 2018-01-06  Aldy Hernandez  <aldyh@redhat.com>
3785
3786         PR middle-end/81897
3787         * tree-ssa-uninit.c (compute_control_dep_chain): Do not bail on
3788         basic blocks with a small number of successors.
3789         (convert_control_dep_chain_into_preds): Improve handling of
3790         forwarder blocks.
3791         (dump_predicates): Split apart into...
3792         (dump_pred_chain): ...here...
3793         (dump_pred_info): ...and here.
3794         (can_one_predicate_be_invalidated_p): Add debugging printfs.
3795         (can_chain_union_be_invalidated_p): Improve check for invalidation
3796         of paths.
3797         (uninit_uses_cannot_happen): Avoid unnecessary if
3798         convert_control_dep_chain_into_preds yielded nothing.
3799
3800 2018-01-06  Martin Sebor  <msebor@redhat.com>
3801
3802         PR tree-optimization/83640
3803         * gimple-ssa-warn-restrict.c (builtin_access::builtin_access): Avoid
3804         subtracting negative offset from size.
3805         (builtin_access::overlap): Adjust offset bounds of the access to fall
3806         within the size of the object if possible.
3807
3808 2018-01-06  Richard Sandiford  <richard.sandiford@linaro.org>
3809
3810         PR rtl-optimization/83699
3811         * expmed.c (extract_bit_field_1): Restrict the vector usage of
3812         extract_bit_field_as_subreg to cases in which the extracted
3813         value is also a vector.
3814
3815         * lra-constraints.c (process_alt_operands): Test for the equivalence
3816         substitutions when detecting a possible reload cycle.
3817
3818 2018-01-06  Jakub Jelinek  <jakub@redhat.com>
3819
3820         PR debug/83480
3821         * toplev.c (process_options): Don't enable debug_nonbind_markers_p
3822         by default if flag_selective_schedling{,2}.  Formatting fixes.
3823
3824         PR rtl-optimization/83682
3825         * rtl.h (const_vec_duplicate_p): Only return true for VEC_DUPLICATE
3826         if it has non-VECTOR_MODE element mode.
3827         (vec_duplicate_p): Likewise.
3828
3829         PR middle-end/83694
3830         * cfgexpand.c (expand_debug_expr): Punt if mode1 is VOIDmode
3831         and bitsize might be greater than MAX_BITSIZE_MODE_ANY_INT.
3832
3833 2018-01-05  Jakub Jelinek  <jakub@redhat.com>
3834
3835         PR target/83604
3836         * config/i386/i386-builtin.def
3837         (__builtin_ia32_vgf2p8affineinvqb_v64qi,
3838         __builtin_ia32_vgf2p8affineqb_v64qi, __builtin_ia32_vgf2p8mulb_v64qi):
3839         Require also OPTION_MASK_ISA_AVX512F in addition to
3840         OPTION_MASK_ISA_GFNI.
3841         (__builtin_ia32_vgf2p8affineinvqb_v16qi_mask,
3842         __builtin_ia32_vgf2p8affineqb_v16qi_mask): Require
3843         OPTION_MASK_ISA_AVX512VL instead of OPTION_MASK_ISA_SSE in addition
3844         to OPTION_MASK_ISA_GFNI.
3845         (__builtin_ia32_vgf2p8mulb_v32qi_mask): Require
3846         OPTION_MASK_ISA_AVX512VL in addition to OPTION_MASK_ISA_GFNI and
3847         OPTION_MASK_ISA_AVX512BW.
3848         (__builtin_ia32_vgf2p8mulb_v16qi_mask): Require
3849         OPTION_MASK_ISA_AVX512VL instead of OPTION_MASK_ISA_AVX512BW in
3850         addition to OPTION_MASK_ISA_GFNI.
3851         (__builtin_ia32_vgf2p8affineinvqb_v16qi,
3852         __builtin_ia32_vgf2p8affineqb_v16qi, __builtin_ia32_vgf2p8mulb_v16qi):
3853         Require OPTION_MASK_ISA_SSE2 instead of OPTION_MASK_ISA_SSE in addition
3854         to OPTION_MASK_ISA_GFNI.
3855         * config/i386/i386.c (def_builtin): Change to builtin isa/isa2 being
3856         a requirement for all ISAs rather than any of them with a few
3857         exceptions.
3858         (ix86_add_new_builtins): Clear OPTION_MASK_ISA_64BIT from isa before
3859         processing.
3860         (ix86_expand_builtin): Require all ISAs from builtin's isa and isa2
3861         bitmasks to be enabled with 3 exceptions, instead of requiring any
3862         enabled ISA with lots of exceptions.
3863         * config/i386/sse.md (vgf2p8affineinvqb_<mode><mask_name>,
3864         vgf2p8affineqb_<mode><mask_name>, vgf2p8mulb_<mode><mask_name>):
3865         Change avx512bw in isa attribute to avx512f.
3866         * config/i386/sgxintrin.h: Add license boilerplate.
3867         * config/i386/vaesintrin.h: Likewise.  Fix macro spelling __AVX512F
3868         to __AVX512F__ and __AVX512VL to __AVX512VL__.
3869         (_mm256_aesdec_epi128, _mm256_aesdeclast_epi128, _mm256_aesenc_epi128,
3870         _mm256_aesenclast_epi128): Enable temporarily avx if __AVX__ is not
3871         defined.
3872         * config/i386/gfniintrin.h (_mm_gf2p8mul_epi8,
3873         _mm_gf2p8affineinv_epi64_epi8, _mm_gf2p8affine_epi64_epi8): Enable
3874         temporarily sse2 rather than sse if not enabled already.
3875
3876         PR target/83604
3877         * config/i386/sse.md (VI248_VLBW): Rename to ...
3878         (VI248_AVX512VL): ... this.  Don't guard V32HI with TARGET_AVX512BW.
3879         (vpshrd_<mode><mask_name>, vpshld_<mode><mask_name>,
3880         vpshrdv_<mode>, vpshrdv_<mode>_mask, vpshrdv_<mode>_maskz,
3881         vpshrdv_<mode>_maskz_1, vpshldv_<mode>, vpshldv_<mode>_mask,
3882         vpshldv_<mode>_maskz, vpshldv_<mode>_maskz_1): Use VI248_AVX512VL
3883         mode iterator instead of VI248_VLBW.
3884
3885 2018-01-05  Jan Hubicka  <hubicka@ucw.cz>
3886
3887         * ipa-fnsummary.c (record_modified_bb_info): Add OP.
3888         (record_modified): Skip clobbers; add debug output.
3889         (param_change_prob): Use sreal frequencies.
3890
3891 2018-01-05  Richard Sandiford  <richard.sandiford@linaro.org>
3892
3893         * tree-vect-data-refs.c (vect_compute_data_ref_alignment): Don't
3894         punt for user-aligned variables.
3895
3896 2018-01-05  Richard Sandiford  <richard.sandiford@linaro.org>
3897
3898         * tree-chrec.c (chrec_contains_symbols): Return true for
3899         POLY_INT_CST.
3900
3901 2018-01-05  Sudakshina Das  <sudi.das@arm.com>
3902
3903         PR target/82439
3904         * simplify-rtx.c (simplify_relational_operation_1): Add simplifications
3905         of (x|y) == x for BICS pattern.
3906
3907 2018-01-05  Jakub Jelinek  <jakub@redhat.com>
3908
3909         PR tree-optimization/83605
3910         * gimple-ssa-strength-reduction.c: Include tree-eh.h.
3911         (find_candidates_dom_walker::before_dom_children): Ignore stmts that
3912         can throw.
3913
3914 2018-01-05  Sebastian Huber  <sebastian.huber@embedded-brains.de>
3915
3916         * config.gcc (epiphany-*-elf*): Add (epiphany-*-rtems*) configuration.
3917         * config/epiphany/rtems.h: New file.
3918
3919 2018-01-04  Jakub Jelinek  <jakub@redhat.com>
3920             Uros Bizjak  <ubizjak@gmail.com>
3921
3922         PR target/83554
3923         * config/i386/i386.md (*<rotate_insn>hi3_1 splitter): Use
3924         QIreg_operand instead of register_operand predicate.
3925         * config/i386/i386.c (ix86_rop_should_change_byte_p,
3926         set_rop_modrm_reg_bits, ix86_mitigate_rop): Use -mmitigate-rop in
3927         comments instead of -fmitigate[-_]rop.
3928
3929 2018-01-04  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
3930
3931         PR bootstrap/81926
3932         * cgraphunit.c (symbol_table::compile): Switch to text_section
3933         before calling assembly_start debug hook.
3934         * run-rtl-passes.c (run_rtl_passes): Likewise.
3935         Include output.h.
3936
3937 2018-01-04  Richard Sandiford  <richard.sandiford@linaro.org>
3938
3939         * tree-vrp.c (extract_range_from_binary_expr_1): Check
3940         range_int_cst_p rather than !symbolic_range_p before calling
3941         extract_range_from_multiplicative_op_1.
3942
3943 2017-01-04  Jeff Law  <law@redhat.com>
3944
3945         * tree-ssa-math-opts.c (execute_cse_reciprocals_1): Remove
3946         redundant test in assertion.
3947
3948 2018-01-04  Richard Sandiford  <richard.sandiford@linaro.org>
3949
3950         * doc/rtl.texi: Document machine_mode wrapper classes.
3951
3952 2018-01-04  Richard Sandiford  <richard.sandiford@linaro.org>
3953
3954         * fold-const.c (fold_ternary_loc): Check tree_fits_uhwi_p before
3955         using tree_to_uhwi.
3956
3957 2018-01-04  Richard Sandiford  <richard.sandiford@linaro.org>
3958
3959         * tree-ssa-forwprop.c (is_combined_permutation_identity): Allow
3960         the VEC_PERM_EXPR fold to fail.
3961
3962 2018-01-04  Jakub Jelinek  <jakub@redhat.com>
3963
3964         PR debug/83585
3965         * bb-reorder.c (insert_section_boundary_note): Set has_bb_partition
3966         to switched_sections.
3967
3968 2018-01-04  Richard Sandiford  <richard.sandiford@linaro.org>
3969
3970         PR target/83680
3971         * config/arm/arm.c (arm_vectorize_vec_perm_const): Fix inverted
3972         test for d.testing.
3973
3974 2018-01-04  Peter Bergner  <bergner@vnet.ibm.com>
3975
3976         PR target/83387
3977         * config/rs6000/rs6000.c (rs6000_discover_homogeneous_aggregate): Do not
3978         allow arguments in FP registers if TARGET_HARD_FLOAT is false.
3979
3980 2018-01-04  Jakub Jelinek  <jakub@redhat.com>
3981
3982         PR debug/83666
3983         * cfgexpand.c (expand_debug_expr) <case BIT_FIELD_REF>: Punt if mode
3984         is BLKmode and bitpos not zero or mode change is needed.
3985
3986 2018-01-04  Richard Sandiford  <richard.sandiford@linaro.org>
3987
3988         PR target/83675
3989         * config/sparc/sparc.c (sparc_vectorize_vec_perm_const): Require
3990         TARGET_VIS2.
3991
3992 2018-01-04  Uros Bizjak  <ubizjak@gmail.com>
3993
3994         PR target/83628
3995         * config/alpha/alpha.md (*sadd<modesuffix>): Use ASHIFT
3996         instead of MULT rtx.  Update all corresponding splitters.
3997         (*saddl_se): Ditto.
3998         (*ssub<modesuffix>): Ditto.
3999         (*ssubl_se): Ditto.
4000         (*cmp_sadd_di): Update split patterns.
4001         (*cmp_sadd_si): Ditto.
4002         (*cmp_sadd_sidi): Ditto.
4003         (*cmp_ssub_di): Ditto.
4004         (*cmp_ssub_si): Ditto.
4005         (*cmp_ssub_sidi): Ditto.
4006         * config/alpha/predicates.md (const23_operand): New predicate.
4007         * config/alpha/alpha.c (alpha_rtx_costs) [PLUS, MINUS]:
4008         Look for ASHIFT, not MULT inner operand.
4009         (alpha_split_conditional_move): Update for *sadd<modesuffix> change.
4010
4011 2018-01-04  Martin Liska  <mliska@suse.cz>
4012
4013         PR gcov-profile/83669
4014         * gcov.c (output_intermediate_file): Add version to intermediate
4015         gcov file.
4016         * doc/gcov.texi: Document new field 'version' in intermediate
4017         file format. Fix location of '-k' option of gcov command.
4018
4019 2018-01-04  Martin Liska  <mliska@suse.cz>
4020
4021         PR ipa/82352
4022         * ipa-icf.c (sem_function::merge): Do not cross comdat boundary.
4023
4024 2018-01-04  Jakub Jelinek  <jakub@redhat.com>
4025
4026         * gimple-ssa-sprintf.c (parse_directive): Cast second dir.len to uhwi.
4027
4028 2018-01-03  Martin Sebor  <msebor@redhat.com>
4029
4030         PR tree-optimization/83655
4031         * gimple-ssa-warn-restrict.c (wrestrict_dom_walker::check_call): Avoid
4032         checking calls with invalid arguments.
4033
4034 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4035
4036         * tree-vect-stmts.c (vect_get_store_rhs): New function.
4037         (vectorizable_mask_load_store): Delete.
4038         (vectorizable_call): Return false for masked loads and stores.
4039         (vectorizable_store): Handle IFN_MASK_STORE.  Use vect_get_store_rhs
4040         instead of gimple_assign_rhs1.
4041         (vectorizable_load): Handle IFN_MASK_LOAD.
4042         (vect_transform_stmt): Don't set is_store for call_vec_info_type.
4043
4044 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4045
4046         * tree-vect-stmts.c (vect_build_gather_load_calls): New function,
4047         split out from..,
4048         (vectorizable_mask_load_store): ...here.
4049         (vectorizable_load): ...and here.
4050
4051 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4052
4053         * tree-vect-stmts.c (vect_build_all_ones_mask)
4054         (vect_build_zero_merge_argument): New functions, split out from...
4055         (vectorizable_load): ...here.
4056
4057 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4058
4059         * tree-vect-stmts.c (vect_check_store_rhs): New function,
4060         split out from...
4061         (vectorizable_mask_load_store): ...here.
4062         (vectorizable_store): ...and here.
4063
4064 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4065
4066         * tree-vect-stmts.c (vect_check_load_store_mask): New function,
4067         split out from...
4068         (vectorizable_mask_load_store): ...here.
4069
4070 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4071
4072         * tree-vectorizer.h (vec_load_store_type): Moved from tree-vec-stmts.c
4073         (vect_model_store_cost): Take a vec_load_store_type instead of a
4074         vect_def_type.
4075         * tree-vect-stmts.c (vec_load_store_type): Move to tree-vectorizer.h.
4076         (vect_model_store_cost): Take a vec_load_store_type instead of a
4077         vect_def_type.
4078         (vectorizable_mask_load_store): Update accordingly.
4079         (vectorizable_store): Likewise.
4080         * tree-vect-slp.c (vect_analyze_slp_cost_1): Update accordingly.
4081
4082 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4083
4084         * tree-vect-loop.c (vect_transform_loop): Stub out scalar
4085         IFN_MASK_LOAD calls here rather than...
4086         * tree-vect-stmts.c (vectorizable_mask_load_store): ...here.
4087
4088 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4089             Alan Hayward  <alan.hayward@arm.com>
4090             David Sherwood  <david.sherwood@arm.com>
4091
4092         * expmed.c (extract_bit_field_1): For vector extracts,
4093         fall back to extract_bit_field_as_subreg if vec_extract
4094         isn't available.
4095
4096 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4097             Alan Hayward  <alan.hayward@arm.com>
4098             David Sherwood  <david.sherwood@arm.com>
4099
4100         * lra-spills.c (pseudo_reg_slot_compare): Sort slots by whether
4101         they are variable or constant sized.
4102         (assign_stack_slot_num_and_sort_pseudos): Don't reuse variable-sized
4103         slots for constant-sized data.
4104
4105 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4106             Alan Hayward  <alan.hayward@arm.com>
4107             David Sherwood  <david.sherwood@arm.com>
4108
4109         * tree-vect-patterns.c (vect_recog_mask_conversion_pattern): When
4110         handling COND_EXPRs with boolean comparisons, try to find a better
4111         basis for the mask type than the boolean itself.
4112
4113 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4114
4115         * doc/rtl.texi (MAX_BITSIZE_MODE_ANY_MODE): Describe how the default
4116         is calculated and how it can be overridden.
4117         * genmodes.c (max_bitsize_mode_any_mode): New variable.
4118         (create_modes): Initialize it from MAX_BITSIZE_MODE_ANY_MODE,
4119         if defined.
4120         (emit_max_int): Use it to set the output MAX_BITSIZE_MODE_ANY_MODE,
4121         if nonzero.
4122
4123 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4124             Alan Hayward  <alan.hayward@arm.com>
4125             David Sherwood  <david.sherwood@arm.com>
4126
4127         * config/aarch64/aarch64-protos.h (aarch64_output_simd_mov_immediate):
4128         Remove the mode argument.
4129         (aarch64_simd_valid_immediate): Remove the mode and inverse
4130         arguments.
4131         * config/aarch64/iterators.md (bitsize): New iterator.
4132         * config/aarch64/aarch64-simd.md (*aarch64_simd_mov<mode>, and<mode>3)
4133         (ior<mode>3): Update calls to aarch64_output_simd_mov_immediate.
4134         * config/aarch64/constraints.md (Do, Db, Dn): Update calls to
4135         aarch64_simd_valid_immediate.
4136         * config/aarch64/predicates.md (aarch64_reg_or_orr_imm): Likewise.
4137         (aarch64_reg_or_bic_imm): Likewise.
4138         * config/aarch64/aarch64.c (simd_immediate_info): Replace mvn
4139         with an insn_type enum and msl with a modifier_type enum.
4140         Replace element_width with a scalar_mode.  Change the shift
4141         to unsigned int.  Add constructors for scalar_float_mode and
4142         scalar_int_mode elements.
4143         (aarch64_vect_float_const_representable_p): Delete.
4144         (aarch64_can_const_movi_rtx_p)
4145         (aarch64_simd_scalar_immediate_valid_for_move)
4146         (aarch64_simd_make_constant): Update call to
4147         aarch64_simd_valid_immediate.
4148         (aarch64_advsimd_valid_immediate_hs): New function.
4149         (aarch64_advsimd_valid_immediate): Likewise.
4150         (aarch64_simd_valid_immediate): Remove mode and inverse
4151         arguments.  Rewrite to use the above.  Use const_vec_duplicate_p
4152         to detect duplicated constants and use aarch64_float_const_zero_rtx_p
4153         and aarch64_float_const_representable_p on the result.
4154         (aarch64_output_simd_mov_immediate): Remove mode argument.
4155         Update call to aarch64_simd_valid_immediate and use of
4156         simd_immediate_info.
4157         (aarch64_output_scalar_simd_mov_immediate): Update call
4158         accordingly.
4159
4160 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4161             Alan Hayward  <alan.hayward@arm.com>
4162             David Sherwood  <david.sherwood@arm.com>
4163
4164         * machmode.h (mode_precision): Prefix with CONST_MODE_PRECISION.
4165         (mode_nunits): Likewise CONST_MODE_NUNITS.
4166         * machmode.def (ADJUST_NUNITS): Document.
4167         * genmodes.c (mode_data::need_nunits_adj): New field.
4168         (blank_mode): Update accordingly.
4169         (adj_nunits): New variable.
4170         (print_maybe_const_decl): Replace CATEGORY with a NEEDS_ADJ
4171         parameter.
4172         (emit_mode_size_inline): Set need_bytesize_adj for all modes
4173         listed in adj_nunits.
4174         (emit_mode_nunits_inline): Set need_nunits_adj for all modes
4175         listed in adj_nunits.  Don't emit case statements for such modes.
4176         (emit_insn_modes_h): Emit definitions of CONST_MODE_NUNITS
4177         and CONST_MODE_PRECISION.  Make CONST_MODE_SIZE expand to
4178         nothing if adj_nunits is nonnull.
4179         (emit_mode_precision, emit_mode_nunits): Use print_maybe_const_decl.
4180         (emit_mode_unit_size, emit_mode_base_align, emit_mode_ibit)
4181         (emit_mode_fbit): Update use of print_maybe_const_decl.
4182         (emit_move_size): Likewise.  Treat the array as non-const
4183         if adj_nunits.
4184         (emit_mode_adjustments): Handle adj_nunits.
4185
4186 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4187
4188         * machmode.def (VECTOR_MODES_WITH_PREFIX): Document.
4189         * genmodes.c (VECTOR_MODES_WITH_PREFIX): New macro.
4190         (VECTOR_MODES): Use it.
4191         (make_vector_modes): Take the prefix as an argument.
4192
4193 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4194             Alan Hayward  <alan.hayward@arm.com>
4195             David Sherwood  <david.sherwood@arm.com>
4196
4197         * mode-classes.def (MODE_VECTOR_BOOL): New mode class.
4198         * machmode.h (INTEGRAL_MODE_P, VECTOR_MODE_P): Return true
4199         for MODE_VECTOR_BOOL.
4200         * machmode.def (VECTOR_BOOL_MODE): Document.
4201         * genmodes.c (VECTOR_BOOL_MODE): New macro.
4202         (make_vector_bool_mode): New function.
4203         (complete_mode, emit_mode_wider, emit_mode_adjustments): Handle
4204         MODE_VECTOR_BOOL.
4205         * lto-streamer-in.c (lto_input_mode_table): Likewise.
4206         * rtx-vector-builder.c (rtx_vector_builder::find_cached_value):
4207         Likewise.
4208         * stor-layout.c (int_mode_for_mode): Likewise.
4209         * tree.c (build_vector_type_for_mode): Likewise.
4210         * varasm.c (output_constant_pool_2): Likewise.
4211         * emit-rtl.c (init_emit_once): Make sure that CONST1_RTX (BImode) and
4212         CONSTM1_RTX (BImode) are the same thing.  Initialize const_tiny_rtx
4213         for MODE_VECTOR_BOOL.
4214         * expr.c (expand_expr_real_1): Use VECTOR_MODE_P instead of a list
4215         of mode class checks.
4216         * tree-vect-generic.c (expand_vector_operation): Use VECTOR_MODE_P
4217         instead of a list of mode class checks.
4218         (expand_vector_scalar_condition): Likewise.
4219         (type_for_widest_vector_mode): Handle BImode as an inner mode.
4220
4221 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4222             Alan Hayward  <alan.hayward@arm.com>
4223             David Sherwood  <david.sherwood@arm.com>
4224
4225         * machmode.h (mode_size): Change from unsigned short to
4226         poly_uint16_pod.
4227         (mode_to_bytes): Return a poly_uint16 rather than an unsigned short.
4228         (GET_MODE_SIZE): Return a constant if ONLY_FIXED_SIZE_MODES,
4229         or if measurement_type is not polynomial.
4230         (fixed_size_mode::includes_p): Check for constant-sized modes.
4231         * genmodes.c (emit_mode_size_inline): Make mode_size_inline
4232         return a poly_uint16 rather than an unsigned short.
4233         (emit_mode_size): Change the type of mode_size from unsigned short
4234         to poly_uint16_pod.  Use ZERO_COEFFS for the initializer.
4235         (emit_mode_adjustments): Cope with polynomial vector sizes.
4236         * lto-streamer-in.c (lto_input_mode_table): Use bp_unpack_poly_value
4237         for GET_MODE_SIZE.
4238         * lto-streamer-out.c (lto_write_mode_table): Use bp_pack_poly_value
4239         for GET_MODE_SIZE.
4240         * auto-inc-dec.c (try_merge): Treat GET_MODE_SIZE as polynomial.
4241         * builtins.c (expand_ifn_atomic_compare_exchange_into_call): Likewise.
4242         * caller-save.c (setup_save_areas): Likewise.
4243         (replace_reg_with_saved_mem): Likewise.
4244         * calls.c (emit_library_call_value_1): Likewise.
4245         * combine-stack-adj.c (combine_stack_adjustments_for_block): Likewise.
4246         * combine.c (simplify_set, make_extraction, simplify_shift_const_1)
4247         (gen_lowpart_for_combine): Likewise.
4248         * convert.c (convert_to_integer_1): Likewise.
4249         * cse.c (equiv_constant, cse_insn): Likewise.
4250         * cselib.c (autoinc_split, cselib_hash_rtx): Likewise.
4251         (cselib_subst_to_values): Likewise.
4252         * dce.c (word_dce_process_block): Likewise.
4253         * df-problems.c (df_word_lr_mark_ref): Likewise.
4254         * dwarf2cfi.c (init_one_dwarf_reg_size): Likewise.
4255         * dwarf2out.c (multiple_reg_loc_descriptor, mem_loc_descriptor)
4256         (concat_loc_descriptor, concatn_loc_descriptor, loc_descriptor)
4257         (rtl_for_decl_location): Likewise.
4258         * emit-rtl.c (gen_highpart, widen_memory_access): Likewise.
4259         * expmed.c (extract_bit_field_1, extract_integral_bit_field): Likewise.
4260         * expr.c (emit_group_load_1, clear_storage_hints): Likewise.
4261         (emit_move_complex, emit_move_multi_word, emit_push_insn): Likewise.
4262         (expand_expr_real_1): Likewise.
4263         * function.c (assign_parm_setup_block_p, assign_parm_setup_block)
4264         (pad_below): Likewise.
4265         * gimple-fold.c (optimize_atomic_compare_exchange_p): Likewise.
4266         * gimple-ssa-store-merging.c (rhs_valid_for_store_merging_p): Likewise.
4267         * ira.c (get_subreg_tracking_sizes): Likewise.
4268         * ira-build.c (ira_create_allocno_objects): Likewise.
4269         * ira-color.c (coalesced_pseudo_reg_slot_compare): Likewise.
4270         (ira_sort_regnos_for_alter_reg): Likewise.
4271         * ira-costs.c (record_operand_costs): Likewise.
4272         * lower-subreg.c (interesting_mode_p, simplify_gen_subreg_concatn)
4273         (resolve_simple_move): Likewise.
4274         * lra-constraints.c (get_reload_reg, operands_match_p): Likewise.
4275         (process_addr_reg, simplify_operand_subreg, curr_insn_transform)
4276         (lra_constraints): Likewise.
4277         (CONST_POOL_OK_P): Reject variable-sized modes.
4278         * lra-spills.c (slot, assign_mem_slot, pseudo_reg_slot_compare)
4279         (add_pseudo_to_slot, lra_spill): Likewise.
4280         * omp-low.c (omp_clause_aligned_alignment): Likewise.
4281         * optabs-query.c (get_best_extraction_insn): Likewise.
4282         * optabs-tree.c (expand_vec_cond_expr_p): Likewise.
4283         * optabs.c (expand_vec_perm_var, expand_vec_cond_expr): Likewise.
4284         (expand_mult_highpart, valid_multiword_target_p): Likewise.
4285         * recog.c (offsettable_address_addr_space_p): Likewise.
4286         * regcprop.c (maybe_mode_change): Likewise.
4287         * reginfo.c (choose_hard_reg_mode, record_subregs_of_mode): Likewise.
4288         * regrename.c (build_def_use): Likewise.
4289         * regstat.c (dump_reg_info): Likewise.
4290         * reload.c (complex_word_subreg_p, push_reload, find_dummy_reload)
4291         (find_reloads, find_reloads_subreg_address): Likewise.
4292         * reload1.c (eliminate_regs_1): Likewise.
4293         * rtlanal.c (for_each_inc_dec_find_inc_dec, rtx_cost): Likewise.
4294         * simplify-rtx.c (avoid_constant_pool_reference): Likewise.
4295         (simplify_binary_operation_1, simplify_subreg): Likewise.
4296         * targhooks.c (default_function_arg_padding): Likewise.
4297         (default_hard_regno_nregs, default_class_max_nregs): Likewise.
4298         * tree-cfg.c (verify_gimple_assign_binary): Likewise.
4299         (verify_gimple_assign_ternary): Likewise.
4300         * tree-inline.c (estimate_move_cost): Likewise.
4301         * tree-ssa-forwprop.c (simplify_vector_constructor): Likewise.
4302         * tree-ssa-loop-ivopts.c (add_autoinc_candidates): Likewise.
4303         (get_address_cost_ainc): Likewise.
4304         * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Likewise.
4305         (vect_supportable_dr_alignment): Likewise.
4306         * tree-vect-loop.c (vect_determine_vectorization_factor): Likewise.
4307         (vectorizable_reduction): Likewise.
4308         * tree-vect-stmts.c (vectorizable_assignment, vectorizable_shift)
4309         (vectorizable_operation, vectorizable_load): Likewise.
4310         * tree.c (build_same_sized_truth_vector_type): Likewise.
4311         * valtrack.c (cleanup_auto_inc_dec): Likewise.
4312         * var-tracking.c (emit_note_insn_var_location): Likewise.
4313         * config/arc/arc.h (ASM_OUTPUT_CASE_END): Use as_a <scalar_int_mode>.
4314         (ADDR_VEC_ALIGN): Likewise.
4315
4316 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4317             Alan Hayward  <alan.hayward@arm.com>
4318             David Sherwood  <david.sherwood@arm.com>
4319
4320         * machmode.h (mode_to_bits): Return a poly_uint16 rather than an
4321         unsigned short.
4322         (GET_MODE_BITSIZE): Return a constant if ONLY_FIXED_SIZE_MODES,
4323         or if measurement_type is polynomial.
4324         * calls.c (shift_return_value): Treat GET_MODE_BITSIZE as polynomial.
4325         * combine.c (make_extraction): Likewise.
4326         * dse.c (find_shift_sequence): Likewise.
4327         * dwarf2out.c (mem_loc_descriptor): Likewise.
4328         * expmed.c (store_integral_bit_field, extract_bit_field_1): Likewise.
4329         (extract_bit_field, extract_low_bits): Likewise.
4330         * expr.c (convert_move, convert_modes, emit_move_insn_1): Likewise.
4331         (optimize_bitfield_assignment_op, expand_assignment): Likewise.
4332         (store_expr_with_bounds, store_field, expand_expr_real_1): Likewise.
4333         * fold-const.c (optimize_bit_field_compare, merge_ranges): Likewise.
4334         * gimple-fold.c (optimize_atomic_compare_exchange_p): Likewise.
4335         * reload.c (find_reloads): Likewise.
4336         * reload1.c (alter_reg): Likewise.
4337         * stor-layout.c (bitwise_mode_for_mode, compute_record_mode): Likewise.
4338         * targhooks.c (default_secondary_memory_needed_mode): Likewise.
4339         * tree-if-conv.c (predicate_mem_writes): Likewise.
4340         * tree-ssa-strlen.c (handle_builtin_memcmp): Likewise.
4341         * tree-vect-patterns.c (adjust_bool_pattern): Likewise.
4342         * tree-vect-stmts.c (vectorizable_simd_clone_call): Likewise.
4343         * valtrack.c (dead_debug_insert_temp): Likewise.
4344         * varasm.c (mergeable_constant_section): Likewise.
4345         * config/sh/sh.h (LOCAL_ALIGNMENT): Use as_a <fixed_size_mode>.
4346
4347 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4348             Alan Hayward  <alan.hayward@arm.com>
4349             David Sherwood  <david.sherwood@arm.com>
4350
4351         * expr.c (expand_assignment): Cope with polynomial mode sizes
4352         when assigning to a CONCAT.
4353
4354 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4355             Alan Hayward  <alan.hayward@arm.com>
4356             David Sherwood  <david.sherwood@arm.com>
4357
4358         * machmode.h (mode_precision): Change from unsigned short to
4359         poly_uint16_pod.
4360         (mode_to_precision): Return a poly_uint16 rather than an unsigned
4361         short.
4362         (GET_MODE_PRECISION): Return a constant if ONLY_FIXED_SIZE_MODES,
4363         or if measurement_type is not polynomial.
4364         (HWI_COMPUTABLE_MODE_P): Turn into a function.  Optimize the case
4365         in which the mode is already known to be a scalar_int_mode.
4366         * genmodes.c (emit_mode_precision): Change the type of mode_precision
4367         from unsigned short to poly_uint16_pod.  Use ZERO_COEFFS for the
4368         initializer.
4369         * lto-streamer-in.c (lto_input_mode_table): Use bp_unpack_poly_value
4370         for GET_MODE_PRECISION.
4371         * lto-streamer-out.c (lto_write_mode_table): Use bp_pack_poly_value
4372         for GET_MODE_PRECISION.
4373         * combine.c (update_rsp_from_reg_equal): Treat GET_MODE_PRECISION
4374         as polynomial.
4375         (try_combine, find_split_point, combine_simplify_rtx): Likewise.
4376         (expand_field_assignment, make_extraction): Likewise.
4377         (make_compound_operation_int, record_dead_and_set_regs_1): Likewise.
4378         (get_last_value): Likewise.
4379         * convert.c (convert_to_integer_1): Likewise.
4380         * cse.c (cse_insn): Likewise.
4381         * expr.c (expand_expr_real_1): Likewise.
4382         * lra-constraints.c (simplify_operand_subreg): Likewise.
4383         * optabs-query.c (can_atomic_load_p): Likewise.
4384         * optabs.c (expand_atomic_load): Likewise.
4385         (expand_atomic_store): Likewise.
4386         * ree.c (combine_reaching_defs): Likewise.
4387         * rtl.h (partial_subreg_p, paradoxical_subreg_p): Likewise.
4388         * rtlanal.c (nonzero_bits1, lsb_bitfield_op_p): Likewise.
4389         * tree.h (type_has_mode_precision_p): Likewise.
4390         * ubsan.c (instrument_si_overflow): Likewise.
4391
4392 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4393             Alan Hayward  <alan.hayward@arm.com>
4394             David Sherwood  <david.sherwood@arm.com>
4395
4396         * tree.h (TYPE_VECTOR_SUBPARTS): Turn into a function and handle
4397         polynomial numbers of units.
4398         (SET_TYPE_VECTOR_SUBPARTS): Likewise.
4399         (valid_vector_subparts_p): New function.
4400         (build_vector_type): Remove temporary shim and take the number
4401         of units as a poly_uint64 rather than an int.
4402         (build_opaque_vector_type): Take the number of units as a
4403         poly_uint64 rather than an int.
4404         * tree.c (build_vector_from_ctor): Handle polynomial
4405         TYPE_VECTOR_SUBPARTS.
4406         (type_hash_canon_hash, type_cache_hasher::equal): Likewise.
4407         (uniform_vector_p, vector_type_mode, build_vector): Likewise.
4408         (build_vector_from_val): If the number of units is variable,
4409         use build_vec_duplicate_cst for constant operands and
4410         VEC_DUPLICATE_EXPR otherwise.
4411         (make_vector_type): Remove temporary is_constant ().
4412         (build_vector_type, build_opaque_vector_type): Take the number of
4413         units as a poly_uint64 rather than an int.
4414         (check_vector_cst): Handle polynomial TYPE_VECTOR_SUBPARTS and
4415         VECTOR_CST_NELTS.
4416         * cfgexpand.c (expand_debug_expr): Likewise.
4417         * expr.c (count_type_elements, categorize_ctor_elements_1): Likewise.
4418         (store_constructor, expand_expr_real_1): Likewise.
4419         (const_scalar_mask_from_tree): Likewise.
4420         * fold-const-call.c (fold_const_reduction): Likewise.
4421         * fold-const.c (const_binop, const_unop, fold_convert_const): Likewise.
4422         (operand_equal_p, fold_vec_perm, fold_ternary_loc): Likewise.
4423         (native_encode_vector, vec_cst_ctor_to_array): Likewise.
4424         (fold_relational_const): Likewise.
4425         (native_interpret_vector): Likewise.  Change the size from an
4426         int to an unsigned int.
4427         * gimple-fold.c (gimple_fold_stmt_to_constant_1): Handle polynomial
4428         TYPE_VECTOR_SUBPARTS.
4429         (gimple_fold_indirect_ref, gimple_build_vector): Likewise.
4430         (gimple_build_vector_from_val): Use VEC_DUPLICATE_EXPR when
4431         duplicating a non-constant operand into a variable-length vector.
4432         * hsa-brig.c (hsa_op_immed::emit_to_buffer): Handle polynomial
4433         TYPE_VECTOR_SUBPARTS and VECTOR_CST_NELTS.
4434         * ipa-icf.c (sem_variable::equals): Likewise.
4435         * match.pd: Likewise.
4436         * omp-simd-clone.c (simd_clone_subparts): Likewise.
4437         * print-tree.c (print_node): Likewise.
4438         * stor-layout.c (layout_type): Likewise.
4439         * targhooks.c (default_builtin_vectorization_cost): Likewise.
4440         * tree-cfg.c (verify_gimple_comparison): Likewise.
4441         (verify_gimple_assign_binary): Likewise.
4442         (verify_gimple_assign_ternary): Likewise.
4443         (verify_gimple_assign_single): Likewise.
4444         * tree-pretty-print.c (dump_generic_node): Likewise.
4445         * tree-ssa-forwprop.c (simplify_vector_constructor): Likewise.
4446         (simplify_bitfield_ref, is_combined_permutation_identity): Likewise.
4447         * tree-vect-data-refs.c (vect_permute_store_chain): Likewise.
4448         (vect_grouped_load_supported, vect_permute_load_chain): Likewise.
4449         (vect_shift_permute_load_chain): Likewise.
4450         * tree-vect-generic.c (nunits_for_known_piecewise_op): Likewise.
4451         (expand_vector_condition, optimize_vector_constructor): Likewise.
4452         (lower_vec_perm, get_compute_type): Likewise.
4453         * tree-vect-loop.c (vect_determine_vectorization_factor): Likewise.
4454         (get_initial_defs_for_reduction, vect_transform_loop): Likewise.
4455         * tree-vect-patterns.c (vect_recog_bool_pattern): Likewise.
4456         (vect_recog_mask_conversion_pattern): Likewise.
4457         * tree-vect-slp.c (vect_supported_load_permutation_p): Likewise.
4458         (vect_get_constant_vectors, vect_transform_slp_perm_load): Likewise.
4459         * tree-vect-stmts.c (perm_mask_for_reverse): Likewise.
4460         (get_group_load_store_type, vectorizable_mask_load_store): Likewise.
4461         (vectorizable_bswap, simd_clone_subparts, vectorizable_assignment)
4462         (vectorizable_shift, vectorizable_operation, vectorizable_store)
4463         (vectorizable_load, vect_is_simple_cond, vectorizable_comparison)
4464         (supportable_widening_operation): Likewise.
4465         (supportable_narrowing_operation): Likewise.
4466         * tree-vector-builder.c (tree_vector_builder::binary_encoded_nelts):
4467         Likewise.
4468         * varasm.c (output_constant): Likewise.
4469
4470 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4471             Alan Hayward  <alan.hayward@arm.com>
4472             David Sherwood  <david.sherwood@arm.com>
4473
4474         * tree-vect-data-refs.c (vect_permute_store_chain): Reorganize
4475         so that both the length == 3 and length != 3 cases set up their
4476         own permute vectors.  Add comments explaining why we know the
4477         number of elements is constant.
4478         (vect_permute_load_chain): Likewise.
4479
4480 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4481             Alan Hayward  <alan.hayward@arm.com>
4482             David Sherwood  <david.sherwood@arm.com>
4483
4484         * machmode.h (mode_nunits): Change from unsigned char to
4485         poly_uint16_pod.
4486         (ONLY_FIXED_SIZE_MODES): New macro.
4487         (pod_mode::measurement_type, scalar_int_mode::measurement_type)
4488         (scalar_float_mode::measurement_type, scalar_mode::measurement_type)
4489         (complex_mode::measurement_type, fixed_size_mode::measurement_type):
4490         New typedefs.
4491         (mode_to_nunits): Return a poly_uint16 rather than an unsigned short.
4492         (GET_MODE_NUNITS): Return a constant if ONLY_FIXED_SIZE_MODES,
4493         or if measurement_type is not polynomial.
4494         * genmodes.c (ZERO_COEFFS): New macro.
4495         (emit_mode_nunits_inline): Make mode_nunits_inline return a
4496         poly_uint16.
4497         (emit_mode_nunits): Change the type of mode_nunits to poly_uint16_pod.
4498         Use ZERO_COEFFS when emitting initializers.
4499         * data-streamer.h (bp_pack_poly_value): New function.
4500         (bp_unpack_poly_value): Likewise.
4501         * lto-streamer-in.c (lto_input_mode_table): Use bp_unpack_poly_value
4502         for GET_MODE_NUNITS.
4503         * lto-streamer-out.c (lto_write_mode_table): Use bp_pack_poly_value
4504         for GET_MODE_NUNITS.
4505         * tree.c (make_vector_type): Remove temporary shim and make
4506         the real function take the number of units as a poly_uint64
4507         rather than an int.
4508         (build_vector_type_for_mode): Handle polynomial nunits.
4509         * dwarf2out.c (loc_descriptor, add_const_value_attribute): Likewise.
4510         * emit-rtl.c (const_vec_series_p_1): Likewise.
4511         (gen_rtx_CONST_VECTOR): Likewise.
4512         * fold-const.c (test_vec_duplicate_folding): Likewise.
4513         * genrecog.c (validate_pattern): Likewise.
4514         * optabs-query.c (can_vec_perm_var_p, can_mult_highpart_p): Likewise.
4515         * optabs-tree.c (expand_vec_cond_expr_p): Likewise.
4516         * optabs.c (expand_vector_broadcast, expand_binop_directly): Likewise.
4517         (shift_amt_for_vec_perm_mask, expand_vec_perm_var): Likewise.
4518         (expand_vec_cond_expr, expand_mult_highpart): Likewise.
4519         * rtlanal.c (subreg_get_info): Likewise.
4520         * tree-vect-data-refs.c (vect_grouped_store_supported): Likewise.
4521         (vect_grouped_load_supported): Likewise.
4522         * tree-vect-generic.c (type_for_widest_vector_mode): Likewise.
4523         * tree-vect-loop.c (have_whole_vector_shift): Likewise.
4524         * simplify-rtx.c (simplify_unary_operation_1): Likewise.
4525         (simplify_const_unary_operation, simplify_binary_operation_1)
4526         (simplify_const_binary_operation, simplify_ternary_operation)
4527         (test_vector_ops_duplicate, test_vector_ops): Likewise.
4528         (simplify_immed_subreg): Use GET_MODE_NUNITS on a fixed_size_mode
4529         instead of CONST_VECTOR_NUNITS.
4530         * varasm.c (output_constant_pool_2): Likewise.
4531         * rtx-vector-builder.c (rtx_vector_builder::build): Only include the
4532         explicit-encoded elements in the XVEC for variable-length vectors.
4533
4534 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4535
4536         * lra-constraints.c (curr_insn_transform): Use partial_subreg_p.
4537
4538 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4539             Alan Hayward  <alan.hayward@arm.com>
4540             David Sherwood  <david.sherwood@arm.com>
4541
4542         * coretypes.h (fixed_size_mode): Declare.
4543         (fixed_size_mode_pod): New typedef.
4544         * builtins.h (target_builtins::x_apply_args_mode)
4545         (target_builtins::x_apply_result_mode): Change type to
4546         fixed_size_mode_pod.
4547         * builtins.c (apply_args_size, apply_result_size, result_vector)
4548         (expand_builtin_apply_args_1, expand_builtin_apply)
4549         (expand_builtin_return): Update accordingly.
4550
4551 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4552
4553         * cse.c (hash_rtx_cb): Hash only the encoded elements.
4554         * cselib.c (cselib_hash_rtx): Likewise.
4555         * expmed.c (make_tree): Build VECTOR_CSTs directly from the
4556         CONST_VECTOR encoding.
4557
4558 2017-01-03  Jakub Jelinek  <jakub@redhat.com>
4559             Jeff Law  <law@redhat.com>
4560
4561         PR target/83641
4562         * config/i386/i386.c (ix86_adjust_stack_and_probe_stack_clash): For
4563         noreturn probe, use gen_pop instead of ix86_emit_restore_reg_using_pop,
4564         only set RTX_FRAME_RELATED_P on both the push and pop if cfa_reg is sp
4565         and add REG_CFA_ADJUST_CFA notes in that case to both insns.
4566
4567         PR target/83641
4568         * config/i386/i386.c (ix86_adjust_stack_and_probe_stack_clash): Do not
4569         explicitly probe *sp in a noreturn function if there were any callee
4570         register saves or frame pointer is needed.
4571
4572 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
4573
4574         PR debug/83621
4575         * cfgexpand.c (expand_debug_expr): Return NULL if mode is
4576         BLKmode for ternary, binary or unary expressions.
4577
4578         PR debug/83645
4579         * var-tracking.c (delete_vta_debug_insn): New inline function.
4580         (delete_vta_debug_insns): Add USE_CFG argument, if true, walk just
4581         insns from get_insns () to NULL instead of each bb separately.
4582         Use delete_vta_debug_insn.  No longer static.
4583         (vt_debug_insns_local, variable_tracking_main_1): Adjust
4584         delete_vta_debug_insns callers.
4585         * rtl.h (delete_vta_debug_insns): Declare.
4586         * final.c (rest_of_handle_final): Call delete_vta_debug_insns
4587         instead of variable_tracking_main.
4588
4589 2018-01-03  Martin Sebor  <msebor@redhat.com>
4590
4591         PR tree-optimization/83603
4592         * calls.c (maybe_warn_nonstring_arg): Avoid accessing function
4593         arguments past the endof the argument list in functions declared
4594         without a prototype.
4595         * gimple-ssa-warn-restrict.c (wrestrict_dom_walker::check_call):
4596         Avoid checking when arguments are null.
4597
4598 2018-01-03  Martin Sebor  <msebor@redhat.com>
4599
4600         PR c/83559
4601         * doc/extend.texi (attribute const): Fix a typo.
4602         * ipa-pure-const.c ((warn_function_const, warn_function_pure): Avoid
4603         issuing -Wsuggest-attribute for void functions.
4604
4605 2018-01-03  Martin Sebor  <msebor@redhat.com>
4606
4607         * gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref): Use
4608         offset_int::from instead of wide_int::to_shwi.
4609         (maybe_diag_overlap): Remove assertion.
4610         Use HOST_WIDE_INT_PRINT_DEC instead of %lli.
4611         * gimple-ssa-sprintf.c (format_directive): Same.
4612         (parse_directive): Same.
4613         (sprintf_dom_walker::compute_format_length): Same.
4614         (try_substitute_return_value): Same.
4615
4616 2017-01-03  Jeff Law  <law@redhat.com>
4617
4618         PR middle-end/83654
4619         * explow.c (anti_adjust_stack_and_probe_stack_clash): Test a
4620         non-constant residual for zero at runtime and avoid probing in
4621         that case.  Reorganize code for trailing problem to mirror handling
4622         of the residual.
4623
4624 2018-01-03  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
4625
4626         PR tree-optimization/83501
4627         * tree-ssa-strlen.c (get_string_cst): New.
4628         (handle_char_store): Call get_string_cst.
4629
4630 2018-01-03  Martin Liska  <mliska@suse.cz>
4631
4632         PR tree-optimization/83593
4633         * tree-ssa-strlen.c: Include tree-cfg.h.
4634         (strlen_check_and_optimize_stmt): Add new argument cleanup_eh.
4635         (strlen_dom_walker): Add new member variable m_cleanup_cfg.
4636         (strlen_dom_walker::strlen_dom_walker): Initialize m_cleanup_cfg
4637         to false.
4638         (strlen_dom_walker::before_dom_children): Call
4639         gimple_purge_dead_eh_edges. Dump tranformation with details
4640         dump flags.
4641         (strlen_dom_walker::before_dom_children): Update call by adding
4642         new argument cleanup_eh.
4643         (pass_strlen::execute): Return TODO_cleanup_cfg if needed.
4644
4645 2018-01-03  Martin Liska  <mliska@suse.cz>
4646
4647         PR ipa/83549
4648         * cif-code.def (VARIADIC_THUNK): New enum value.
4649         * ipa-fnsummary.c (compute_fn_summary): Do not inline variadic
4650         thunks.
4651
4652 2018-01-03  Jan Beulich  <jbeulich@suse.com>
4653
4654         * sse.md (mov<mode>_internal): Tighten condition for when to use
4655         vmovdqu<ssescalarsize> for TI and OI modes.
4656
4657 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
4658
4659         Update copyright years.
4660
4661 2018-01-03  Martin Liska  <mliska@suse.cz>
4662
4663         PR ipa/83594
4664         * ipa-visibility.c (function_and_variable_visibility): Skip
4665         functions with noipa attribure.
4666
4667 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
4668
4669         * gcc.c (process_command): Update copyright notice dates.
4670         * gcov-dump.c (print_version): Ditto.
4671         * gcov.c (print_version): Ditto.
4672         * gcov-tool.c (print_version): Ditto.
4673         * gengtype.c (create_file): Ditto.
4674         * doc/cpp.texi: Bump @copying's copyright year.
4675         * doc/cppinternals.texi: Ditto.
4676         * doc/gcc.texi: Ditto.
4677         * doc/gccint.texi: Ditto.
4678         * doc/gcov.texi: Ditto.
4679         * doc/install.texi: Ditto.
4680         * doc/invoke.texi: Ditto.
4681
4682 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4683
4684         * vector-builder.h (vector_builder::m_full_nelts): Change from
4685         unsigned int to poly_uint64.
4686         (vector_builder::full_nelts): Update prototype accordingly.
4687         (vector_builder::new_vector): Likewise.
4688         (vector_builder::encoded_full_vector_p): Handle polynomial full_nelts.
4689         (vector_builder::operator ==): Likewise.
4690         (vector_builder::finalize): Likewise.
4691         * int-vector-builder.h (int_vector_builder::int_vector_builder):
4692         Take the number of elements as a poly_uint64 rather than an
4693         unsigned int.
4694         * vec-perm-indices.h (vec_perm_indices::m_nelts_per_input): Change
4695         from unsigned int to poly_uint64.
4696         (vec_perm_indices::vec_perm_indices): Update prototype accordingly.
4697         (vec_perm_indices::new_vector): Likewise.
4698         (vec_perm_indices::length): Likewise.
4699         (vec_perm_indices::nelts_per_input): Likewise.
4700         (vec_perm_indices::input_nelts): Likewise.
4701         * vec-perm-indices.c (vec_perm_indices::new_vector): Take the
4702         number of elements per input as a poly_uint64 rather than an
4703         unsigned int.  Use the original encoding for variable-length
4704         vectors, rather than clamping each individual element.
4705         For the second and subsequent elements in each pattern,
4706         clamp the step and base before clamping their sum.
4707         (vec_perm_indices::series_p): Handle polynomial element counts.
4708         (vec_perm_indices::all_in_range_p): Likewise.
4709         (vec_perm_indices_to_tree): Likewise.
4710         (vec_perm_indices_to_rtx): Likewise.
4711         * tree-vect-stmts.c (vect_gen_perm_mask_any): Likewise.
4712         * tree-vector-builder.c (tree_vector_builder::new_unary_operation)
4713         (tree_vector_builder::new_binary_operation): Handle polynomial
4714         element counts.  Return false if we need to know the number
4715         of elements at compile time.
4716         * fold-const.c (fold_vec_perm): Punt if the number of elements
4717         isn't known at compile time.
4718
4719 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4720
4721         * vec-perm-indices.h (vec_perm_builder): Change element type
4722         from HOST_WIDE_INT to poly_int64.
4723         (vec_perm_indices::element_type): Update accordingly.
4724         (vec_perm_indices::clamp): Handle polynomial element_types.
4725         * vec-perm-indices.c (vec_perm_indices::series_p): Likewise.
4726         (vec_perm_indices::all_in_range_p): Likewise.
4727         (tree_to_vec_perm_builder): Check for poly_int64 trees rather
4728         than shwi trees.
4729         * vector-builder.h (vector_builder::stepped_sequence_p): Handle
4730         polynomial vec_perm_indices element types.
4731         * int-vector-builder.h (int_vector_builder::equal_p): Likewise.
4732         * fold-const.c (fold_vec_perm): Likewise.
4733         * optabs.c (shift_amt_for_vec_perm_mask): Likewise.
4734         * tree-vect-generic.c (lower_vec_perm): Likewise.
4735         * tree-vect-slp.c (vect_transform_slp_perm_load): Likewise.
4736         * config/aarch64/aarch64.c (aarch64_evpc_tbl): Cast d->perm
4737         element type to HOST_WIDE_INT.
4738
4739 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4740             Alan Hayward  <alan.hayward@arm.com>
4741             David Sherwood  <david.sherwood@arm.com>
4742
4743         * alias.c (addr_side_effect_eval): Take the size as a poly_int64
4744         rather than an int.  Use plus_constant.
4745         (memrefs_conflict_p): Take the sizes as poly_int64s rather than ints.
4746         Take the offset "c" as a poly_int64 rather than a HOST_WIDE_INT.
4747
4748 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4749             Alan Hayward  <alan.hayward@arm.com>
4750             David Sherwood  <david.sherwood@arm.com>
4751
4752         * calls.c (emit_call_1, expand_call): Change struct_value_size from
4753         a HOST_WIDE_INT to a poly_int64.
4754
4755 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4756             Alan Hayward  <alan.hayward@arm.com>
4757             David Sherwood  <david.sherwood@arm.com>
4758
4759         * calls.c (load_register_parameters): Cope with polynomial
4760         mode sizes.  Require a constant size for BLKmode parameters
4761         that aren't described by a PARALLEL.  If BLOCK_REG_PADDING
4762         forces a parameter to be padded at the lsb end in order to
4763         fill a complete number of words, require the parameter size
4764         to be ordered wrt UNITS_PER_WORD.
4765
4766 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4767             Alan Hayward  <alan.hayward@arm.com>
4768             David Sherwood  <david.sherwood@arm.com>
4769
4770         * reload1.c (spill_stack_slot_width): Change element type
4771         from unsigned int to poly_uint64_pod.
4772         (alter_reg): Treat mode sizes as polynomial.
4773
4774 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4775             Alan Hayward  <alan.hayward@arm.com>
4776             David Sherwood  <david.sherwood@arm.com>
4777
4778         * reload.c (complex_word_subreg_p): New function.
4779         (reload_inner_reg_of_subreg, push_reload): Use it.
4780
4781 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4782             Alan Hayward  <alan.hayward@arm.com>
4783             David Sherwood  <david.sherwood@arm.com>
4784
4785         * lra-constraints.c (process_alt_operands): Reject matched
4786         operands whose sizes aren't ordered.
4787         (match_reload): Refer to this check here.
4788
4789 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4790             Alan Hayward  <alan.hayward@arm.com>
4791             David Sherwood  <david.sherwood@arm.com>
4792
4793         * builtins.c (expand_ifn_atomic_compare_exchange_into_call): Assert
4794         that the mode size is in the set {1, 2, 4, 8, 16}.
4795
4796 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4797             Alan Hayward  <alan.hayward@arm.com>
4798             David Sherwood  <david.sherwood@arm.com>
4799
4800         * var-tracking.c (adjust_mems): Treat mode sizes as polynomial.
4801         Use plus_constant instead of gen_rtx_PLUS.
4802
4803 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4804             Alan Hayward  <alan.hayward@arm.com>
4805             David Sherwood  <david.sherwood@arm.com>
4806
4807         * config/cr16/cr16-protos.h (cr16_push_rounding): Declare.
4808         * config/cr16/cr16.h (PUSH_ROUNDING): Move implementation to...
4809         * config/cr16/cr16.c (cr16_push_rounding): ...this new function.
4810         * config/h8300/h8300-protos.h (h8300_push_rounding): Declare.
4811         * config/h8300/h8300.h (PUSH_ROUNDING): Move implementation to...
4812         * config/h8300/h8300.c (h8300_push_rounding): ...this new function.
4813         * config/i386/i386-protos.h (ix86_push_rounding): Declare.
4814         * config/i386/i386.h (PUSH_ROUNDING): Move implementation to...
4815         * config/i386/i386.c (ix86_push_rounding): ...this new function.
4816         * config/m32c/m32c-protos.h (m32c_push_rounding): Take and return
4817         a poly_int64.
4818         * config/m32c/m32c.c (m32c_push_rounding): Likewise.
4819         * config/m68k/m68k-protos.h (m68k_push_rounding): Declare.
4820         * config/m68k/m68k.h (PUSH_ROUNDING): Move implementation to...
4821         * config/m68k/m68k.c (m68k_push_rounding): ...this new function.
4822         * config/pdp11/pdp11-protos.h (pdp11_push_rounding): Declare.
4823         * config/pdp11/pdp11.h (PUSH_ROUNDING): Move implementation to...
4824         * config/pdp11/pdp11.c (pdp11_push_rounding): ...this new function.
4825         * config/stormy16/stormy16-protos.h (xstormy16_push_rounding): Declare.
4826         * config/stormy16/stormy16.h (PUSH_ROUNDING): Move implementation to...
4827         * config/stormy16/stormy16.c (xstormy16_push_rounding): ...this new
4828         function.
4829         * expr.c (emit_move_resolve_push): Treat the input and result
4830         of PUSH_ROUNDING as a poly_int64.
4831         (emit_move_complex_push, emit_single_push_insn_1): Likewise.
4832         (emit_push_insn): Likewise.
4833         * lra-eliminations.c (mark_not_eliminable): Likewise.
4834         * recog.c (push_operand): Likewise.
4835         * reload1.c (elimination_effects): Likewise.
4836         * rtlanal.c (nonzero_bits1): Likewise.
4837         * calls.c (store_one_arg): Likewise.  Require the padding to be
4838         known at compile time.
4839
4840 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4841             Alan Hayward  <alan.hayward@arm.com>
4842             David Sherwood  <david.sherwood@arm.com>
4843
4844         * expr.c (emit_single_push_insn_1): Treat mode sizes as polynomial.
4845         Use plus_constant instead of gen_rtx_PLUS.
4846
4847 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4848             Alan Hayward  <alan.hayward@arm.com>
4849             David Sherwood  <david.sherwood@arm.com>
4850
4851         * auto-inc-dec.c (set_inc_state): Take the mode size as a poly_int64
4852         rather than an int.
4853
4854 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4855             Alan Hayward  <alan.hayward@arm.com>
4856             David Sherwood  <david.sherwood@arm.com>
4857
4858         * expr.c (expand_expr_real_1): Use tree_to_poly_uint64
4859         instead of int_size_in_bytes when handling VIEW_CONVERT_EXPRs
4860         via stack temporaries.  Treat the mode size as polynomial too.
4861
4862 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4863             Alan Hayward  <alan.hayward@arm.com>
4864             David Sherwood  <david.sherwood@arm.com>
4865
4866         * expr.c (expand_expr_real_2): When handling conversions involving
4867         unions, apply tree_to_poly_uint64 to the TYPE_SIZE rather than
4868         multiplying int_size_in_bytes by BITS_PER_UNIT.  Treat GET_MODE_BISIZE
4869         as a poly_uint64 too.
4870
4871 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4872             Alan Hayward  <alan.hayward@arm.com>
4873             David Sherwood  <david.sherwood@arm.com>
4874
4875         * rtlanal.c (subreg_get_info): Handle polynomial mode sizes.
4876
4877 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4878             Alan Hayward  <alan.hayward@arm.com>
4879             David Sherwood  <david.sherwood@arm.com>
4880
4881         * combine.c (can_change_dest_mode): Handle polynomial
4882         REGMODE_NATURAL_SIZE.
4883         * expmed.c (store_bit_field_1): Likewise.
4884         * expr.c (store_constructor): Likewise.
4885         * emit-rtl.c (validate_subreg): Operate on polynomial mode sizes
4886         and polynomial REGMODE_NATURAL_SIZE.
4887         (gen_lowpart_common): Likewise.
4888         * reginfo.c (record_subregs_of_mode): Likewise.
4889         * rtlanal.c (read_modify_subreg_p): Likewise.
4890
4891 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4892             Alan Hayward  <alan.hayward@arm.com>
4893             David Sherwood  <david.sherwood@arm.com>
4894
4895         * internal-fn.c (expand_vector_ubsan_overflow): Handle polynomial
4896         numbers of elements.
4897
4898 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4899             Alan Hayward  <alan.hayward@arm.com>
4900             David Sherwood  <david.sherwood@arm.com>
4901
4902         * match.pd: Cope with polynomial numbers of vector elements.
4903
4904 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4905             Alan Hayward  <alan.hayward@arm.com>
4906             David Sherwood  <david.sherwood@arm.com>
4907
4908         * fold-const.c (fold_indirect_ref_1): Handle polynomial offsets
4909         in a POINTER_PLUS_EXPR.
4910
4911 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4912             Alan Hayward  <alan.hayward@arm.com>
4913             David Sherwood  <david.sherwood@arm.com>
4914
4915         * omp-simd-clone.c (simd_clone_subparts): New function.
4916         (simd_clone_init_simd_arrays): Use it instead of TYPE_VECTOR_SUBPARTS.
4917         (ipa_simd_modify_function_body): Likewise.
4918
4919 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4920             Alan Hayward  <alan.hayward@arm.com>
4921             David Sherwood  <david.sherwood@arm.com>
4922
4923         * tree-vect-generic.c (nunits_for_known_piecewise_op): New function.
4924         (expand_vector_piecewise): Use it instead of TYPE_VECTOR_SUBPARTS.
4925         (expand_vector_addition, add_rshift, expand_vector_divmod): Likewise.
4926         (expand_vector_condition, vector_element): Likewise.
4927         (subparts_gt): New function.
4928         (get_compute_type): Use subparts_gt.
4929         (count_type_subparts): Delete.
4930         (expand_vector_operations_1): Use subparts_gt instead of
4931         count_type_subparts.
4932
4933 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4934             Alan Hayward  <alan.hayward@arm.com>
4935             David Sherwood  <david.sherwood@arm.com>
4936
4937         * tree-vect-data-refs.c (vect_no_alias_p): Replace with...
4938         (vect_compile_time_alias): ...this new function.  Do the calculation
4939         on poly_ints rather than trees.
4940         (vect_prune_runtime_alias_test_list): Update call accordingly.
4941
4942 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4943             Alan Hayward  <alan.hayward@arm.com>
4944             David Sherwood  <david.sherwood@arm.com>
4945
4946         * tree-vect-slp.c (vect_build_slp_tree_1): Handle polynomial
4947         numbers of units.
4948         (vect_schedule_slp_instance): Likewise.
4949
4950 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4951             Alan Hayward  <alan.hayward@arm.com>
4952             David Sherwood  <david.sherwood@arm.com>
4953
4954         * tree-vect-slp.c (vect_get_and_check_slp_defs): Reject
4955         constant and extern definitions for variable-length vectors.
4956         (vect_get_constant_vectors): Note that the number of units
4957         is known to be constant.
4958
4959 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4960             Alan Hayward  <alan.hayward@arm.com>
4961             David Sherwood  <david.sherwood@arm.com>
4962
4963         * tree-vect-stmts.c (vectorizable_conversion): Treat the number
4964         of units as polynomial.  Choose between WIDE and NARROW based
4965         on multiple_p.
4966
4967 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4968             Alan Hayward  <alan.hayward@arm.com>
4969             David Sherwood  <david.sherwood@arm.com>
4970
4971         * tree-vect-stmts.c (simd_clone_subparts): New function.
4972         (vectorizable_simd_clone_call): Use it instead of TYPE_VECTOR_SUBPARTS.
4973
4974 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4975             Alan Hayward  <alan.hayward@arm.com>
4976             David Sherwood  <david.sherwood@arm.com>
4977
4978         * tree-vect-stmts.c (vectorizable_call): Treat the number of
4979         vectors as polynomial.  Use build_index_vector for
4980         IFN_GOMP_SIMD_LANE.
4981
4982 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4983             Alan Hayward  <alan.hayward@arm.com>
4984             David Sherwood  <david.sherwood@arm.com>
4985
4986         * tree-vect-stmts.c (get_load_store_type): Treat the number of
4987         units as polynomial.  Reject VMAT_ELEMENTWISE and VMAT_STRIDED_SLP
4988         for variable-length vectors.
4989         (vectorizable_mask_load_store): Treat the number of units as
4990         polynomial, asserting that it is constant if the condition has
4991         already been enforced.
4992         (vectorizable_store, vectorizable_load): Likewise.
4993
4994 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4995             Alan Hayward  <alan.hayward@arm.com>
4996             David Sherwood  <david.sherwood@arm.com>
4997
4998         * tree-vect-loop.c (vectorizable_live_operation): Treat the number
4999         of units as polynomial.  Punt if we can't tell at compile time
5000         which vector contains the final result.
5001
5002 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
5003             Alan Hayward  <alan.hayward@arm.com>
5004             David Sherwood  <david.sherwood@arm.com>
5005
5006         * tree-vect-loop.c (vectorizable_induction): Treat the number
5007         of units as polynomial.  Punt on SLP inductions.  Use an integer
5008         VEC_SERIES_EXPR for variable-length integer reductions.  Use a
5009         cast of such a series for variable-length floating-point
5010         reductions.
5011
5012 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
5013             Alan Hayward  <alan.hayward@arm.com>
5014             David Sherwood  <david.sherwood@arm.com>
5015
5016         * tree.h (build_index_vector): Declare.
5017         * tree.c (build_index_vector): New function.
5018         * tree-vect-loop.c (get_initial_defs_for_reduction): Treat the number
5019         of units as polynomial, forcibly converting it to a constant if
5020         vectorizable_reduction has already enforced the condition.
5021         (vect_create_epilog_for_reduction): Likewise.  Use build_index_vector
5022         to create a {1,2,3,...} vector.
5023         (vectorizable_reduction): Treat the number of units as polynomial.
5024         Choose vectype_in based on the largest scalar element size rather
5025         than the smallest number of units.  Enforce the restrictions
5026         relied on above.
5027
5028 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
5029             Alan Hayward  <alan.hayward@arm.com>
5030             David Sherwood  <david.sherwood@arm.com>
5031
5032         * tree-vect-data-refs.c (vector_alignment_reachable_p): Treat the
5033         number of units as polynomial.
5034
5035 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
5036             Alan Hayward  <alan.hayward@arm.com>
5037             David Sherwood  <david.sherwood@arm.com>
5038
5039         * target.h (vector_sizes, auto_vector_sizes): New typedefs.
5040         * target.def (autovectorize_vector_sizes): Return the vector sizes
5041         by pointer, using vector_sizes rather than a bitmask.
5042         * targhooks.h (default_autovectorize_vector_sizes): Update accordingly.
5043         * targhooks.c (default_autovectorize_vector_sizes): Likewise.
5044         * config/aarch64/aarch64.c (aarch64_autovectorize_vector_sizes):
5045         Likewise.
5046         * config/arc/arc.c (arc_autovectorize_vector_sizes): Likewise.
5047         * config/arm/arm.c (arm_autovectorize_vector_sizes): Likewise.
5048         * config/i386/i386.c (ix86_autovectorize_vector_sizes): Likewise.
5049         * config/mips/mips.c (mips_autovectorize_vector_sizes): Likewise.
5050         * omp-general.c (omp_max_vf): Likewise.
5051         * omp-low.c (omp_clause_aligned_alignment): Likewise.
5052         * optabs-query.c (can_vec_mask_load_store_p): Likewise.
5053         * tree-vect-loop.c (vect_analyze_loop): Likewise.
5054         * tree-vect-slp.c (vect_slp_bb): Likewise.
5055         * doc/tm.texi: Regenerate.
5056         * tree-vectorizer.h (current_vector_size): Change from an unsigned int
5057         to a poly_uint64.
5058         * tree-vect-stmts.c (get_vectype_for_scalar_type_and_size): Take
5059         the vector size as a poly_uint64 rather than an unsigned int.
5060         (current_vector_size): Change from an unsigned int to a poly_uint64.
5061         (get_vectype_for_scalar_type): Update accordingly.
5062         * tree.h (build_truth_vector_type): Take the size and number of
5063         units as a poly_uint64 rather than an unsigned int.
5064         (build_vector_type): Add a temporary overload that takes
5065         the number of units as a poly_uint64 rather than an unsigned int.
5066         * tree.c (make_vector_type): Likewise.
5067         (build_truth_vector_type): Take the number of units as a poly_uint64
5068         rather than an unsigned int.
5069
5070 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
5071             Alan Hayward  <alan.hayward@arm.com>
5072             David Sherwood  <david.sherwood@arm.com>
5073
5074         * target.def (get_mask_mode): Take the number of units and length
5075         as poly_uint64s rather than unsigned ints.
5076         * targhooks.h (default_get_mask_mode): Update accordingly.
5077         * targhooks.c (default_get_mask_mode): Likewise.
5078         * config/i386/i386.c (ix86_get_mask_mode): Likewise.
5079         * doc/tm.texi: Regenerate.
5080
5081 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
5082             Alan Hayward  <alan.hayward@arm.com>
5083             David Sherwood  <david.sherwood@arm.com>
5084
5085         * omp-general.h (omp_max_vf): Return a poly_uint64 instead of an int.
5086         * omp-general.c (omp_max_vf): Likewise.
5087         * omp-expand.c (omp_adjust_chunk_size): Update call to omp_max_vf.
5088         (expand_omp_simd): Handle polynomial safelen.
5089         * omp-low.c (omplow_simd_context): Add a default constructor.
5090         (omplow_simd_context::max_vf): Change from int to poly_uint64.
5091         (lower_rec_simd_input_clauses): Update accordingly.
5092         (lower_rec_input_clauses): Likewise.
5093
5094 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
5095             Alan Hayward  <alan.hayward@arm.com>
5096             David Sherwood  <david.sherwood@arm.com>
5097
5098         * tree-vectorizer.h (vect_nunits_for_cost): New function.
5099         * tree-vect-loop.c (vect_model_reduction_cost): Use it.
5100         * tree-vect-slp.c (vect_analyze_slp_cost_1): Likewise.
5101         (vect_analyze_slp_cost): Likewise.
5102         * tree-vect-stmts.c (vect_model_store_cost): Likewise.
5103         (vect_model_load_cost): Likewise.
5104
5105 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
5106             Alan Hayward  <alan.hayward@arm.com>
5107             David Sherwood  <david.sherwood@arm.com>
5108
5109         * tree-vect-slp.c (vect_record_max_nunits, vect_build_slp_tree_1)
5110         (vect_build_slp_tree_2, vect_build_slp_tree): Change max_nunits
5111         from an unsigned int * to a poly_uint64_pod *.
5112         (calculate_unrolling_factor): New function.
5113         (vect_analyze_slp_instance): Use it.  Track polynomial max_nunits.
5114
5115 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
5116             Alan Hayward  <alan.hayward@arm.com>
5117             David Sherwood  <david.sherwood@arm.com>
5118
5119         * tree-vectorizer.h (_slp_instance::unrolling_factor): Change
5120         from an unsigned int to a poly_uint64.
5121         (_loop_vec_info::slp_unrolling_factor): Likewise.
5122         (_loop_vec_info::vectorization_factor): Change from an int
5123         to a poly_uint64.
5124         (MAX_VECTORIZATION_FACTOR): Bump from 64 to INT_MAX.
5125         (vect_get_num_vectors): New function.
5126         (vect_update_max_nunits, vect_vf_for_cost): Likewise.
5127         (vect_get_num_copies): Use vect_get_num_vectors.
5128         (vect_analyze_data_ref_dependences): Change max_vf from an int *
5129         to an unsigned int *.
5130         (vect_analyze_data_refs): Change min_vf from an int * to a
5131         poly_uint64 *.
5132         (vect_transform_slp_perm_load): Take the vf as a poly_uint64 rather
5133         than an unsigned HOST_WIDE_INT.
5134         * tree-vect-data-refs.c (vect_analyze_possibly_independent_ddr)
5135         (vect_analyze_data_ref_dependence): Change max_vf from an int *
5136         to an unsigned int *.
5137         (vect_analyze_data_ref_dependences): Likewise.
5138         (vect_compute_data_ref_alignment): Handle polynomial vf.
5139         (vect_enhance_data_refs_alignment): Likewise.
5140         (vect_prune_runtime_alias_test_list): Likewise.
5141         (vect_shift_permute_load_chain): Likewise.
5142         (vect_supportable_dr_alignment): Likewise.
5143         (dependence_distance_ge_vf): Take the vectorization factor as a
5144         poly_uint64 rather than an unsigned HOST_WIDE_INT.
5145         (vect_analyze_data_refs): Change min_vf from an int * to a
5146         poly_uint64 *.
5147         * tree-vect-loop-manip.c (vect_gen_scalar_loop_niters): Take
5148         vfm1 as a poly_uint64 rather than an int.  Make the same change
5149         for the returned bound_scalar.
5150         (vect_gen_vector_loop_niters): Handle polynomial vf.
5151         (vect_do_peeling): Likewise.  Update call to
5152         vect_gen_scalar_loop_niters and handle polynomial bound_scalars.
5153         (vect_gen_vector_loop_niters_mult_vf): Assert that the vf must
5154         be constant.
5155         * tree-vect-loop.c (vect_determine_vectorization_factor)
5156         (vect_update_vf_for_slp, vect_analyze_loop_2): Handle polynomial vf.
5157         (vect_get_known_peeling_cost): Likewise.
5158         (vect_estimate_min_profitable_iters, vectorizable_reduction): Likewise.
5159         (vect_worthwhile_without_simd_p, vectorizable_induction): Likewise.
5160         (vect_transform_loop): Likewise.  Use the lowest possible VF when
5161         updating the upper bounds of the loop.
5162         (vect_min_worthwhile_factor): Make static.  Return an unsigned int
5163         rather than an int.
5164         * tree-vect-slp.c (vect_attempt_slp_rearrange_stmts): Cope with
5165         polynomial unroll factors.
5166         (vect_analyze_slp_cost_1, vect_analyze_slp_instance): Likewise.
5167         (vect_make_slp_decision): Likewise.
5168         (vect_supported_load_permutation_p): Likewise, and polynomial
5169         vf too.
5170         (vect_analyze_slp_cost): Handle polynomial vf.
5171         (vect_slp_analyze_node_operations): Likewise.
5172         (vect_slp_analyze_bb_1): Likewise.
5173         (vect_transform_slp_perm_load): Take the vf as a poly_uint64 rather
5174         than an unsigned HOST_WIDE_INT.
5175         * tree-vect-stmts.c (vectorizable_simd_clone_call, vectorizable_store)
5176         (vectorizable_load): Handle polynomial vf.
5177         * tree-vectorizer.c (simduid_to_vf::vf): Change from an int to
5178         a poly_uint64.
5179         (adjust_simduid_builtins, shrink_simd_arrays): Update accordingly.
5180
5181 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
5182             Alan Hayward  <alan.hayward@arm.com>
5183             David Sherwood  <david.sherwood@arm.com>
5184
5185         * match.pd: Handle bit operations involving three constants
5186         and try to fold one pair.
5187
5188 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
5189
5190         * tree-vect-loop-manip.c: Include gimple-fold.h.
5191         (slpeel_make_loop_iterate_ntimes): Add step, final_iv and
5192         niters_maybe_zero parameters.  Handle other cases besides a step of 1.
5193         (vect_gen_vector_loop_niters): Add a step_vector_ptr parameter.
5194         Add a path that uses a step of VF instead of 1, but disable it
5195         for now.
5196         (vect_do_peeling): Add step_vector, niters_vector_mult_vf_var
5197         and niters_no_overflow parameters.  Update calls to
5198         slpeel_make_loop_iterate_ntimes and vect_gen_vector_loop_niters.
5199         Create a new SSA name if the latter choses to use a ste other
5200         than zero, and return it via niters_vector_mult_vf_var.
5201         * tree-vect-loop.c (vect_transform_loop): Update calls to
5202         vect_do_peeling, vect_gen_vector_loop_niters and
5203         slpeel_make_loop_iterate_ntimes.
5204         * tree-vectorizer.h (slpeel_make_loop_iterate_ntimes, vect_do_peeling)
5205         (vect_gen_vector_loop_niters): Update declarations after above changes.
5206
5207 2018-01-02  Michael Meissner  <meissner@linux.vnet.ibm.com>
5208
5209         * config/rs6000/rs6000.md (floor<mode>2): Add support for IEEE
5210         128-bit round to integer instructions.
5211         (ceil<mode>2): Likewise.
5212         (btrunc<mode>2): Likewise.
5213         (round<mode>2): Likewise.
5214
5215 2018-01-02  Aaron Sawdey  <acsawdey@linux.vnet.ibm.com>
5216
5217         * config/rs6000/rs6000-string.c (expand_block_move): Allow the use of
5218         unaligned VSX load/store on P8/P9.
5219         (expand_block_clear): Allow the use of unaligned VSX
5220         load/store on P8/P9.
5221
5222 2018-01-02  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
5223
5224         * config/rs6000/rs6000-p8swap.c (swap_feeds_both_load_and_store):
5225         New function.
5226         (rs6000_analyze_swaps): Mark a web unoptimizable if it contains a
5227         swap associated with both a load and a store.
5228
5229 2018-01-02  Andrew Waterman  <andrew@sifive.com>
5230
5231         * config/riscv/linux.h (ICACHE_FLUSH_FUNC): New.
5232         * config/riscv/riscv.md (clear_cache): Use it.
5233
5234 2018-01-02  Artyom Skrobov  <tyomitch@gmail.com>
5235
5236         * web.c: Remove out-of-date comment.
5237
5238 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
5239
5240         * expr.c (fixup_args_size_notes): Check that any existing
5241         REG_ARGS_SIZE notes are correct, and don't try to re-add them.
5242         (emit_single_push_insn_1): Move stack_pointer_delta adjustment to...
5243         (emit_single_push_insn): ...here.
5244
5245 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
5246
5247         * rtl.h (CONST_VECTOR_ELT): Redefine to const_vector_elt.
5248         (const_vector_encoded_nelts): New function.
5249         (CONST_VECTOR_NUNITS): Redefine to use GET_MODE_NUNITS.
5250         (const_vector_int_elt, const_vector_elt): Declare.
5251         * emit-rtl.c (const_vector_int_elt_1): New function.
5252         (const_vector_elt): Likewise.
5253         * simplify-rtx.c (simplify_immed_subreg): Avoid taking the address
5254         of CONST_VECTOR_ELT.
5255
5256 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
5257
5258         * expr.c: Include rtx-vector-builder.h.
5259         (const_vector_mask_from_tree): Use rtx_vector_builder and operate
5260         directly on the tree encoding.
5261         (const_vector_from_tree): Likewise.
5262         * optabs.c: Include rtx-vector-builder.h.
5263         (expand_vec_perm_var): Use rtx_vector_builder and create a repeating
5264         sequence of "u" values.
5265         * vec-perm-indices.c: Include rtx-vector-builder.h.
5266         (vec_perm_indices_to_rtx): Use rtx_vector_builder and operate
5267         directly on the vec_perm_indices encoding.
5268
5269 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
5270
5271         * doc/rtl.texi (const_vector): Describe new encoding scheme.
5272         * Makefile.in (OBJS): Add rtx-vector-builder.o.
5273         * rtx-vector-builder.h: New file.
5274         * rtx-vector-builder.c: Likewise.
5275         * rtl.h (rtx_def::u2): Add a const_vector field.
5276         (CONST_VECTOR_NPATTERNS): New macro.
5277         (CONST_VECTOR_NELTS_PER_PATTERN): Likewise.
5278         (CONST_VECTOR_DUPLICATE_P): Likewise.
5279         (CONST_VECTOR_STEPPED_P): Likewise.
5280         (CONST_VECTOR_ENCODED_ELT): Likewise.
5281         (const_vec_duplicate_p): Check for a duplicated vector encoding.
5282         (unwrap_const_vec_duplicate): Likewise.
5283         (const_vec_series_p): Check for a non-duplicated vector encoding.
5284         Say that the function only returns true for integer vectors.
5285         * emit-rtl.c: Include rtx-vector-builder.h.
5286         (gen_const_vec_duplicate_1): Delete.
5287         (gen_const_vector): Call gen_const_vec_duplicate instead of
5288         gen_const_vec_duplicate_1.
5289         (const_vec_series_p_1): Operate directly on the CONST_VECTOR encoding.
5290         (gen_const_vec_duplicate): Use rtx_vector_builder.
5291         (gen_const_vec_series): Likewise.
5292         (gen_rtx_CONST_VECTOR): Likewise.
5293         * config/powerpcspe/powerpcspe.c: Include rtx-vector-builder.h.
5294         (swap_const_vector_halves): Take an rtx pointer rather than rtx.
5295         Build a new vector rather than modifying a CONST_VECTOR in-place.
5296         (handle_special_swappables): Update call accordingly.
5297         * config/rs6000/rs6000-p8swap.c: Include rtx-vector-builder.h.
5298         (swap_const_vector_halves): Take an rtx pointer rather than rtx.
5299         Build a new vector rather than modifying a CONST_VECTOR in-place.
5300         (handle_special_swappables): Update call accordingly.
5301
5302 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
5303
5304         * simplify-rtx.c (simplify_const_binary_operation): Use
5305         CONST_VECTOR_ELT instead of XVECEXP.
5306
5307 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
5308
5309         * tree-cfg.c (verify_gimple_assign_ternary): Allow the size of
5310         the selector elements to be different from the data elements
5311         if the selector is a VECTOR_CST.
5312         * tree-vect-stmts.c (vect_gen_perm_mask_any): Use a vector of
5313         ssizetype for the selector.
5314
5315 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
5316
5317         * optabs.c (shift_amt_for_vec_perm_mask): Try using series_p
5318         before testing each element individually.
5319         * tree-vect-generic.c (lower_vec_perm): Likewise.
5320
5321 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
5322
5323         * selftest.h (selftest::vec_perm_indices_c_tests): Declare.
5324         * selftest-run-tests.c (selftest::run_tests): Call it.
5325         * vector-builder.h (vector_builder::operator ==): New function.
5326         (vector_builder::operator !=): Likewise.
5327         * vec-perm-indices.h (vec_perm_indices::series_p): Declare.
5328         (vec_perm_indices::all_from_input_p): New function.
5329         * vec-perm-indices.c (vec_perm_indices::series_p): Likewise.
5330         (test_vec_perm_12, selftest::vec_perm_indices_c_tests): Likewise.
5331         * fold-const.c (fold_ternary_loc): Use tree_to_vec_perm_builder
5332         instead of reading the VECTOR_CST directly.  Detect whether both
5333         vector inputs are the same before constructing the vec_perm_indices,
5334         and update the number of inputs argument accordingly.  Use the
5335         utility functions added above.  Only construct sel2 if we need to.
5336
5337 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
5338
5339         * optabs.c (expand_vec_perm_var): Use an explicit encoding for
5340         the broadcast of the low byte.
5341         (expand_mult_highpart): Use an explicit encoding for the permutes.
5342         * optabs-query.c (can_mult_highpart_p): Likewise.
5343         * tree-vect-loop.c (calc_vec_perm_mask_for_shift): Likewise.
5344         * tree-vect-stmts.c (perm_mask_for_reverse): Likewise.
5345         (vectorizable_bswap): Likewise.
5346         * tree-vect-data-refs.c (vect_grouped_store_supported): Use an
5347         explicit encoding for the power-of-2 permutes.
5348         (vect_permute_store_chain): Likewise.
5349         (vect_grouped_load_supported): Likewise.
5350         (vect_permute_load_chain): Likewise.
5351
5352 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
5353
5354         * vec-perm-indices.h (vec_perm_indices_to_tree): Declare.
5355         * vec-perm-indices.c (vec_perm_indices_to_tree): New function.
5356         * tree-ssa-forwprop.c (simplify_vector_constructor): Use it.
5357         * tree-vect-slp.c (vect_transform_slp_perm_load): Likewise.
5358         * tree-vect-stmts.c (vectorizable_bswap): Likewise.
5359         (vect_gen_perm_mask_any): Likewise.
5360
5361 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
5362
5363         * int-vector-builder.h: New file.
5364         * vec-perm-indices.h: Include int-vector-builder.h.
5365         (vec_perm_indices): Redefine as an int_vector_builder.
5366         (auto_vec_perm_indices): Delete.
5367         (vec_perm_builder): Redefine as a stand-alone class.
5368         (vec_perm_indices::vec_perm_indices): New function.
5369         (vec_perm_indices::clamp): Likewise.
5370         * vec-perm-indices.c: Include fold-const.h and tree-vector-builder.h.
5371         (vec_perm_indices::new_vector): New function.
5372         (vec_perm_indices::new_expanded_vector): Update for new
5373         vec_perm_indices class.
5374         (vec_perm_indices::rotate_inputs): New function.
5375         (vec_perm_indices::all_in_range_p): Operate directly on the
5376         encoded form, without computing elided elements.
5377         (tree_to_vec_perm_builder): Operate directly on the VECTOR_CST
5378         encoding.  Update for new vec_perm_indices class.
5379         * optabs.c (expand_vec_perm_const): Create a vec_perm_indices for
5380         the given vec_perm_builder.
5381         (expand_vec_perm_var): Update vec_perm_builder constructor.
5382         (expand_mult_highpart): Use vec_perm_builder instead of
5383         auto_vec_perm_indices.
5384         * optabs-query.c (can_mult_highpart_p): Use vec_perm_builder and
5385         vec_perm_indices instead of auto_vec_perm_indices.  Use a single
5386         or double series encoding as appropriate.
5387         * fold-const.c (fold_ternary_loc): Use vec_perm_builder and
5388         vec_perm_indices instead of auto_vec_perm_indices.
5389         * tree-ssa-forwprop.c (simplify_vector_constructor): Likewise.
5390         * tree-vect-data-refs.c (vect_grouped_store_supported): Likewise.
5391         (vect_permute_store_chain): Likewise.
5392         (vect_grouped_load_supported): Likewise.
5393         (vect_permute_load_chain): Likewise.
5394         (vect_shift_permute_load_chain): Likewise.
5395         * tree-vect-slp.c (vect_build_slp_tree_1): Likewise.
5396         (vect_transform_slp_perm_load): Likewise.
5397         (vect_schedule_slp_instance): Likewise.
5398         * tree-vect-stmts.c (perm_mask_for_reverse): Likewise.
5399         (vectorizable_mask_load_store): Likewise.
5400         (vectorizable_bswap): Likewise.
5401         (vectorizable_store): Likewise.
5402         (vectorizable_load): Likewise.
5403         * tree-vect-generic.c (lower_vec_perm): Use vec_perm_builder and
5404         vec_perm_indices instead of auto_vec_perm_indices.  Use
5405         tree_to_vec_perm_builder to read the vector from a tree.
5406         * tree-vect-loop.c (calc_vec_perm_mask_for_shift): Take a
5407         vec_perm_builder instead of a vec_perm_indices.
5408         (have_whole_vector_shift): Use vec_perm_builder and
5409         vec_perm_indices instead of auto_vec_perm_indices.  Leave the
5410         truncation to calc_vec_perm_mask_for_shift.
5411         (vect_create_epilog_for_reduction): Likewise.
5412         * config/aarch64/aarch64.c (expand_vec_perm_d::perm): Change
5413         from auto_vec_perm_indices to vec_perm_indices.
5414         (aarch64_expand_vec_perm_const_1): Use rotate_inputs on d.perm
5415         instead of changing individual elements.
5416         (aarch64_vectorize_vec_perm_const): Use new_vector to install
5417         the vector in d.perm.
5418         * config/arm/arm.c (expand_vec_perm_d::perm): Change
5419         from auto_vec_perm_indices to vec_perm_indices.
5420         (arm_expand_vec_perm_const_1): Use rotate_inputs on d.perm
5421         instead of changing individual elements.
5422         (arm_vectorize_vec_perm_const): Use new_vector to install
5423         the vector in d.perm.
5424         * config/powerpcspe/powerpcspe.c (rs6000_expand_extract_even):
5425         Update vec_perm_builder constructor.
5426         (rs6000_expand_interleave): Likewise.
5427         * config/rs6000/rs6000.c (rs6000_expand_extract_even): Likewise.
5428         (rs6000_expand_interleave): Likewise.
5429
5430 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
5431
5432         * optabs-query.c (can_vec_perm_var_p): Check whether lowering
5433         to qimode could truncate the indices.
5434         * optabs.c (expand_vec_perm_var): Likewise.
5435
5436 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
5437
5438         * Makefile.in (OBJS): Add vec-perm-indices.o.
5439         * vec-perm-indices.h: New file.
5440         * vec-perm-indices.c: Likewise.
5441         * target.h (vec_perm_indices): Replace with a forward class
5442         declaration.
5443         (auto_vec_perm_indices): Move to vec-perm-indices.h.
5444         * optabs.h: Include vec-perm-indices.h.
5445         (expand_vec_perm): Delete.
5446         (selector_fits_mode_p, expand_vec_perm_var): Declare.
5447         (expand_vec_perm_const): Declare.
5448         * target.def (vec_perm_const_ok): Replace with...
5449         (vec_perm_const): ...this new hook.
5450         * doc/tm.texi.in (TARGET_VECTORIZE_VEC_PERM_CONST_OK): Replace with...
5451         (TARGET_VECTORIZE_VEC_PERM_CONST): ...this new hook.
5452         * doc/tm.texi: Regenerate.
5453         * optabs.def (vec_perm_const): Delete.
5454         * doc/md.texi (vec_perm_const): Likewise.
5455         (vec_perm): Refer to TARGET_VECTORIZE_VEC_PERM_CONST.
5456         * expr.c (expand_expr_real_2): Use expand_vec_perm_const rather than
5457         expand_vec_perm for constant permutation vectors.  Assert that
5458         the mode of variable permutation vectors is the integer equivalent
5459         of the mode that is being permuted.
5460         * optabs-query.h (selector_fits_mode_p): Declare.
5461         * optabs-query.c: Include vec-perm-indices.h.
5462         (selector_fits_mode_p): New function.
5463         (can_vec_perm_const_p): Check whether targetm.vectorize.vec_perm_const
5464         is defined, instead of checking whether the vec_perm_const_optab
5465         exists.  Use targetm.vectorize.vec_perm_const instead of
5466         targetm.vectorize.vec_perm_const_ok.  Check whether the indices
5467         fit in the vector mode before using a variable permute.
5468         * optabs.c (shift_amt_for_vec_perm_mask): Take a mode and a
5469         vec_perm_indices instead of an rtx.
5470         (expand_vec_perm): Replace with...
5471         (expand_vec_perm_const): ...this new function.  Take the selector
5472         as a vec_perm_indices rather than an rtx.  Also take the mode of
5473         the selector.  Update call to shift_amt_for_vec_perm_mask.
5474         Use targetm.vectorize.vec_perm_const instead of vec_perm_const_optab.
5475         Use vec_perm_indices::new_expanded_vector to expand the original
5476         selector into bytes.  Check whether the indices fit in the vector
5477         mode before using a variable permute.
5478         (expand_vec_perm_var): Make global.
5479         (expand_mult_highpart): Use expand_vec_perm_const.
5480         * fold-const.c: Includes vec-perm-indices.h.
5481         * tree-ssa-forwprop.c: Likewise.
5482         * tree-vect-data-refs.c: Likewise.
5483         * tree-vect-generic.c: Likewise.
5484         * tree-vect-loop.c: Likewise.
5485         * tree-vect-slp.c: Likewise.
5486         * tree-vect-stmts.c: Likewise.
5487         * config/aarch64/aarch64-protos.h (aarch64_expand_vec_perm_const):
5488         Delete.
5489         * config/aarch64/aarch64-simd.md (vec_perm_const<mode>): Delete.
5490         * config/aarch64/aarch64.c (aarch64_expand_vec_perm_const)
5491         (aarch64_vectorize_vec_perm_const_ok): Fuse into...
5492         (aarch64_vectorize_vec_perm_const): ...this new function.
5493         (TARGET_VECTORIZE_VEC_PERM_CONST_OK): Delete.
5494         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
5495         * config/arm/arm-protos.h (arm_expand_vec_perm_const): Delete.
5496         * config/arm/vec-common.md (vec_perm_const<mode>): Delete.
5497         * config/arm/arm.c (TARGET_VECTORIZE_VEC_PERM_CONST_OK): Delete.
5498         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
5499         (arm_expand_vec_perm_const, arm_vectorize_vec_perm_const_ok): Merge
5500         into...
5501         (arm_vectorize_vec_perm_const): ...this new function.  Explicitly
5502         check for NEON modes.
5503         * config/i386/i386-protos.h (ix86_expand_vec_perm_const): Delete.
5504         * config/i386/sse.md (VEC_PERM_CONST, vec_perm_const<mode>): Delete.
5505         * config/i386/i386.c (ix86_expand_vec_perm_const_1): Update comment.
5506         (ix86_expand_vec_perm_const, ix86_vectorize_vec_perm_const_ok): Merge
5507         into...
5508         (ix86_vectorize_vec_perm_const): ...this new function.  Incorporate
5509         the old VEC_PERM_CONST conditions.
5510         * config/ia64/ia64-protos.h (ia64_expand_vec_perm_const): Delete.
5511         * config/ia64/vect.md (vec_perm_const<mode>): Delete.
5512         * config/ia64/ia64.c (ia64_expand_vec_perm_const)
5513         (ia64_vectorize_vec_perm_const_ok): Merge into...
5514         (ia64_vectorize_vec_perm_const): ...this new function.
5515         * config/mips/loongson.md (vec_perm_const<mode>): Delete.
5516         * config/mips/mips-msa.md (vec_perm_const<mode>): Delete.
5517         * config/mips/mips-ps-3d.md (vec_perm_constv2sf): Delete.
5518         * config/mips/mips-protos.h (mips_expand_vec_perm_const): Delete.
5519         * config/mips/mips.c (mips_expand_vec_perm_const)
5520         (mips_vectorize_vec_perm_const_ok): Merge into...
5521         (mips_vectorize_vec_perm_const): ...this new function.
5522         * config/powerpcspe/altivec.md (vec_perm_constv16qi): Delete.
5523         * config/powerpcspe/paired.md (vec_perm_constv2sf): Delete.
5524         * config/powerpcspe/spe.md (vec_perm_constv2si): Delete.
5525         * config/powerpcspe/vsx.md (vec_perm_const<mode>): Delete.
5526         * config/powerpcspe/powerpcspe-protos.h (altivec_expand_vec_perm_const)
5527         (rs6000_expand_vec_perm_const): Delete.
5528         * config/powerpcspe/powerpcspe.c (TARGET_VECTORIZE_VEC_PERM_CONST_OK):
5529         Delete.
5530         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
5531         (altivec_expand_vec_perm_const_le): Take each operand individually.
5532         Operate on constant selectors rather than rtxes.
5533         (altivec_expand_vec_perm_const): Likewise.  Update call to
5534         altivec_expand_vec_perm_const_le.
5535         (rs6000_expand_vec_perm_const): Delete.
5536         (rs6000_vectorize_vec_perm_const_ok): Delete.
5537         (rs6000_vectorize_vec_perm_const): New function.
5538         (rs6000_do_expand_vec_perm): Take a vec_perm_builder instead of
5539         an element count and rtx array.
5540         (rs6000_expand_extract_even): Update call accordingly.
5541         (rs6000_expand_interleave): Likewise.
5542         * config/rs6000/altivec.md (vec_perm_constv16qi): Delete.
5543         * config/rs6000/paired.md (vec_perm_constv2sf): Delete.
5544         * config/rs6000/vsx.md (vec_perm_const<mode>): Delete.
5545         * config/rs6000/rs6000-protos.h (altivec_expand_vec_perm_const)
5546         (rs6000_expand_vec_perm_const): Delete.
5547         * config/rs6000/rs6000.c (TARGET_VECTORIZE_VEC_PERM_CONST_OK): Delete.
5548         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
5549         (altivec_expand_vec_perm_const_le): Take each operand individually.
5550         Operate on constant selectors rather than rtxes.
5551         (altivec_expand_vec_perm_const): Likewise.  Update call to
5552         altivec_expand_vec_perm_const_le.
5553         (rs6000_expand_vec_perm_const): Delete.
5554         (rs6000_vectorize_vec_perm_const_ok): Delete.
5555         (rs6000_vectorize_vec_perm_const): New function.  Remove stray
5556         reference to the SPE evmerge intructions.
5557         (rs6000_do_expand_vec_perm): Take a vec_perm_builder instead of
5558         an element count and rtx array.
5559         (rs6000_expand_extract_even): Update call accordingly.
5560         (rs6000_expand_interleave): Likewise.
5561         * config/sparc/sparc.md (vec_perm_constv8qi): Delete in favor of...
5562         * config/sparc/sparc.c (sparc_vectorize_vec_perm_const): ...this
5563         new function.
5564         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
5565
5566 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
5567
5568         * optabs.c (expand_vec_perm_1): Assert that SEL has an integer
5569         vector mode and that that mode matches the mode of the data
5570         being permuted.
5571         (expand_vec_perm): Split handling of non-CONST_VECTOR selectors
5572         out into expand_vec_perm_var.  Do all CONST_VECTOR handling here,
5573         directly using expand_vec_perm_1 when forcing selectors into
5574         registers.
5575         (expand_vec_perm_var): New function, split out from expand_vec_perm.
5576
5577 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
5578
5579         * optabs-query.h (can_vec_perm_p): Delete.
5580         (can_vec_perm_var_p, can_vec_perm_const_p): Declare.
5581         * optabs-query.c (can_vec_perm_p): Split into...
5582         (can_vec_perm_var_p, can_vec_perm_const_p): ...these two functions.
5583         (can_mult_highpart_p): Use can_vec_perm_const_p to test whether a
5584         particular selector is valid.
5585         * tree-ssa-forwprop.c (simplify_vector_constructor): Likewise.
5586         * tree-vect-data-refs.c (vect_grouped_store_supported): Likewise.
5587         (vect_grouped_load_supported): Likewise.
5588         (vect_shift_permute_load_chain): Likewise.
5589         * tree-vect-slp.c (vect_build_slp_tree_1): Likewise.
5590         (vect_transform_slp_perm_load): Likewise.
5591         * tree-vect-stmts.c (perm_mask_for_reverse): Likewise.
5592         (vectorizable_bswap): Likewise.
5593         (vect_gen_perm_mask_checked): Likewise.
5594         * fold-const.c (fold_ternary_loc): Likewise.  Don't take
5595         implementations of variable permutation vectors into account
5596         when deciding which selector to use.
5597         * tree-vect-loop.c (have_whole_vector_shift): Don't check whether
5598         vec_perm_const_optab is supported; instead use can_vec_perm_const_p
5599         with a false third argument.
5600         * tree-vect-generic.c (lower_vec_perm): Use can_vec_perm_const_p
5601         to test whether the constant selector is valid and can_vec_perm_var_p
5602         to test whether a variable selector is valid.
5603
5604 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
5605
5606         * optabs-query.h (can_vec_perm_p): Take a const vec_perm_indices *.
5607         * optabs-query.c (can_vec_perm_p): Likewise.
5608         * fold-const.c (fold_vec_perm): Take a const vec_perm_indices &
5609         instead of vec_perm_indices.
5610         * tree-vectorizer.h (vect_gen_perm_mask_any): Likewise,
5611         (vect_gen_perm_mask_checked): Likewise,
5612         * tree-vect-stmts.c (vect_gen_perm_mask_any): Likewise,
5613         (vect_gen_perm_mask_checked): Likewise,
5614
5615 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
5616
5617         * optabs-query.h (qimode_for_vec_perm): Declare.
5618         * optabs-query.c (can_vec_perm_p): Split out qimode search to...
5619         (qimode_for_vec_perm): ...this new function.
5620         * optabs.c (expand_vec_perm): Use qimode_for_vec_perm.
5621
5622 2018-01-02  Aaron Sawdey  <acsawdey@linux.vnet.ibm.com>
5623
5624         * rtlanal.c (canonicalize_condition): Return 0 if final rtx
5625         does not have a conditional at the top.
5626
5627 2018-01-02  Richard Biener  <rguenther@suse.de>
5628
5629         * ipa-inline.c (big_speedup_p): Fix expression.
5630
5631 2018-01-02  Jan Hubicka  <hubicka@ucw.cz>
5632
5633         PR target/81616
5634         * config/i386/x86-tune-costs.h: Increase cost of integer load costs
5635         for generic 4->6.
5636
5637 2018-01-02  Jan Hubicka  <hubicka@ucw.cz>
5638
5639         PR target/81616
5640         Generic tuning.
5641         * x86-tune-costs.h (generic_cost): Reduce cost of FDIV 20->17,
5642         cost of sqrt 20->14, DIVSS 18->13, DIVSD 32->17, SQRtSS 30->14
5643         and SQRTsD 58->18, cond_not_taken_branch_cost. 2->1. Increase
5644         cond_taken_branch_cost 3->4.
5645
5646 2018-01-01  Jakub Jelinek  <jakub@redhat.com>
5647
5648         PR tree-optimization/83581
5649         * tree-loop-distribution.c (pass_loop_distribution::execute): Return
5650         TODO_cleanup_cfg if any changes have been made.
5651
5652         PR middle-end/83608
5653         * expr.c (store_expr_with_bounds): Use simplify_gen_subreg instead of
5654         convert_modes if target mode has the right side, but different mode
5655         class.
5656
5657         PR middle-end/83609
5658         * expr.c (expand_assignment): Fix up a typo in simplify_gen_subreg
5659         last argument when extracting from CONCAT.  If either from_real or
5660         from_imag is NULL, use expansion through memory.  If result is not
5661         a CONCAT and simplify_gen_subreg fails, try to simplify_gen_subreg
5662         the parts directly to inner mode, if even that fails, use expansion
5663         through memory.
5664
5665         PR middle-end/83623
5666         * expmed.c (expand_shift_1): For 2-byte rotates by BITS_PER_UNIT,
5667         check for bswap in mode rather than HImode and use that in expand_unop
5668         too.
5669 \f
5670 Copyright (C) 2018 Free Software Foundation, Inc.
5671
5672 Copying and distribution of this file, with or without modification,
5673 are permitted in any medium without royalty provided the copyright
5674 notice and this notice are preserved.