pa.h (MALLOC_ABI_ALIGNMENT): Set 32-bit alignment default to 64 bits.
[official-gcc.git] / gcc / ChangeLog
blobc90859fc450ee721f89ce8290b6591f98fabb342
1 2018-01-16  John David Anglin  <danglin@gcc.gnu.org>
3         * config/pa.h (MALLOC_ABI_ALIGNMENT): Set 32-bit alignment default to
4         64 bits.
5         * config/pa/pa32-linux.h (MALLOC_ABI_ALIGNMENT): Set alignment to
6         128 bits.
8         * config/pa/som.h (ASM_DECLARE_FUNCTION_NAME): Cleanup type and mode
9         variables.
11         * config/pa/pa.c (pa_function_arg_size): Apply CEIL to GET_MODE_SIZE
12         return value.
14 2018-01-16  Eric Botcazou  <ebotcazou@adacore.com>
16         * gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref): For an
17         ADDR_EXPR, do not count the offset of a COMPONENT_REF twice.
19 2018-01-16  Kelvin Nilsen  <kelvin@gcc.gnu.org>
21         * config/rs6000/rs6000-p8swap.c (rs6000_gen_stvx): Generate
22         different rtl trees depending on TARGET_64BIT.
23         (rs6000_gen_lvx): Likewise.
25 2018-01-16  Eric Botcazou  <ebotcazou@adacore.com>
27         * config/visium/visium.md (nop): Tweak comment.
28         (hazard_nop): Likewise.
30 2018-01-16  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
32         * config/rs6000/rs6000.c (rs6000_opt_vars): Add entry for
33         -mspeculate-indirect-jumps.
34         * config/rs6000/rs6000.md (*call_indirect_elfv2<mode>): Disable
35         for -mno-speculate-indirect-jumps.
36         (*call_indirect_elfv2<mode>_nospec): New define_insn.
37         (*call_value_indirect_elfv2<mode>): Disable for
38         -mno-speculate-indirect-jumps.
39         (*call_value_indirect_elfv2<mode>_nospec): New define_insn.
40         (indirect_jump): Emit different RTL for
41         -mno-speculate-indirect-jumps.
42         (*indirect_jump<mode>): Disable for
43         -mno-speculate-indirect-jumps.
44         (*indirect_jump<mode>_nospec): New define_insn.
45         (tablejump): Emit different RTL for
46         -mno-speculate-indirect-jumps.
47         (tablejumpsi): Disable for -mno-speculate-indirect-jumps.
48         (tablejumpsi_nospec): New define_expand.
49         (tablejumpdi): Disable for -mno-speculate-indirect-jumps.
50         (tablejumpdi_nospec): New define_expand.
51         (*tablejump<mode>_internal1): Disable for
52         -mno-speculate-indirect-jumps.
53         (*tablejump<mode>_internal1_nospec): New define_insn.
54         * config/rs6000/rs6000.opt (mspeculate-indirect-jumps): New
55         option.
57 2018-01-16  Artyom Skrobov tyomitch@gmail.com
59         * caller-save.c (insert_save): Drop unnecessary parameter.  All
60         callers updated.
62 2018-01-16  Jakub Jelinek  <jakub@redhat.com>
63             Richard Biener  <rguenth@suse.de>
65         PR libgomp/83590
66         * gimplify.c (gimplify_one_sizepos): For is_gimple_constant (expr)
67         return early, inline manually is_gimple_sizepos.  Make sure if we
68         call gimplify_expr we don't end up with a gimple constant.
69         * tree.c (variably_modified_type_p): Don't return true for
70         is_gimple_constant (_t).  Inline manually is_gimple_sizepos.
71         * gimplify.h (is_gimple_sizepos): Remove.
73 2018-01-16  Richard Sandiford  <richard.sandiford@linaro.org>
75         PR tree-optimization/83857
76         * tree-vect-loop.c (vect_analyze_loop_operations): Don't call
77         vectorizable_live_operation for pure SLP statements.
78         (vectorizable_live_operation): Handle PHIs.
80 2018-01-16  Richard Biener  <rguenther@suse.de>
82         PR tree-optimization/83867
83         * tree-vect-stmts.c (vect_transform_stmt): Precompute
84         nested_in_vect_loop_p since the scalar stmt may get invalidated.
86 2018-01-16  Jakub Jelinek  <jakub@redhat.com>
88         PR c/83844
89         * stor-layout.c (handle_warn_if_not_align): Use byte_position and
90         multiple_of_p instead of unchecked tree_to_uhwi and UHWI check.
91         If off is not INTEGER_CST, issue a may not be aligned warning
92         rather than isn't aligned.  Use isn%'t rather than isn't.
93         * fold-const.c (multiple_of_p) <case BIT_AND_EXPR>: Don't fall through
94         into MULT_EXPR.
95         <case MULT_EXPR>: Improve the case when bottom and one of the
96         MULT_EXPR operands are INTEGER_CSTs and bottom is multiple of that
97         operand, in that case check if the other operand is multiple of
98         bottom divided by the INTEGER_CST operand.
100 2018-01-16  Richard Sandiford  <richard.sandiford@linaro.org>
102         PR target/83858
103         * config/pa/pa.h (FUNCTION_ARG_SIZE): Delete.
104         * config/pa/pa-protos.h (pa_function_arg_size): Declare.
105         * config/pa/som.h (ASM_DECLARE_FUNCTION_NAME): Use
106         pa_function_arg_size instead of FUNCTION_ARG_SIZE.
107         * config/pa/pa.c (pa_function_arg_advance): Likewise.
108         (pa_function_arg, pa_arg_partial_bytes): Likewise.
109         (pa_function_arg_size): New function.
111 2018-01-16  Richard Sandiford  <richard.sandiford@linaro.org>
113         * fold-const.c (fold_ternary_loc): Construct the vec_perm_indices
114         in a separate statement.
116 2018-01-16  Richard Sandiford  <richard.sandiford@linaro.org>
118         PR tree-optimization/83847
119         * tree-vect-data-refs.c (vect_analyze_data_ref_accesses): Don't
120         group gathers and scatters.
122 2018-01-16  Jakub Jelinek  <jakub@redhat.com>
124         PR rtl-optimization/86620
125         * params.def (max-sched-ready-insns): Bump minimum value to 1.
127         PR rtl-optimization/83213
128         * recog.c (peep2_attempt): Copy over CROSSING_JUMP_P from peepinsn
129         to last if both are JUMP_INSNs.
131         PR tree-optimization/83843
132         * gimple-ssa-store-merging.c
133         (imm_store_chain_info::output_merged_store): Handle bit_not_p on
134         store_immediate_info for bswap/nop orig_stores.
136 2018-01-15  Andrew Waterman  <andrew@sifive.com>
138         * config/riscv/riscv.c (riscv_rtx_costs) <MULT>: Increase cost if
139         !TARGET_MUL.
140         <UDIV>: Increase cost if !TARGET_DIV.
142 2018-01-15  Segher Boessenkool  <segher@kernel.crashing.org>
144         * config/rs6000/rs6000.md (define_attr "type"): Remove delayed_cr.
145         (define_attr "cr_logical_3op"): New.
146         (cceq_ior_compare): Adjust.
147         (cceq_ior_compare_complement): Adjust.
148         (*cceq_rev_compare): Adjust.
149         * config/rs6000/rs6000.c (rs6000_adjust_cost): Adjust.
150         (is_cracked_insn): Adjust.
151         (insn_must_be_first_in_group): Adjust.
152         * config/rs6000/40x.md: Adjust.
153         * config/rs6000/440.md: Adjust.
154         * config/rs6000/476.md: Adjust.
155         * config/rs6000/601.md: Adjust.
156         * config/rs6000/603.md: Adjust.
157         * config/rs6000/6xx.md: Adjust.
158         * config/rs6000/7450.md: Adjust.
159         * config/rs6000/7xx.md: Adjust.
160         * config/rs6000/8540.md: Adjust.
161         * config/rs6000/cell.md: Adjust.
162         * config/rs6000/e300c2c3.md: Adjust.
163         * config/rs6000/e500mc.md: Adjust.
164         * config/rs6000/e500mc64.md: Adjust.
165         * config/rs6000/e5500.md: Adjust.
166         * config/rs6000/e6500.md: Adjust.
167         * config/rs6000/mpc.md: Adjust.
168         * config/rs6000/power4.md: Adjust.
169         * config/rs6000/power5.md: Adjust.
170         * config/rs6000/power6.md: Adjust.
171         * config/rs6000/power7.md: Adjust.
172         * config/rs6000/power8.md: Adjust.
173         * config/rs6000/power9.md: Adjust.
174         * config/rs6000/rs64.md: Adjust.
175         * config/rs6000/titan.md: Adjust.
177 2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>
179         * config/i386/predicates.md (indirect_branch_operand): Rewrite
180         ix86_indirect_branch_register logic.
182 2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>
184         * config/i386/constraints.md (Bs): Update
185         ix86_indirect_branch_register check.  Don't check
186         ix86_indirect_branch_register with GOT_memory_operand.
187         (Bw): Likewise.
188         * config/i386/predicates.md (GOT_memory_operand): Don't check
189         ix86_indirect_branch_register here.
190         (GOT32_symbol_operand): Likewise.
192 2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>
194         * config/i386/predicates.md (constant_call_address_operand):
195         Rewrite ix86_indirect_branch_register logic.
196         (sibcall_insn_operand): Likewise.
198 2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>
200         * config/i386/constraints.md (Bs): Replace
201         ix86_indirect_branch_thunk_register with
202         ix86_indirect_branch_register.
203         (Bw): Likewise.
204         * config/i386/i386.md (indirect_jump): Likewise.
205         (tablejump): Likewise.
206         (*sibcall_memory): Likewise.
207         (*sibcall_value_memory): Likewise.
208         Peepholes of indirect call and jump via memory: Likewise.
209         * config/i386/i386.opt: Likewise.
210         * config/i386/predicates.md (indirect_branch_operand): Likewise.
211         (GOT_memory_operand): Likewise.
212         (call_insn_operand): Likewise.
213         (sibcall_insn_operand): Likewise.
214         (GOT32_symbol_operand): Likewise.
216 2018-01-15  Jakub Jelinek  <jakub@redhat.com>
218         PR middle-end/83837
219         * omp-expand.c (expand_omp_atomic_pipeline): Use loaded_val
220         type rather than type addr's type points to.
221         (expand_omp_atomic_mutex): Likewise.
222         (expand_omp_atomic): Likewise.
224 2018-01-15  H.J. Lu  <hongjiu.lu@intel.com>
226         PR target/83839
227         * config/i386/i386.c (output_indirect_thunk_function): Use
228         ASM_OUTPUT_LABEL, instead of ASM_OUTPUT_DEF, for TARGET_MACHO
229         for  __x86_return_thunk.
231 2018-01-15  Richard Biener  <rguenther@suse.de>
233         PR middle-end/83850
234         * expmed.c (extract_bit_field_1): Fix typo.
236 2018-01-15  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
238         PR target/83687
239         * config/arm/iterators.md (VF): New mode iterator.
240         * config/arm/neon.md (neon_vabd<mode>_2): Use the above.
241         Remove integer-related logic from pattern.
242         (neon_vabd<mode>_3): Likewise.
244 2018-01-15  Jakub Jelinek  <jakub@redhat.com>
246         PR middle-end/82694
247         * common.opt (fstrict-overflow): No longer an alias.
248         (fwrapv-pointer): New option.
249         * tree.h (TYPE_OVERFLOW_WRAPS, TYPE_OVERFLOW_UNDEFINED): Define
250         also for pointer types based on flag_wrapv_pointer.
251         * opts.c (common_handle_option) <case OPT_fstrict_overflow>: Set
252         opts->x_flag_wrap[pv] to !value, clear opts->x_flag_trapv if
253         opts->x_flag_wrapv got set.
254         * fold-const.c (fold_comparison, fold_binary_loc): Revert 2017-08-01
255         changes, just use TYPE_OVERFLOW_UNDEFINED on pointer type instead of
256         POINTER_TYPE_OVERFLOW_UNDEFINED.
257         * match.pd: Likewise in address comparison pattern.
258         * doc/invoke.texi: Document -fwrapv and -fstrict-overflow.
260 2018-01-15  Richard Biener  <rguenther@suse.de>
262         PR lto/83804
263         * tree.c (free_lang_data_in_type): Always unlink TYPE_DECLs
264         from TYPE_FIELDS.  Free TYPE_BINFO if not used by devirtualization.
265         Reset type names to their identifier if their TYPE_DECL doesn't
266         have linkage (and thus is used for ODR and devirt).
267         (save_debug_info_for_decl): Remove.
268         (save_debug_info_for_type): Likewise.
269         (add_tree_to_fld_list): Adjust.
270         * tree-pretty-print.c (dump_generic_node): Make dumping of
271         type names more robust.
273 2018-01-15  Richard Biener  <rguenther@suse.de>
275         * BASE-VER: Bump to 8.0.1.
277 2018-01-14  Martin Sebor  <msebor@redhat.com>
279         PR other/83508
280         * builtins.c (check_access): Avoid warning when the no-warning bit
281         is set.
283 2018-01-14  Cory Fields  <cory-nospam-@coryfields.com>
285         * tree-ssa-loop-im.c (sort_bbs_in_loop_postorder_cmp): Stabilize sort.
286         * ira-color (allocno_hard_regs_compare): Likewise.
288 2018-01-14  Nathan Rossi  <nathan@nathanrossi.com>
290         PR target/83013
291         * config/microblaze/microblaze.c (microblaze_asm_output_ident):
292         Use .pushsection/.popsection.
294 2018-01-14  Martin Sebor  <msebor@redhat.com>
296         PR c++/81327
297         * doc/invoke.texi (-Wlass-memaccess): Document suppression by casting.
299 2018-01-14  Jakub Jelinek  <jakub@redhat.com>
301         * config.gcc (i[34567]86-*-*): Remove one duplicate gfniintrin.h
302         entry from extra_headers.
303         (x86_64-*-*): Remove two duplicate gfniintrin.h entries from
304         extra_headers, make the list bitwise identical to the i?86-*-* one.
306 2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>
308         * config/i386/i386.c (ix86_set_indirect_branch_type): Disallow
309         -mcmodel=large with -mindirect-branch=thunk,
310         -mindirect-branch=thunk-extern, -mfunction-return=thunk and
311         -mfunction-return=thunk-extern.
312         * doc/invoke.texi: Document -mcmodel=large is incompatible with
313         -mindirect-branch=thunk, -mindirect-branch=thunk-extern,
314         -mfunction-return=thunk and -mfunction-return=thunk-extern.
316 2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>
318         * config/i386/i386.c (print_reg): Print the name of the full
319         integer register without '%'.
320         (ix86_print_operand): Handle 'V'.
321          * doc/extend.texi: Document 'V' modifier.
323 2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>
325         * config/i386/constraints.md (Bs): Disallow memory operand for
326         -mindirect-branch-register.
327         (Bw): Likewise.
328         * config/i386/predicates.md (indirect_branch_operand): Likewise.
329         (GOT_memory_operand): Likewise.
330         (call_insn_operand): Likewise.
331         (sibcall_insn_operand): Likewise.
332         (GOT32_symbol_operand): Likewise.
333         * config/i386/i386.md (indirect_jump): Call convert_memory_address
334         for -mindirect-branch-register.
335         (tablejump): Likewise.
336         (*sibcall_memory): Likewise.
337         (*sibcall_value_memory): Likewise.
338         Disallow peepholes of indirect call and jump via memory for
339         -mindirect-branch-register.
340         (*call_pop): Replace m with Bw.
341         (*call_value_pop): Likewise.
342         (*sibcall_pop_memory): Replace m with Bs.
343         * config/i386/i386.opt (mindirect-branch-register): New option.
344         * doc/invoke.texi: Document -mindirect-branch-register option.
346 2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>
348         * config/i386/i386-protos.h (ix86_output_function_return): New.
349         * config/i386/i386.c (ix86_set_indirect_branch_type): Also
350         set function_return_type.
351         (indirect_thunk_name): Add ret_p to indicate thunk for function
352         return.
353         (output_indirect_thunk_function): Pass false to
354         indirect_thunk_name.
355         (ix86_output_indirect_branch_via_reg): Likewise.
356         (ix86_output_indirect_branch_via_push): Likewise.
357         (output_indirect_thunk_function): Create alias for function
358         return thunk if regno < 0.
359         (ix86_output_function_return): New function.
360         (ix86_handle_fndecl_attribute): Handle function_return.
361         (ix86_attribute_table): Add function_return.
362         * config/i386/i386.h (machine_function): Add
363         function_return_type.
364         * config/i386/i386.md (simple_return_internal): Use
365         ix86_output_function_return.
366         (simple_return_internal_long): Likewise.
367         * config/i386/i386.opt (mfunction-return=): New option.
368         (indirect_branch): Mention -mfunction-return=.
369         * doc/extend.texi: Document function_return function attribute.
370         * doc/invoke.texi: Document -mfunction-return= option.
372 2018-01-14  H.J. Lu  <hongjiu.lu@intel.com>
374         * config/i386/i386-opts.h (indirect_branch): New.
375         * config/i386/i386-protos.h (ix86_output_indirect_jmp): Likewise.
376         * config/i386/i386.c (ix86_using_red_zone): Disallow red-zone
377         with local indirect jump when converting indirect call and jump.
378         (ix86_set_indirect_branch_type): New.
379         (ix86_set_current_function): Call ix86_set_indirect_branch_type.
380         (indirectlabelno): New.
381         (indirect_thunk_needed): Likewise.
382         (indirect_thunk_bnd_needed): Likewise.
383         (indirect_thunks_used): Likewise.
384         (indirect_thunks_bnd_used): Likewise.
385         (INDIRECT_LABEL): Likewise.
386         (indirect_thunk_name): Likewise.
387         (output_indirect_thunk): Likewise.
388         (output_indirect_thunk_function): Likewise.
389         (ix86_output_indirect_branch_via_reg): Likewise.
390         (ix86_output_indirect_branch_via_push): Likewise.
391         (ix86_output_indirect_branch): Likewise.
392         (ix86_output_indirect_jmp): Likewise.
393         (ix86_code_end): Call output_indirect_thunk_function if needed.
394         (ix86_output_call_insn): Call ix86_output_indirect_branch if
395         needed.
396         (ix86_handle_fndecl_attribute): Handle indirect_branch.
397         (ix86_attribute_table): Add indirect_branch.
398         * config/i386/i386.h (machine_function): Add indirect_branch_type
399         and has_local_indirect_jump.
400         * config/i386/i386.md (indirect_jump): Set has_local_indirect_jump
401         to true.
402         (tablejump): Likewise.
403         (*indirect_jump): Use ix86_output_indirect_jmp.
404         (*tablejump_1): Likewise.
405         (simple_return_indirect_internal): Likewise.
406         * config/i386/i386.opt (mindirect-branch=): New option.
407         (indirect_branch): New.
408         (keep): Likewise.
409         (thunk): Likewise.
410         (thunk-inline): Likewise.
411         (thunk-extern): Likewise.
412         * doc/extend.texi: Document indirect_branch function attribute.
413         * doc/invoke.texi: Document -mindirect-branch= option.
415 2018-01-14  Jan Hubicka  <hubicka@ucw.cz>
417         PR ipa/83051
418         * ipa-inline.c (edge_badness): Tolerate roundoff errors.
420 2018-01-14  Richard Sandiford  <richard.sandiford@linaro.org>
422         * ipa-inline.c (want_inline_small_function_p): Return false if
423         inlining has already failed with CIF_FINAL_ERROR.
424         (update_caller_keys): Call want_inline_small_function_p before
425         can_inline_edge_p.
426         (update_callee_keys): Likewise.
428 2018-01-10  Kelvin Nilsen  <kelvin@gcc.gnu.org>
430         * config/rs6000/rs6000-p8swap.c (rs6000_sum_of_two_registers_p):
431         New function.
432         (rs6000_quadword_masked_address_p): Likewise.
433         (quad_aligned_load_p): Likewise.
434         (quad_aligned_store_p): Likewise.
435         (const_load_sequence_p): Add comment to describe the outer-most loop.
436         (mimic_memory_attributes_and_flags): New function.
437         (rs6000_gen_stvx): Likewise.
438         (replace_swapped_aligned_store): Likewise.
439         (rs6000_gen_lvx): Likewise.
440         (replace_swapped_aligned_load): Likewise.
441         (replace_swapped_load_constant): Capitalize argument name in
442         comment describing this function.
443         (rs6000_analyze_swaps): Add a third pass to search for vector loads
444         and stores that access quad-word aligned addresses and replace
445         with stvx or lvx instructions when appropriate.
446         * config/rs6000/rs6000-protos.h (rs6000_sum_of_two_registers_p):
447         New function prototype.
448         (rs6000_quadword_masked_address_p): Likewise.
449         (rs6000_gen_lvx): Likewise.
450         (rs6000_gen_stvx): Likewise.
451         * config/rs6000/vsx.md (*vsx_le_perm_load_<mode>): For modes
452         VSX_D (V2DF, V2DI), modify this split to select lvx instruction
453         when memory address is aligned.
454         (*vsx_le_perm_load_<mode>): For modes VSX_W (V4SF, V4SI), modify
455         this split to select lvx instruction when memory address is aligned.
456         (*vsx_le_perm_load_v8hi): Modify this split to select lvx
457         instruction when memory address is aligned.
458         (*vsx_le_perm_load_v16qi): Likewise.
459         (four unnamed splitters): Modify to select the stvx instruction
460         when memory is aligned.
462 2018-01-13  Jan Hubicka  <hubicka@ucw.cz>
464         * predict.c (determine_unlikely_bbs): Handle correctly BBs
465         which appears in the queue multiple times.
467 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
468             Alan Hayward  <alan.hayward@arm.com>
469             David Sherwood  <david.sherwood@arm.com>
471         * tree-vectorizer.h (vec_lower_bound): New structure.
472         (_loop_vec_info): Add check_nonzero and lower_bounds.
473         (LOOP_VINFO_CHECK_NONZERO): New macro.
474         (LOOP_VINFO_LOWER_BOUNDS): Likewise.
475         (LOOP_REQUIRES_VERSIONING_FOR_ALIAS): Check lower_bounds too.
476         * tree-data-ref.h (dr_with_seg_len): Add access_size and align
477         fields.  Make seg_len the distance travelled, not including the
478         access size.
479         (dr_direction_indicator): Declare.
480         (dr_zero_step_indicator): Likewise.
481         (dr_known_forward_stride_p): Likewise.
482         * tree-data-ref.c: Include stringpool.h, tree-vrp.h and
483         tree-ssanames.h.
484         (runtime_alias_check_p): Allow runtime alias checks with
485         variable strides.
486         (operator ==): Compare access_size and align.
487         (prune_runtime_alias_test_list): Rework for new distinction between
488         the access_size and seg_len.
489         (create_intersect_range_checks_index): Likewise.  Cope with polynomial
490         segment lengths.
491         (get_segment_min_max): New function.
492         (create_intersect_range_checks): Use it.
493         (dr_step_indicator): New function.
494         (dr_direction_indicator): Likewise.
495         (dr_zero_step_indicator): Likewise.
496         (dr_known_forward_stride_p): Likewise.
497         * tree-loop-distribution.c (data_ref_segment_size): Return
498         DR_STEP * (niters - 1).
499         (compute_alias_check_pairs): Update call to the dr_with_seg_len
500         constructor.
501         * tree-vect-data-refs.c (vect_check_nonzero_value): New function.
502         (vect_preserves_scalar_order_p): New function, split out from...
503         (vect_analyze_data_ref_dependence): ...here.  Check for zero steps.
504         (vect_vfa_segment_size): Return DR_STEP * (length_factor - 1).
505         (vect_vfa_access_size): New function.
506         (vect_vfa_align): Likewise.
507         (vect_compile_time_alias): Take access_size_a and access_b arguments.
508         (dump_lower_bound): New function.
509         (vect_check_lower_bound): Likewise.
510         (vect_small_gap_p): Likewise.
511         (vectorizable_with_step_bound_p): Likewise.
512         (vect_prune_runtime_alias_test_list): Ignore cross-iteration
513         depencies if the vectorization factor is 1.  Convert the checks
514         for nonzero steps into checks on the bounds of DR_STEP.  Try using
515         a bunds check for variable steps if the minimum required step is
516         relatively small. Update calls to the dr_with_seg_len
517         constructor and to vect_compile_time_alias.
518         * tree-vect-loop-manip.c (vect_create_cond_for_lower_bounds): New
519         function.
520         (vect_loop_versioning): Call it.
521         * tree-vect-loop.c (vect_analyze_loop_2): Clear LOOP_VINFO_LOWER_BOUNDS
522         when retrying.
523         (vect_estimate_min_profitable_iters): Account for any bounds checks.
525 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
526             Alan Hayward  <alan.hayward@arm.com>
527             David Sherwood  <david.sherwood@arm.com>
529         * doc/sourcebuild.texi (vect_scatter_store): Document.
530         * optabs.def (scatter_store_optab, mask_scatter_store_optab): New
531         optabs.
532         * doc/md.texi (scatter_store@var{m}, mask_scatter_store@var{m}):
533         Document.
534         * genopinit.c (main): Add supports_vec_scatter_store and
535         supports_vec_scatter_store_cached to target_optabs.
536         * gimple.h (gimple_expr_type): Handle IFN_SCATTER_STORE and
537         IFN_MASK_SCATTER_STORE.
538         * internal-fn.def (SCATTER_STORE, MASK_SCATTER_STORE): New internal
539         functions.
540         * internal-fn.h (internal_store_fn_p): Declare.
541         (internal_fn_stored_value_index): Likewise.
542         * internal-fn.c (scatter_store_direct): New macro.
543         (expand_scatter_store_optab_fn): New function.
544         (direct_scatter_store_optab_supported_p): New macro.
545         (internal_store_fn_p): New function.
546         (internal_gather_scatter_fn_p): Handle IFN_SCATTER_STORE and
547         IFN_MASK_SCATTER_STORE.
548         (internal_fn_mask_index): Likewise.
549         (internal_fn_stored_value_index): New function.
550         (internal_gather_scatter_fn_supported_p): Adjust operand numbers
551         for scatter stores.
552         * optabs-query.h (supports_vec_scatter_store_p): Declare.
553         * optabs-query.c (supports_vec_scatter_store_p): New function.
554         * tree-vectorizer.h (vect_get_store_rhs): Declare.
555         * tree-vect-data-refs.c (vect_analyze_data_ref_access): Return
556         true for scatter stores.
557         (vect_gather_scatter_fn_p): Handle scatter stores too.
558         (vect_check_gather_scatter): Consider using scatter stores if
559         supports_vec_scatter_store_p.
560         * tree-vect-patterns.c (vect_try_gather_scatter_pattern): Handle
561         scatter stores too.
562         * tree-vect-stmts.c (exist_non_indexing_operands_for_use_p): Use
563         internal_fn_stored_value_index.
564         (check_load_store_masking): Handle scatter stores too.
565         (vect_get_store_rhs): Make public.
566         (vectorizable_call): Use internal_store_fn_p.
567         (vectorizable_store): Handle scatter store internal functions.
568         (vect_transform_stmt): Compare GROUP_STORE_COUNT with GROUP_SIZE
569         when deciding whether the end of the group has been reached.
570         * config/aarch64/aarch64.md (UNSPEC_ST1_SCATTER): New unspec.
571         * config/aarch64/aarch64-sve.md (scatter_store<mode>): New expander.
572         (mask_scatter_store<mode>): New insns.
574 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
575             Alan Hayward  <alan.hayward@arm.com>
576             David Sherwood  <david.sherwood@arm.com>
578         * tree-vectorizer.h (vect_gather_scatter_fn_p): Declare.
579         * tree-vect-data-refs.c (vect_gather_scatter_fn_p): Make public.
580         * tree-vect-stmts.c (vect_truncate_gather_scatter_offset): New
581         function.
582         (vect_use_strided_gather_scatters_p): Take a masked_p argument.
583         Use vect_truncate_gather_scatter_offset if we can't treat the
584         operation as a normal gather load or scatter store.
585         (get_group_load_store_type): Take the gather_scatter_info
586         as argument.  Try using a gather load or scatter store for
587         single-element groups.
588         (get_load_store_type): Update calls to get_group_load_store_type
589         and vect_use_strided_gather_scatters_p.
591 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
592             Alan Hayward  <alan.hayward@arm.com>
593             David Sherwood  <david.sherwood@arm.com>
595         * tree-vectorizer.h (vect_create_data_ref_ptr): Take an extra
596         optional tree argument.
597         * tree-vect-data-refs.c (vect_check_gather_scatter): Check for
598         null target hooks.
599         (vect_create_data_ref_ptr): Take the iv_step as an optional argument,
600         but continue to use the current value as a fallback.
601         (bump_vector_ptr): Use operand_equal_p rather than tree_int_cst_compare
602         to compare the updates.
603         * tree-vect-stmts.c (vect_use_strided_gather_scatters_p): New function.
604         (get_load_store_type): Use it when handling a strided access.
605         (vect_get_strided_load_store_ops): New function.
606         (vect_get_data_ptr_increment): Likewise.
607         (vectorizable_load): Handle strided gather loads.  Always pass
608         a step to vect_create_data_ref_ptr and bump_vector_ptr.
610 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
611             Alan Hayward  <alan.hayward@arm.com>
612             David Sherwood  <david.sherwood@arm.com>
614         * doc/md.texi (gather_load@var{m}): Document.
615         (mask_gather_load@var{m}): Likewise.
616         * genopinit.c (main): Add supports_vec_gather_load and
617         supports_vec_gather_load_cached to target_optabs.
618         * optabs-tree.c (init_tree_optimization_optabs): Use
619         ggc_cleared_alloc to allocate target_optabs.
620         * optabs.def (gather_load_optab, mask_gather_laod_optab): New optabs.
621         * internal-fn.def (GATHER_LOAD, MASK_GATHER_LOAD): New internal
622         functions.
623         * internal-fn.h (internal_load_fn_p): Declare.
624         (internal_gather_scatter_fn_p): Likewise.
625         (internal_fn_mask_index): Likewise.
626         (internal_gather_scatter_fn_supported_p): Likewise.
627         * internal-fn.c (gather_load_direct): New macro.
628         (expand_gather_load_optab_fn): New function.
629         (direct_gather_load_optab_supported_p): New macro.
630         (direct_internal_fn_optab): New function.
631         (internal_load_fn_p): Likewise.
632         (internal_gather_scatter_fn_p): Likewise.
633         (internal_fn_mask_index): Likewise.
634         (internal_gather_scatter_fn_supported_p): Likewise.
635         * optabs-query.c (supports_at_least_one_mode_p): New function.
636         (supports_vec_gather_load_p): Likewise.
637         * optabs-query.h (supports_vec_gather_load_p): Declare.
638         * tree-vectorizer.h (gather_scatter_info): Add ifn, element_type
639         and memory_type field.
640         (NUM_PATTERNS): Bump to 15.
641         * tree-vect-data-refs.c: Include internal-fn.h.
642         (vect_gather_scatter_fn_p): New function.
643         (vect_describe_gather_scatter_call): Likewise.
644         (vect_check_gather_scatter): Try using internal functions for
645         gather loads.  Recognize existing calls to a gather load function.
646         (vect_analyze_data_refs): Consider using gather loads if
647         supports_vec_gather_load_p.
648         * tree-vect-patterns.c (vect_get_load_store_mask): New function.
649         (vect_get_gather_scatter_offset_type): Likewise.
650         (vect_convert_mask_for_vectype): Likewise.
651         (vect_add_conversion_to_patterm): Likewise.
652         (vect_try_gather_scatter_pattern): Likewise.
653         (vect_recog_gather_scatter_pattern): New pattern recognizer.
654         (vect_vect_recog_func_ptrs): Add it.
655         * tree-vect-stmts.c (exist_non_indexing_operands_for_use_p): Use
656         internal_fn_mask_index and internal_gather_scatter_fn_p.
657         (check_load_store_masking): Take the gather_scatter_info as an
658         argument and handle gather loads.
659         (vect_get_gather_scatter_ops): New function.
660         (vectorizable_call): Check internal_load_fn_p.
661         (vectorizable_load): Likewise.  Handle gather load internal
662         functions.
663         (vectorizable_store): Update call to check_load_store_masking.
664         * config/aarch64/aarch64.md (UNSPEC_LD1_GATHER): New unspec.
665         * config/aarch64/iterators.md (SVE_S, SVE_D): New mode iterators.
666         * config/aarch64/predicates.md (aarch64_gather_scale_operand_w)
667         (aarch64_gather_scale_operand_d): New predicates.
668         * config/aarch64/aarch64-sve.md (gather_load<mode>): New expander.
669         (mask_gather_load<mode>): New insns.
671 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
672             Alan Hayward  <alan.hayward@arm.com>
673             David Sherwood  <david.sherwood@arm.com>
675         * optabs.def (fold_left_plus_optab): New optab.
676         * doc/md.texi (fold_left_plus_@var{m}): Document.
677         * internal-fn.def (IFN_FOLD_LEFT_PLUS): New internal function.
678         * internal-fn.c (fold_left_direct): Define.
679         (expand_fold_left_optab_fn): Likewise.
680         (direct_fold_left_optab_supported_p): Likewise.
681         * fold-const-call.c (fold_const_fold_left): New function.
682         (fold_const_call): Use it to fold CFN_FOLD_LEFT_PLUS.
683         * tree-parloops.c (valid_reduction_p): New function.
684         (gather_scalar_reductions): Use it.
685         * tree-vectorizer.h (FOLD_LEFT_REDUCTION): New vect_reduction_type.
686         (vect_finish_replace_stmt): Declare.
687         * tree-vect-loop.c (fold_left_reduction_fn): New function.
688         (needs_fold_left_reduction_p): New function, split out from...
689         (vect_is_simple_reduction): ...here.  Accept reductions that
690         forbid reassociation, but give them type FOLD_LEFT_REDUCTION.
691         (vect_force_simple_reduction): Also store the reduction type in
692         the assignment's STMT_VINFO_REDUC_TYPE.
693         (vect_model_reduction_cost): Handle FOLD_LEFT_REDUCTION.
694         (merge_with_identity): New function.
695         (vect_expand_fold_left): Likewise.
696         (vectorize_fold_left_reduction): Likewise.
697         (vectorizable_reduction): Handle FOLD_LEFT_REDUCTION.  Leave the
698         scalar phi in place for it.  Check for target support and reject
699         cases that would reassociate the operation.  Defer the transform
700         phase to vectorize_fold_left_reduction.
701         * config/aarch64/aarch64.md (UNSPEC_FADDA): New unspec.
702         * config/aarch64/aarch64-sve.md (fold_left_plus_<mode>): New expander.
703         (*fold_left_plus_<mode>, *pred_fold_left_plus_<mode>): New insns.
705 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
707         * tree-if-conv.c (predicate_mem_writes): Remove redundant
708         call to ifc_temp_var.
710 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
711             Alan Hayward  <alan.hayward@arm.com>
712             David Sherwood  <david.sherwood@arm.com>
714         * target.def (legitimize_address_displacement): Take the original
715         offset as a poly_int.
716         * targhooks.h (default_legitimize_address_displacement): Update
717         accordingly.
718         * targhooks.c (default_legitimize_address_displacement): Likewise.
719         * doc/tm.texi: Regenerate.
720         * lra-constraints.c (base_plus_disp_to_reg): Take the displacement
721         as an argument, moving assert of ad->disp == ad->disp_term to...
722         (process_address_1): ...here.  Update calls to base_plus_disp_to_reg.
723         Try calling targetm.legitimize_address_displacement before expanding
724         the address rather than afterwards, and adjust for the new interface.
725         * config/aarch64/aarch64.c (aarch64_legitimize_address_displacement):
726         Match the new hook interface.  Handle SVE addresses.
727         * config/sh/sh.c (sh_legitimize_address_displacement): Make the
728         new hook interface.
730 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
732         * Makefile.in (OBJS): Add early-remat.o.
733         * target.def (select_early_remat_modes): New hook.
734         * doc/tm.texi.in (TARGET_SELECT_EARLY_REMAT_MODES): New hook.
735         * doc/tm.texi: Regenerate.
736         * targhooks.h (default_select_early_remat_modes): Declare.
737         * targhooks.c (default_select_early_remat_modes): New function.
738         * timevar.def (TV_EARLY_REMAT): New timevar.
739         * passes.def (pass_early_remat): New pass.
740         * tree-pass.h (make_pass_early_remat): Declare.
741         * early-remat.c: New file.
742         * config/aarch64/aarch64.c (aarch64_select_early_remat_modes): New
743         function.
744         (TARGET_SELECT_EARLY_REMAT_MODES): Define.
746 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
747             Alan Hayward  <alan.hayward@arm.com>
748             David Sherwood  <david.sherwood@arm.com>
750         * tree-vect-loop-manip.c (vect_gen_scalar_loop_niters): Replace
751         vfm1 with a bound_epilog parameter.
752         (vect_do_peeling): Update calls accordingly, and move the prologue
753         call earlier in the function.  Treat the base bound_epilog as 0 for
754         fully-masked loops and retain vf - 1 for other loops.  Add 1 to
755         this base when peeling for gaps.
756         * tree-vect-loop.c (vect_analyze_loop_2): Allow peeling for gaps
757         with fully-masked loops.
758         (vect_estimate_min_profitable_iters): Handle the single peeled
759         iteration in that case.
761 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
762             Alan Hayward  <alan.hayward@arm.com>
763             David Sherwood  <david.sherwood@arm.com>
765         * tree-vect-data-refs.c (vect_analyze_group_access_1): Allow
766         single-element interleaving even if the size is not a power of 2.
767         * tree-vect-stmts.c (get_load_store_type): Disallow elementwise
768         accesses for single-element interleaving if the group size is
769         not a power of 2.
771 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
772             Alan Hayward  <alan.hayward@arm.com>
773             David Sherwood  <david.sherwood@arm.com>
775         * doc/md.texi (fold_extract_last_@var{m}): Document.
776         * doc/sourcebuild.texi (vect_fold_extract_last): Likewise.
777         * optabs.def (fold_extract_last_optab): New optab.
778         * internal-fn.def (FOLD_EXTRACT_LAST): New internal function.
779         * internal-fn.c (fold_extract_direct): New macro.
780         (expand_fold_extract_optab_fn): Likewise.
781         (direct_fold_extract_optab_supported_p): Likewise.
782         * tree-vectorizer.h (EXTRACT_LAST_REDUCTION): New vect_reduction_type.
783         * tree-vect-loop.c (vect_model_reduction_cost): Handle
784         EXTRACT_LAST_REDUCTION.
785         (get_initial_def_for_reduction): Do not create an initial vector
786         for EXTRACT_LAST_REDUCTION reductions.
787         (vectorizable_reduction): Leave the scalar phi in place for
788         EXTRACT_LAST_REDUCTIONs.  Try using EXTRACT_LAST_REDUCTION
789         ahead of INTEGER_INDUC_COND_REDUCTION.  Do not check for an
790         epilogue code for EXTRACT_LAST_REDUCTION and defer the
791         transform phase to vectorizable_condition.
792         * tree-vect-stmts.c (vect_finish_stmt_generation_1): New function,
793         split out from...
794         (vect_finish_stmt_generation): ...here.
795         (vect_finish_replace_stmt): New function.
796         (vectorizable_condition): Handle EXTRACT_LAST_REDUCTION.
797         * config/aarch64/aarch64-sve.md (fold_extract_last_<mode>): New
798         pattern.
799         * config/aarch64/aarch64.md (UNSPEC_CLASTB): New unspec.
801 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
802             Alan Hayward  <alan.hayward@arm.com>
803             David Sherwood  <david.sherwood@arm.com>
805         * doc/md.texi (extract_last_@var{m}): Document.
806         * optabs.def (extract_last_optab): New optab.
807         * internal-fn.def (EXTRACT_LAST): New internal function.
808         * internal-fn.c (cond_unary_direct): New macro.
809         (expand_cond_unary_optab_fn): Likewise.
810         (direct_cond_unary_optab_supported_p): Likewise.
811         * tree-vect-loop.c (vectorizable_live_operation): Allow fully-masked
812         loops using EXTRACT_LAST.
813         * config/aarch64/aarch64-sve.md (aarch64_sve_lastb<mode>): Rename to...
814         (extract_last_<mode>): ...this optab.
815         (vec_extract<mode><Vel>): Update accordingly.
817 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
818             Alan Hayward  <alan.hayward@arm.com>
819             David Sherwood  <david.sherwood@arm.com>
821         * target.def (empty_mask_is_expensive): New hook.
822         * doc/tm.texi.in (TARGET_VECTORIZE_EMPTY_MASK_IS_EXPENSIVE): New hook.
823         * doc/tm.texi: Regenerate.
824         * targhooks.h (default_empty_mask_is_expensive): Declare.
825         * targhooks.c (default_empty_mask_is_expensive): New function.
826         * tree-vectorizer.c (vectorize_loops): Only call optimize_mask_stores
827         if the target says that empty masks are expensive.
828         * config/aarch64/aarch64.c (aarch64_empty_mask_is_expensive):
829         New function.
830         (TARGET_VECTORIZE_EMPTY_MASK_IS_EXPENSIVE): Redefine.
832 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
833             Alan Hayward  <alan.hayward@arm.com>
834             David Sherwood  <david.sherwood@arm.com>
836         * tree-vectorizer.h (_loop_vec_info::mask_skip_niters): New field.
837         (LOOP_VINFO_MASK_SKIP_NITERS): New macro.
838         (vect_use_loop_mask_for_alignment_p): New function.
839         (vect_prepare_for_masked_peels, vect_gen_while_not): Declare.
840         * tree-vect-loop-manip.c (vect_set_loop_masks_directly): Add an
841         niters_skip argument.  Make sure that the first niters_skip elements
842         of the first iteration are inactive.
843         (vect_set_loop_condition_masked): Handle LOOP_VINFO_MASK_SKIP_NITERS.
844         Update call to vect_set_loop_masks_directly.
845         (get_misalign_in_elems): New function, split out from...
846         (vect_gen_prolog_loop_niters): ...here.
847         (vect_update_init_of_dr): Take a code argument that specifies whether
848         the adjustment should be added or subtracted.
849         (vect_update_init_of_drs): Likewise.
850         (vect_prepare_for_masked_peels): New function.
851         (vect_do_peeling): Skip prologue peeling if we're using a mask
852         instead.  Update call to vect_update_inits_of_drs.
853         * tree-vect-loop.c (_loop_vec_info::_loop_vec_info): Initialize
854         mask_skip_niters.
855         (vect_analyze_loop_2): Allow fully-masked loops with peeling for
856         alignment.  Do not include the number of peeled iterations in
857         the minimum threshold in that case.
858         (vectorizable_induction): Adjust the start value down by
859         LOOP_VINFO_MASK_SKIP_NITERS iterations.
860         (vect_transform_loop): Call vect_prepare_for_masked_peels.
861         Take the number of skipped iterations into account when calculating
862         the loop bounds.
863         * tree-vect-stmts.c (vect_gen_while_not): New function.
865 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
866             Alan Hayward  <alan.hayward@arm.com>
867             David Sherwood  <david.sherwood@arm.com>
869         * doc/sourcebuild.texi (vect_fully_masked): Document.
870         * params.def (PARAM_MIN_VECT_LOOP_BOUND): Change minimum and
871         default value to 0.
872         * tree-vect-loop.c (vect_analyze_loop_costing): New function,
873         split out from...
874         (vect_analyze_loop_2): ...here. Don't check the vectorization
875         factor against the number of loop iterations if the loop is
876         fully-masked.
878 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
879             Alan Hayward  <alan.hayward@arm.com>
880             David Sherwood  <david.sherwood@arm.com>
882         * tree-ssa-loop-ivopts.c (USE_ADDRESS): Split into...
883         (USE_REF_ADDRESS, USE_PTR_ADDRESS): ...these new use types.
884         (dump_groups): Update accordingly.
885         (iv_use::mem_type): New member variable.
886         (address_p): New function.
887         (record_use): Add a mem_type argument and initialize the new
888         mem_type field.
889         (record_group_use): Add a mem_type argument.  Use address_p.
890         Remove obsolete null checks of base_object.  Update call to record_use.
891         (find_interesting_uses_op): Update call to record_group_use.
892         (find_interesting_uses_cond): Likewise.
893         (find_interesting_uses_address): Likewise.
894         (get_mem_type_for_internal_fn): New function.
895         (find_address_like_use): Likewise.
896         (find_interesting_uses_stmt): Try find_address_like_use before
897         calling find_interesting_uses_op.
898         (addr_offset_valid_p): Use the iv mem_type field as the type
899         of the addressed memory.
900         (add_autoinc_candidates): Likewise.
901         (get_address_cost): Likewise.
902         (split_small_address_groups_p): Use address_p.
903         (split_address_groups): Likewise.
904         (add_iv_candidate_for_use): Likewise.
905         (autoinc_possible_for_pair): Likewise.
906         (rewrite_groups): Likewise.
907         (get_use_type): Check for USE_REF_ADDRESS instead of USE_ADDRESS.
908         (determine_group_iv_cost): Update after split of USE_ADDRESS.
909         (get_alias_ptr_type_for_ptr_address): New function.
910         (rewrite_use_address): Rewrite address uses in calls that were
911         identified by find_address_like_use.
913 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
914             Alan Hayward  <alan.hayward@arm.com>
915             David Sherwood  <david.sherwood@arm.com>
917         * expr.c (expand_expr_addr_expr_1): Handle ADDR_EXPRs of
918         TARGET_MEM_REFs.
919         * gimple-expr.h (is_gimple_addressable: Likewise.
920         * gimple-expr.c (is_gimple_address): Likewise.
921         * internal-fn.c (expand_call_mem_ref): New function.
922         (expand_mask_load_optab_fn): Use it.
923         (expand_mask_store_optab_fn): Likewise.
925 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
926             Alan Hayward  <alan.hayward@arm.com>
927             David Sherwood  <david.sherwood@arm.com>
929         * doc/md.texi (cond_add@var{mode}, cond_sub@var{mode})
930         (cond_and@var{mode}, cond_ior@var{mode}, cond_xor@var{mode})
931         (cond_smin@var{mode}, cond_smax@var{mode}, cond_umin@var{mode})
932         (cond_umax@var{mode}): Document.
933         * optabs.def (cond_add_optab, cond_sub_optab, cond_and_optab)
934         (cond_ior_optab, cond_xor_optab, cond_smin_optab, cond_smax_optab)
935         (cond_umin_optab, cond_umax_optab): New optabs.
936         * internal-fn.def (COND_ADD, COND_SUB, COND_MIN, COND_MAX, COND_AND)
937         (COND_IOR, COND_XOR): New internal functions.
938         * internal-fn.h (get_conditional_internal_fn): Declare.
939         * internal-fn.c (cond_binary_direct): New macro.
940         (expand_cond_binary_optab_fn): Likewise.
941         (direct_cond_binary_optab_supported_p): Likewise.
942         (get_conditional_internal_fn): New function.
943         * tree-vect-loop.c (vectorizable_reduction): Handle fully-masked loops.
944         Cope with reduction statements that are vectorized as calls rather
945         than assignments.
946         * config/aarch64/aarch64-sve.md (cond_<optab><mode>): New insns.
947         * config/aarch64/iterators.md (UNSPEC_COND_ADD, UNSPEC_COND_SUB)
948         (UNSPEC_COND_SMAX, UNSPEC_COND_UMAX, UNSPEC_COND_SMIN)
949         (UNSPEC_COND_UMIN, UNSPEC_COND_AND, UNSPEC_COND_ORR)
950         (UNSPEC_COND_EOR): New unspecs.
951         (optab): Add mappings for them.
952         (SVE_COND_INT_OP, SVE_COND_FP_OP): New int iterators.
953         (sve_int_op, sve_fp_op): New int attributes.
955 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
956             Alan Hayward  <alan.hayward@arm.com>
957             David Sherwood  <david.sherwood@arm.com>
959         * optabs.def (while_ult_optab): New optab.
960         * doc/md.texi (while_ult@var{m}@var{n}): Document.
961         * internal-fn.def (WHILE_ULT): New internal function.
962         * internal-fn.h (direct_internal_fn_supported_p): New override
963         that takes two types as argument.
964         * internal-fn.c (while_direct): New macro.
965         (expand_while_optab_fn): New function.
966         (convert_optab_supported_p): Likewise.
967         (direct_while_optab_supported_p): New macro.
968         * wide-int.h (wi::udiv_ceil): New function.
969         * tree-vectorizer.h (rgroup_masks): New structure.
970         (vec_loop_masks): New typedef.
971         (_loop_vec_info): Add masks, mask_compare_type, can_fully_mask_p
972         and fully_masked_p.
973         (LOOP_VINFO_CAN_FULLY_MASK_P, LOOP_VINFO_FULLY_MASKED_P)
974         (LOOP_VINFO_MASKS, LOOP_VINFO_MASK_COMPARE_TYPE): New macros.
975         (vect_max_vf): New function.
976         (slpeel_make_loop_iterate_ntimes): Delete.
977         (vect_set_loop_condition, vect_get_loop_mask_type, vect_gen_while)
978         (vect_halve_mask_nunits, vect_double_mask_nunits): Declare.
979         (vect_record_loop_mask, vect_get_loop_mask): Likewise.
980         * tree-vect-loop-manip.c: Include tree-ssa-loop-niter.h,
981         internal-fn.h, stor-layout.h and optabs-query.h.
982         (vect_set_loop_mask): New function.
983         (add_preheader_seq): Likewise.
984         (add_header_seq): Likewise.
985         (interleave_supported_p): Likewise.
986         (vect_maybe_permute_loop_masks): Likewise.
987         (vect_set_loop_masks_directly): Likewise.
988         (vect_set_loop_condition_masked): Likewise.
989         (vect_set_loop_condition_unmasked): New function, split out from
990         slpeel_make_loop_iterate_ntimes.
991         (slpeel_make_loop_iterate_ntimes): Rename to..
992         (vect_set_loop_condition): ...this.  Use vect_set_loop_condition_masked
993         for fully-masked loops and vect_set_loop_condition_unmasked otherwise.
994         (vect_do_peeling): Update call accordingly.
995         (vect_gen_vector_loop_niters): Use VF as the step for fully-masked
996         loops.
997         * tree-vect-loop.c (_loop_vec_info::_loop_vec_info): Initialize
998         mask_compare_type, can_fully_mask_p and fully_masked_p.
999         (release_vec_loop_masks): New function.
1000         (_loop_vec_info): Use it to free the loop masks.
1001         (can_produce_all_loop_masks_p): New function.
1002         (vect_get_max_nscalars_per_iter): Likewise.
1003         (vect_verify_full_masking): Likewise.
1004         (vect_analyze_loop_2): Save LOOP_VINFO_CAN_FULLY_MASK_P around
1005         retries, and free the mask rgroups before retrying.  Check loop-wide
1006         reasons for disallowing fully-masked loops.  Make the final decision
1007         about whether use a fully-masked loop or not.
1008         (vect_estimate_min_profitable_iters): Do not assume that peeling
1009         for the number of iterations will be needed for fully-masked loops.
1010         (vectorizable_reduction): Disable fully-masked loops.
1011         (vectorizable_live_operation): Likewise.
1012         (vect_halve_mask_nunits): New function.
1013         (vect_double_mask_nunits): Likewise.
1014         (vect_record_loop_mask): Likewise.
1015         (vect_get_loop_mask): Likewise.
1016         (vect_transform_loop): Handle the case in which the final loop
1017         iteration might handle a partial vector.  Call vect_set_loop_condition
1018         instead of slpeel_make_loop_iterate_ntimes.
1019         * tree-vect-stmts.c: Include tree-ssa-loop-niter.h and gimple-fold.h.
1020         (check_load_store_masking): New function.
1021         (prepare_load_store_mask): Likewise.
1022         (vectorizable_store): Handle fully-masked loops.
1023         (vectorizable_load): Likewise.
1024         (supportable_widening_operation): Use vect_halve_mask_nunits for
1025         booleans.
1026         (supportable_narrowing_operation): Likewise vect_double_mask_nunits.
1027         (vect_gen_while): New function.
1028         * config/aarch64/aarch64.md (umax<mode>3): New expander.
1029         (aarch64_uqdec<mode>): New insn.
1031 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1032             Alan Hayward  <alan.hayward@arm.com>
1033             David Sherwood  <david.sherwood@arm.com>
1035         * optabs.def (reduc_and_scal_optab, reduc_ior_scal_optab)
1036         (reduc_xor_scal_optab): New optabs.
1037         * doc/md.texi (reduc_and_scal_@var{m}, reduc_ior_scal_@var{m})
1038         (reduc_xor_scal_@var{m}): Document.
1039         * doc/sourcebuild.texi (vect_logical_reduc): Likewise.
1040         * internal-fn.def (IFN_REDUC_AND, IFN_REDUC_IOR, IFN_REDUC_XOR): New
1041         internal functions.
1042         * fold-const-call.c (fold_const_call): Handle them.
1043         * tree-vect-loop.c (reduction_fn_for_scalar_code): Return the new
1044         internal functions for BIT_AND_EXPR, BIT_IOR_EXPR and BIT_XOR_EXPR.
1045         * config/aarch64/aarch64-sve.md (reduc_<bit_reduc>_scal_<mode>):
1046         (*reduc_<bit_reduc>_scal_<mode>): New patterns.
1047         * config/aarch64/iterators.md (UNSPEC_ANDV, UNSPEC_ORV)
1048         (UNSPEC_XORV): New unspecs.
1049         (optab): Add entries for them.
1050         (BITWISEV): New int iterator.
1051         (bit_reduc_op): New int attributes.
1053 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1054             Alan Hayward  <alan.hayward@arm.com>
1055             David Sherwood  <david.sherwood@arm.com>
1057         * doc/md.texi (vec_shl_insert_@var{m}): New optab.
1058         * internal-fn.def (VEC_SHL_INSERT): New internal function.
1059         * optabs.def (vec_shl_insert_optab): New optab.
1060         * tree-vectorizer.h (can_duplicate_and_interleave_p): Declare.
1061         (duplicate_and_interleave): Likewise.
1062         * tree-vect-loop.c: Include internal-fn.h.
1063         (neutral_op_for_slp_reduction): New function, split out from
1064         get_initial_defs_for_reduction.
1065         (get_initial_def_for_reduction): Handle option 2 for variable-length
1066         vectors by loading the neutral value into a vector and then shifting
1067         the initial value into element 0.
1068         (get_initial_defs_for_reduction): Replace the code argument with
1069         the neutral value calculated by neutral_op_for_slp_reduction.
1070         Use gimple_build_vector for constant-length vectors.
1071         Use IFN_VEC_SHL_INSERT for variable-length vectors if all
1072         but the first group_size elements have a neutral value.
1073         Use duplicate_and_interleave otherwise.
1074         (vect_create_epilog_for_reduction): Take a neutral_op parameter.
1075         Update call to get_initial_defs_for_reduction.  Handle SLP
1076         reductions for variable-length vectors by creating one vector
1077         result for each scalar result, with the elements associated
1078         with other scalar results stubbed out with the neutral value.
1079         (vectorizable_reduction): Call neutral_op_for_slp_reduction.
1080         Require IFN_VEC_SHL_INSERT for double reductions on
1081         variable-length vectors, or SLP reductions that have
1082         a neutral value.  Require can_duplicate_and_interleave_p
1083         support for variable-length unchained SLP reductions if there
1084         is no neutral value, such as for MIN/MAX reductions.  Also require
1085         the number of vector elements to be a multiple of the number of
1086         SLP statements when doing variable-length unchained SLP reductions.
1087         Update call to vect_create_epilog_for_reduction.
1088         * tree-vect-slp.c (can_duplicate_and_interleave_p): Make public
1089         and remove initial values.
1090         (duplicate_and_interleave): Make public.
1091         * config/aarch64/aarch64.md (UNSPEC_INSR): New unspec.
1092         * config/aarch64/aarch64-sve.md (vec_shl_insert_<mode>): New insn.
1094 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1095             Alan Hayward  <alan.hayward@arm.com>
1096             David Sherwood  <david.sherwood@arm.com>
1098         * tree-vect-slp.c: Include gimple-fold.h and internal-fn.h
1099         (can_duplicate_and_interleave_p): New function.
1100         (vect_get_and_check_slp_defs): Take the vector of statements
1101         rather than just the current one.  Remove excess parentheses.
1102         Restriction rejectinon of vect_constant_def and vect_external_def
1103         for variable-length vectors to boolean types, or types for which
1104         can_duplicate_and_interleave_p is false.
1105         (vect_build_slp_tree_2): Update call to vect_get_and_check_slp_defs.
1106         (duplicate_and_interleave): New function.
1107         (vect_get_constant_vectors): Use gimple_build_vector for
1108         constant-length vectors and suitable variable-length constant
1109         vectors.  Use duplicate_and_interleave for other variable-length
1110         vectors.  Don't defer the update when inserting new statements.
1112 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1113             Alan Hayward  <alan.hayward@arm.com>
1114             David Sherwood  <david.sherwood@arm.com>
1116         * tree-vect-loop.c (vect_estimate_min_profitable_iters): Make sure
1117         min_profitable_iters doesn't go negative.
1119 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1120             Alan Hayward  <alan.hayward@arm.com>
1121             David Sherwood  <david.sherwood@arm.com>
1123         * doc/md.texi (vec_mask_load_lanes@var{m}@var{n}): Document.
1124         (vec_mask_store_lanes@var{m}@var{n}): Likewise.
1125         * optabs.def (vec_mask_load_lanes_optab): New optab.
1126         (vec_mask_store_lanes_optab): Likewise.
1127         * internal-fn.def (MASK_LOAD_LANES): New internal function.
1128         (MASK_STORE_LANES): Likewise.
1129         * internal-fn.c (mask_load_lanes_direct): New macro.
1130         (mask_store_lanes_direct): Likewise.
1131         (expand_mask_load_optab_fn): Handle masked operations.
1132         (expand_mask_load_lanes_optab_fn): New macro.
1133         (expand_mask_store_optab_fn): Handle masked operations.
1134         (expand_mask_store_lanes_optab_fn): New macro.
1135         (direct_mask_load_lanes_optab_supported_p): Likewise.
1136         (direct_mask_store_lanes_optab_supported_p): Likewise.
1137         * tree-vectorizer.h (vect_store_lanes_supported): Take a masked_p
1138         parameter.
1139         (vect_load_lanes_supported): Likewise.
1140         * tree-vect-data-refs.c (strip_conversion): New function.
1141         (can_group_stmts_p): Likewise.
1142         (vect_analyze_data_ref_accesses): Use it instead of checking
1143         for a pair of assignments.
1144         (vect_store_lanes_supported): Take a masked_p parameter.
1145         (vect_load_lanes_supported): Likewise.
1146         * tree-vect-loop.c (vect_analyze_loop_2): Update calls to
1147         vect_store_lanes_supported and vect_load_lanes_supported.
1148         * tree-vect-slp.c (vect_analyze_slp_instance): Likewise.
1149         * tree-vect-stmts.c (get_group_load_store_type): Take a masked_p
1150         parameter.  Don't allow gaps for masked accesses.
1151         Use vect_get_store_rhs.  Update calls to vect_store_lanes_supported
1152         and vect_load_lanes_supported.
1153         (get_load_store_type): Take a masked_p parameter and update
1154         call to get_group_load_store_type.
1155         (vectorizable_store): Update call to get_load_store_type.
1156         Handle IFN_MASK_STORE_LANES.
1157         (vectorizable_load): Update call to get_load_store_type.
1158         Handle IFN_MASK_LOAD_LANES.
1160 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1161             Alan Hayward  <alan.hayward@arm.com>
1162             David Sherwood  <david.sherwood@arm.com>
1164         * config/aarch64/aarch64-modes.def: Define x2, x3 and x4 vector
1165         modes for SVE.
1166         * config/aarch64/aarch64-protos.h
1167         (aarch64_sve_struct_memory_operand_p): Declare.
1168         * config/aarch64/iterators.md (SVE_STRUCT): New mode iterator.
1169         (vector_count, insn_length, VSINGLE, vsingle): New mode attributes.
1170         (VPRED, vpred): Handle SVE structure modes.
1171         * config/aarch64/constraints.md (Utx): New constraint.
1172         * config/aarch64/predicates.md (aarch64_sve_struct_memory_operand)
1173         (aarch64_sve_struct_nonimmediate_operand): New predicates.
1174         * config/aarch64/aarch64.md (UNSPEC_LDN, UNSPEC_STN): New unspecs.
1175         * config/aarch64/aarch64-sve.md (mov<mode>, *aarch64_sve_mov<mode>_le)
1176         (*aarch64_sve_mov<mode>_be, pred_mov<mode>): New patterns for
1177         structure modes.  Split into pieces after RA.
1178         (vec_load_lanes<mode><vsingle>, vec_mask_load_lanes<mode><vsingle>)
1179         (vec_store_lanes<mode><vsingle>, vec_mask_store_lanes<mode><vsingle>):
1180         New patterns.
1181         * config/aarch64/aarch64.c (aarch64_classify_vector_mode): Handle
1182         SVE structure modes.
1183         (aarch64_classify_address): Likewise.
1184         (sizetochar): Move earlier in file.
1185         (aarch64_print_operand): Handle SVE register lists.
1186         (aarch64_array_mode): New function.
1187         (aarch64_sve_struct_memory_operand_p): Likewise.
1188         (TARGET_ARRAY_MODE): Redefine.
1190 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1191             Alan Hayward  <alan.hayward@arm.com>
1192             David Sherwood  <david.sherwood@arm.com>
1194         * target.def (array_mode): New target hook.
1195         * doc/tm.texi.in (TARGET_ARRAY_MODE): New hook.
1196         * doc/tm.texi: Regenerate.
1197         * hooks.h (hook_optmode_mode_uhwi_none): Declare.
1198         * hooks.c (hook_optmode_mode_uhwi_none): New function.
1199         * tree-vect-data-refs.c (vect_lanes_optab_supported_p): Use
1200         targetm.array_mode.
1201         * stor-layout.c (mode_for_array): Likewise.  Support polynomial
1202         type sizes.
1204 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1205             Alan Hayward  <alan.hayward@arm.com>
1206             David Sherwood  <david.sherwood@arm.com>
1208         * fold-const.c (fold_binary_loc): Check the argument types
1209         rather than the result type when testing for a vector operation.
1211 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1213         * doc/tm.texi.in (DWARF_LAZY_REGISTER_VALUE): Document.
1214         * doc/tm.texi: Regenerate.
1216 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1217             Alan Hayward  <alan.hayward@arm.com>
1218             David Sherwood  <david.sherwood@arm.com>
1220         * doc/invoke.texi (-msve-vector-bits=): Document new option.
1221         (sve): Document new AArch64 extension.
1222         * doc/md.texi (w): Extend the description of the AArch64
1223         constraint to include SVE vectors.
1224         (Upl, Upa): Document new AArch64 predicate constraints.
1225         * config/aarch64/aarch64-opts.h (aarch64_sve_vector_bits_enum): New
1226         enum.
1227         * config/aarch64/aarch64.opt (sve_vector_bits): New enum.
1228         (msve-vector-bits=): New option.
1229         * config/aarch64/aarch64-option-extensions.def (fp, simd): Disable
1230         SVE when these are disabled.
1231         (sve): New extension.
1232         * config/aarch64/aarch64-modes.def: Define SVE vector and predicate
1233         modes.  Adjust their number of units based on aarch64_sve_vg.
1234         (MAX_BITSIZE_MODE_ANY_MODE): Define.
1235         * config/aarch64/aarch64-protos.h (ADDR_QUERY_ANY): New
1236         aarch64_addr_query_type.
1237         (aarch64_const_vec_all_same_in_range_p, aarch64_sve_pred_mode)
1238         (aarch64_sve_cnt_immediate_p, aarch64_sve_addvl_addpl_immediate_p)
1239         (aarch64_sve_inc_dec_immediate_p, aarch64_add_offset_temporaries)
1240         (aarch64_split_add_offset, aarch64_output_sve_cnt_immediate)
1241         (aarch64_output_sve_addvl_addpl, aarch64_output_sve_inc_dec_immediate)
1242         (aarch64_output_sve_mov_immediate, aarch64_output_ptrue): Declare.
1243         (aarch64_simd_imm_zero_p): Delete.
1244         (aarch64_check_zero_based_sve_index_immediate): Declare.
1245         (aarch64_sve_index_immediate_p, aarch64_sve_arith_immediate_p)
1246         (aarch64_sve_bitmask_immediate_p, aarch64_sve_dup_immediate_p)
1247         (aarch64_sve_cmp_immediate_p, aarch64_sve_float_arith_immediate_p)
1248         (aarch64_sve_float_mul_immediate_p): Likewise.
1249         (aarch64_classify_symbol): Take the offset as a HOST_WIDE_INT
1250         rather than an rtx.
1251         (aarch64_sve_ld1r_operand_p, aarch64_sve_ldr_operand_p): Declare.
1252         (aarch64_expand_mov_immediate): Take a gen_vec_duplicate callback.
1253         (aarch64_emit_sve_pred_move, aarch64_expand_sve_mem_move): Declare.
1254         (aarch64_expand_sve_vec_cmp_int, aarch64_expand_sve_vec_cmp_float)
1255         (aarch64_expand_sve_vcond, aarch64_expand_sve_vec_perm): Declare.
1256         (aarch64_regmode_natural_size): Likewise.
1257         * config/aarch64/aarch64.h (AARCH64_FL_SVE): New macro.
1258         (AARCH64_FL_V8_3, AARCH64_FL_RCPC, AARCH64_FL_DOTPROD): Shift
1259         left one place.
1260         (AARCH64_ISA_SVE, TARGET_SVE): New macros.
1261         (FIXED_REGISTERS, CALL_USED_REGISTERS, REGISTER_NAMES): Add entries
1262         for VG and the SVE predicate registers.
1263         (V_ALIASES): Add a "z"-prefixed alias.
1264         (FIRST_PSEUDO_REGISTER): Change to P15_REGNUM + 1.
1265         (AARCH64_DWARF_VG, AARCH64_DWARF_P0): New macros.
1266         (PR_REGNUM_P, PR_LO_REGNUM_P): Likewise.
1267         (PR_LO_REGS, PR_HI_REGS, PR_REGS): New reg_classes.
1268         (REG_CLASS_NAMES): Add entries for them.
1269         (REG_CLASS_CONTENTS): Likewise.  Update ALL_REGS to include VG
1270         and the predicate registers.
1271         (aarch64_sve_vg): Declare.
1272         (BITS_PER_SVE_VECTOR, BYTES_PER_SVE_VECTOR, BYTES_PER_SVE_PRED)
1273         (SVE_BYTE_MODE, MAX_COMPILE_TIME_VEC_BYTES): New macros.
1274         (REGMODE_NATURAL_SIZE): Define.
1275         * config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins): Handle
1276         SVE macros.
1277         * config/aarch64/aarch64.c: Include cfgrtl.h.
1278         (simd_immediate_info): Add a constructor for series vectors,
1279         and an associated step field.
1280         (aarch64_sve_vg): New variable.
1281         (aarch64_dbx_register_number): Handle VG and the predicate registers.
1282         (aarch64_vect_struct_mode_p, aarch64_vector_mode_p): Delete.
1283         (VEC_ADVSIMD, VEC_SVE_DATA, VEC_SVE_PRED, VEC_STRUCT, VEC_ANY_SVE)
1284         (VEC_ANY_DATA, VEC_STRUCT): New constants.
1285         (aarch64_advsimd_struct_mode_p, aarch64_sve_pred_mode_p)
1286         (aarch64_classify_vector_mode, aarch64_vector_data_mode_p)
1287         (aarch64_sve_data_mode_p, aarch64_sve_pred_mode)
1288         (aarch64_get_mask_mode): New functions.
1289         (aarch64_hard_regno_nregs): Handle SVE data modes for FP_REGS
1290         and FP_LO_REGS.  Handle PR_REGS, PR_LO_REGS and PR_HI_REGS.
1291         (aarch64_hard_regno_mode_ok): Handle VG.  Also handle the SVE
1292         predicate modes and predicate registers.  Explicitly restrict
1293         GPRs to modes of 16 bytes or smaller.  Only allow FP registers
1294         to store a vector mode if it is recognized by
1295         aarch64_classify_vector_mode.
1296         (aarch64_regmode_natural_size): New function.
1297         (aarch64_hard_regno_caller_save_mode): Return the original mode
1298         for predicates.
1299         (aarch64_sve_cnt_immediate_p, aarch64_output_sve_cnt_immediate)
1300         (aarch64_sve_addvl_addpl_immediate_p, aarch64_output_sve_addvl_addpl)
1301         (aarch64_sve_inc_dec_immediate_p, aarch64_output_sve_inc_dec_immediate)
1302         (aarch64_add_offset_1_temporaries, aarch64_offset_temporaries): New
1303         functions.
1304         (aarch64_add_offset): Add a temp2 parameter.  Assert that temp1
1305         does not overlap dest if the function is frame-related.  Handle
1306         SVE constants.
1307         (aarch64_split_add_offset): New function.
1308         (aarch64_add_sp, aarch64_sub_sp): Add temp2 parameters and pass
1309         them aarch64_add_offset.
1310         (aarch64_allocate_and_probe_stack_space): Add a temp2 parameter
1311         and update call to aarch64_sub_sp.
1312         (aarch64_add_cfa_expression): New function.
1313         (aarch64_expand_prologue): Pass extra temporary registers to the
1314         functions above.  Handle the case in which we need to emit new
1315         DW_CFA_expressions for registers that were originally saved
1316         relative to the stack pointer, but now have to be expressed
1317         relative to the frame pointer.
1318         (aarch64_output_mi_thunk): Pass extra temporary registers to the
1319         functions above.
1320         (aarch64_expand_epilogue): Likewise.  Prevent inheritance of
1321         IP0 and IP1 values for SVE frames.
1322         (aarch64_expand_vec_series): New function.
1323         (aarch64_expand_sve_widened_duplicate): Likewise.
1324         (aarch64_expand_sve_const_vector): Likewise.
1325         (aarch64_expand_mov_immediate): Add a gen_vec_duplicate parameter.
1326         Handle SVE constants.  Use emit_move_insn to move a force_const_mem
1327         into the register, rather than emitting a SET directly.
1328         (aarch64_emit_sve_pred_move, aarch64_expand_sve_mem_move)
1329         (aarch64_get_reg_raw_mode, offset_4bit_signed_scaled_p)
1330         (offset_6bit_unsigned_scaled_p, aarch64_offset_7bit_signed_scaled_p)
1331         (offset_9bit_signed_scaled_p): New functions.
1332         (aarch64_replicate_bitmask_imm): New function.
1333         (aarch64_bitmask_imm): Use it.
1334         (aarch64_cannot_force_const_mem): Reject expressions involving
1335         a CONST_POLY_INT.  Update call to aarch64_classify_symbol.
1336         (aarch64_classify_index): Handle SVE indices, by requiring
1337         a plain register index with a scale that matches the element size.
1338         (aarch64_classify_address): Handle SVE addresses.  Assert that
1339         the mode of the address is VOIDmode or an integer mode.
1340         Update call to aarch64_classify_symbol.
1341         (aarch64_classify_symbolic_expression): Update call to
1342         aarch64_classify_symbol.
1343         (aarch64_const_vec_all_in_range_p): New function.
1344         (aarch64_print_vector_float_operand): Likewise.
1345         (aarch64_print_operand): Handle 'N' and 'C'.  Use "zN" rather than
1346         "vN" for FP registers with SVE modes.  Handle (const ...) vectors
1347         and the FP immediates 1.0 and 0.5.
1348         (aarch64_print_address_internal): Handle SVE addresses.
1349         (aarch64_print_operand_address): Use ADDR_QUERY_ANY.
1350         (aarch64_regno_regclass): Handle predicate registers.
1351         (aarch64_secondary_reload): Handle big-endian reloads of SVE
1352         data modes.
1353         (aarch64_class_max_nregs): Handle SVE modes and predicate registers.
1354         (aarch64_rtx_costs): Check for ADDVL and ADDPL instructions.
1355         (aarch64_convert_sve_vector_bits): New function.
1356         (aarch64_override_options): Use it to handle -msve-vector-bits=.
1357         (aarch64_classify_symbol): Take the offset as a HOST_WIDE_INT
1358         rather than an rtx.
1359         (aarch64_legitimate_constant_p): Use aarch64_classify_vector_mode.
1360         Handle SVE vector and predicate modes.  Accept VL-based constants
1361         that need only one temporary register, and VL offsets that require
1362         no temporary registers.
1363         (aarch64_conditional_register_usage): Mark the predicate registers
1364         as fixed if SVE isn't available.
1365         (aarch64_vector_mode_supported_p): Use aarch64_classify_vector_mode.
1366         Return true for SVE vector and predicate modes.
1367         (aarch64_simd_container_mode): Take the number of bits as a poly_int64
1368         rather than an unsigned int.  Handle SVE modes.
1369         (aarch64_preferred_simd_mode): Update call accordingly.  Handle
1370         SVE modes.
1371         (aarch64_autovectorize_vector_sizes): Add BYTES_PER_SVE_VECTOR
1372         if SVE is enabled.
1373         (aarch64_sve_index_immediate_p, aarch64_sve_arith_immediate_p)
1374         (aarch64_sve_bitmask_immediate_p, aarch64_sve_dup_immediate_p)
1375         (aarch64_sve_cmp_immediate_p, aarch64_sve_float_arith_immediate_p)
1376         (aarch64_sve_float_mul_immediate_p): New functions.
1377         (aarch64_sve_valid_immediate): New function.
1378         (aarch64_simd_valid_immediate): Use it as the fallback for SVE vectors.
1379         Explicitly reject structure modes.  Check for INDEX constants.
1380         Handle PTRUE and PFALSE constants.
1381         (aarch64_check_zero_based_sve_index_immediate): New function.
1382         (aarch64_simd_imm_zero_p): Delete.
1383         (aarch64_mov_operand_p): Use aarch64_simd_valid_immediate for
1384         vector modes.  Accept constants in the range of CNT[BHWD].
1385         (aarch64_simd_scalar_immediate_valid_for_move): Explicitly
1386         ask for an Advanced SIMD mode.
1387         (aarch64_sve_ld1r_operand_p, aarch64_sve_ldr_operand_p): New functions.
1388         (aarch64_simd_vector_alignment): Handle SVE predicates.
1389         (aarch64_vectorize_preferred_vector_alignment): New function.
1390         (aarch64_simd_vector_alignment_reachable): Use it instead of
1391         the vector size.
1392         (aarch64_shift_truncation_mask): Use aarch64_vector_data_mode_p.
1393         (aarch64_output_sve_mov_immediate, aarch64_output_ptrue): New
1394         functions.
1395         (MAX_VECT_LEN): Delete.
1396         (expand_vec_perm_d): Add a vec_flags field.
1397         (emit_unspec2, aarch64_expand_sve_vec_perm): New functions.
1398         (aarch64_evpc_trn, aarch64_evpc_uzp, aarch64_evpc_zip)
1399         (aarch64_evpc_ext): Don't apply a big-endian lane correction
1400         for SVE modes.
1401         (aarch64_evpc_rev): Rename to...
1402         (aarch64_evpc_rev_local): ...this.  Use a predicated operation for SVE.
1403         (aarch64_evpc_rev_global): New function.
1404         (aarch64_evpc_dup): Enforce a 64-byte range for SVE DUP.
1405         (aarch64_evpc_tbl): Use MAX_COMPILE_TIME_VEC_BYTES instead of
1406         MAX_VECT_LEN.
1407         (aarch64_evpc_sve_tbl): New function.
1408         (aarch64_expand_vec_perm_const_1): Update after rename of
1409         aarch64_evpc_rev.  Handle SVE permutes too, trying
1410         aarch64_evpc_rev_global and using aarch64_evpc_sve_tbl rather
1411         than aarch64_evpc_tbl.
1412         (aarch64_vectorize_vec_perm_const): Initialize vec_flags.
1413         (aarch64_sve_cmp_operand_p, aarch64_unspec_cond_code)
1414         (aarch64_gen_unspec_cond, aarch64_expand_sve_vec_cmp_int)
1415         (aarch64_emit_unspec_cond, aarch64_emit_unspec_cond_or)
1416         (aarch64_emit_inverted_unspec_cond, aarch64_expand_sve_vec_cmp_float)
1417         (aarch64_expand_sve_vcond): New functions.
1418         (aarch64_modes_tieable_p): Use aarch64_vector_data_mode_p instead
1419         of aarch64_vector_mode_p.
1420         (aarch64_dwarf_poly_indeterminate_value): New function.
1421         (aarch64_compute_pressure_classes): Likewise.
1422         (aarch64_can_change_mode_class): Likewise.
1423         (TARGET_GET_RAW_RESULT_MODE, TARGET_GET_RAW_ARG_MODE): Redefine.
1424         (TARGET_VECTORIZE_PREFERRED_VECTOR_ALIGNMENT): Likewise.
1425         (TARGET_VECTORIZE_GET_MASK_MODE): Likewise.
1426         (TARGET_DWARF_POLY_INDETERMINATE_VALUE): Likewise.
1427         (TARGET_COMPUTE_PRESSURE_CLASSES): Likewise.
1428         (TARGET_CAN_CHANGE_MODE_CLASS): Likewise.
1429         * config/aarch64/constraints.md (Upa, Upl, Uav, Uat, Usv, Usi, Utr)
1430         (Uty, Dm, vsa, vsc, vsd, vsi, vsn, vsl, vsm, vsA, vsM, vsN): New
1431         constraints.
1432         (Dn, Dl, Dr): Accept const as well as const_vector.
1433         (Dz): Likewise.  Compare against CONST0_RTX.
1434         * config/aarch64/iterators.md: Refer to "Advanced SIMD" instead
1435         of "vector" where appropriate.
1436         (SVE_ALL, SVE_BH, SVE_BHS, SVE_BHSI, SVE_HSDI, SVE_HSF, SVE_SD)
1437         (SVE_SDI, SVE_I, SVE_F, PRED_ALL, PRED_BHS): New mode iterators.
1438         (UNSPEC_SEL, UNSPEC_ANDF, UNSPEC_IORF, UNSPEC_XORF, UNSPEC_COND_LT)
1439         (UNSPEC_COND_LE, UNSPEC_COND_EQ, UNSPEC_COND_NE, UNSPEC_COND_GE)
1440         (UNSPEC_COND_GT, UNSPEC_COND_LO, UNSPEC_COND_LS, UNSPEC_COND_HS)
1441         (UNSPEC_COND_HI, UNSPEC_COND_UO): New unspecs.
1442         (Vetype, VEL, Vel, VWIDE, Vwide, vw, vwcore, V_INT_EQUIV)
1443         (v_int_equiv): Extend to SVE modes.
1444         (Vesize, V128, v128, Vewtype, V_FP_EQUIV, v_fp_equiv, VPRED): New
1445         mode attributes.
1446         (LOGICAL_OR, SVE_INT_UNARY, SVE_FP_UNARY): New code iterators.
1447         (optab): Handle popcount, smin, smax, umin, umax, abs and sqrt.
1448         (logical_nn, lr, sve_int_op, sve_fp_op): New code attributs.
1449         (LOGICALF, OPTAB_PERMUTE, UNPACK, UNPACK_UNSIGNED, SVE_COND_INT_CMP)
1450         (SVE_COND_FP_CMP): New int iterators.
1451         (perm_hilo): Handle the new unpack unspecs.
1452         (optab, logicalf_op, su, perm_optab, cmp_op, imm_con): New int
1453         attributes.
1454         * config/aarch64/predicates.md (aarch64_sve_cnt_immediate)
1455         (aarch64_sve_addvl_addpl_immediate, aarch64_split_add_offset_immediate)
1456         (aarch64_pluslong_or_poly_operand, aarch64_nonmemory_operand)
1457         (aarch64_equality_operator, aarch64_constant_vector_operand)
1458         (aarch64_sve_ld1r_operand, aarch64_sve_ldr_operand): New predicates.
1459         (aarch64_sve_nonimmediate_operand): Likewise.
1460         (aarch64_sve_general_operand): Likewise.
1461         (aarch64_sve_dup_operand, aarch64_sve_arith_immediate): Likewise.
1462         (aarch64_sve_sub_arith_immediate, aarch64_sve_inc_dec_immediate)
1463         (aarch64_sve_logical_immediate, aarch64_sve_mul_immediate): Likewise.
1464         (aarch64_sve_dup_immediate, aarch64_sve_cmp_vsc_immediate): Likewise.
1465         (aarch64_sve_cmp_vsd_immediate, aarch64_sve_index_immediate): Likewise.
1466         (aarch64_sve_float_arith_immediate): Likewise.
1467         (aarch64_sve_float_arith_with_sub_immediate): Likewise.
1468         (aarch64_sve_float_mul_immediate, aarch64_sve_arith_operand): Likewise.
1469         (aarch64_sve_add_operand, aarch64_sve_logical_operand): Likewise.
1470         (aarch64_sve_lshift_operand, aarch64_sve_rshift_operand): Likewise.
1471         (aarch64_sve_mul_operand, aarch64_sve_cmp_vsc_operand): Likewise.
1472         (aarch64_sve_cmp_vsd_operand, aarch64_sve_index_operand): Likewise.
1473         (aarch64_sve_float_arith_operand): Likewise.
1474         (aarch64_sve_float_arith_with_sub_operand): Likewise.
1475         (aarch64_sve_float_mul_operand): Likewise.
1476         (aarch64_sve_vec_perm_operand): Likewise.
1477         (aarch64_pluslong_operand): Include aarch64_sve_addvl_addpl_immediate.
1478         (aarch64_mov_operand): Accept const_poly_int and const_vector.
1479         (aarch64_simd_lshift_imm, aarch64_simd_rshift_imm): Accept const
1480         as well as const_vector.
1481         (aarch64_simd_imm_zero, aarch64_simd_imm_minus_one): Move earlier
1482         in file.  Use CONST0_RTX and CONSTM1_RTX.
1483         (aarch64_simd_or_scalar_imm_zero): Likewise.  Add match_codes.
1484         (aarch64_simd_reg_or_zero): Accept const as well as const_vector.
1485         Use aarch64_simd_imm_zero.
1486         * config/aarch64/aarch64-sve.md: New file.
1487         * config/aarch64/aarch64.md: Include it.
1488         (VG_REGNUM, P0_REGNUM, P7_REGNUM, P15_REGNUM): New register numbers.
1489         (UNSPEC_REV, UNSPEC_LD1_SVE, UNSPEC_ST1_SVE, UNSPEC_MERGE_PTRUE)
1490         (UNSPEC_PTEST_PTRUE, UNSPEC_UNPACKSHI, UNSPEC_UNPACKUHI)
1491         (UNSPEC_UNPACKSLO, UNSPEC_UNPACKULO, UNSPEC_PACK)
1492         (UNSPEC_FLOAT_CONVERT, UNSPEC_WHILE_LO): New unspec constants.
1493         (sve): New attribute.
1494         (enabled): Disable instructions with the sve attribute unless
1495         TARGET_SVE.
1496         (movqi, movhi): Pass CONST_POLY_INT operaneds through
1497         aarch64_expand_mov_immediate.
1498         (*mov<mode>_aarch64, *movsi_aarch64, *movdi_aarch64): Handle
1499         CNT[BHSD] immediates.
1500         (movti): Split CONST_POLY_INT moves into two halves.
1501         (add<mode>3): Accept aarch64_pluslong_or_poly_operand.
1502         Split additions that need a temporary here if the destination
1503         is the stack pointer.
1504         (*add<mode>3_aarch64): Handle ADDVL and ADDPL immediates.
1505         (*add<mode>3_poly_1): New instruction.
1506         (set_clobber_cc): New expander.
1508 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1510         * simplify-rtx.c (simplify_immed_subreg): Add an inner_bytes
1511         parameter and use it instead of GET_MODE_SIZE (innermode).  Use
1512         inner_bytes * BITS_PER_UNIT instead of GET_MODE_BITSIZE (innermode).
1513         Use CEIL (inner_bytes, GET_MODE_UNIT_SIZE (innermode)) instead of
1514         GET_MODE_NUNITS (innermode).  Also add a first_elem parameter.
1515         Change innermode from fixed_mode_size to machine_mode.
1516         (simplify_subreg): Update call accordingly.  Handle a constant-sized
1517         subreg of a variable-length CONST_VECTOR.
1519 2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
1520             Alan Hayward  <alan.hayward@arm.com>
1521             David Sherwood  <david.sherwood@arm.com>
1523         * tree-ssa-address.c (mem_ref_valid_without_offset_p): New function.
1524         (add_offset_to_base): New function, split out from...
1525         (create_mem_ref): ...here.  When handling a scale other than 1,
1526         check first whether the address is valid without the offset.
1527         Add it into the base if so, leaving the index and scale as-is.
1529 2018-01-12  Jakub Jelinek  <jakub@redhat.com>
1531         PR c++/83778
1532         * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): Call
1533         fold_for_warn before checking if arg2 is INTEGER_CST.
1535 2018-01-12  Segher Boessenkool  <segher@kernel.crashing.org>
1537         * config/rs6000/predicates.md (load_multiple_operation): Delete.
1538         (store_multiple_operation): Delete.
1539         * config/rs6000/rs6000-cpus.def (601): Remove MASK_STRING.
1540         * config/rs6000/rs6000-protos.h (rs6000_output_load_multiple): Delete.
1541         * config/rs6000/rs6000-string.c (expand_block_move): Delete everything
1542         guarded by TARGET_STRING.
1543         (rs6000_output_load_multiple): Delete.
1544         * config/rs6000/rs6000.c (rs6000_option_override_internal): Delete
1545         OPTION_MASK_STRING / TARGET_STRING handling.
1546         (print_operand) <'N', 'O'>: Add comment that these are unused now.
1547         (const rs6000_opt_masks) <"string">: Change mask to 0.
1548         * config/rs6000/rs6000.h (TARGET_DEFAULT): Remove MASK_STRING.
1549         (MASK_STRING): Delete.
1550         * config/rs6000/rs6000.md (*mov<mode>_string): Delete TARGET_STRING
1551         parts.  Simplify.
1552         (load_multiple): Delete.
1553         (*ldmsi8): Delete.
1554         (*ldmsi7): Delete.
1555         (*ldmsi6): Delete.
1556         (*ldmsi5): Delete.
1557         (*ldmsi4): Delete.
1558         (*ldmsi3): Delete.
1559         (store_multiple): Delete.
1560         (*stmsi8): Delete.
1561         (*stmsi7): Delete.
1562         (*stmsi6): Delete.
1563         (*stmsi5): Delete.
1564         (*stmsi4): Delete.
1565         (*stmsi3): Delete.
1566         (movmemsi_8reg): Delete.
1567         (corresponding unnamed define_insn): Delete.
1568         (movmemsi_6reg): Delete.
1569         (corresponding unnamed define_insn): Delete.
1570         (movmemsi_4reg): Delete.
1571         (corresponding unnamed define_insn): Delete.
1572         (movmemsi_2reg): Delete.
1573         (corresponding unnamed define_insn): Delete.
1574         (movmemsi_1reg): Delete.
1575         (corresponding unnamed define_insn): Delete.
1576         * config/rs6000/rs6000.opt (mno-string): New.
1577         (mstring): Replace by deprecation warning stub.
1578         * doc/invoke.texi (RS/6000 and PowerPC Options): Delete -mstring.
1580 2018-01-12  Jakub Jelinek  <jakub@redhat.com>
1582         * regrename.c (regrename_do_replace): If replacing the same
1583         reg multiple times, try to reuse last created gen_raw_REG.
1585         PR debug/81155
1586         * bb-reorder.c (pass_partition_blocks::gate): In lto don't partition
1587         main to workaround a bug in GDB.
1589 2018-01-12  Tom de Vries  <tom@codesourcery.com>
1591         PR target/83737
1592         * config.gcc (nvptx*-*-*): Set use_gcc_stdint=wrap.
1594 2018-01-12  Vladimir Makarov  <vmakarov@redhat.com>
1596         PR rtl-optimization/80481
1597         * ira-color.c (get_cap_member): New function.
1598         (allocnos_conflict_by_live_ranges_p): Use it.
1599         (slot_coalesced_allocno_live_ranges_intersect_p): Add assert.
1600         (setup_slot_coalesced_allocno_live_ranges): Ditto.
1602 2018-01-12  Uros Bizjak  <ubizjak@gmail.com>
1604         PR target/83628
1605         * config/alpha/alpha.md (*saddsi_1): New insn_ans_split pattern.
1606         (*saddl_se_1): Ditto.
1607         (*ssubsi_1): Ditto.
1608         (*saddl_se_1): Ditto.
1610 2018-01-12  Richard Sandiford  <richard.sandiford@linaro.org>
1612         * tree-predcom.c (aff_combination_dr_offset): Use wi::to_poly_widest
1613         rather than wi::to_widest for DR_INITs.
1614         * tree-vect-data-refs.c (vect_find_same_alignment_drs): Use
1615         wi::to_poly_offset rather than wi::to_offset for DR_INIT.
1616         (vect_analyze_data_ref_accesses): Require both DR_INITs to be
1617         INTEGER_CSTs.
1618         (vect_analyze_group_access_1): Note that here.
1620 2018-01-12  Richard Sandiford  <richard.sandiford@linaro.org>
1622         * tree-vectorizer.c (get_vec_alignment_for_array_type): Handle
1623         polynomial type sizes.
1625 2018-01-12  Richard Sandiford  <richard.sandiford@linaro.org>
1627         * gimplify.c (gimple_add_tmp_var_fn): Allow variables to have a
1628         poly_uint64 size, rather than requiring an unsigned HOST_WIDE_INT size.
1629         (gimple_add_tmp_var): Likewise.
1631 2018-01-12  Martin Liska  <mliska@suse.cz>
1633         * gimple.c (gimple_alloc_counts): Use uint64_t instead of int.
1634         (gimple_alloc_sizes): Likewise.
1635         (dump_gimple_statistics): Use PRIu64 in printf format.
1636         * gimple.h: Change uint64_t to int.
1638 2018-01-12  Martin Liska  <mliska@suse.cz>
1640         * tree-core.h: Use uint64_t instead of int.
1641         * tree.c (tree_node_counts): Likewise.
1642         (tree_node_sizes): Likewise.
1643         (dump_tree_statistics): Use PRIu64 in printf format.
1645 2018-01-12  Martin Liska  <mliska@suse.cz>
1647         * Makefile.in: As qsort_chk is implemented in vec.c, add
1648         vec.o to linkage of gencfn-macros.
1649         * tree.c (build_new_poly_int_cst): Add CXX_MEM_STAT_INFO as it's
1650         passing the info to record_node_allocation_statistics.
1651         (test_vector_cst_patterns): Add CXX_MEM_STAT_INFO to declaration
1652         and pass the info.
1653         * ggc-common.c (struct ggc_usage): Add operator== and use
1654         it in operator< and compare function.
1655         * mem-stats.h (struct mem_usage): Likewise.
1656         * vec.c (struct vec_usage): Remove operator< and compare
1657         function. Can be simply inherited.
1659 2018-01-12  Martin Jambor  <mjambor@suse.cz>
1661         PR target/81616
1662         * params.def: New parameter PARAM_AVOID_FMA_MAX_BITS.
1663         * tree-ssa-math-opts.c: Include domwalk.h.
1664         (convert_mult_to_fma_1): New function.
1665         (fma_transformation_info): New type.
1666         (fma_deferring_state): Likewise.
1667         (cancel_fma_deferring): New function.
1668         (result_of_phi): Likewise.
1669         (last_fma_candidate_feeds_initial_phi): Likewise.
1670         (convert_mult_to_fma): Added deferring logic, split actual
1671         transformation to convert_mult_to_fma_1.
1672         (math_opts_dom_walker): New type.
1673         (math_opts_dom_walker::after_dom_children): New method, body moved
1674         here from pass_optimize_widening_mul::execute, added deferring logic
1675         bits.
1676         (pass_optimize_widening_mul::execute): Moved most of code to
1677         math_opts_dom_walker::after_dom_children.
1678         * config/i386/x86-tune.def (X86_TUNE_AVOID_128FMA_CHAINS): New.
1679         * config/i386/i386.c (ix86_option_override_internal): Added
1680         maybe_setting of PARAM_AVOID_FMA_MAX_BITS.
1682 2018-01-12  Richard Biener  <rguenther@suse.de>
1684         PR debug/83157
1685         * dwarf2out.c (gen_variable_die): Do not reset old_die for
1686         inline instance vars.
1688 2018-01-12  Oleg Endo  <olegendo@gcc.gnu.org>
1690         PR target/81819
1691         * config/rx/rx.c (rx_is_restricted_memory_address):
1692         Handle SUBREG case.
1694 2018-01-12  Richard Biener  <rguenther@suse.de>
1696         PR tree-optimization/80846
1697         * target.def (split_reduction): New target hook.
1698         * targhooks.c (default_split_reduction): New function.
1699         * targhooks.h (default_split_reduction): Declare.
1700         * tree-vect-loop.c (vect_create_epilog_for_reduction): If the
1701         target requests first reduce vectors by combining low and high
1702         parts.
1703         * tree-vect-stmts.c (vect_gen_perm_mask_any): Adjust.
1704         (get_vectype_for_scalar_type_and_size): Export.
1705         * tree-vectorizer.h (get_vectype_for_scalar_type_and_size): Declare.
1706         * doc/tm.texi.in (TARGET_VECTORIZE_SPLIT_REDUCTION): Document.
1707         * doc/tm.texi: Regenerate.
1708         * config/i386/i386.c (ix86_split_reduction): Implement
1709         TARGET_VECTORIZE_SPLIT_REDUCTION.
1711 2018-01-12  Eric Botcazou  <ebotcazou@adacore.com>
1713         PR target/83368
1714         * config/sparc/sparc.h (PIC_OFFSET_TABLE_REGNUM): Set to INVALID_REGNUM
1715         in PIC mode except for TARGET_VXWORKS_RTP.
1716         * config/sparc/sparc.c: Include cfgrtl.h.
1717         (TARGET_INIT_PIC_REG): Define.
1718         (TARGET_USE_PSEUDO_PIC_REG): Likewise.
1719         (sparc_pic_register_p): New predicate.
1720         (sparc_legitimate_address_p): Use it.
1721         (sparc_legitimize_pic_address): Likewise.
1722         (sparc_delegitimize_address): Likewise.
1723         (sparc_mode_dependent_address_p): Likewise.
1724         (gen_load_pcrel_sym): Remove 4th parameter.
1725         (load_got_register): Adjust call to above.  Remove obsolete stuff.
1726         (sparc_expand_prologue): Do not call load_got_register here.
1727         (sparc_flat_expand_prologue): Likewise.
1728         (sparc_output_mi_thunk): Set the pic_offset_table_rtx object.
1729         (sparc_use_pseudo_pic_reg): New function.
1730         (sparc_init_pic_reg): Likewise.
1731         * config/sparc/sparc.md (vxworks_load_got): Set the GOT register.
1732         (builtin_setjmp_receiver): Enable only for TARGET_VXWORKS_RTP.
1734 2018-01-12  Christophe Lyon  <christophe.lyon@linaro.org>
1736         * doc/sourcebuild.texi (Effective-Target Keywords, Other attributes):
1737         Add item for branch_cost.
1739 2018-01-12  Eric Botcazou  <ebotcazou@adacore.com>
1741         PR rtl-optimization/83565
1742         * rtlanal.c (nonzero_bits1): On WORD_REGISTER_OPERATIONS machines, do
1743         not extend the result to a larger mode for rotate operations.
1744         (num_sign_bit_copies1): Likewise.
1746 2018-01-12  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
1748         PR target/40411
1749         * config/sol2.h (STARTFILE_ARCH_SPEC): Don't use with -shared or
1750         -symbolic.
1751         Use values-Xc.o for -pedantic.
1752         Link with values-xpg4.o for C90, values-xpg6.o otherwise.
1754 2018-01-12  Martin Liska  <mliska@suse.cz>
1756         PR ipa/83054
1757         * ipa-devirt.c (final_warning_record::grow_type_warnings):
1758         New function.
1759         (possible_polymorphic_call_targets): Use it.
1760         (ipa_devirt): Likewise.
1762 2018-01-12  Martin Liska  <mliska@suse.cz>
1764         * profile-count.h (enum profile_quality): Use 0 as invalid
1765         enum value of profile_quality.
1767 2018-01-12  Chung-Ju Wu  <jasonwucj@gmail.com>
1769         * doc/invoke.texi (NDS32 Options): Add -mext-perf, -mext-perf2 and
1770         -mext-string options.
1772 2018-01-12  Richard Biener  <rguenther@suse.de>
1774         * lto-streamer-out.c (DFS::DFS_write_tree_body): Process
1775         DECL_DEBUG_EXPR conditional on DECL_HAS_DEBUG_EXPR_P.
1776         * tree-streamer-in.c (lto_input_ts_decl_common_tree_pointers):
1777         Likewise.
1778         * tree-streamer-out.c (write_ts_decl_common_tree_pointers): Likewise.
1780 2018-01-11  Michael Meissner  <meissner@linux.vnet.ibm.com>
1782         * configure.ac (--with-long-double-format): Add support for the
1783         configuration option to change the default long double format on
1784         PowerPC systems.
1785         * config.gcc (powerpc*-linux*-*): Likewise.
1786         * configure: Regenerate.
1787         * config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): If long
1788         double is IEEE, define __KC__ and __KF__ to allow floatn.h to be
1789         used without modification.
1791 2018-01-11  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
1793         * config/rs6000/rs6000-builtin.def (BU_P7_MISC_X): New #define.
1794         (SPEC_BARRIER): New instantiation of BU_P7_MISC_X.
1795         * config/rs6000/rs6000.c (rs6000_expand_builtin): Handle
1796         MISC_BUILTIN_SPEC_BARRIER.
1797         (rs6000_init_builtins): Likewise.
1798         * config/rs6000/rs6000.md (UNSPECV_SPEC_BARRIER): New UNSPECV
1799         enum value.
1800         (speculation_barrier): New define_insn.
1801         * doc/extend.texi: Document __builtin_speculation_barrier.
1803 2018-01-11  Jakub Jelinek  <jakub@redhat.com>
1805         PR target/83203
1806         * config/i386/i386.c (ix86_expand_vector_init_one_nonzero): If one_var
1807         is 0, for V{8,16}S[IF] and V[48]D[IF]mode use gen_vec_set<mode>_0.
1808         * config/i386/sse.md (VI8_AVX_AVX512F, VI4F_256_512): New mode
1809         iterators.
1810         (ssescalarmodesuffix): Add 512-bit vectors.  Use "d" or "q" for
1811         integral modes instead of "ss" and "sd".
1812         (vec_set<mode>_0): New define_insns for 256-bit and 512-bit
1813         vectors with 32-bit and 64-bit elements.
1814         (vecdupssescalarmodesuffix): New mode attribute.
1815         (vec_dup<mode>): Use it.
1817 2018-01-11  H.J. Lu  <hongjiu.lu@intel.com>
1819         PR target/83330
1820         * config/i386/i386.c (ix86_compute_frame_layout): Align stack
1821         frame if argument is passed on stack.
1823 2018-01-11  Jakub Jelinek  <jakub@redhat.com>
1825         PR target/82682
1826         * ree.c (combine_reaching_defs): Optimize also
1827         reg2=exp; reg1=reg2; reg2=any_extend(reg1); into
1828         reg2=any_extend(exp); reg1=reg2;, formatting fix.
1830 2018-01-11  Jan Hubicka  <hubicka@ucw.cz>
1832         PR middle-end/83189
1833         * gimple-ssa-isolate-paths.c (isolate_path): Fix profile update.
1835 2018-01-11  Jan Hubicka  <hubicka@ucw.cz>
1837         PR middle-end/83718
1838         * tree-inline.c (copy_cfg_body): Adjust num&den for scaling
1839         after they are computed.
1841 2018-01-11  Bin Cheng  <bin.cheng@arm.com>
1843         PR tree-optimization/83695
1844         * gimple-loop-linterchange.cc
1845         (tree_loop_interchange::interchange_loops): Call scev_reset_htab to
1846         reset cached scev information after interchange.
1847         (pass_linterchange::execute): Remove call to scev_reset_htab.
1849 2018-01-11  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
1851         * config/arm/arm_neon.h (vfmlal_lane_low_u32, vfmlal_lane_high_u32,
1852         vfmlalq_laneq_low_u32, vfmlalq_lane_low_u32, vfmlal_laneq_low_u32,
1853         vfmlalq_laneq_high_u32, vfmlalq_lane_high_u32, vfmlal_laneq_high_u32,
1854         vfmlsl_lane_low_u32, vfmlsl_lane_high_u32, vfmlslq_laneq_low_u32,
1855         vfmlslq_lane_low_u32, vfmlsl_laneq_low_u32, vfmlslq_laneq_high_u32,
1856         vfmlslq_lane_high_u32, vfmlsl_laneq_high_u32): Define.
1857         * config/arm/arm_neon_builtins.def (vfmal_lane_low,
1858         vfmal_lane_lowv4hf, vfmal_lane_lowv8hf, vfmal_lane_high,
1859         vfmal_lane_highv4hf, vfmal_lane_highv8hf, vfmsl_lane_low,
1860         vfmsl_lane_lowv4hf, vfmsl_lane_lowv8hf, vfmsl_lane_high,
1861         vfmsl_lane_highv4hf, vfmsl_lane_highv8hf): New sets of builtins.
1862         * config/arm/iterators.md (VFMLSEL2, vfmlsel2): New mode attributes.
1863         (V_lane_reg): Likewise.
1864         * config/arm/neon.md (neon_vfm<vfml_op>l_lane_<vfml_half><VCVTF:mode>):
1865         New define_expand.
1866         (neon_vfm<vfml_op>l_lane_<vfml_half><vfmlsel2><mode>): Likewise.
1867         (vfmal_lane_low<mode>_intrinsic,
1868         vfmal_lane_low<vfmlsel2><mode>_intrinsic,
1869         vfmal_lane_high<vfmlsel2><mode>_intrinsic,
1870         vfmal_lane_high<mode>_intrinsic, vfmsl_lane_low<mode>_intrinsic,
1871         vfmsl_lane_low<vfmlsel2><mode>_intrinsic,
1872         vfmsl_lane_high<vfmlsel2><mode>_intrinsic,
1873         vfmsl_lane_high<mode>_intrinsic): New define_insns.
1875 2018-01-11  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
1877         * config/arm/arm-cpus.in (fp16fml): New feature.
1878         (ALL_SIMD): Add fp16fml.
1879         (armv8.2-a): Add fp16fml as an option.
1880         (armv8.3-a): Likewise.
1881         (armv8.4-a): Add fp16fml as part of fp16.
1882         * config/arm/arm.h (TARGET_FP16FML): Define.
1883         * config/arm/arm-c.c (arm_cpu_builtins): Define __ARM_FEATURE_FP16_FML
1884         when appropriate.
1885         * config/arm/arm-modes.def (V2HF): Define.
1886         * config/arm/arm_neon.h (vfmlal_low_u32, vfmlsl_low_u32,
1887         vfmlal_high_u32, vfmlsl_high_u32, vfmlalq_low_u32,
1888         vfmlslq_low_u32, vfmlalq_high_u32, vfmlslq_high_u32): Define.
1889         * config/arm/arm_neon_builtins.def (vfmal_low, vfmal_high,
1890         vfmsl_low, vfmsl_high): New set of builtins.
1891         * config/arm/iterators.md (PLUSMINUS): New code iterator.
1892         (vfml_op): New code attribute.
1893         (VFMLHALVES): New int iterator.
1894         (VFML, VFMLSEL): New mode attributes.
1895         (V_reg): Define mapping for V2HF.
1896         (V_hi, V_lo): New mode attributes.
1897         (VF_constraint): Likewise.
1898         (vfml_half, vfml_half_selector): New int attributes.
1899         * config/arm/neon.md (neon_vfm<vfml_op>l_<vfml_half><mode>): New
1900         define_expand.
1901         (vfmal_low<mode>_intrinsic, vfmsl_high<mode>_intrinsic,
1902         vfmal_high<mode>_intrinsic, vfmsl_low<mode>_intrinsic):
1903         New define_insn.
1904         * config/arm/t-arm-elf (v8_fps): Add fp16fml.
1905         * config/arm/t-multilib (v8_2_a_simd_variants): Add fp16fml.
1906         * config/arm/unspecs.md (UNSPEC_VFML_LO, UNSPEC_VFML_HI): New unspecs.
1907         * doc/invoke.texi (ARM Options): Document fp16fml.  Update armv8.4-a
1908         documentation.
1909         * doc/sourcebuild.texi (arm_fp16fml_neon_ok, arm_fp16fml_neon):
1910         Document new effective target and option set.
1912 2017-01-11  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
1914         * config/arm/arm-cpus.in (armv8_4): New feature.
1915         (ARMv8_4a): New fgroup.
1916         (armv8.4-a): New arch.
1917         * config/arm/arm-tables.opt: Regenerate.
1918         * config/arm/t-aprofile: Add matching rules for -march=armv8.4-a.
1919         * config/arm/t-arm-elf (all_v8_archs): Add armv8.4-a.
1920         * config/arm/t-multilib (v8_4_a_simd_variants): New variable.
1921         Add matching rules for -march=armv8.4-a and extensions.
1922         * doc/invoke.texi (ARM Options): Document -march=armv8.4-a.
1924 2018-01-11  Oleg Endo  <olegendo@gcc.gnu.org>
1926         PR target/81821
1927         * config/rx/rx.md (BW): New mode attribute.
1928         (sync_lock_test_and_setsi): Add mode suffix to insn output.
1930 2018-01-11  Richard Biener  <rguenther@suse.de>
1932         PR tree-optimization/83435
1933         * graphite.c (canonicalize_loop_form): Ignore fake loop exit edges.
1934         * graphite-scop-detection.c (scop_detection::get_sese): Likewise.
1935         * tree-vrp.c (add_assert_info): Drop TREE_OVERFLOW if they appear.
1937 2018-01-11  Richard Sandiford  <richard.sandiford@linaro.org>
1938             Alan Hayward  <alan.hayward@arm.com>
1939             David Sherwood  <david.sherwood@arm.com>
1941         * config/aarch64/aarch64.c (aarch64_address_info): Add a const_offset
1942         field.
1943         (aarch64_classify_address): Initialize it.  Track polynomial offsets.
1944         (aarch64_print_address_internal): Use it to check for a zero offset.
1946 2018-01-11  Richard Sandiford  <richard.sandiford@linaro.org>
1947             Alan Hayward  <alan.hayward@arm.com>
1948             David Sherwood  <david.sherwood@arm.com>
1950         * config/aarch64/aarch64-modes.def (NUM_POLY_INT_COEFFS): Set to 2.
1951         * config/aarch64/aarch64-protos.h (aarch64_initial_elimination_offset):
1952         Return a poly_int64 rather than a HOST_WIDE_INT.
1953         (aarch64_offset_7bit_signed_scaled_p): Take the offset as a poly_int64
1954         rather than a HOST_WIDE_INT.
1955         * config/aarch64/aarch64.h (aarch64_frame): Protect with
1956         HAVE_POLY_INT_H rather than HOST_WIDE_INT.  Change locals_offset,
1957         hard_fp_offset, frame_size, initial_adjust, callee_offset and
1958         final_offset from HOST_WIDE_INT to poly_int64.
1959         * config/aarch64/aarch64-builtins.c (aarch64_simd_expand_args): Use
1960         to_constant when getting the number of units in an Advanced SIMD
1961         mode.
1962         (aarch64_builtin_vectorized_function): Check for a constant number
1963         of units.
1964         * config/aarch64/aarch64-simd.md (mov<mode>): Handle polynomial
1965         GET_MODE_SIZE.
1966         (aarch64_ld<VSTRUCT:nregs>_lane<VALLDIF:mode>): Use the nunits
1967         attribute instead of GET_MODE_NUNITS.
1968         * config/aarch64/aarch64.c (aarch64_hard_regno_nregs)
1969         (aarch64_class_max_nregs): Use the constant_lowest_bound of the
1970         GET_MODE_SIZE for fixed-size registers.
1971         (aarch64_const_vec_all_same_in_range_p): Use const_vec_duplicate_p.
1972         (aarch64_hard_regno_call_part_clobbered, aarch64_classify_index)
1973         (aarch64_mode_valid_for_sched_fusion_p, aarch64_classify_address)
1974         (aarch64_legitimize_address_displacement, aarch64_secondary_reload)
1975         (aarch64_print_operand, aarch64_print_address_internal)
1976         (aarch64_address_cost, aarch64_rtx_costs, aarch64_register_move_cost)
1977         (aarch64_short_vector_p, aapcs_vfp_sub_candidate)
1978         (aarch64_simd_attr_length_rglist, aarch64_operands_ok_for_ldpstp):
1979         Handle polynomial GET_MODE_SIZE.
1980         (aarch64_hard_regno_caller_save_mode): Likewise.  Return modes
1981         wider than SImode without modification.
1982         (tls_symbolic_operand_type): Use strip_offset instead of split_const.
1983         (aarch64_pass_by_reference, aarch64_layout_arg, aarch64_pad_reg_upward)
1984         (aarch64_gimplify_va_arg_expr): Assert that we don't yet handle
1985         passing and returning SVE modes.
1986         (aarch64_function_value, aarch64_layout_arg): Use gen_int_mode
1987         rather than GEN_INT.
1988         (aarch64_emit_probe_stack_range): Take the size as a poly_int64
1989         rather than a HOST_WIDE_INT, but call sorry if it isn't constant.
1990         (aarch64_allocate_and_probe_stack_space): Likewise.
1991         (aarch64_layout_frame): Cope with polynomial offsets.
1992         (aarch64_save_callee_saves, aarch64_restore_callee_saves): Take the
1993         start_offset as a poly_int64 rather than a HOST_WIDE_INT.  Track
1994         polynomial offsets.
1995         (offset_9bit_signed_unscaled_p, offset_12bit_unsigned_scaled_p)
1996         (aarch64_offset_7bit_signed_scaled_p): Take the offset as a
1997         poly_int64 rather than a HOST_WIDE_INT.
1998         (aarch64_get_separate_components, aarch64_process_components)
1999         (aarch64_expand_prologue, aarch64_expand_epilogue)
2000         (aarch64_use_return_insn_p): Handle polynomial frame offsets.
2001         (aarch64_anchor_offset): New function, split out from...
2002         (aarch64_legitimize_address): ...here.
2003         (aarch64_builtin_vectorization_cost): Handle polynomial
2004         TYPE_VECTOR_SUBPARTS.
2005         (aarch64_simd_check_vect_par_cnst_half): Handle polynomial
2006         GET_MODE_NUNITS.
2007         (aarch64_simd_make_constant, aarch64_expand_vector_init): Get the
2008         number of elements from the PARALLEL rather than the mode.
2009         (aarch64_shift_truncation_mask): Use GET_MODE_UNIT_BITSIZE
2010         rather than GET_MODE_BITSIZE.
2011         (aarch64_evpc_trn, aarch64_evpc_uzp, aarch64_evpc_ext)
2012         (aarch64_evpc_rev, aarch64_evpc_dup, aarch64_evpc_zip)
2013         (aarch64_expand_vec_perm_const_1): Handle polynomial
2014         d->perm.length () and d->perm elements.
2015         (aarch64_evpc_tbl): Likewise.  Use nelt rather than GET_MODE_NUNITS.
2016         Apply to_constant to d->perm elements.
2017         (aarch64_simd_valid_immediate, aarch64_vec_fpconst_pow_of_2): Handle
2018         polynomial CONST_VECTOR_NUNITS.
2019         (aarch64_move_pointer): Take amount as a poly_int64 rather
2020         than an int.
2021         (aarch64_progress_pointer): Avoid temporary variable.
2022         * config/aarch64/aarch64.md (aarch64_<crc_variant>): Use
2023         the mode attribute instead of GET_MODE.
2025 2018-01-11  Richard Sandiford  <richard.sandiford@linaro.org>
2026             Alan Hayward  <alan.hayward@arm.com>
2027             David Sherwood  <david.sherwood@arm.com>
2029         * config/aarch64/aarch64.c (aarch64_force_temporary): Assert that
2030         x exists before using it.
2031         (aarch64_add_constant_internal): Rename to...
2032         (aarch64_add_offset_1): ...this.  Replace regnum with separate
2033         src and dest rtxes.  Handle the case in which they're different,
2034         including when the offset is zero.  Replace scratchreg with an rtx.
2035         Use 2 additions if there is no spare register into which we can
2036         move a 16-bit constant.
2037         (aarch64_add_constant): Delete.
2038         (aarch64_add_offset): Replace reg with separate src and dest
2039         rtxes.  Take a poly_int64 offset instead of a HOST_WIDE_INT.
2040         Use aarch64_add_offset_1.
2041         (aarch64_add_sp, aarch64_sub_sp): Take the scratch register as
2042         an rtx rather than an int.  Take the delta as a poly_int64
2043         rather than a HOST_WIDE_INT.  Use aarch64_add_offset.
2044         (aarch64_expand_mov_immediate): Update uses of aarch64_add_offset.
2045         (aarch64_expand_prologue): Update calls to aarch64_sub_sp,
2046         aarch64_allocate_and_probe_stack_space and aarch64_add_offset.
2047         (aarch64_expand_epilogue): Update calls to aarch64_add_offset
2048         and aarch64_add_sp.
2049         (aarch64_output_mi_thunk): Use aarch64_add_offset rather than
2050         aarch64_add_constant.
2052 2018-01-11  Richard Sandiford  <richard.sandiford@linaro.org>
2054         * config/aarch64/aarch64.c (aarch64_reinterpret_float_as_int):
2055         Use scalar_float_mode.
2057 2018-01-11  Richard Sandiford  <richard.sandiford@linaro.org>
2059         * config/aarch64/aarch64-simd.md
2060         (aarch64_fml<f16mac1>l<f16quad>_low<mode>): Avoid GET_MODE_NUNITS.
2061         (aarch64_fml<f16mac1>l<f16quad>_high<mode>): Likewise.
2062         (aarch64_fml<f16mac1>l_lane_lowv2sf): Likewise.
2063         (aarch64_fml<f16mac1>l_lane_highv2sf): Likewise.
2064         (aarch64_fml<f16mac1>lq_laneq_lowv4sf): Likewise.
2065         (aarch64_fml<f16mac1>lq_laneq_highv4sf): Likewise.
2066         (aarch64_fml<f16mac1>l_laneq_lowv2sf): Likewise.
2067         (aarch64_fml<f16mac1>l_laneq_highv2sf): Likewise.
2068         (aarch64_fml<f16mac1>lq_lane_lowv4sf): Likewise.
2069         (aarch64_fml<f16mac1>lq_lane_highv4sf): Likewise.
2071 2018-01-11  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
2073         PR target/83514
2074         * config/arm/arm.c (arm_declare_function_name): Set arch_to_print if
2075         targ_options->x_arm_arch_string is non NULL.
2077 2018-01-11  Tamar Christina  <tamar.christina@arm.com>
2079         * config/aarch64/aarch64.h
2080         (AARCH64_FL_FOR_ARCH8_4): Add  AARCH64_FL_DOTPROD.
2082 2018-01-11  Sudakshina Das  <sudi.das@arm.com>
2084         PR target/82096
2085         * expmed.c (emit_store_flag_force): Swap if const op0
2086         and change VOIDmode to mode of op0.
2088 2018-01-11  Richard Sandiford  <richard.sandiford@linaro.org>
2090         PR rtl-optimization/83761
2091         * caller-save.c (replace_reg_with_saved_mem): Pass bits rather
2092         than bytes to mode_for_size.
2094 2018-01-10  Jan Hubicka  <hubicka@ucw.cz>
2096         PR middle-end/83189
2097         * gfortran.fortran-torture/compile/pr83189.f90: New testcase.
2098         * tree-ssa-loop-manip.c (tree_transform_and_unroll_loop): Handle zero
2099         profile.
2101 2018-01-10  Jan Hubicka  <hubicka@ucw.cz>
2103         PR middle-end/83575
2104         * cfgrtl.c (rtl_verify_edges): Only verify fixability of partition
2105         when in layout mode.
2106         (cfg_layout_finalize): Do not verify cfg before we are out of layout.
2107         * cfgcleanup.c (try_optimize_cfg): Only verify flow info when doing
2108         partition fixup.
2110 2018-01-10  Michael Collison  <michael.collison@arm.com>
2112         * config/aarch64/aarch64-modes.def (V2HF): New VECTOR_MODE.
2113         * config/aarch64/aarch64-option-extension.def: Add
2114         AARCH64_OPT_EXTENSION of 'fp16fml'.
2115         * config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins):
2116         (__ARM_FEATURE_FP16_FML): Define if TARGET_F16FML is true.
2117         * config/aarch64/predicates.md (aarch64_lane_imm3): New predicate.
2118         * config/aarch64/constraints.md (Ui7): New constraint.
2119         * config/aarch64/iterators.md (VFMLA_W): New mode iterator.
2120         (VFMLA_SEL_W): Ditto.
2121         (f16quad): Ditto.
2122         (f16mac1): Ditto.
2123         (VFMLA16_LOW): New int iterator.
2124         (VFMLA16_HIGH): Ditto.
2125         (UNSPEC_FMLAL): New unspec.
2126         (UNSPEC_FMLSL): Ditto.
2127         (UNSPEC_FMLAL2): Ditto.
2128         (UNSPEC_FMLSL2): Ditto.
2129         (f16mac): New code attribute.
2130         * config/aarch64/aarch64-simd-builtins.def
2131         (aarch64_fmlal_lowv2sf): Ditto.
2132         (aarch64_fmlsl_lowv2sf): Ditto.
2133         (aarch64_fmlalq_lowv4sf): Ditto.
2134         (aarch64_fmlslq_lowv4sf): Ditto.
2135         (aarch64_fmlal_highv2sf): Ditto.
2136         (aarch64_fmlsl_highv2sf): Ditto.
2137         (aarch64_fmlalq_highv4sf): Ditto.
2138         (aarch64_fmlslq_highv4sf): Ditto.
2139         (aarch64_fmlal_lane_lowv2sf): Ditto.
2140         (aarch64_fmlsl_lane_lowv2sf): Ditto.
2141         (aarch64_fmlal_laneq_lowv2sf): Ditto.
2142         (aarch64_fmlsl_laneq_lowv2sf): Ditto.
2143         (aarch64_fmlalq_lane_lowv4sf): Ditto.
2144         (aarch64_fmlsl_lane_lowv4sf): Ditto.
2145         (aarch64_fmlalq_laneq_lowv4sf): Ditto.
2146         (aarch64_fmlsl_laneq_lowv4sf): Ditto.
2147         (aarch64_fmlal_lane_highv2sf): Ditto.
2148         (aarch64_fmlsl_lane_highv2sf): Ditto.
2149         (aarch64_fmlal_laneq_highv2sf): Ditto.
2150         (aarch64_fmlsl_laneq_highv2sf): Ditto.
2151         (aarch64_fmlalq_lane_highv4sf): Ditto.
2152         (aarch64_fmlsl_lane_highv4sf): Ditto.
2153         (aarch64_fmlalq_laneq_highv4sf): Ditto.
2154         (aarch64_fmlsl_laneq_highv4sf): Ditto.
2155         * config/aarch64/aarch64-simd.md:
2156         (aarch64_fml<f16mac1>l<f16quad>_low<mode>): New pattern.
2157         (aarch64_fml<f16mac1>l<f16quad>_high<mode>): Ditto.
2158         (aarch64_simd_fml<f16mac1>l<f16quad>_low<mode>): Ditto.
2159         (aarch64_simd_fml<f16mac1>l<f16quad>_high<mode>): Ditto.
2160         (aarch64_fml<f16mac1>l_lane_lowv2sf): Ditto.
2161         (aarch64_fml<f16mac1>l_lane_highv2sf): Ditto.
2162         (aarch64_simd_fml<f16mac>l_lane_lowv2sf): Ditto.
2163         (aarch64_simd_fml<f16mac>l_lane_highv2sf): Ditto.
2164         (aarch64_fml<f16mac1>lq_laneq_lowv4sf): Ditto.
2165         (aarch64_fml<f16mac1>lq_laneq_highv4sf): Ditto.
2166         (aarch64_simd_fml<f16mac>lq_laneq_lowv4sf): Ditto.
2167         (aarch64_simd_fml<f16mac>lq_laneq_highv4sf): Ditto.
2168         (aarch64_fml<f16mac1>l_laneq_lowv2sf): Ditto.
2169         (aarch64_fml<f16mac1>l_laneq_highv2sf): Ditto.
2170         (aarch64_simd_fml<f16mac>l_laneq_lowv2sf): Ditto.
2171         (aarch64_simd_fml<f16mac>l_laneq_highv2sf): Ditto.
2172         (aarch64_fml<f16mac1>lq_lane_lowv4sf): Ditto.
2173         (aarch64_fml<f16mac1>lq_lane_highv4sf): Ditto.
2174         (aarch64_simd_fml<f16mac>lq_lane_lowv4sf): Ditto.
2175         (aarch64_simd_fml<f16mac>lq_lane_highv4sf): Ditto.
2176         * config/aarch64/arm_neon.h (vfmlal_low_u32): New intrinsic.
2177         (vfmlsl_low_u32): Ditto.
2178         (vfmlalq_low_u32): Ditto.
2179         (vfmlslq_low_u32): Ditto.
2180         (vfmlal_high_u32): Ditto.
2181         (vfmlsl_high_u32): Ditto.
2182         (vfmlalq_high_u32): Ditto.
2183         (vfmlslq_high_u32): Ditto.
2184         (vfmlal_lane_low_u32): Ditto.
2185         (vfmlsl_lane_low_u32): Ditto.
2186         (vfmlal_laneq_low_u32): Ditto.
2187         (vfmlsl_laneq_low_u32): Ditto.
2188         (vfmlalq_lane_low_u32): Ditto.
2189         (vfmlslq_lane_low_u32): Ditto.
2190         (vfmlalq_laneq_low_u32): Ditto.
2191         (vfmlslq_laneq_low_u32): Ditto.
2192         (vfmlal_lane_high_u32): Ditto.
2193         (vfmlsl_lane_high_u32): Ditto.
2194         (vfmlal_laneq_high_u32): Ditto.
2195         (vfmlsl_laneq_high_u32): Ditto.
2196         (vfmlalq_lane_high_u32): Ditto.
2197         (vfmlslq_lane_high_u32): Ditto.
2198         (vfmlalq_laneq_high_u32): Ditto.
2199         (vfmlslq_laneq_high_u32): Ditto.
2200         * config/aarch64/aarch64.h (AARCH64_FL_F16SML): New flag.
2201         (AARCH64_FL_FOR_ARCH8_4): New.
2202         (AARCH64_ISA_F16FML): New ISA flag.
2203         (TARGET_F16FML): New feature flag for fp16fml.
2204         (doc/invoke.texi): Document new fp16fml option.
2206 2018-01-10  Michael Collison  <michael.collison@arm.com>
2208         * config/aarch64/aarch64-builtins.c:
2209         (aarch64_types_ternopu_imm_qualifiers, TYPES_TERNOPUI): New.
2210         * config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins):
2211         (__ARM_FEATURE_SHA3): Define if TARGET_SHA3 is true.
2212         * config/aarch64/aarch64.h (AARCH64_FL_SHA3): New flags.
2213         (AARCH64_ISA_SHA3): New ISA flag.
2214         (TARGET_SHA3): New feature flag for sha3.
2215         * config/aarch64/iterators.md (sha512_op): New int attribute.
2216         (CRYPTO_SHA512): New int iterator.
2217         (UNSPEC_SHA512H): New unspec.
2218         (UNSPEC_SHA512H2): Ditto.
2219         (UNSPEC_SHA512SU0): Ditto.
2220         (UNSPEC_SHA512SU1): Ditto.
2221         * config/aarch64/aarch64-simd-builtins.def
2222         (aarch64_crypto_sha512hqv2di): New builtin.
2223         (aarch64_crypto_sha512h2qv2di): Ditto.
2224         (aarch64_crypto_sha512su0qv2di): Ditto.
2225         (aarch64_crypto_sha512su1qv2di): Ditto.
2226         (aarch64_eor3qv8hi): Ditto.
2227         (aarch64_rax1qv2di): Ditto.
2228         (aarch64_xarqv2di): Ditto.
2229         (aarch64_bcaxqv8hi): Ditto.
2230         * config/aarch64/aarch64-simd.md:
2231         (aarch64_crypto_sha512h<sha512_op>qv2di): New pattern.
2232         (aarch64_crypto_sha512su0qv2di): Ditto.
2233         (aarch64_crypto_sha512su1qv2di): Ditto.
2234         (aarch64_eor3qv8hi): Ditto.
2235         (aarch64_rax1qv2di): Ditto.
2236         (aarch64_xarqv2di): Ditto.
2237         (aarch64_bcaxqv8hi): Ditto.
2238         * config/aarch64/arm_neon.h (vsha512hq_u64): New intrinsic.
2239         (vsha512h2q_u64): Ditto.
2240         (vsha512su0q_u64): Ditto.
2241         (vsha512su1q_u64): Ditto.
2242         (veor3q_u16): Ditto.
2243         (vrax1q_u64): Ditto.
2244         (vxarq_u64): Ditto.
2245         (vbcaxq_u16): Ditto.
2246         * config/arm/types.md (crypto_sha512): New type attribute.
2247         (crypto_sha3): Ditto.
2248         (doc/invoke.texi): Document new sha3 option.
2250 2018-01-10  Michael Collison  <michael.collison@arm.com>
2252         * config/aarch64/aarch64-builtins.c:
2253         (aarch64_types_quadopu_imm_qualifiers, TYPES_QUADOPUI): New.
2254         * config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins):
2255         (__ARM_FEATURE_SM3): Define if TARGET_SM4 is true.
2256         (__ARM_FEATURE_SM4): Define if TARGET_SM4 is true.
2257         * config/aarch64/aarch64.h (AARCH64_FL_SM4): New flags.
2258         (AARCH64_ISA_SM4): New ISA flag.
2259         (TARGET_SM4): New feature flag for sm4.
2260         * config/aarch64/aarch64-simd-builtins.def
2261         (aarch64_sm3ss1qv4si): Ditto.
2262         (aarch64_sm3tt1aq4si): Ditto.
2263         (aarch64_sm3tt1bq4si): Ditto.
2264         (aarch64_sm3tt2aq4si): Ditto.
2265         (aarch64_sm3tt2bq4si): Ditto.
2266         (aarch64_sm3partw1qv4si): Ditto.
2267         (aarch64_sm3partw2qv4si): Ditto.
2268         (aarch64_sm4eqv4si): Ditto.
2269         (aarch64_sm4ekeyqv4si): Ditto.
2270         * config/aarch64/aarch64-simd.md:
2271         (aarch64_sm3ss1qv4si): Ditto.
2272         (aarch64_sm3tt<sm3tt_op>qv4si): Ditto.
2273         (aarch64_sm3partw<sm3part_op>qv4si): Ditto.
2274         (aarch64_sm4eqv4si): Ditto.
2275         (aarch64_sm4ekeyqv4si): Ditto.
2276         * config/aarch64/iterators.md (sm3tt_op): New int iterator.
2277         (sm3part_op): Ditto.
2278         (CRYPTO_SM3TT): Ditto.
2279         (CRYPTO_SM3PART): Ditto.
2280         (UNSPEC_SM3SS1): New unspec.
2281         (UNSPEC_SM3TT1A): Ditto.
2282         (UNSPEC_SM3TT1B): Ditto.
2283         (UNSPEC_SM3TT2A): Ditto.
2284         (UNSPEC_SM3TT2B): Ditto.
2285         (UNSPEC_SM3PARTW1): Ditto.
2286         (UNSPEC_SM3PARTW2): Ditto.
2287         (UNSPEC_SM4E): Ditto.
2288         (UNSPEC_SM4EKEY): Ditto.
2289         * config/aarch64/constraints.md (Ui2): New constraint.
2290         * config/aarch64/predicates.md (aarch64_imm2): New predicate.
2291         * config/arm/types.md (crypto_sm3): New type attribute.
2292         (crypto_sm4): Ditto.
2293         * config/aarch64/arm_neon.h (vsm3ss1q_u32): New intrinsic.
2294         (vsm3tt1aq_u32): Ditto.
2295         (vsm3tt1bq_u32): Ditto.
2296         (vsm3tt2aq_u32): Ditto.
2297         (vsm3tt2bq_u32): Ditto.
2298         (vsm3partw1q_u32): Ditto.
2299         (vsm3partw2q_u32): Ditto.
2300         (vsm4eq_u32): Ditto.
2301         (vsm4ekeyq_u32): Ditto.
2302         (doc/invoke.texi): Document new sm4 option.
2304 2018-01-10  Michael Collison  <michael.collison@arm.com>
2306         * config/aarch64/aarch64-arches.def (armv8.4-a): New architecture.
2307         * config/aarch64/aarch64.h (AARCH64_ISA_V8_4): New ISA flag.
2308         (AARCH64_FL_FOR_ARCH8_4): New.
2309         (AARCH64_FL_V8_4): New flag.
2310         (doc/invoke.texi): Document new armv8.4-a option.
2312 2018-01-10  Michael Collison  <michael.collison@arm.com>
2314         * config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins):
2315         (__ARM_FEATURE_AES): Define if TARGET_AES is true.
2316         (__ARM_FEATURE_SHA2): Define if TARGET_SHA2 is true.
2317         * config/aarch64/aarch64-option-extension.def: Add
2318         AARCH64_OPT_EXTENSION of 'sha2'.
2319         (aes): Add AARCH64_OPT_EXTENSION of 'aes'.
2320         (crypto): Disable sha2 and aes if crypto disabled.
2321         (crypto): Enable aes and sha2 if enabled.
2322         (simd): Disable sha2 and aes if simd disabled.
2323         * config/aarch64/aarch64.h (AARCH64_FL_AES, AARCH64_FL_SHA2):
2324         New flags.
2325         (AARCH64_ISA_AES, AARCH64_ISA_SHA2): New ISA flags.
2326         (TARGET_SHA2): New feature flag for sha2.
2327         (TARGET_AES): New feature flag for aes.
2328         * config/aarch64/aarch64-simd.md:
2329         (aarch64_crypto_aes<aes_op>v16qi): Make pattern
2330         conditional on TARGET_AES.
2331         (aarch64_crypto_aes<aesmc_op>v16qi): Ditto.
2332         (aarch64_crypto_sha1hsi): Make pattern conditional
2333         on TARGET_SHA2.
2334         (aarch64_crypto_sha1hv4si): Ditto.
2335         (aarch64_be_crypto_sha1hv4si): Ditto.
2336         (aarch64_crypto_sha1su1v4si): Ditto.
2337         (aarch64_crypto_sha1<sha1_op>v4si): Ditto.
2338         (aarch64_crypto_sha1su0v4si): Ditto.
2339         (aarch64_crypto_sha256h<sha256_op>v4si): Ditto.
2340         (aarch64_crypto_sha256su0v4si): Ditto.
2341         (aarch64_crypto_sha256su1v4si): Ditto.
2342         (doc/invoke.texi): Document new aes and sha2 options.
2344 2018-01-10  Martin Sebor  <msebor@redhat.com>
2346         PR tree-optimization/83781
2347         * gimple-fold.c (get_range_strlen): Avoid treating arrays of pointers
2348         as string arrays.
2350 2018-01-11  Martin Sebor  <msebor@gmail.com>
2351             Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
2353         PR tree-optimization/83501
2354         PR tree-optimization/81703
2356         * tree-ssa-strlen.c (get_string_cst): Rename...
2357         (get_string_len): ...to this.  Handle global constants.
2358         (handle_char_store): Adjust.
2360 2018-01-10  Kito Cheng  <kito.cheng@gmail.com>
2361             Jim Wilson  <jimw@sifive.com>
2363         * config/riscv/riscv-protos.h (riscv_output_return): New.
2364         * config/riscv/riscv.c (struct machine_function): New naked_p field.
2365         (riscv_attribute_table, riscv_output_return),
2366         (riscv_handle_fndecl_attribute, riscv_naked_function_p),
2367         (riscv_allocate_stack_slots_for_args, riscv_warn_func_return): New.
2368         (riscv_compute_frame_info): Only compute frame->mask if not a naked
2369         function.
2370         (riscv_expand_prologue): Add early return for naked function.
2371         (riscv_expand_epilogue): Likewise.
2372         (riscv_function_ok_for_sibcall): Return false for naked function.
2373         (riscv_set_current_function): New.
2374         (TARGET_SET_CURRENT_FUNCTION, TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS),
2375         (TARGET_ATTRIBUTE_TABLE, TARGET_WARN_FUNC_RETURN): New.
2376         * config/riscv/riscv.md (simple_return): Call riscv_output_return.
2377         * doc/extend.texi (RISC-V Function Attributes): New.
2379 2018-01-10  Michael Meissner  <meissner@linux.vnet.ibm.com>
2381         * config/rs6000/rs6000.c (is_complex_IBM_long_double): Explicitly
2382         check for 128-bit long double before checking TCmode.
2383         * config/rs6000/rs6000.h (FLOAT128_IEEE_P): Explicitly check for
2384         128-bit long doubles before checking TFmode or TCmode.
2385         (FLOAT128_IBM_P): Likewise.
2387 2018-01-10  Martin Sebor  <msebor@redhat.com>
2389         PR tree-optimization/83671
2390         * builtins.c (c_strlen): Unconditionally return zero for the empty
2391         string.
2392         Use -Warray-bounds for warnings.
2393         * gimple-fold.c (get_range_strlen): Handle non-constant lengths
2394         for non-constant array indices with COMPONENT_REF, arrays of
2395         arrays, and pointers to arrays.
2396         (gimple_fold_builtin_strlen): Determine and set length range for
2397         non-constant character arrays.
2399 2018-01-10  Aldy Hernandez  <aldyh@redhat.com>
2401         PR middle-end/81897
2402         * tree-ssa-uninit.c (convert_control_dep_chain_into_preds): Skip
2403         empty blocks.
2405 2018-01-10  Eric Botcazou  <ebotcazou@adacore.com>
2407         * dwarf2out.c (dwarf2out_var_location): Do not pass NULL to fprintf.
2409 2018-01-10  Peter Bergner  <bergner@vnet.ibm.com>
2411         PR target/83399
2412         * config/rs6000/rs6000.c (print_operand) <'y'>: Use
2413         VECTOR_MEM_ALTIVEC_OR_VSX_P.
2414         * config/rs6000/vsx.md (*vsx_le_perm_load_<mode> for VSX_D): Use
2415         indexed_or_indirect_operand predicate.
2416         (*vsx_le_perm_load_<mode> for VSX_W): Likewise.
2417         (*vsx_le_perm_load_v8hi): Likewise.
2418         (*vsx_le_perm_load_v16qi): Likewise.
2419         (*vsx_le_perm_store_<mode> for VSX_D): Likewise.
2420         (*vsx_le_perm_store_<mode> for VSX_W): Likewise.
2421         (*vsx_le_perm_store_v8hi): Likewise.
2422         (*vsx_le_perm_store_v16qi): Likewise.
2423         (eight unnamed splitters): Likewise.
2425 2018-01-10  Peter Bergner  <bergner@vnet.ibm.com>
2427         * config/rs6000/x86intrin.h: Change #warning to #error. Update message.
2428         * config/rs6000/emmintrin.h: Likewise.
2429         * config/rs6000/mmintrin.h: Likewise.
2430         * config/rs6000/xmmintrin.h: Likewise.
2432 2018-01-10  David Malcolm  <dmalcolm@redhat.com>
2434         PR c++/43486
2435         * tree-core.h: Document EXPR_LOCATION_WRAPPER_P's usage of
2436         "public_flag".
2437         * tree.c (tree_nop_conversion): Return true for location wrapper
2438         nodes.
2439         (maybe_wrap_with_location): New function.
2440         (selftest::check_strip_nops): New function.
2441         (selftest::test_location_wrappers): New function.
2442         (selftest::tree_c_tests): Call it.
2443         * tree.h (STRIP_ANY_LOCATION_WRAPPER): New macro.
2444         (maybe_wrap_with_location): New decl.
2445         (EXPR_LOCATION_WRAPPER_P): New macro.
2446         (location_wrapper_p): New inline function.
2447         (tree_strip_any_location_wrapper): New inline function.
2449 2018-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2451         PR target/83735
2452         * config/i386/i386.c (ix86_compute_frame_layout): Always adjust
2453         stack_realign_offset for the largest alignment of stack slot
2454         actually used.
2455         (ix86_find_max_used_stack_alignment): New function.
2456         (ix86_finalize_stack_frame_flags): Use it.  Set
2457         max_used_stack_alignment if we don't realign stack.
2458         * config/i386/i386.h (machine_function): Add
2459         max_used_stack_alignment.
2461 2018-01-10  Christophe Lyon  <christophe.lyon@linaro.org>
2463         * config/arm/arm.opt (-mbranch-cost): New option.
2464         * config/arm/arm.h (BRANCH_COST): Take arm_branch_cost into
2465         account.
2467 2018-01-10  Segher Boessenkool  <segher@kernel.crashing.org>
2469         PR target/83629
2470         * config/rs6000/rs6000.md (load_toc_v4_PIC_2, load_toc_v4_PIC_3b,
2471         load_toc_v4_PIC_3c): Wrap const term in CONST RTL.
2473 2018-01-10  Richard Biener  <rguenther@suse.de>
2475         PR debug/83765
2476         * dwarf2out.c (gen_subprogram_die): Hoist old_die && declaration
2477         early out so it also covers the case where we have a non-NULL
2478         origin.
2480 2018-01-10  Richard Sandiford  <richard.sandiford@linaro.org>
2482         PR tree-optimization/83753
2483         * tree-vect-stmts.c (get_group_load_store_type): Use VMAT_CONTIGUOUS
2484         for non-strided grouped accesses if the number of elements is 1.
2486 2018-01-10  Jan Hubicka  <hubicka@ucw.cz>
2488         PR target/81616
2489         * i386.c (ix86_vectorize_builtin_gather): Check TARGET_USE_GATHER.
2490         * i386.h (TARGET_USE_GATHER): Define.
2491         * x86-tune.def (X86_TUNE_USE_GATHER): New.
2493 2018-01-10  Martin Liska  <mliska@suse.cz>
2495         PR bootstrap/82831
2496         * basic-block.h (CLEANUP_NO_PARTITIONING): New define.
2497         * bb-reorder.c (pass_reorder_blocks::execute): Do not clean up
2498         partitioning.
2499         * cfgcleanup.c (try_optimize_cfg): Fix up partitioning if
2500         CLEANUP_NO_PARTITIONING is not set.
2502 2018-01-10  Richard Sandiford  <richard.sandiford@linaro.org>
2504         * doc/rtl.texi: Remove documentation of (const ...) wrappers
2505         for vectors, as a partial revert of r254296.
2506         * rtl.h (const_vec_p): Delete.
2507         (const_vec_duplicate_p): Don't test for vector CONSTs.
2508         (unwrap_const_vec_duplicate, const_vec_series_p): Likewise.
2509         * expmed.c (make_tree): Likewise.
2511         Revert:
2512         * common.md (E, F): Use CONSTANT_P instead of checking for
2513         CONST_VECTOR.
2514         * emit-rtl.c (gen_lowpart_common): Use const_vec_p instead of
2515         checking for CONST_VECTOR.
2517 2018-01-09  Jan Hubicka  <hubicka@ucw.cz>
2519         PR middle-end/83575
2520         * predict.c (force_edge_cold): Handle in more sane way edges
2521         with no prediction.
2523 2018-01-09  Carl Love  <cel@us.ibm.com>
2525         * config/rs6002/altivec.md (p8_vmrgow): Add support for V2DI, V2DF,
2526         V4SI, V4SF types.
2527         (p8_vmrgew): Add support for V2DI, V2DF, V4SF types.
2528         * config/rs6000/rs6000-builtin.def: Add definitions for FLOAT2_V2DF,
2529         VMRGEW_V2DI, VMRGEW_V2DF, VMRGEW_V4SF, VMRGOW_V4SI, VMRGOW_V4SF,
2530         VMRGOW_V2DI, VMRGOW_V2DF.  Remove definition for VMRGOW.
2531         * config/rs6000/rs6000-c.c (VSX_BUILTIN_VEC_FLOAT2,
2532         P8V_BUILTIN_VEC_VMRGEW, P8V_BUILTIN_VEC_VMRGOW):  Add definitions.
2533         * config/rs6000/rs6000-protos.h: Add extern defition for
2534         rs6000_generate_float2_double_code.
2535         * config/rs6000/rs6000.c (rs6000_generate_float2_double_code): Add
2536         function.
2537         * config/rs6000/vsx.md (vsx_xvcdpsp): Add define_insn.
2538         (float2_v2df): Add define_expand.
2540 2018-01-09  Uros Bizjak  <ubizjak@gmail.com>
2542         PR target/83628
2543         * combine.c (force_int_to_mode) <case ASHIFT>: Use mode instead of
2544         op_mode in the force_to_mode call.
2546 2018-01-09  Richard Sandiford  <richard.sandiford@linaro.org>
2548         * config/aarch64/aarch64.c (aarch64_evpc_trn): Use d.perm.series_p
2549         instead of checking each element individually.
2550         (aarch64_evpc_uzp): Likewise.
2551         (aarch64_evpc_zip): Likewise.
2552         (aarch64_evpc_ext): Likewise.
2553         (aarch64_evpc_rev): Likewise.
2554         (aarch64_evpc_dup): Test the encoding for a single duplicated element,
2555         instead of checking each element individually.  Return true without
2556         generating rtl if
2557         (aarch64_vectorize_vec_perm_const): Use all_from_input_p to test
2558         whether all selected elements come from the same input, instead of
2559         checking each element individually.  Remove calls to gen_rtx_REG,
2560         start_sequence and end_sequence and instead assert that no rtl is
2561         generated.
2563 2018-01-09  Richard Sandiford  <richard.sandiford@linaro.org>
2565         * config/aarch64/aarch64.c (aarch64_legitimate_constant_p): Fix
2566         order of HIGH and CONST checks.
2568 2018-01-09  Richard Sandiford  <richard.sandiford@linaro.org>
2570         * tree-vect-stmts.c (permute_vec_elements): Create a fresh variable
2571         if the destination isn't an SSA_NAME.
2573 2018-01-09  Richard Biener  <rguenther@suse.de>
2575         PR tree-optimization/83668
2576         * graphite.c (canonicalize_loop_closed_ssa): Add edge argument,
2577         move prologue...
2578         (canonicalize_loop_form): ... here, renamed from ...
2579         (canonicalize_loop_closed_ssa_form): ... this and amended to
2580         swap successor edges for loop exit blocks to make us use
2581         the RPO order we need for initial schedule generation.
2583 2018-01-09  Joseph Myers  <joseph@codesourcery.com>
2585         PR tree-optimization/64811
2586         * match.pd: When optimizing comparisons with Inf, avoid
2587         introducing or losing exceptions from comparisons with NaN.
2589 2018-01-09  Martin Liska  <mliska@suse.cz>
2591         PR sanitizer/82517
2592         * asan.c (shadow_mem_size): Add gcc_assert.
2594 2018-01-09  Georg-Johann Lay  <avr@gjlay.de>
2596         Don't save registers in main().
2598         PR target/83738
2599         * doc/invoke.texi (AVR Options) [-mmain-is-OS_task]: Document it.
2600         * config/avr/avr.opt (-mmain-is-OS_task): New target option.
2601         * config/avr/avr.c (avr_set_current_function): Don't error if
2602         naked, OS_task or OS_main are specified at the same time.
2603         (avr_function_ok_for_sibcall): Don't disable sibcalls for OS_task,
2604         OS_main.
2605         (avr_insert_attributes) [-mmain-is-OS_task] <main>: Add OS_task
2606         attribute.
2607         * common/config/avr/avr-common.c (avr_option_optimization_table):
2608         Switch on -mmain-is-OS_task for optimizing compilations.
2610 2018-01-09  Richard Biener  <rguenther@suse.de>
2612         PR tree-optimization/83572
2613         * graphite.c: Include cfganal.h.
2614         (graphite_transform_loops): Connect infinite loops to exit
2615         and remove fake edges at the end.
2617 2018-01-09  Jan Hubicka  <hubicka@ucw.cz>
2619         * ipa-inline.c (edge_badness): Revert accidental checkin.
2621 2018-01-09  Jan Hubicka  <hubicka@ucw.cz>
2623         PR ipa/80763
2624         * ipa-comdats.c (set_comdat_group): Only set comdat group of real
2625         symbols; not inline clones.
2627 2018-01-09  Jakub Jelinek  <jakub@redhat.com>
2629         PR target/83507
2630         * modulo-sched.c (schedule_reg_moves): Punt if we'd need to move
2631         hard registers.  Formatting fixes.
2633         PR preprocessor/83722
2634         * gcc.c (try_generate_repro): Pass
2635         &temp_stderr_files[RETRY_ICE_ATTEMPTS - 1] rather than
2636         &temp_stdout_files[RETRY_ICE_ATTEMPTS - 1] as last argument to
2637         do_report_bug.
2639 2018-01-08  Monk Chiang  <sh.chiang04@gmail.com>
2640             Kito Cheng  <kito.cheng@gmail.com>
2642         * config/riscv/riscv.c (machine_function::is_leaf): Remove field.
2643         (riscv_leaf_function_p): Delete.
2644         (riscv_function_ok_for_sibcall): Return false when TARGET_SAVE_RESTORE.
2646 2018-01-08  Aaron Sawdey  <acsawdey@linux.vnet.ibm.com>
2648         * config/rs6000/rs6000-string.c (do_load_for_compare_from_addr): New
2649         function.
2650         (do_ifelse): New function.
2651         (do_isel): New function.
2652         (do_sub3): New function.
2653         (do_add3): New function.
2654         (do_load_mask_compare): New function.
2655         (do_overlap_load_compare): New function.
2656         (expand_compare_loop): New function.
2657         (expand_block_compare): Call expand_compare_loop() when appropriate.
2658         * config/rs6000/rs6000.opt (-mblock-compare-inline-limit): Change
2659         option description.
2660         (-mblock-compare-inline-loop-limit): New option.
2662 2018-01-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
2664         PR target/83677
2665         * config/rs6000/altivec.md (*altivec_vpermr_<mode>_internal):
2666         Reverse order of second and third operands in first alternative.
2667         * config/rs6000/rs6000.c (rs6000_expand_vector_set): Reverse order
2668         of first and second elements in UNSPEC_VPERMR vector.
2669         (altivec_expand_vec_perm_le): Likewise.
2671 2017-01-08  Jeff Law  <law@redhat.com>
2673         PR rtl-optimizatin/81308
2674         * tree-switch-conversion.c (cfg_altered): New file scoped static.
2675         (process_switch): If group_case_labels makes a change, then set
2676         cfg_altered.
2677         (pass_convert_switch::execute): If a switch is converted, then
2678         set cfg_altered.  Return TODO_cfg_cleanup if cfg_altered is true.
2680         PR rtl-optimization/81308
2681         * recog.c (split_all_insns): Conditionally cleanup the CFG after
2682         splitting insns.
2684 2018-01-08  Vidya Praveen  <vidyapraveen@arm.com>
2686         PR target/83663 - Revert r255946
2687         * config/aarch64/aarch64.c (aarch64_expand_vector_init): Modify code
2688         generation for cases where splatting a value is not useful.
2689         * simplify-rtx.c (simplify_ternary_operation): Simplify vec_merge
2690         across a vec_duplicate and a paradoxical subreg forming a vector
2691         mode to a vec_concat.
2693 2018-01-08  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
2695         * config/arm/t-aprofile (MULTILIB_MATCHES): Add mapping rules for
2696         -march=armv8.3-a variants.
2697         * config/arm/t-multilib: Likewise.
2698         * config/arm/t-arm-elf: Likewise.  Handle dotprod extension.
2700 2018-01-08  Aaron Sawdey  <acsawdey@linux.vnet.ibm.com>
2702         * config/rs6000/rs6000.md (cceq_ior_compare): Remove * so I can use it
2703         to generate rtl.
2704         (cceq_ior_compare_complement): Give it a name so I can use it, and
2705         change boolean_or_operator predicate to boolean_operator so it can
2706         be used to generate a crand.
2707         (eqne): New code iterator.
2708         (bd/bd_neg): New code_attrs.
2709         (<bd>_<mode>): New name for ctr<mode>_internal[12] now combined into
2710         a single define_insn.
2711         (<bd>tf_<mode>): A new insn pattern for the conditional form branch
2712         decrement (bdnzt/bdnzf/bdzt/bdzf).
2713         * config/rs6000/rs6000.c (rs6000_legitimate_combined_insn): Updated
2714         with the new names of the branch decrement patterns, and added the
2715         names of the branch decrement conditional patterns.
2717 2018-01-08  Richard Biener  <rguenther@suse.de>
2719         PR tree-optimization/83563
2720         * graphite.c (canonicalize_loop_closed_ssa_form): Reset the SCEV
2721         cache.
2723 2018-01-08  Richard Biener  <rguenther@suse.de>
2725         PR middle-end/83713
2726         * convert.c (do_narrow): Properly guard TYPE_OVERFLOW_WRAPS checks.
2728 2018-01-08  Richard Biener  <rguenther@suse.de>
2730         PR tree-optimization/83685
2731         * tree-ssa-pre.c (create_expression_by_pieces): Do not insert
2732         references to abnormals.
2734 2018-01-08  Richard Biener  <rguenther@suse.de>
2736         PR lto/83719
2737         * dwarf2out.c (output_indirect_strings): Handle empty
2738         skeleton_debug_str_hash.
2739         (dwarf2out_early_finish): Index strings for -gsplit-dwarf.
2741 2018-01-08  Claudiu Zissulescu  <claziss@synopsys.com>
2743         * config/arc/arc.c (TARGET_TRAMPOLINE_ADJUST_ADDRESS): Delete.
2744         (emit_store_direct): Likewise.
2745         (arc_trampoline_adjust_address): Likewise.
2746         (arc_asm_trampoline_template): New function.
2747         (arc_initialize_trampoline): Use asm_trampoline_template.
2748         (TARGET_ASM_TRAMPOLINE_TEMPLATE): Define.
2749         * config/arc/arc.h (TRAMPOLINE_SIZE): Adjust to 16.
2750         * config/arc/arc.md (flush_icache): Delete pattern.
2752 2018-01-08  Claudiu Zissulescu  <claziss@synopsys.com>
2754         * config/arc/arc-c.def (__ARC_UNALIGNED__): New define.
2755         * config/arc/arc.h (STRICT_ALIGNMENT): Control this macro using
2756         munaligned-access.
2758 2018-01-08  Sebastian Huber  <sebastian.huber@embedded-brains.de>
2760         PR target/83681
2761         * config/epiphany/epiphany.h (make_pass_mode_switch_use): Guard
2762         by not USED_FOR_TARGET.
2763         (make_pass_resolve_sw_modes): Likewise.
2765 2018-01-08  Sebastian Huber  <sebastian.huber@embedded-brains.de>
2767         * config/nios2/nios2.h (nios2_section_threshold): Guard by not
2768         USED_FOR_TARGET.
2770 2018-01-08  Richard Biener  <rguenther@suse.de>
2772         PR middle-end/83580
2773         * tree-data-ref.c (split_constant_offset): Remove STRIP_NOPS.
2775 2018-01-08  Richard Biener  <rguenther@suse.de>
2777         PR middle-end/83517
2778         * match.pd ((t * 2) / 2) -> t): Add missing :c.
2780 2018-01-06  Aldy Hernandez  <aldyh@redhat.com>
2782         PR middle-end/81897
2783         * tree-ssa-uninit.c (compute_control_dep_chain): Do not bail on
2784         basic blocks with a small number of successors.
2785         (convert_control_dep_chain_into_preds): Improve handling of
2786         forwarder blocks.
2787         (dump_predicates): Split apart into...
2788         (dump_pred_chain): ...here...
2789         (dump_pred_info): ...and here.
2790         (can_one_predicate_be_invalidated_p): Add debugging printfs.
2791         (can_chain_union_be_invalidated_p): Improve check for invalidation
2792         of paths.
2793         (uninit_uses_cannot_happen): Avoid unnecessary if
2794         convert_control_dep_chain_into_preds yielded nothing.
2796 2018-01-06  Martin Sebor  <msebor@redhat.com>
2798         PR tree-optimization/83640
2799         * gimple-ssa-warn-restrict.c (builtin_access::builtin_access): Avoid
2800         subtracting negative offset from size.
2801         (builtin_access::overlap): Adjust offset bounds of the access to fall
2802         within the size of the object if possible.
2804 2018-01-06  Richard Sandiford  <richard.sandiford@linaro.org>
2806         PR rtl-optimization/83699
2807         * expmed.c (extract_bit_field_1): Restrict the vector usage of
2808         extract_bit_field_as_subreg to cases in which the extracted
2809         value is also a vector.
2811         * lra-constraints.c (process_alt_operands): Test for the equivalence
2812         substitutions when detecting a possible reload cycle.
2814 2018-01-06  Jakub Jelinek  <jakub@redhat.com>
2816         PR debug/83480
2817         * toplev.c (process_options): Don't enable debug_nonbind_markers_p
2818         by default if flag_selective_schedling{,2}.  Formatting fixes.
2820         PR rtl-optimization/83682
2821         * rtl.h (const_vec_duplicate_p): Only return true for VEC_DUPLICATE
2822         if it has non-VECTOR_MODE element mode.
2823         (vec_duplicate_p): Likewise.
2825         PR middle-end/83694
2826         * cfgexpand.c (expand_debug_expr): Punt if mode1 is VOIDmode
2827         and bitsize might be greater than MAX_BITSIZE_MODE_ANY_INT.
2829 2018-01-05  Jakub Jelinek  <jakub@redhat.com>
2831         PR target/83604
2832         * config/i386/i386-builtin.def
2833         (__builtin_ia32_vgf2p8affineinvqb_v64qi,
2834         __builtin_ia32_vgf2p8affineqb_v64qi, __builtin_ia32_vgf2p8mulb_v64qi):
2835         Require also OPTION_MASK_ISA_AVX512F in addition to
2836         OPTION_MASK_ISA_GFNI.
2837         (__builtin_ia32_vgf2p8affineinvqb_v16qi_mask,
2838         __builtin_ia32_vgf2p8affineqb_v16qi_mask): Require
2839         OPTION_MASK_ISA_AVX512VL instead of OPTION_MASK_ISA_SSE in addition
2840         to OPTION_MASK_ISA_GFNI.
2841         (__builtin_ia32_vgf2p8mulb_v32qi_mask): Require
2842         OPTION_MASK_ISA_AVX512VL in addition to OPTION_MASK_ISA_GFNI and
2843         OPTION_MASK_ISA_AVX512BW.
2844         (__builtin_ia32_vgf2p8mulb_v16qi_mask): Require
2845         OPTION_MASK_ISA_AVX512VL instead of OPTION_MASK_ISA_AVX512BW in
2846         addition to OPTION_MASK_ISA_GFNI.
2847         (__builtin_ia32_vgf2p8affineinvqb_v16qi,
2848         __builtin_ia32_vgf2p8affineqb_v16qi, __builtin_ia32_vgf2p8mulb_v16qi):
2849         Require OPTION_MASK_ISA_SSE2 instead of OPTION_MASK_ISA_SSE in addition
2850         to OPTION_MASK_ISA_GFNI.
2851         * config/i386/i386.c (def_builtin): Change to builtin isa/isa2 being
2852         a requirement for all ISAs rather than any of them with a few
2853         exceptions.
2854         (ix86_add_new_builtins): Clear OPTION_MASK_ISA_64BIT from isa before
2855         processing.
2856         (ix86_expand_builtin): Require all ISAs from builtin's isa and isa2
2857         bitmasks to be enabled with 3 exceptions, instead of requiring any
2858         enabled ISA with lots of exceptions.
2859         * config/i386/sse.md (vgf2p8affineinvqb_<mode><mask_name>,
2860         vgf2p8affineqb_<mode><mask_name>, vgf2p8mulb_<mode><mask_name>):
2861         Change avx512bw in isa attribute to avx512f.
2862         * config/i386/sgxintrin.h: Add license boilerplate.
2863         * config/i386/vaesintrin.h: Likewise.  Fix macro spelling __AVX512F
2864         to __AVX512F__ and __AVX512VL to __AVX512VL__.
2865         (_mm256_aesdec_epi128, _mm256_aesdeclast_epi128, _mm256_aesenc_epi128,
2866         _mm256_aesenclast_epi128): Enable temporarily avx if __AVX__ is not
2867         defined.
2868         * config/i386/gfniintrin.h (_mm_gf2p8mul_epi8,
2869         _mm_gf2p8affineinv_epi64_epi8, _mm_gf2p8affine_epi64_epi8): Enable
2870         temporarily sse2 rather than sse if not enabled already.
2872         PR target/83604
2873         * config/i386/sse.md (VI248_VLBW): Rename to ...
2874         (VI248_AVX512VL): ... this.  Don't guard V32HI with TARGET_AVX512BW.
2875         (vpshrd_<mode><mask_name>, vpshld_<mode><mask_name>,
2876         vpshrdv_<mode>, vpshrdv_<mode>_mask, vpshrdv_<mode>_maskz,
2877         vpshrdv_<mode>_maskz_1, vpshldv_<mode>, vpshldv_<mode>_mask,
2878         vpshldv_<mode>_maskz, vpshldv_<mode>_maskz_1): Use VI248_AVX512VL
2879         mode iterator instead of VI248_VLBW.
2881 2018-01-05  Jan Hubicka  <hubicka@ucw.cz>
2883         * ipa-fnsummary.c (record_modified_bb_info): Add OP.
2884         (record_modified): Skip clobbers; add debug output.
2885         (param_change_prob): Use sreal frequencies.
2887 2018-01-05  Richard Sandiford  <richard.sandiford@linaro.org>
2889         * tree-vect-data-refs.c (vect_compute_data_ref_alignment): Don't
2890         punt for user-aligned variables.
2892 2018-01-05  Richard Sandiford  <richard.sandiford@linaro.org>
2894         * tree-chrec.c (chrec_contains_symbols): Return true for
2895         POLY_INT_CST.
2897 2018-01-05  Sudakshina Das  <sudi.das@arm.com>
2899         PR target/82439
2900         * simplify-rtx.c (simplify_relational_operation_1): Add simplifications
2901         of (x|y) == x for BICS pattern.
2903 2018-01-05  Jakub Jelinek  <jakub@redhat.com>
2905         PR tree-optimization/83605
2906         * gimple-ssa-strength-reduction.c: Include tree-eh.h.
2907         (find_candidates_dom_walker::before_dom_children): Ignore stmts that
2908         can throw.
2910 2018-01-05  Sebastian Huber  <sebastian.huber@embedded-brains.de>
2912         * config.gcc (epiphany-*-elf*): Add (epiphany-*-rtems*) configuration.
2913         * config/epiphany/rtems.h: New file.
2915 2018-01-04  Jakub Jelinek  <jakub@redhat.com>
2916             Uros Bizjak  <ubizjak@gmail.com>
2918         PR target/83554
2919         * config/i386/i386.md (*<rotate_insn>hi3_1 splitter): Use
2920         QIreg_operand instead of register_operand predicate.
2921         * config/i386/i386.c (ix86_rop_should_change_byte_p,
2922         set_rop_modrm_reg_bits, ix86_mitigate_rop): Use -mmitigate-rop in
2923         comments instead of -fmitigate[-_]rop.
2925 2018-01-04  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
2927         PR bootstrap/81926
2928         * cgraphunit.c (symbol_table::compile): Switch to text_section
2929         before calling assembly_start debug hook.
2930         * run-rtl-passes.c (run_rtl_passes): Likewise.
2931         Include output.h.
2933 2018-01-04  Richard Sandiford  <richard.sandiford@linaro.org>
2935         * tree-vrp.c (extract_range_from_binary_expr_1): Check
2936         range_int_cst_p rather than !symbolic_range_p before calling
2937         extract_range_from_multiplicative_op_1.
2939 2017-01-04  Jeff Law  <law@redhat.com>
2941         * tree-ssa-math-opts.c (execute_cse_reciprocals_1): Remove
2942         redundant test in assertion.
2944 2018-01-04  Richard Sandiford  <richard.sandiford@linaro.org>
2946         * doc/rtl.texi: Document machine_mode wrapper classes.
2948 2018-01-04  Richard Sandiford  <richard.sandiford@linaro.org>
2950         * fold-const.c (fold_ternary_loc): Check tree_fits_uhwi_p before
2951         using tree_to_uhwi.
2953 2018-01-04  Richard Sandiford  <richard.sandiford@linaro.org>
2955         * tree-ssa-forwprop.c (is_combined_permutation_identity): Allow
2956         the VEC_PERM_EXPR fold to fail.
2958 2018-01-04  Jakub Jelinek  <jakub@redhat.com>
2960         PR debug/83585
2961         * bb-reorder.c (insert_section_boundary_note): Set has_bb_partition
2962         to switched_sections.
2964 2018-01-04  Richard Sandiford  <richard.sandiford@linaro.org>
2966         PR target/83680
2967         * config/arm/arm.c (arm_vectorize_vec_perm_const): Fix inverted
2968         test for d.testing.
2970 2018-01-04  Peter Bergner  <bergner@vnet.ibm.com>
2972         PR target/83387
2973         * config/rs6000/rs6000.c (rs6000_discover_homogeneous_aggregate): Do not
2974         allow arguments in FP registers if TARGET_HARD_FLOAT is false.
2976 2018-01-04  Jakub Jelinek  <jakub@redhat.com>
2978         PR debug/83666
2979         * cfgexpand.c (expand_debug_expr) <case BIT_FIELD_REF>: Punt if mode
2980         is BLKmode and bitpos not zero or mode change is needed.
2982 2018-01-04  Richard Sandiford  <richard.sandiford@linaro.org>
2984         PR target/83675
2985         * config/sparc/sparc.c (sparc_vectorize_vec_perm_const): Require
2986         TARGET_VIS2.
2988 2018-01-04  Uros Bizjak  <ubizjak@gmail.com>
2990         PR target/83628
2991         * config/alpha/alpha.md (*sadd<modesuffix>): Use ASHIFT
2992         instead of MULT rtx.  Update all corresponding splitters.
2993         (*saddl_se): Ditto.
2994         (*ssub<modesuffix>): Ditto.
2995         (*ssubl_se): Ditto.
2996         (*cmp_sadd_di): Update split patterns.
2997         (*cmp_sadd_si): Ditto.
2998         (*cmp_sadd_sidi): Ditto.
2999         (*cmp_ssub_di): Ditto.
3000         (*cmp_ssub_si): Ditto.
3001         (*cmp_ssub_sidi): Ditto.
3002         * config/alpha/predicates.md (const23_operand): New predicate.
3003         * config/alpha/alpha.c (alpha_rtx_costs) [PLUS, MINUS]:
3004         Look for ASHIFT, not MULT inner operand.
3005         (alpha_split_conditional_move): Update for *sadd<modesuffix> change.
3007 2018-01-04  Martin Liska  <mliska@suse.cz>
3009         PR gcov-profile/83669
3010         * gcov.c (output_intermediate_file): Add version to intermediate
3011         gcov file.
3012         * doc/gcov.texi: Document new field 'version' in intermediate
3013         file format. Fix location of '-k' option of gcov command.
3015 2018-01-04  Martin Liska  <mliska@suse.cz>
3017         PR ipa/82352
3018         * ipa-icf.c (sem_function::merge): Do not cross comdat boundary.
3020 2018-01-04  Jakub Jelinek  <jakub@redhat.com>
3022         * gimple-ssa-sprintf.c (parse_directive): Cast second dir.len to uhwi.
3024 2018-01-03  Martin Sebor  <msebor@redhat.com>
3026         PR tree-optimization/83655
3027         * gimple-ssa-warn-restrict.c (wrestrict_dom_walker::check_call): Avoid
3028         checking calls with invalid arguments.
3030 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3032         * tree-vect-stmts.c (vect_get_store_rhs): New function.
3033         (vectorizable_mask_load_store): Delete.
3034         (vectorizable_call): Return false for masked loads and stores.
3035         (vectorizable_store): Handle IFN_MASK_STORE.  Use vect_get_store_rhs
3036         instead of gimple_assign_rhs1.
3037         (vectorizable_load): Handle IFN_MASK_LOAD.
3038         (vect_transform_stmt): Don't set is_store for call_vec_info_type.
3040 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3042         * tree-vect-stmts.c (vect_build_gather_load_calls): New function,
3043         split out from..,
3044         (vectorizable_mask_load_store): ...here.
3045         (vectorizable_load): ...and here.
3047 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3049         * tree-vect-stmts.c (vect_build_all_ones_mask)
3050         (vect_build_zero_merge_argument): New functions, split out from...
3051         (vectorizable_load): ...here.
3053 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3055         * tree-vect-stmts.c (vect_check_store_rhs): New function,
3056         split out from...
3057         (vectorizable_mask_load_store): ...here.
3058         (vectorizable_store): ...and here.
3060 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3062         * tree-vect-stmts.c (vect_check_load_store_mask): New function,
3063         split out from...
3064         (vectorizable_mask_load_store): ...here.
3066 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3068         * tree-vectorizer.h (vec_load_store_type): Moved from tree-vec-stmts.c
3069         (vect_model_store_cost): Take a vec_load_store_type instead of a
3070         vect_def_type.
3071         * tree-vect-stmts.c (vec_load_store_type): Move to tree-vectorizer.h.
3072         (vect_model_store_cost): Take a vec_load_store_type instead of a
3073         vect_def_type.
3074         (vectorizable_mask_load_store): Update accordingly.
3075         (vectorizable_store): Likewise.
3076         * tree-vect-slp.c (vect_analyze_slp_cost_1): Update accordingly.
3078 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3080         * tree-vect-loop.c (vect_transform_loop): Stub out scalar
3081         IFN_MASK_LOAD calls here rather than...
3082         * tree-vect-stmts.c (vectorizable_mask_load_store): ...here.
3084 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3085             Alan Hayward  <alan.hayward@arm.com>
3086             David Sherwood  <david.sherwood@arm.com>
3088         * expmed.c (extract_bit_field_1): For vector extracts,
3089         fall back to extract_bit_field_as_subreg if vec_extract
3090         isn't available.
3092 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3093             Alan Hayward  <alan.hayward@arm.com>
3094             David Sherwood  <david.sherwood@arm.com>
3096         * lra-spills.c (pseudo_reg_slot_compare): Sort slots by whether
3097         they are variable or constant sized.
3098         (assign_stack_slot_num_and_sort_pseudos): Don't reuse variable-sized
3099         slots for constant-sized data.
3101 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3102             Alan Hayward  <alan.hayward@arm.com>
3103             David Sherwood  <david.sherwood@arm.com>
3105         * tree-vect-patterns.c (vect_recog_mask_conversion_pattern): When
3106         handling COND_EXPRs with boolean comparisons, try to find a better
3107         basis for the mask type than the boolean itself.
3109 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3111         * doc/rtl.texi (MAX_BITSIZE_MODE_ANY_MODE): Describe how the default
3112         is calculated and how it can be overridden.
3113         * genmodes.c (max_bitsize_mode_any_mode): New variable.
3114         (create_modes): Initialize it from MAX_BITSIZE_MODE_ANY_MODE,
3115         if defined.
3116         (emit_max_int): Use it to set the output MAX_BITSIZE_MODE_ANY_MODE,
3117         if nonzero.
3119 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3120             Alan Hayward  <alan.hayward@arm.com>
3121             David Sherwood  <david.sherwood@arm.com>
3123         * config/aarch64/aarch64-protos.h (aarch64_output_simd_mov_immediate):
3124         Remove the mode argument.
3125         (aarch64_simd_valid_immediate): Remove the mode and inverse
3126         arguments.
3127         * config/aarch64/iterators.md (bitsize): New iterator.
3128         * config/aarch64/aarch64-simd.md (*aarch64_simd_mov<mode>, and<mode>3)
3129         (ior<mode>3): Update calls to aarch64_output_simd_mov_immediate.
3130         * config/aarch64/constraints.md (Do, Db, Dn): Update calls to
3131         aarch64_simd_valid_immediate.
3132         * config/aarch64/predicates.md (aarch64_reg_or_orr_imm): Likewise.
3133         (aarch64_reg_or_bic_imm): Likewise.
3134         * config/aarch64/aarch64.c (simd_immediate_info): Replace mvn
3135         with an insn_type enum and msl with a modifier_type enum.
3136         Replace element_width with a scalar_mode.  Change the shift
3137         to unsigned int.  Add constructors for scalar_float_mode and
3138         scalar_int_mode elements.
3139         (aarch64_vect_float_const_representable_p): Delete.
3140         (aarch64_can_const_movi_rtx_p)
3141         (aarch64_simd_scalar_immediate_valid_for_move)
3142         (aarch64_simd_make_constant): Update call to
3143         aarch64_simd_valid_immediate.
3144         (aarch64_advsimd_valid_immediate_hs): New function.
3145         (aarch64_advsimd_valid_immediate): Likewise.
3146         (aarch64_simd_valid_immediate): Remove mode and inverse
3147         arguments.  Rewrite to use the above.  Use const_vec_duplicate_p
3148         to detect duplicated constants and use aarch64_float_const_zero_rtx_p
3149         and aarch64_float_const_representable_p on the result.
3150         (aarch64_output_simd_mov_immediate): Remove mode argument.
3151         Update call to aarch64_simd_valid_immediate and use of
3152         simd_immediate_info.
3153         (aarch64_output_scalar_simd_mov_immediate): Update call
3154         accordingly.
3156 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3157             Alan Hayward  <alan.hayward@arm.com>
3158             David Sherwood  <david.sherwood@arm.com>
3160         * machmode.h (mode_precision): Prefix with CONST_MODE_PRECISION.
3161         (mode_nunits): Likewise CONST_MODE_NUNITS.
3162         * machmode.def (ADJUST_NUNITS): Document.
3163         * genmodes.c (mode_data::need_nunits_adj): New field.
3164         (blank_mode): Update accordingly.
3165         (adj_nunits): New variable.
3166         (print_maybe_const_decl): Replace CATEGORY with a NEEDS_ADJ
3167         parameter.
3168         (emit_mode_size_inline): Set need_bytesize_adj for all modes
3169         listed in adj_nunits.
3170         (emit_mode_nunits_inline): Set need_nunits_adj for all modes
3171         listed in adj_nunits.  Don't emit case statements for such modes.
3172         (emit_insn_modes_h): Emit definitions of CONST_MODE_NUNITS
3173         and CONST_MODE_PRECISION.  Make CONST_MODE_SIZE expand to
3174         nothing if adj_nunits is nonnull.
3175         (emit_mode_precision, emit_mode_nunits): Use print_maybe_const_decl.
3176         (emit_mode_unit_size, emit_mode_base_align, emit_mode_ibit)
3177         (emit_mode_fbit): Update use of print_maybe_const_decl.
3178         (emit_move_size): Likewise.  Treat the array as non-const
3179         if adj_nunits.
3180         (emit_mode_adjustments): Handle adj_nunits.
3182 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3184         * machmode.def (VECTOR_MODES_WITH_PREFIX): Document.
3185         * genmodes.c (VECTOR_MODES_WITH_PREFIX): New macro.
3186         (VECTOR_MODES): Use it.
3187         (make_vector_modes): Take the prefix as an argument.
3189 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3190             Alan Hayward  <alan.hayward@arm.com>
3191             David Sherwood  <david.sherwood@arm.com>
3193         * mode-classes.def (MODE_VECTOR_BOOL): New mode class.
3194         * machmode.h (INTEGRAL_MODE_P, VECTOR_MODE_P): Return true
3195         for MODE_VECTOR_BOOL.
3196         * machmode.def (VECTOR_BOOL_MODE): Document.
3197         * genmodes.c (VECTOR_BOOL_MODE): New macro.
3198         (make_vector_bool_mode): New function.
3199         (complete_mode, emit_mode_wider, emit_mode_adjustments): Handle
3200         MODE_VECTOR_BOOL.
3201         * lto-streamer-in.c (lto_input_mode_table): Likewise.
3202         * rtx-vector-builder.c (rtx_vector_builder::find_cached_value):
3203         Likewise.
3204         * stor-layout.c (int_mode_for_mode): Likewise.
3205         * tree.c (build_vector_type_for_mode): Likewise.
3206         * varasm.c (output_constant_pool_2): Likewise.
3207         * emit-rtl.c (init_emit_once): Make sure that CONST1_RTX (BImode) and
3208         CONSTM1_RTX (BImode) are the same thing.  Initialize const_tiny_rtx
3209         for MODE_VECTOR_BOOL.
3210         * expr.c (expand_expr_real_1): Use VECTOR_MODE_P instead of a list
3211         of mode class checks.
3212         * tree-vect-generic.c (expand_vector_operation): Use VECTOR_MODE_P
3213         instead of a list of mode class checks.
3214         (expand_vector_scalar_condition): Likewise.
3215         (type_for_widest_vector_mode): Handle BImode as an inner mode.
3217 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3218             Alan Hayward  <alan.hayward@arm.com>
3219             David Sherwood  <david.sherwood@arm.com>
3221         * machmode.h (mode_size): Change from unsigned short to
3222         poly_uint16_pod.
3223         (mode_to_bytes): Return a poly_uint16 rather than an unsigned short.
3224         (GET_MODE_SIZE): Return a constant if ONLY_FIXED_SIZE_MODES,
3225         or if measurement_type is not polynomial.
3226         (fixed_size_mode::includes_p): Check for constant-sized modes.
3227         * genmodes.c (emit_mode_size_inline): Make mode_size_inline
3228         return a poly_uint16 rather than an unsigned short.
3229         (emit_mode_size): Change the type of mode_size from unsigned short
3230         to poly_uint16_pod.  Use ZERO_COEFFS for the initializer.
3231         (emit_mode_adjustments): Cope with polynomial vector sizes.
3232         * lto-streamer-in.c (lto_input_mode_table): Use bp_unpack_poly_value
3233         for GET_MODE_SIZE.
3234         * lto-streamer-out.c (lto_write_mode_table): Use bp_pack_poly_value
3235         for GET_MODE_SIZE.
3236         * auto-inc-dec.c (try_merge): Treat GET_MODE_SIZE as polynomial.
3237         * builtins.c (expand_ifn_atomic_compare_exchange_into_call): Likewise.
3238         * caller-save.c (setup_save_areas): Likewise.
3239         (replace_reg_with_saved_mem): Likewise.
3240         * calls.c (emit_library_call_value_1): Likewise.
3241         * combine-stack-adj.c (combine_stack_adjustments_for_block): Likewise.
3242         * combine.c (simplify_set, make_extraction, simplify_shift_const_1)
3243         (gen_lowpart_for_combine): Likewise.
3244         * convert.c (convert_to_integer_1): Likewise.
3245         * cse.c (equiv_constant, cse_insn): Likewise.
3246         * cselib.c (autoinc_split, cselib_hash_rtx): Likewise.
3247         (cselib_subst_to_values): Likewise.
3248         * dce.c (word_dce_process_block): Likewise.
3249         * df-problems.c (df_word_lr_mark_ref): Likewise.
3250         * dwarf2cfi.c (init_one_dwarf_reg_size): Likewise.
3251         * dwarf2out.c (multiple_reg_loc_descriptor, mem_loc_descriptor)
3252         (concat_loc_descriptor, concatn_loc_descriptor, loc_descriptor)
3253         (rtl_for_decl_location): Likewise.
3254         * emit-rtl.c (gen_highpart, widen_memory_access): Likewise.
3255         * expmed.c (extract_bit_field_1, extract_integral_bit_field): Likewise.
3256         * expr.c (emit_group_load_1, clear_storage_hints): Likewise.
3257         (emit_move_complex, emit_move_multi_word, emit_push_insn): Likewise.
3258         (expand_expr_real_1): Likewise.
3259         * function.c (assign_parm_setup_block_p, assign_parm_setup_block)
3260         (pad_below): Likewise.
3261         * gimple-fold.c (optimize_atomic_compare_exchange_p): Likewise.
3262         * gimple-ssa-store-merging.c (rhs_valid_for_store_merging_p): Likewise.
3263         * ira.c (get_subreg_tracking_sizes): Likewise.
3264         * ira-build.c (ira_create_allocno_objects): Likewise.
3265         * ira-color.c (coalesced_pseudo_reg_slot_compare): Likewise.
3266         (ira_sort_regnos_for_alter_reg): Likewise.
3267         * ira-costs.c (record_operand_costs): Likewise.
3268         * lower-subreg.c (interesting_mode_p, simplify_gen_subreg_concatn)
3269         (resolve_simple_move): Likewise.
3270         * lra-constraints.c (get_reload_reg, operands_match_p): Likewise.
3271         (process_addr_reg, simplify_operand_subreg, curr_insn_transform)
3272         (lra_constraints): Likewise.
3273         (CONST_POOL_OK_P): Reject variable-sized modes.
3274         * lra-spills.c (slot, assign_mem_slot, pseudo_reg_slot_compare)
3275         (add_pseudo_to_slot, lra_spill): Likewise.
3276         * omp-low.c (omp_clause_aligned_alignment): Likewise.
3277         * optabs-query.c (get_best_extraction_insn): Likewise.
3278         * optabs-tree.c (expand_vec_cond_expr_p): Likewise.
3279         * optabs.c (expand_vec_perm_var, expand_vec_cond_expr): Likewise.
3280         (expand_mult_highpart, valid_multiword_target_p): Likewise.
3281         * recog.c (offsettable_address_addr_space_p): Likewise.
3282         * regcprop.c (maybe_mode_change): Likewise.
3283         * reginfo.c (choose_hard_reg_mode, record_subregs_of_mode): Likewise.
3284         * regrename.c (build_def_use): Likewise.
3285         * regstat.c (dump_reg_info): Likewise.
3286         * reload.c (complex_word_subreg_p, push_reload, find_dummy_reload)
3287         (find_reloads, find_reloads_subreg_address): Likewise.
3288         * reload1.c (eliminate_regs_1): Likewise.
3289         * rtlanal.c (for_each_inc_dec_find_inc_dec, rtx_cost): Likewise.
3290         * simplify-rtx.c (avoid_constant_pool_reference): Likewise.
3291         (simplify_binary_operation_1, simplify_subreg): Likewise.
3292         * targhooks.c (default_function_arg_padding): Likewise.
3293         (default_hard_regno_nregs, default_class_max_nregs): Likewise.
3294         * tree-cfg.c (verify_gimple_assign_binary): Likewise.
3295         (verify_gimple_assign_ternary): Likewise.
3296         * tree-inline.c (estimate_move_cost): Likewise.
3297         * tree-ssa-forwprop.c (simplify_vector_constructor): Likewise.
3298         * tree-ssa-loop-ivopts.c (add_autoinc_candidates): Likewise.
3299         (get_address_cost_ainc): Likewise.
3300         * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Likewise.
3301         (vect_supportable_dr_alignment): Likewise.
3302         * tree-vect-loop.c (vect_determine_vectorization_factor): Likewise.
3303         (vectorizable_reduction): Likewise.
3304         * tree-vect-stmts.c (vectorizable_assignment, vectorizable_shift)
3305         (vectorizable_operation, vectorizable_load): Likewise.
3306         * tree.c (build_same_sized_truth_vector_type): Likewise.
3307         * valtrack.c (cleanup_auto_inc_dec): Likewise.
3308         * var-tracking.c (emit_note_insn_var_location): Likewise.
3309         * config/arc/arc.h (ASM_OUTPUT_CASE_END): Use as_a <scalar_int_mode>.
3310         (ADDR_VEC_ALIGN): Likewise.
3312 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3313             Alan Hayward  <alan.hayward@arm.com>
3314             David Sherwood  <david.sherwood@arm.com>
3316         * machmode.h (mode_to_bits): Return a poly_uint16 rather than an
3317         unsigned short.
3318         (GET_MODE_BITSIZE): Return a constant if ONLY_FIXED_SIZE_MODES,
3319         or if measurement_type is polynomial.
3320         * calls.c (shift_return_value): Treat GET_MODE_BITSIZE as polynomial.
3321         * combine.c (make_extraction): Likewise.
3322         * dse.c (find_shift_sequence): Likewise.
3323         * dwarf2out.c (mem_loc_descriptor): Likewise.
3324         * expmed.c (store_integral_bit_field, extract_bit_field_1): Likewise.
3325         (extract_bit_field, extract_low_bits): Likewise.
3326         * expr.c (convert_move, convert_modes, emit_move_insn_1): Likewise.
3327         (optimize_bitfield_assignment_op, expand_assignment): Likewise.
3328         (store_expr_with_bounds, store_field, expand_expr_real_1): Likewise.
3329         * fold-const.c (optimize_bit_field_compare, merge_ranges): Likewise.
3330         * gimple-fold.c (optimize_atomic_compare_exchange_p): Likewise.
3331         * reload.c (find_reloads): Likewise.
3332         * reload1.c (alter_reg): Likewise.
3333         * stor-layout.c (bitwise_mode_for_mode, compute_record_mode): Likewise.
3334         * targhooks.c (default_secondary_memory_needed_mode): Likewise.
3335         * tree-if-conv.c (predicate_mem_writes): Likewise.
3336         * tree-ssa-strlen.c (handle_builtin_memcmp): Likewise.
3337         * tree-vect-patterns.c (adjust_bool_pattern): Likewise.
3338         * tree-vect-stmts.c (vectorizable_simd_clone_call): Likewise.
3339         * valtrack.c (dead_debug_insert_temp): Likewise.
3340         * varasm.c (mergeable_constant_section): Likewise.
3341         * config/sh/sh.h (LOCAL_ALIGNMENT): Use as_a <fixed_size_mode>.
3343 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3344             Alan Hayward  <alan.hayward@arm.com>
3345             David Sherwood  <david.sherwood@arm.com>
3347         * expr.c (expand_assignment): Cope with polynomial mode sizes
3348         when assigning to a CONCAT.
3350 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3351             Alan Hayward  <alan.hayward@arm.com>
3352             David Sherwood  <david.sherwood@arm.com>
3354         * machmode.h (mode_precision): Change from unsigned short to
3355         poly_uint16_pod.
3356         (mode_to_precision): Return a poly_uint16 rather than an unsigned
3357         short.
3358         (GET_MODE_PRECISION): Return a constant if ONLY_FIXED_SIZE_MODES,
3359         or if measurement_type is not polynomial.
3360         (HWI_COMPUTABLE_MODE_P): Turn into a function.  Optimize the case
3361         in which the mode is already known to be a scalar_int_mode.
3362         * genmodes.c (emit_mode_precision): Change the type of mode_precision
3363         from unsigned short to poly_uint16_pod.  Use ZERO_COEFFS for the
3364         initializer.
3365         * lto-streamer-in.c (lto_input_mode_table): Use bp_unpack_poly_value
3366         for GET_MODE_PRECISION.
3367         * lto-streamer-out.c (lto_write_mode_table): Use bp_pack_poly_value
3368         for GET_MODE_PRECISION.
3369         * combine.c (update_rsp_from_reg_equal): Treat GET_MODE_PRECISION
3370         as polynomial.
3371         (try_combine, find_split_point, combine_simplify_rtx): Likewise.
3372         (expand_field_assignment, make_extraction): Likewise.
3373         (make_compound_operation_int, record_dead_and_set_regs_1): Likewise.
3374         (get_last_value): Likewise.
3375         * convert.c (convert_to_integer_1): Likewise.
3376         * cse.c (cse_insn): Likewise.
3377         * expr.c (expand_expr_real_1): Likewise.
3378         * lra-constraints.c (simplify_operand_subreg): Likewise.
3379         * optabs-query.c (can_atomic_load_p): Likewise.
3380         * optabs.c (expand_atomic_load): Likewise.
3381         (expand_atomic_store): Likewise.
3382         * ree.c (combine_reaching_defs): Likewise.
3383         * rtl.h (partial_subreg_p, paradoxical_subreg_p): Likewise.
3384         * rtlanal.c (nonzero_bits1, lsb_bitfield_op_p): Likewise.
3385         * tree.h (type_has_mode_precision_p): Likewise.
3386         * ubsan.c (instrument_si_overflow): Likewise.
3388 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3389             Alan Hayward  <alan.hayward@arm.com>
3390             David Sherwood  <david.sherwood@arm.com>
3392         * tree.h (TYPE_VECTOR_SUBPARTS): Turn into a function and handle
3393         polynomial numbers of units.
3394         (SET_TYPE_VECTOR_SUBPARTS): Likewise.
3395         (valid_vector_subparts_p): New function.
3396         (build_vector_type): Remove temporary shim and take the number
3397         of units as a poly_uint64 rather than an int.
3398         (build_opaque_vector_type): Take the number of units as a
3399         poly_uint64 rather than an int.
3400         * tree.c (build_vector_from_ctor): Handle polynomial
3401         TYPE_VECTOR_SUBPARTS.
3402         (type_hash_canon_hash, type_cache_hasher::equal): Likewise.
3403         (uniform_vector_p, vector_type_mode, build_vector): Likewise.
3404         (build_vector_from_val): If the number of units is variable,
3405         use build_vec_duplicate_cst for constant operands and
3406         VEC_DUPLICATE_EXPR otherwise.
3407         (make_vector_type): Remove temporary is_constant ().
3408         (build_vector_type, build_opaque_vector_type): Take the number of
3409         units as a poly_uint64 rather than an int.
3410         (check_vector_cst): Handle polynomial TYPE_VECTOR_SUBPARTS and
3411         VECTOR_CST_NELTS.
3412         * cfgexpand.c (expand_debug_expr): Likewise.
3413         * expr.c (count_type_elements, categorize_ctor_elements_1): Likewise.
3414         (store_constructor, expand_expr_real_1): Likewise.
3415         (const_scalar_mask_from_tree): Likewise.
3416         * fold-const-call.c (fold_const_reduction): Likewise.
3417         * fold-const.c (const_binop, const_unop, fold_convert_const): Likewise.
3418         (operand_equal_p, fold_vec_perm, fold_ternary_loc): Likewise.
3419         (native_encode_vector, vec_cst_ctor_to_array): Likewise.
3420         (fold_relational_const): Likewise.
3421         (native_interpret_vector): Likewise.  Change the size from an
3422         int to an unsigned int.
3423         * gimple-fold.c (gimple_fold_stmt_to_constant_1): Handle polynomial
3424         TYPE_VECTOR_SUBPARTS.
3425         (gimple_fold_indirect_ref, gimple_build_vector): Likewise.
3426         (gimple_build_vector_from_val): Use VEC_DUPLICATE_EXPR when
3427         duplicating a non-constant operand into a variable-length vector.
3428         * hsa-brig.c (hsa_op_immed::emit_to_buffer): Handle polynomial
3429         TYPE_VECTOR_SUBPARTS and VECTOR_CST_NELTS.
3430         * ipa-icf.c (sem_variable::equals): Likewise.
3431         * match.pd: Likewise.
3432         * omp-simd-clone.c (simd_clone_subparts): Likewise.
3433         * print-tree.c (print_node): Likewise.
3434         * stor-layout.c (layout_type): Likewise.
3435         * targhooks.c (default_builtin_vectorization_cost): Likewise.
3436         * tree-cfg.c (verify_gimple_comparison): Likewise.
3437         (verify_gimple_assign_binary): Likewise.
3438         (verify_gimple_assign_ternary): Likewise.
3439         (verify_gimple_assign_single): Likewise.
3440         * tree-pretty-print.c (dump_generic_node): Likewise.
3441         * tree-ssa-forwprop.c (simplify_vector_constructor): Likewise.
3442         (simplify_bitfield_ref, is_combined_permutation_identity): Likewise.
3443         * tree-vect-data-refs.c (vect_permute_store_chain): Likewise.
3444         (vect_grouped_load_supported, vect_permute_load_chain): Likewise.
3445         (vect_shift_permute_load_chain): Likewise.
3446         * tree-vect-generic.c (nunits_for_known_piecewise_op): Likewise.
3447         (expand_vector_condition, optimize_vector_constructor): Likewise.
3448         (lower_vec_perm, get_compute_type): Likewise.
3449         * tree-vect-loop.c (vect_determine_vectorization_factor): Likewise.
3450         (get_initial_defs_for_reduction, vect_transform_loop): Likewise.
3451         * tree-vect-patterns.c (vect_recog_bool_pattern): Likewise.
3452         (vect_recog_mask_conversion_pattern): Likewise.
3453         * tree-vect-slp.c (vect_supported_load_permutation_p): Likewise.
3454         (vect_get_constant_vectors, vect_transform_slp_perm_load): Likewise.
3455         * tree-vect-stmts.c (perm_mask_for_reverse): Likewise.
3456         (get_group_load_store_type, vectorizable_mask_load_store): Likewise.
3457         (vectorizable_bswap, simd_clone_subparts, vectorizable_assignment)
3458         (vectorizable_shift, vectorizable_operation, vectorizable_store)
3459         (vectorizable_load, vect_is_simple_cond, vectorizable_comparison)
3460         (supportable_widening_operation): Likewise.
3461         (supportable_narrowing_operation): Likewise.
3462         * tree-vector-builder.c (tree_vector_builder::binary_encoded_nelts):
3463         Likewise.
3464         * varasm.c (output_constant): Likewise.
3466 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3467             Alan Hayward  <alan.hayward@arm.com>
3468             David Sherwood  <david.sherwood@arm.com>
3470         * tree-vect-data-refs.c (vect_permute_store_chain): Reorganize
3471         so that both the length == 3 and length != 3 cases set up their
3472         own permute vectors.  Add comments explaining why we know the
3473         number of elements is constant.
3474         (vect_permute_load_chain): Likewise.
3476 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3477             Alan Hayward  <alan.hayward@arm.com>
3478             David Sherwood  <david.sherwood@arm.com>
3480         * machmode.h (mode_nunits): Change from unsigned char to
3481         poly_uint16_pod.
3482         (ONLY_FIXED_SIZE_MODES): New macro.
3483         (pod_mode::measurement_type, scalar_int_mode::measurement_type)
3484         (scalar_float_mode::measurement_type, scalar_mode::measurement_type)
3485         (complex_mode::measurement_type, fixed_size_mode::measurement_type):
3486         New typedefs.
3487         (mode_to_nunits): Return a poly_uint16 rather than an unsigned short.
3488         (GET_MODE_NUNITS): Return a constant if ONLY_FIXED_SIZE_MODES,
3489         or if measurement_type is not polynomial.
3490         * genmodes.c (ZERO_COEFFS): New macro.
3491         (emit_mode_nunits_inline): Make mode_nunits_inline return a
3492         poly_uint16.
3493         (emit_mode_nunits): Change the type of mode_nunits to poly_uint16_pod.
3494         Use ZERO_COEFFS when emitting initializers.
3495         * data-streamer.h (bp_pack_poly_value): New function.
3496         (bp_unpack_poly_value): Likewise.
3497         * lto-streamer-in.c (lto_input_mode_table): Use bp_unpack_poly_value
3498         for GET_MODE_NUNITS.
3499         * lto-streamer-out.c (lto_write_mode_table): Use bp_pack_poly_value
3500         for GET_MODE_NUNITS.
3501         * tree.c (make_vector_type): Remove temporary shim and make
3502         the real function take the number of units as a poly_uint64
3503         rather than an int.
3504         (build_vector_type_for_mode): Handle polynomial nunits.
3505         * dwarf2out.c (loc_descriptor, add_const_value_attribute): Likewise.
3506         * emit-rtl.c (const_vec_series_p_1): Likewise.
3507         (gen_rtx_CONST_VECTOR): Likewise.
3508         * fold-const.c (test_vec_duplicate_folding): Likewise.
3509         * genrecog.c (validate_pattern): Likewise.
3510         * optabs-query.c (can_vec_perm_var_p, can_mult_highpart_p): Likewise.
3511         * optabs-tree.c (expand_vec_cond_expr_p): Likewise.
3512         * optabs.c (expand_vector_broadcast, expand_binop_directly): Likewise.
3513         (shift_amt_for_vec_perm_mask, expand_vec_perm_var): Likewise.
3514         (expand_vec_cond_expr, expand_mult_highpart): Likewise.
3515         * rtlanal.c (subreg_get_info): Likewise.
3516         * tree-vect-data-refs.c (vect_grouped_store_supported): Likewise.
3517         (vect_grouped_load_supported): Likewise.
3518         * tree-vect-generic.c (type_for_widest_vector_mode): Likewise.
3519         * tree-vect-loop.c (have_whole_vector_shift): Likewise.
3520         * simplify-rtx.c (simplify_unary_operation_1): Likewise.
3521         (simplify_const_unary_operation, simplify_binary_operation_1)
3522         (simplify_const_binary_operation, simplify_ternary_operation)
3523         (test_vector_ops_duplicate, test_vector_ops): Likewise.
3524         (simplify_immed_subreg): Use GET_MODE_NUNITS on a fixed_size_mode
3525         instead of CONST_VECTOR_NUNITS.
3526         * varasm.c (output_constant_pool_2): Likewise.
3527         * rtx-vector-builder.c (rtx_vector_builder::build): Only include the
3528         explicit-encoded elements in the XVEC for variable-length vectors.
3530 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3532         * lra-constraints.c (curr_insn_transform): Use partial_subreg_p.
3534 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3535             Alan Hayward  <alan.hayward@arm.com>
3536             David Sherwood  <david.sherwood@arm.com>
3538         * coretypes.h (fixed_size_mode): Declare.
3539         (fixed_size_mode_pod): New typedef.
3540         * builtins.h (target_builtins::x_apply_args_mode)
3541         (target_builtins::x_apply_result_mode): Change type to
3542         fixed_size_mode_pod.
3543         * builtins.c (apply_args_size, apply_result_size, result_vector)
3544         (expand_builtin_apply_args_1, expand_builtin_apply)
3545         (expand_builtin_return): Update accordingly.
3547 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3549         * cse.c (hash_rtx_cb): Hash only the encoded elements.
3550         * cselib.c (cselib_hash_rtx): Likewise.
3551         * expmed.c (make_tree): Build VECTOR_CSTs directly from the
3552         CONST_VECTOR encoding.
3554 2017-01-03  Jakub Jelinek  <jakub@redhat.com>
3555             Jeff Law  <law@redhat.com>
3557         PR target/83641
3558         * config/i386/i386.c (ix86_adjust_stack_and_probe_stack_clash): For
3559         noreturn probe, use gen_pop instead of ix86_emit_restore_reg_using_pop,
3560         only set RTX_FRAME_RELATED_P on both the push and pop if cfa_reg is sp
3561         and add REG_CFA_ADJUST_CFA notes in that case to both insns.
3563         PR target/83641
3564         * config/i386/i386.c (ix86_adjust_stack_and_probe_stack_clash): Do not
3565         explicitly probe *sp in a noreturn function if there were any callee
3566         register saves or frame pointer is needed.
3568 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
3570         PR debug/83621
3571         * cfgexpand.c (expand_debug_expr): Return NULL if mode is
3572         BLKmode for ternary, binary or unary expressions.
3574         PR debug/83645
3575         * var-tracking.c (delete_vta_debug_insn): New inline function.
3576         (delete_vta_debug_insns): Add USE_CFG argument, if true, walk just
3577         insns from get_insns () to NULL instead of each bb separately.
3578         Use delete_vta_debug_insn.  No longer static.
3579         (vt_debug_insns_local, variable_tracking_main_1): Adjust
3580         delete_vta_debug_insns callers.
3581         * rtl.h (delete_vta_debug_insns): Declare.
3582         * final.c (rest_of_handle_final): Call delete_vta_debug_insns
3583         instead of variable_tracking_main.
3585 2018-01-03  Martin Sebor  <msebor@redhat.com>
3587         PR tree-optimization/83603
3588         * calls.c (maybe_warn_nonstring_arg): Avoid accessing function
3589         arguments past the endof the argument list in functions declared
3590         without a prototype.
3591         * gimple-ssa-warn-restrict.c (wrestrict_dom_walker::check_call):
3592         Avoid checking when arguments are null.
3594 2018-01-03  Martin Sebor  <msebor@redhat.com>
3596         PR c/83559
3597         * doc/extend.texi (attribute const): Fix a typo.
3598         * ipa-pure-const.c ((warn_function_const, warn_function_pure): Avoid
3599         issuing -Wsuggest-attribute for void functions.
3601 2018-01-03  Martin Sebor  <msebor@redhat.com>
3603         * gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref): Use
3604         offset_int::from instead of wide_int::to_shwi.
3605         (maybe_diag_overlap): Remove assertion.
3606         Use HOST_WIDE_INT_PRINT_DEC instead of %lli.
3607         * gimple-ssa-sprintf.c (format_directive): Same.
3608         (parse_directive): Same.
3609         (sprintf_dom_walker::compute_format_length): Same.
3610         (try_substitute_return_value): Same.
3612 2017-01-03  Jeff Law  <law@redhat.com>
3614         PR middle-end/83654
3615         * explow.c (anti_adjust_stack_and_probe_stack_clash): Test a
3616         non-constant residual for zero at runtime and avoid probing in
3617         that case.  Reorganize code for trailing problem to mirror handling
3618         of the residual.
3620 2018-01-03  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
3622         PR tree-optimization/83501
3623         * tree-ssa-strlen.c (get_string_cst): New.
3624         (handle_char_store): Call get_string_cst.
3626 2018-01-03  Martin Liska  <mliska@suse.cz>
3628         PR tree-optimization/83593
3629         * tree-ssa-strlen.c: Include tree-cfg.h.
3630         (strlen_check_and_optimize_stmt): Add new argument cleanup_eh.
3631         (strlen_dom_walker): Add new member variable m_cleanup_cfg.
3632         (strlen_dom_walker::strlen_dom_walker): Initialize m_cleanup_cfg
3633         to false.
3634         (strlen_dom_walker::before_dom_children): Call
3635         gimple_purge_dead_eh_edges. Dump tranformation with details
3636         dump flags.
3637         (strlen_dom_walker::before_dom_children): Update call by adding
3638         new argument cleanup_eh.
3639         (pass_strlen::execute): Return TODO_cleanup_cfg if needed.
3641 2018-01-03  Martin Liska  <mliska@suse.cz>
3643         PR ipa/83549
3644         * cif-code.def (VARIADIC_THUNK): New enum value.
3645         * ipa-fnsummary.c (compute_fn_summary): Do not inline variadic
3646         thunks.
3648 2018-01-03  Jan Beulich  <jbeulich@suse.com>
3650         * sse.md (mov<mode>_internal): Tighten condition for when to use
3651         vmovdqu<ssescalarsize> for TI and OI modes.
3653 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
3655         Update copyright years.
3657 2018-01-03  Martin Liska  <mliska@suse.cz>
3659         PR ipa/83594
3660         * ipa-visibility.c (function_and_variable_visibility): Skip
3661         functions with noipa attribure.
3663 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
3665         * gcc.c (process_command): Update copyright notice dates.
3666         * gcov-dump.c (print_version): Ditto.
3667         * gcov.c (print_version): Ditto.
3668         * gcov-tool.c (print_version): Ditto.
3669         * gengtype.c (create_file): Ditto.
3670         * doc/cpp.texi: Bump @copying's copyright year.
3671         * doc/cppinternals.texi: Ditto.
3672         * doc/gcc.texi: Ditto.
3673         * doc/gccint.texi: Ditto.
3674         * doc/gcov.texi: Ditto.
3675         * doc/install.texi: Ditto.
3676         * doc/invoke.texi: Ditto.
3678 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3680         * vector-builder.h (vector_builder::m_full_nelts): Change from
3681         unsigned int to poly_uint64.
3682         (vector_builder::full_nelts): Update prototype accordingly.
3683         (vector_builder::new_vector): Likewise.
3684         (vector_builder::encoded_full_vector_p): Handle polynomial full_nelts.
3685         (vector_builder::operator ==): Likewise.
3686         (vector_builder::finalize): Likewise.
3687         * int-vector-builder.h (int_vector_builder::int_vector_builder):
3688         Take the number of elements as a poly_uint64 rather than an
3689         unsigned int.
3690         * vec-perm-indices.h (vec_perm_indices::m_nelts_per_input): Change
3691         from unsigned int to poly_uint64.
3692         (vec_perm_indices::vec_perm_indices): Update prototype accordingly.
3693         (vec_perm_indices::new_vector): Likewise.
3694         (vec_perm_indices::length): Likewise.
3695         (vec_perm_indices::nelts_per_input): Likewise.
3696         (vec_perm_indices::input_nelts): Likewise.
3697         * vec-perm-indices.c (vec_perm_indices::new_vector): Take the
3698         number of elements per input as a poly_uint64 rather than an
3699         unsigned int.  Use the original encoding for variable-length
3700         vectors, rather than clamping each individual element.
3701         For the second and subsequent elements in each pattern,
3702         clamp the step and base before clamping their sum.
3703         (vec_perm_indices::series_p): Handle polynomial element counts.
3704         (vec_perm_indices::all_in_range_p): Likewise.
3705         (vec_perm_indices_to_tree): Likewise.
3706         (vec_perm_indices_to_rtx): Likewise.
3707         * tree-vect-stmts.c (vect_gen_perm_mask_any): Likewise.
3708         * tree-vector-builder.c (tree_vector_builder::new_unary_operation)
3709         (tree_vector_builder::new_binary_operation): Handle polynomial
3710         element counts.  Return false if we need to know the number
3711         of elements at compile time.
3712         * fold-const.c (fold_vec_perm): Punt if the number of elements
3713         isn't known at compile time.
3715 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3717         * vec-perm-indices.h (vec_perm_builder): Change element type
3718         from HOST_WIDE_INT to poly_int64.
3719         (vec_perm_indices::element_type): Update accordingly.
3720         (vec_perm_indices::clamp): Handle polynomial element_types.
3721         * vec-perm-indices.c (vec_perm_indices::series_p): Likewise.
3722         (vec_perm_indices::all_in_range_p): Likewise.
3723         (tree_to_vec_perm_builder): Check for poly_int64 trees rather
3724         than shwi trees.
3725         * vector-builder.h (vector_builder::stepped_sequence_p): Handle
3726         polynomial vec_perm_indices element types.
3727         * int-vector-builder.h (int_vector_builder::equal_p): Likewise.
3728         * fold-const.c (fold_vec_perm): Likewise.
3729         * optabs.c (shift_amt_for_vec_perm_mask): Likewise.
3730         * tree-vect-generic.c (lower_vec_perm): Likewise.
3731         * tree-vect-slp.c (vect_transform_slp_perm_load): Likewise.
3732         * config/aarch64/aarch64.c (aarch64_evpc_tbl): Cast d->perm
3733         element type to HOST_WIDE_INT.
3735 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3736             Alan Hayward  <alan.hayward@arm.com>
3737             David Sherwood  <david.sherwood@arm.com>
3739         * alias.c (addr_side_effect_eval): Take the size as a poly_int64
3740         rather than an int.  Use plus_constant.
3741         (memrefs_conflict_p): Take the sizes as poly_int64s rather than ints.
3742         Take the offset "c" as a poly_int64 rather than a HOST_WIDE_INT.
3744 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3745             Alan Hayward  <alan.hayward@arm.com>
3746             David Sherwood  <david.sherwood@arm.com>
3748         * calls.c (emit_call_1, expand_call): Change struct_value_size from
3749         a HOST_WIDE_INT to a poly_int64.
3751 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3752             Alan Hayward  <alan.hayward@arm.com>
3753             David Sherwood  <david.sherwood@arm.com>
3755         * calls.c (load_register_parameters): Cope with polynomial
3756         mode sizes.  Require a constant size for BLKmode parameters
3757         that aren't described by a PARALLEL.  If BLOCK_REG_PADDING
3758         forces a parameter to be padded at the lsb end in order to
3759         fill a complete number of words, require the parameter size
3760         to be ordered wrt UNITS_PER_WORD.
3762 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3763             Alan Hayward  <alan.hayward@arm.com>
3764             David Sherwood  <david.sherwood@arm.com>
3766         * reload1.c (spill_stack_slot_width): Change element type
3767         from unsigned int to poly_uint64_pod.
3768         (alter_reg): Treat mode sizes as polynomial.
3770 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3771             Alan Hayward  <alan.hayward@arm.com>
3772             David Sherwood  <david.sherwood@arm.com>
3774         * reload.c (complex_word_subreg_p): New function.
3775         (reload_inner_reg_of_subreg, push_reload): Use it.
3777 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3778             Alan Hayward  <alan.hayward@arm.com>
3779             David Sherwood  <david.sherwood@arm.com>
3781         * lra-constraints.c (process_alt_operands): Reject matched
3782         operands whose sizes aren't ordered.
3783         (match_reload): Refer to this check here.
3785 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3786             Alan Hayward  <alan.hayward@arm.com>
3787             David Sherwood  <david.sherwood@arm.com>
3789         * builtins.c (expand_ifn_atomic_compare_exchange_into_call): Assert
3790         that the mode size is in the set {1, 2, 4, 8, 16}.
3792 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3793             Alan Hayward  <alan.hayward@arm.com>
3794             David Sherwood  <david.sherwood@arm.com>
3796         * var-tracking.c (adjust_mems): Treat mode sizes as polynomial.
3797         Use plus_constant instead of gen_rtx_PLUS.
3799 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3800             Alan Hayward  <alan.hayward@arm.com>
3801             David Sherwood  <david.sherwood@arm.com>
3803         * config/cr16/cr16-protos.h (cr16_push_rounding): Declare.
3804         * config/cr16/cr16.h (PUSH_ROUNDING): Move implementation to...
3805         * config/cr16/cr16.c (cr16_push_rounding): ...this new function.
3806         * config/h8300/h8300-protos.h (h8300_push_rounding): Declare.
3807         * config/h8300/h8300.h (PUSH_ROUNDING): Move implementation to...
3808         * config/h8300/h8300.c (h8300_push_rounding): ...this new function.
3809         * config/i386/i386-protos.h (ix86_push_rounding): Declare.
3810         * config/i386/i386.h (PUSH_ROUNDING): Move implementation to...
3811         * config/i386/i386.c (ix86_push_rounding): ...this new function.
3812         * config/m32c/m32c-protos.h (m32c_push_rounding): Take and return
3813         a poly_int64.
3814         * config/m32c/m32c.c (m32c_push_rounding): Likewise.
3815         * config/m68k/m68k-protos.h (m68k_push_rounding): Declare.
3816         * config/m68k/m68k.h (PUSH_ROUNDING): Move implementation to...
3817         * config/m68k/m68k.c (m68k_push_rounding): ...this new function.
3818         * config/pdp11/pdp11-protos.h (pdp11_push_rounding): Declare.
3819         * config/pdp11/pdp11.h (PUSH_ROUNDING): Move implementation to...
3820         * config/pdp11/pdp11.c (pdp11_push_rounding): ...this new function.
3821         * config/stormy16/stormy16-protos.h (xstormy16_push_rounding): Declare.
3822         * config/stormy16/stormy16.h (PUSH_ROUNDING): Move implementation to...
3823         * config/stormy16/stormy16.c (xstormy16_push_rounding): ...this new
3824         function.
3825         * expr.c (emit_move_resolve_push): Treat the input and result
3826         of PUSH_ROUNDING as a poly_int64.
3827         (emit_move_complex_push, emit_single_push_insn_1): Likewise.
3828         (emit_push_insn): Likewise.
3829         * lra-eliminations.c (mark_not_eliminable): Likewise.
3830         * recog.c (push_operand): Likewise.
3831         * reload1.c (elimination_effects): Likewise.
3832         * rtlanal.c (nonzero_bits1): Likewise.
3833         * calls.c (store_one_arg): Likewise.  Require the padding to be
3834         known at compile time.
3836 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3837             Alan Hayward  <alan.hayward@arm.com>
3838             David Sherwood  <david.sherwood@arm.com>
3840         * expr.c (emit_single_push_insn_1): Treat mode sizes as polynomial.
3841         Use plus_constant instead of gen_rtx_PLUS.
3843 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3844             Alan Hayward  <alan.hayward@arm.com>
3845             David Sherwood  <david.sherwood@arm.com>
3847         * auto-inc-dec.c (set_inc_state): Take the mode size as a poly_int64
3848         rather than an int.
3850 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3851             Alan Hayward  <alan.hayward@arm.com>
3852             David Sherwood  <david.sherwood@arm.com>
3854         * expr.c (expand_expr_real_1): Use tree_to_poly_uint64
3855         instead of int_size_in_bytes when handling VIEW_CONVERT_EXPRs
3856         via stack temporaries.  Treat the mode size as polynomial too.
3858 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3859             Alan Hayward  <alan.hayward@arm.com>
3860             David Sherwood  <david.sherwood@arm.com>
3862         * expr.c (expand_expr_real_2): When handling conversions involving
3863         unions, apply tree_to_poly_uint64 to the TYPE_SIZE rather than
3864         multiplying int_size_in_bytes by BITS_PER_UNIT.  Treat GET_MODE_BISIZE
3865         as a poly_uint64 too.
3867 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3868             Alan Hayward  <alan.hayward@arm.com>
3869             David Sherwood  <david.sherwood@arm.com>
3871         * rtlanal.c (subreg_get_info): Handle polynomial mode sizes.
3873 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3874             Alan Hayward  <alan.hayward@arm.com>
3875             David Sherwood  <david.sherwood@arm.com>
3877         * combine.c (can_change_dest_mode): Handle polynomial
3878         REGMODE_NATURAL_SIZE.
3879         * expmed.c (store_bit_field_1): Likewise.
3880         * expr.c (store_constructor): Likewise.
3881         * emit-rtl.c (validate_subreg): Operate on polynomial mode sizes
3882         and polynomial REGMODE_NATURAL_SIZE.
3883         (gen_lowpart_common): Likewise.
3884         * reginfo.c (record_subregs_of_mode): Likewise.
3885         * rtlanal.c (read_modify_subreg_p): Likewise.
3887 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3888             Alan Hayward  <alan.hayward@arm.com>
3889             David Sherwood  <david.sherwood@arm.com>
3891         * internal-fn.c (expand_vector_ubsan_overflow): Handle polynomial
3892         numbers of elements.
3894 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3895             Alan Hayward  <alan.hayward@arm.com>
3896             David Sherwood  <david.sherwood@arm.com>
3898         * match.pd: Cope with polynomial numbers of vector elements.
3900 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3901             Alan Hayward  <alan.hayward@arm.com>
3902             David Sherwood  <david.sherwood@arm.com>
3904         * fold-const.c (fold_indirect_ref_1): Handle polynomial offsets
3905         in a POINTER_PLUS_EXPR.
3907 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3908             Alan Hayward  <alan.hayward@arm.com>
3909             David Sherwood  <david.sherwood@arm.com>
3911         * omp-simd-clone.c (simd_clone_subparts): New function.
3912         (simd_clone_init_simd_arrays): Use it instead of TYPE_VECTOR_SUBPARTS.
3913         (ipa_simd_modify_function_body): Likewise.
3915 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3916             Alan Hayward  <alan.hayward@arm.com>
3917             David Sherwood  <david.sherwood@arm.com>
3919         * tree-vect-generic.c (nunits_for_known_piecewise_op): New function.
3920         (expand_vector_piecewise): Use it instead of TYPE_VECTOR_SUBPARTS.
3921         (expand_vector_addition, add_rshift, expand_vector_divmod): Likewise.
3922         (expand_vector_condition, vector_element): Likewise.
3923         (subparts_gt): New function.
3924         (get_compute_type): Use subparts_gt.
3925         (count_type_subparts): Delete.
3926         (expand_vector_operations_1): Use subparts_gt instead of
3927         count_type_subparts.
3929 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3930             Alan Hayward  <alan.hayward@arm.com>
3931             David Sherwood  <david.sherwood@arm.com>
3933         * tree-vect-data-refs.c (vect_no_alias_p): Replace with...
3934         (vect_compile_time_alias): ...this new function.  Do the calculation
3935         on poly_ints rather than trees.
3936         (vect_prune_runtime_alias_test_list): Update call accordingly.
3938 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3939             Alan Hayward  <alan.hayward@arm.com>
3940             David Sherwood  <david.sherwood@arm.com>
3942         * tree-vect-slp.c (vect_build_slp_tree_1): Handle polynomial
3943         numbers of units.
3944         (vect_schedule_slp_instance): Likewise.
3946 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3947             Alan Hayward  <alan.hayward@arm.com>
3948             David Sherwood  <david.sherwood@arm.com>
3950         * tree-vect-slp.c (vect_get_and_check_slp_defs): Reject
3951         constant and extern definitions for variable-length vectors.
3952         (vect_get_constant_vectors): Note that the number of units
3953         is known to be constant.
3955 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3956             Alan Hayward  <alan.hayward@arm.com>
3957             David Sherwood  <david.sherwood@arm.com>
3959         * tree-vect-stmts.c (vectorizable_conversion): Treat the number
3960         of units as polynomial.  Choose between WIDE and NARROW based
3961         on multiple_p.
3963 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3964             Alan Hayward  <alan.hayward@arm.com>
3965             David Sherwood  <david.sherwood@arm.com>
3967         * tree-vect-stmts.c (simd_clone_subparts): New function.
3968         (vectorizable_simd_clone_call): Use it instead of TYPE_VECTOR_SUBPARTS.
3970 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3971             Alan Hayward  <alan.hayward@arm.com>
3972             David Sherwood  <david.sherwood@arm.com>
3974         * tree-vect-stmts.c (vectorizable_call): Treat the number of
3975         vectors as polynomial.  Use build_index_vector for
3976         IFN_GOMP_SIMD_LANE.
3978 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3979             Alan Hayward  <alan.hayward@arm.com>
3980             David Sherwood  <david.sherwood@arm.com>
3982         * tree-vect-stmts.c (get_load_store_type): Treat the number of
3983         units as polynomial.  Reject VMAT_ELEMENTWISE and VMAT_STRIDED_SLP
3984         for variable-length vectors.
3985         (vectorizable_mask_load_store): Treat the number of units as
3986         polynomial, asserting that it is constant if the condition has
3987         already been enforced.
3988         (vectorizable_store, vectorizable_load): Likewise.
3990 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3991             Alan Hayward  <alan.hayward@arm.com>
3992             David Sherwood  <david.sherwood@arm.com>
3994         * tree-vect-loop.c (vectorizable_live_operation): Treat the number
3995         of units as polynomial.  Punt if we can't tell at compile time
3996         which vector contains the final result.
3998 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
3999             Alan Hayward  <alan.hayward@arm.com>
4000             David Sherwood  <david.sherwood@arm.com>
4002         * tree-vect-loop.c (vectorizable_induction): Treat the number
4003         of units as polynomial.  Punt on SLP inductions.  Use an integer
4004         VEC_SERIES_EXPR for variable-length integer reductions.  Use a
4005         cast of such a series for variable-length floating-point
4006         reductions.
4008 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4009             Alan Hayward  <alan.hayward@arm.com>
4010             David Sherwood  <david.sherwood@arm.com>
4012         * tree.h (build_index_vector): Declare.
4013         * tree.c (build_index_vector): New function.
4014         * tree-vect-loop.c (get_initial_defs_for_reduction): Treat the number
4015         of units as polynomial, forcibly converting it to a constant if
4016         vectorizable_reduction has already enforced the condition.
4017         (vect_create_epilog_for_reduction): Likewise.  Use build_index_vector
4018         to create a {1,2,3,...} vector.
4019         (vectorizable_reduction): Treat the number of units as polynomial.
4020         Choose vectype_in based on the largest scalar element size rather
4021         than the smallest number of units.  Enforce the restrictions
4022         relied on above.
4024 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4025             Alan Hayward  <alan.hayward@arm.com>
4026             David Sherwood  <david.sherwood@arm.com>
4028         * tree-vect-data-refs.c (vector_alignment_reachable_p): Treat the
4029         number of units as polynomial.
4031 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4032             Alan Hayward  <alan.hayward@arm.com>
4033             David Sherwood  <david.sherwood@arm.com>
4035         * target.h (vector_sizes, auto_vector_sizes): New typedefs.
4036         * target.def (autovectorize_vector_sizes): Return the vector sizes
4037         by pointer, using vector_sizes rather than a bitmask.
4038         * targhooks.h (default_autovectorize_vector_sizes): Update accordingly.
4039         * targhooks.c (default_autovectorize_vector_sizes): Likewise.
4040         * config/aarch64/aarch64.c (aarch64_autovectorize_vector_sizes):
4041         Likewise.
4042         * config/arc/arc.c (arc_autovectorize_vector_sizes): Likewise.
4043         * config/arm/arm.c (arm_autovectorize_vector_sizes): Likewise.
4044         * config/i386/i386.c (ix86_autovectorize_vector_sizes): Likewise.
4045         * config/mips/mips.c (mips_autovectorize_vector_sizes): Likewise.
4046         * omp-general.c (omp_max_vf): Likewise.
4047         * omp-low.c (omp_clause_aligned_alignment): Likewise.
4048         * optabs-query.c (can_vec_mask_load_store_p): Likewise.
4049         * tree-vect-loop.c (vect_analyze_loop): Likewise.
4050         * tree-vect-slp.c (vect_slp_bb): Likewise.
4051         * doc/tm.texi: Regenerate.
4052         * tree-vectorizer.h (current_vector_size): Change from an unsigned int
4053         to a poly_uint64.
4054         * tree-vect-stmts.c (get_vectype_for_scalar_type_and_size): Take
4055         the vector size as a poly_uint64 rather than an unsigned int.
4056         (current_vector_size): Change from an unsigned int to a poly_uint64.
4057         (get_vectype_for_scalar_type): Update accordingly.
4058         * tree.h (build_truth_vector_type): Take the size and number of
4059         units as a poly_uint64 rather than an unsigned int.
4060         (build_vector_type): Add a temporary overload that takes
4061         the number of units as a poly_uint64 rather than an unsigned int.
4062         * tree.c (make_vector_type): Likewise.
4063         (build_truth_vector_type): Take the number of units as a poly_uint64
4064         rather than an unsigned int.
4066 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4067             Alan Hayward  <alan.hayward@arm.com>
4068             David Sherwood  <david.sherwood@arm.com>
4070         * target.def (get_mask_mode): Take the number of units and length
4071         as poly_uint64s rather than unsigned ints.
4072         * targhooks.h (default_get_mask_mode): Update accordingly.
4073         * targhooks.c (default_get_mask_mode): Likewise.
4074         * config/i386/i386.c (ix86_get_mask_mode): Likewise.
4075         * doc/tm.texi: Regenerate.
4077 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4078             Alan Hayward  <alan.hayward@arm.com>
4079             David Sherwood  <david.sherwood@arm.com>
4081         * omp-general.h (omp_max_vf): Return a poly_uint64 instead of an int.
4082         * omp-general.c (omp_max_vf): Likewise.
4083         * omp-expand.c (omp_adjust_chunk_size): Update call to omp_max_vf.
4084         (expand_omp_simd): Handle polynomial safelen.
4085         * omp-low.c (omplow_simd_context): Add a default constructor.
4086         (omplow_simd_context::max_vf): Change from int to poly_uint64.
4087         (lower_rec_simd_input_clauses): Update accordingly.
4088         (lower_rec_input_clauses): Likewise.
4090 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4091             Alan Hayward  <alan.hayward@arm.com>
4092             David Sherwood  <david.sherwood@arm.com>
4094         * tree-vectorizer.h (vect_nunits_for_cost): New function.
4095         * tree-vect-loop.c (vect_model_reduction_cost): Use it.
4096         * tree-vect-slp.c (vect_analyze_slp_cost_1): Likewise.
4097         (vect_analyze_slp_cost): Likewise.
4098         * tree-vect-stmts.c (vect_model_store_cost): Likewise.
4099         (vect_model_load_cost): Likewise.
4101 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4102             Alan Hayward  <alan.hayward@arm.com>
4103             David Sherwood  <david.sherwood@arm.com>
4105         * tree-vect-slp.c (vect_record_max_nunits, vect_build_slp_tree_1)
4106         (vect_build_slp_tree_2, vect_build_slp_tree): Change max_nunits
4107         from an unsigned int * to a poly_uint64_pod *.
4108         (calculate_unrolling_factor): New function.
4109         (vect_analyze_slp_instance): Use it.  Track polynomial max_nunits.
4111 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4112             Alan Hayward  <alan.hayward@arm.com>
4113             David Sherwood  <david.sherwood@arm.com>
4115         * tree-vectorizer.h (_slp_instance::unrolling_factor): Change
4116         from an unsigned int to a poly_uint64.
4117         (_loop_vec_info::slp_unrolling_factor): Likewise.
4118         (_loop_vec_info::vectorization_factor): Change from an int
4119         to a poly_uint64.
4120         (MAX_VECTORIZATION_FACTOR): Bump from 64 to INT_MAX.
4121         (vect_get_num_vectors): New function.
4122         (vect_update_max_nunits, vect_vf_for_cost): Likewise.
4123         (vect_get_num_copies): Use vect_get_num_vectors.
4124         (vect_analyze_data_ref_dependences): Change max_vf from an int *
4125         to an unsigned int *.
4126         (vect_analyze_data_refs): Change min_vf from an int * to a
4127         poly_uint64 *.
4128         (vect_transform_slp_perm_load): Take the vf as a poly_uint64 rather
4129         than an unsigned HOST_WIDE_INT.
4130         * tree-vect-data-refs.c (vect_analyze_possibly_independent_ddr)
4131         (vect_analyze_data_ref_dependence): Change max_vf from an int *
4132         to an unsigned int *.
4133         (vect_analyze_data_ref_dependences): Likewise.
4134         (vect_compute_data_ref_alignment): Handle polynomial vf.
4135         (vect_enhance_data_refs_alignment): Likewise.
4136         (vect_prune_runtime_alias_test_list): Likewise.
4137         (vect_shift_permute_load_chain): Likewise.
4138         (vect_supportable_dr_alignment): Likewise.
4139         (dependence_distance_ge_vf): Take the vectorization factor as a
4140         poly_uint64 rather than an unsigned HOST_WIDE_INT.
4141         (vect_analyze_data_refs): Change min_vf from an int * to a
4142         poly_uint64 *.
4143         * tree-vect-loop-manip.c (vect_gen_scalar_loop_niters): Take
4144         vfm1 as a poly_uint64 rather than an int.  Make the same change
4145         for the returned bound_scalar.
4146         (vect_gen_vector_loop_niters): Handle polynomial vf.
4147         (vect_do_peeling): Likewise.  Update call to
4148         vect_gen_scalar_loop_niters and handle polynomial bound_scalars.
4149         (vect_gen_vector_loop_niters_mult_vf): Assert that the vf must
4150         be constant.
4151         * tree-vect-loop.c (vect_determine_vectorization_factor)
4152         (vect_update_vf_for_slp, vect_analyze_loop_2): Handle polynomial vf.
4153         (vect_get_known_peeling_cost): Likewise.
4154         (vect_estimate_min_profitable_iters, vectorizable_reduction): Likewise.
4155         (vect_worthwhile_without_simd_p, vectorizable_induction): Likewise.
4156         (vect_transform_loop): Likewise.  Use the lowest possible VF when
4157         updating the upper bounds of the loop.
4158         (vect_min_worthwhile_factor): Make static.  Return an unsigned int
4159         rather than an int.
4160         * tree-vect-slp.c (vect_attempt_slp_rearrange_stmts): Cope with
4161         polynomial unroll factors.
4162         (vect_analyze_slp_cost_1, vect_analyze_slp_instance): Likewise.
4163         (vect_make_slp_decision): Likewise.
4164         (vect_supported_load_permutation_p): Likewise, and polynomial
4165         vf too.
4166         (vect_analyze_slp_cost): Handle polynomial vf.
4167         (vect_slp_analyze_node_operations): Likewise.
4168         (vect_slp_analyze_bb_1): Likewise.
4169         (vect_transform_slp_perm_load): Take the vf as a poly_uint64 rather
4170         than an unsigned HOST_WIDE_INT.
4171         * tree-vect-stmts.c (vectorizable_simd_clone_call, vectorizable_store)
4172         (vectorizable_load): Handle polynomial vf.
4173         * tree-vectorizer.c (simduid_to_vf::vf): Change from an int to
4174         a poly_uint64.
4175         (adjust_simduid_builtins, shrink_simd_arrays): Update accordingly.
4177 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4178             Alan Hayward  <alan.hayward@arm.com>
4179             David Sherwood  <david.sherwood@arm.com>
4181         * match.pd: Handle bit operations involving three constants
4182         and try to fold one pair.
4184 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
4186         * tree-vect-loop-manip.c: Include gimple-fold.h.
4187         (slpeel_make_loop_iterate_ntimes): Add step, final_iv and
4188         niters_maybe_zero parameters.  Handle other cases besides a step of 1.
4189         (vect_gen_vector_loop_niters): Add a step_vector_ptr parameter.
4190         Add a path that uses a step of VF instead of 1, but disable it
4191         for now.
4192         (vect_do_peeling): Add step_vector, niters_vector_mult_vf_var
4193         and niters_no_overflow parameters.  Update calls to
4194         slpeel_make_loop_iterate_ntimes and vect_gen_vector_loop_niters.
4195         Create a new SSA name if the latter choses to use a ste other
4196         than zero, and return it via niters_vector_mult_vf_var.
4197         * tree-vect-loop.c (vect_transform_loop): Update calls to
4198         vect_do_peeling, vect_gen_vector_loop_niters and
4199         slpeel_make_loop_iterate_ntimes.
4200         * tree-vectorizer.h (slpeel_make_loop_iterate_ntimes, vect_do_peeling)
4201         (vect_gen_vector_loop_niters): Update declarations after above changes.
4203 2018-01-02  Michael Meissner  <meissner@linux.vnet.ibm.com>
4205         * config/rs6000/rs6000.md (floor<mode>2): Add support for IEEE
4206         128-bit round to integer instructions.
4207         (ceil<mode>2): Likewise.
4208         (btrunc<mode>2): Likewise.
4209         (round<mode>2): Likewise.
4211 2018-01-02  Aaron Sawdey  <acsawdey@linux.vnet.ibm.com>
4213         * config/rs6000/rs6000-string.c (expand_block_move): Allow the use of
4214         unaligned VSX load/store on P8/P9.
4215         (expand_block_clear): Allow the use of unaligned VSX
4216         load/store on P8/P9.
4218 2018-01-02  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
4220         * config/rs6000/rs6000-p8swap.c (swap_feeds_both_load_and_store):
4221         New function.
4222         (rs6000_analyze_swaps): Mark a web unoptimizable if it contains a
4223         swap associated with both a load and a store.
4225 2018-01-02  Andrew Waterman  <andrew@sifive.com>
4227         * config/riscv/linux.h (ICACHE_FLUSH_FUNC): New.
4228         * config/riscv/riscv.md (clear_cache): Use it.
4230 2018-01-02  Artyom Skrobov  <tyomitch@gmail.com>
4232         * web.c: Remove out-of-date comment.
4234 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
4236         * expr.c (fixup_args_size_notes): Check that any existing
4237         REG_ARGS_SIZE notes are correct, and don't try to re-add them.
4238         (emit_single_push_insn_1): Move stack_pointer_delta adjustment to...
4239         (emit_single_push_insn): ...here.
4241 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
4243         * rtl.h (CONST_VECTOR_ELT): Redefine to const_vector_elt.
4244         (const_vector_encoded_nelts): New function.
4245         (CONST_VECTOR_NUNITS): Redefine to use GET_MODE_NUNITS.
4246         (const_vector_int_elt, const_vector_elt): Declare.
4247         * emit-rtl.c (const_vector_int_elt_1): New function.
4248         (const_vector_elt): Likewise.
4249         * simplify-rtx.c (simplify_immed_subreg): Avoid taking the address
4250         of CONST_VECTOR_ELT.
4252 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
4254         * expr.c: Include rtx-vector-builder.h.
4255         (const_vector_mask_from_tree): Use rtx_vector_builder and operate
4256         directly on the tree encoding.
4257         (const_vector_from_tree): Likewise.
4258         * optabs.c: Include rtx-vector-builder.h.
4259         (expand_vec_perm_var): Use rtx_vector_builder and create a repeating
4260         sequence of "u" values.
4261         * vec-perm-indices.c: Include rtx-vector-builder.h.
4262         (vec_perm_indices_to_rtx): Use rtx_vector_builder and operate
4263         directly on the vec_perm_indices encoding.
4265 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
4267         * doc/rtl.texi (const_vector): Describe new encoding scheme.
4268         * Makefile.in (OBJS): Add rtx-vector-builder.o.
4269         * rtx-vector-builder.h: New file.
4270         * rtx-vector-builder.c: Likewise.
4271         * rtl.h (rtx_def::u2): Add a const_vector field.
4272         (CONST_VECTOR_NPATTERNS): New macro.
4273         (CONST_VECTOR_NELTS_PER_PATTERN): Likewise.
4274         (CONST_VECTOR_DUPLICATE_P): Likewise.
4275         (CONST_VECTOR_STEPPED_P): Likewise.
4276         (CONST_VECTOR_ENCODED_ELT): Likewise.
4277         (const_vec_duplicate_p): Check for a duplicated vector encoding.
4278         (unwrap_const_vec_duplicate): Likewise.
4279         (const_vec_series_p): Check for a non-duplicated vector encoding.
4280         Say that the function only returns true for integer vectors.
4281         * emit-rtl.c: Include rtx-vector-builder.h.
4282         (gen_const_vec_duplicate_1): Delete.
4283         (gen_const_vector): Call gen_const_vec_duplicate instead of
4284         gen_const_vec_duplicate_1.
4285         (const_vec_series_p_1): Operate directly on the CONST_VECTOR encoding.
4286         (gen_const_vec_duplicate): Use rtx_vector_builder.
4287         (gen_const_vec_series): Likewise.
4288         (gen_rtx_CONST_VECTOR): Likewise.
4289         * config/powerpcspe/powerpcspe.c: Include rtx-vector-builder.h.
4290         (swap_const_vector_halves): Take an rtx pointer rather than rtx.
4291         Build a new vector rather than modifying a CONST_VECTOR in-place.
4292         (handle_special_swappables): Update call accordingly.
4293         * config/rs6000/rs6000-p8swap.c: Include rtx-vector-builder.h.
4294         (swap_const_vector_halves): Take an rtx pointer rather than rtx.
4295         Build a new vector rather than modifying a CONST_VECTOR in-place.
4296         (handle_special_swappables): Update call accordingly.
4298 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
4300         * simplify-rtx.c (simplify_const_binary_operation): Use
4301         CONST_VECTOR_ELT instead of XVECEXP.
4303 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
4305         * tree-cfg.c (verify_gimple_assign_ternary): Allow the size of
4306         the selector elements to be different from the data elements
4307         if the selector is a VECTOR_CST.
4308         * tree-vect-stmts.c (vect_gen_perm_mask_any): Use a vector of
4309         ssizetype for the selector.
4311 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
4313         * optabs.c (shift_amt_for_vec_perm_mask): Try using series_p
4314         before testing each element individually.
4315         * tree-vect-generic.c (lower_vec_perm): Likewise.
4317 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
4319         * selftest.h (selftest::vec_perm_indices_c_tests): Declare.
4320         * selftest-run-tests.c (selftest::run_tests): Call it.
4321         * vector-builder.h (vector_builder::operator ==): New function.
4322         (vector_builder::operator !=): Likewise.
4323         * vec-perm-indices.h (vec_perm_indices::series_p): Declare.
4324         (vec_perm_indices::all_from_input_p): New function.
4325         * vec-perm-indices.c (vec_perm_indices::series_p): Likewise.
4326         (test_vec_perm_12, selftest::vec_perm_indices_c_tests): Likewise.
4327         * fold-const.c (fold_ternary_loc): Use tree_to_vec_perm_builder
4328         instead of reading the VECTOR_CST directly.  Detect whether both
4329         vector inputs are the same before constructing the vec_perm_indices,
4330         and update the number of inputs argument accordingly.  Use the
4331         utility functions added above.  Only construct sel2 if we need to.
4333 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
4335         * optabs.c (expand_vec_perm_var): Use an explicit encoding for
4336         the broadcast of the low byte.
4337         (expand_mult_highpart): Use an explicit encoding for the permutes.
4338         * optabs-query.c (can_mult_highpart_p): Likewise.
4339         * tree-vect-loop.c (calc_vec_perm_mask_for_shift): Likewise.
4340         * tree-vect-stmts.c (perm_mask_for_reverse): Likewise.
4341         (vectorizable_bswap): Likewise.
4342         * tree-vect-data-refs.c (vect_grouped_store_supported): Use an
4343         explicit encoding for the power-of-2 permutes.
4344         (vect_permute_store_chain): Likewise.
4345         (vect_grouped_load_supported): Likewise.
4346         (vect_permute_load_chain): Likewise.
4348 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
4350         * vec-perm-indices.h (vec_perm_indices_to_tree): Declare.
4351         * vec-perm-indices.c (vec_perm_indices_to_tree): New function.
4352         * tree-ssa-forwprop.c (simplify_vector_constructor): Use it.
4353         * tree-vect-slp.c (vect_transform_slp_perm_load): Likewise.
4354         * tree-vect-stmts.c (vectorizable_bswap): Likewise.
4355         (vect_gen_perm_mask_any): Likewise.
4357 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
4359         * int-vector-builder.h: New file.
4360         * vec-perm-indices.h: Include int-vector-builder.h.
4361         (vec_perm_indices): Redefine as an int_vector_builder.
4362         (auto_vec_perm_indices): Delete.
4363         (vec_perm_builder): Redefine as a stand-alone class.
4364         (vec_perm_indices::vec_perm_indices): New function.
4365         (vec_perm_indices::clamp): Likewise.
4366         * vec-perm-indices.c: Include fold-const.h and tree-vector-builder.h.
4367         (vec_perm_indices::new_vector): New function.
4368         (vec_perm_indices::new_expanded_vector): Update for new
4369         vec_perm_indices class.
4370         (vec_perm_indices::rotate_inputs): New function.
4371         (vec_perm_indices::all_in_range_p): Operate directly on the
4372         encoded form, without computing elided elements.
4373         (tree_to_vec_perm_builder): Operate directly on the VECTOR_CST
4374         encoding.  Update for new vec_perm_indices class.
4375         * optabs.c (expand_vec_perm_const): Create a vec_perm_indices for
4376         the given vec_perm_builder.
4377         (expand_vec_perm_var): Update vec_perm_builder constructor.
4378         (expand_mult_highpart): Use vec_perm_builder instead of
4379         auto_vec_perm_indices.
4380         * optabs-query.c (can_mult_highpart_p): Use vec_perm_builder and
4381         vec_perm_indices instead of auto_vec_perm_indices.  Use a single
4382         or double series encoding as appropriate.
4383         * fold-const.c (fold_ternary_loc): Use vec_perm_builder and
4384         vec_perm_indices instead of auto_vec_perm_indices.
4385         * tree-ssa-forwprop.c (simplify_vector_constructor): Likewise.
4386         * tree-vect-data-refs.c (vect_grouped_store_supported): Likewise.
4387         (vect_permute_store_chain): Likewise.
4388         (vect_grouped_load_supported): Likewise.
4389         (vect_permute_load_chain): Likewise.
4390         (vect_shift_permute_load_chain): Likewise.
4391         * tree-vect-slp.c (vect_build_slp_tree_1): Likewise.
4392         (vect_transform_slp_perm_load): Likewise.
4393         (vect_schedule_slp_instance): Likewise.
4394         * tree-vect-stmts.c (perm_mask_for_reverse): Likewise.
4395         (vectorizable_mask_load_store): Likewise.
4396         (vectorizable_bswap): Likewise.
4397         (vectorizable_store): Likewise.
4398         (vectorizable_load): Likewise.
4399         * tree-vect-generic.c (lower_vec_perm): Use vec_perm_builder and
4400         vec_perm_indices instead of auto_vec_perm_indices.  Use
4401         tree_to_vec_perm_builder to read the vector from a tree.
4402         * tree-vect-loop.c (calc_vec_perm_mask_for_shift): Take a
4403         vec_perm_builder instead of a vec_perm_indices.
4404         (have_whole_vector_shift): Use vec_perm_builder and
4405         vec_perm_indices instead of auto_vec_perm_indices.  Leave the
4406         truncation to calc_vec_perm_mask_for_shift.
4407         (vect_create_epilog_for_reduction): Likewise.
4408         * config/aarch64/aarch64.c (expand_vec_perm_d::perm): Change
4409         from auto_vec_perm_indices to vec_perm_indices.
4410         (aarch64_expand_vec_perm_const_1): Use rotate_inputs on d.perm
4411         instead of changing individual elements.
4412         (aarch64_vectorize_vec_perm_const): Use new_vector to install
4413         the vector in d.perm.
4414         * config/arm/arm.c (expand_vec_perm_d::perm): Change
4415         from auto_vec_perm_indices to vec_perm_indices.
4416         (arm_expand_vec_perm_const_1): Use rotate_inputs on d.perm
4417         instead of changing individual elements.
4418         (arm_vectorize_vec_perm_const): Use new_vector to install
4419         the vector in d.perm.
4420         * config/powerpcspe/powerpcspe.c (rs6000_expand_extract_even):
4421         Update vec_perm_builder constructor.
4422         (rs6000_expand_interleave): Likewise.
4423         * config/rs6000/rs6000.c (rs6000_expand_extract_even): Likewise.
4424         (rs6000_expand_interleave): Likewise.
4426 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
4428         * optabs-query.c (can_vec_perm_var_p): Check whether lowering
4429         to qimode could truncate the indices.
4430         * optabs.c (expand_vec_perm_var): Likewise.
4432 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
4434         * Makefile.in (OBJS): Add vec-perm-indices.o.
4435         * vec-perm-indices.h: New file.
4436         * vec-perm-indices.c: Likewise.
4437         * target.h (vec_perm_indices): Replace with a forward class
4438         declaration.
4439         (auto_vec_perm_indices): Move to vec-perm-indices.h.
4440         * optabs.h: Include vec-perm-indices.h.
4441         (expand_vec_perm): Delete.
4442         (selector_fits_mode_p, expand_vec_perm_var): Declare.
4443         (expand_vec_perm_const): Declare.
4444         * target.def (vec_perm_const_ok): Replace with...
4445         (vec_perm_const): ...this new hook.
4446         * doc/tm.texi.in (TARGET_VECTORIZE_VEC_PERM_CONST_OK): Replace with...
4447         (TARGET_VECTORIZE_VEC_PERM_CONST): ...this new hook.
4448         * doc/tm.texi: Regenerate.
4449         * optabs.def (vec_perm_const): Delete.
4450         * doc/md.texi (vec_perm_const): Likewise.
4451         (vec_perm): Refer to TARGET_VECTORIZE_VEC_PERM_CONST.
4452         * expr.c (expand_expr_real_2): Use expand_vec_perm_const rather than
4453         expand_vec_perm for constant permutation vectors.  Assert that
4454         the mode of variable permutation vectors is the integer equivalent
4455         of the mode that is being permuted.
4456         * optabs-query.h (selector_fits_mode_p): Declare.
4457         * optabs-query.c: Include vec-perm-indices.h.
4458         (selector_fits_mode_p): New function.
4459         (can_vec_perm_const_p): Check whether targetm.vectorize.vec_perm_const
4460         is defined, instead of checking whether the vec_perm_const_optab
4461         exists.  Use targetm.vectorize.vec_perm_const instead of
4462         targetm.vectorize.vec_perm_const_ok.  Check whether the indices
4463         fit in the vector mode before using a variable permute.
4464         * optabs.c (shift_amt_for_vec_perm_mask): Take a mode and a
4465         vec_perm_indices instead of an rtx.
4466         (expand_vec_perm): Replace with...
4467         (expand_vec_perm_const): ...this new function.  Take the selector
4468         as a vec_perm_indices rather than an rtx.  Also take the mode of
4469         the selector.  Update call to shift_amt_for_vec_perm_mask.
4470         Use targetm.vectorize.vec_perm_const instead of vec_perm_const_optab.
4471         Use vec_perm_indices::new_expanded_vector to expand the original
4472         selector into bytes.  Check whether the indices fit in the vector
4473         mode before using a variable permute.
4474         (expand_vec_perm_var): Make global.
4475         (expand_mult_highpart): Use expand_vec_perm_const.
4476         * fold-const.c: Includes vec-perm-indices.h.
4477         * tree-ssa-forwprop.c: Likewise.
4478         * tree-vect-data-refs.c: Likewise.
4479         * tree-vect-generic.c: Likewise.
4480         * tree-vect-loop.c: Likewise.
4481         * tree-vect-slp.c: Likewise.
4482         * tree-vect-stmts.c: Likewise.
4483         * config/aarch64/aarch64-protos.h (aarch64_expand_vec_perm_const):
4484         Delete.
4485         * config/aarch64/aarch64-simd.md (vec_perm_const<mode>): Delete.
4486         * config/aarch64/aarch64.c (aarch64_expand_vec_perm_const)
4487         (aarch64_vectorize_vec_perm_const_ok): Fuse into...
4488         (aarch64_vectorize_vec_perm_const): ...this new function.
4489         (TARGET_VECTORIZE_VEC_PERM_CONST_OK): Delete.
4490         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
4491         * config/arm/arm-protos.h (arm_expand_vec_perm_const): Delete.
4492         * config/arm/vec-common.md (vec_perm_const<mode>): Delete.
4493         * config/arm/arm.c (TARGET_VECTORIZE_VEC_PERM_CONST_OK): Delete.
4494         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
4495         (arm_expand_vec_perm_const, arm_vectorize_vec_perm_const_ok): Merge
4496         into...
4497         (arm_vectorize_vec_perm_const): ...this new function.  Explicitly
4498         check for NEON modes.
4499         * config/i386/i386-protos.h (ix86_expand_vec_perm_const): Delete.
4500         * config/i386/sse.md (VEC_PERM_CONST, vec_perm_const<mode>): Delete.
4501         * config/i386/i386.c (ix86_expand_vec_perm_const_1): Update comment.
4502         (ix86_expand_vec_perm_const, ix86_vectorize_vec_perm_const_ok): Merge
4503         into...
4504         (ix86_vectorize_vec_perm_const): ...this new function.  Incorporate
4505         the old VEC_PERM_CONST conditions.
4506         * config/ia64/ia64-protos.h (ia64_expand_vec_perm_const): Delete.
4507         * config/ia64/vect.md (vec_perm_const<mode>): Delete.
4508         * config/ia64/ia64.c (ia64_expand_vec_perm_const)
4509         (ia64_vectorize_vec_perm_const_ok): Merge into...
4510         (ia64_vectorize_vec_perm_const): ...this new function.
4511         * config/mips/loongson.md (vec_perm_const<mode>): Delete.
4512         * config/mips/mips-msa.md (vec_perm_const<mode>): Delete.
4513         * config/mips/mips-ps-3d.md (vec_perm_constv2sf): Delete.
4514         * config/mips/mips-protos.h (mips_expand_vec_perm_const): Delete.
4515         * config/mips/mips.c (mips_expand_vec_perm_const)
4516         (mips_vectorize_vec_perm_const_ok): Merge into...
4517         (mips_vectorize_vec_perm_const): ...this new function.
4518         * config/powerpcspe/altivec.md (vec_perm_constv16qi): Delete.
4519         * config/powerpcspe/paired.md (vec_perm_constv2sf): Delete.
4520         * config/powerpcspe/spe.md (vec_perm_constv2si): Delete.
4521         * config/powerpcspe/vsx.md (vec_perm_const<mode>): Delete.
4522         * config/powerpcspe/powerpcspe-protos.h (altivec_expand_vec_perm_const)
4523         (rs6000_expand_vec_perm_const): Delete.
4524         * config/powerpcspe/powerpcspe.c (TARGET_VECTORIZE_VEC_PERM_CONST_OK):
4525         Delete.
4526         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
4527         (altivec_expand_vec_perm_const_le): Take each operand individually.
4528         Operate on constant selectors rather than rtxes.
4529         (altivec_expand_vec_perm_const): Likewise.  Update call to
4530         altivec_expand_vec_perm_const_le.
4531         (rs6000_expand_vec_perm_const): Delete.
4532         (rs6000_vectorize_vec_perm_const_ok): Delete.
4533         (rs6000_vectorize_vec_perm_const): New function.
4534         (rs6000_do_expand_vec_perm): Take a vec_perm_builder instead of
4535         an element count and rtx array.
4536         (rs6000_expand_extract_even): Update call accordingly.
4537         (rs6000_expand_interleave): Likewise.
4538         * config/rs6000/altivec.md (vec_perm_constv16qi): Delete.
4539         * config/rs6000/paired.md (vec_perm_constv2sf): Delete.
4540         * config/rs6000/vsx.md (vec_perm_const<mode>): Delete.
4541         * config/rs6000/rs6000-protos.h (altivec_expand_vec_perm_const)
4542         (rs6000_expand_vec_perm_const): Delete.
4543         * config/rs6000/rs6000.c (TARGET_VECTORIZE_VEC_PERM_CONST_OK): Delete.
4544         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
4545         (altivec_expand_vec_perm_const_le): Take each operand individually.
4546         Operate on constant selectors rather than rtxes.
4547         (altivec_expand_vec_perm_const): Likewise.  Update call to
4548         altivec_expand_vec_perm_const_le.
4549         (rs6000_expand_vec_perm_const): Delete.
4550         (rs6000_vectorize_vec_perm_const_ok): Delete.
4551         (rs6000_vectorize_vec_perm_const): New function.  Remove stray
4552         reference to the SPE evmerge intructions.
4553         (rs6000_do_expand_vec_perm): Take a vec_perm_builder instead of
4554         an element count and rtx array.
4555         (rs6000_expand_extract_even): Update call accordingly.
4556         (rs6000_expand_interleave): Likewise.
4557         * config/sparc/sparc.md (vec_perm_constv8qi): Delete in favor of...
4558         * config/sparc/sparc.c (sparc_vectorize_vec_perm_const): ...this
4559         new function.
4560         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
4562 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
4564         * optabs.c (expand_vec_perm_1): Assert that SEL has an integer
4565         vector mode and that that mode matches the mode of the data
4566         being permuted.
4567         (expand_vec_perm): Split handling of non-CONST_VECTOR selectors
4568         out into expand_vec_perm_var.  Do all CONST_VECTOR handling here,
4569         directly using expand_vec_perm_1 when forcing selectors into
4570         registers.
4571         (expand_vec_perm_var): New function, split out from expand_vec_perm.
4573 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
4575         * optabs-query.h (can_vec_perm_p): Delete.
4576         (can_vec_perm_var_p, can_vec_perm_const_p): Declare.
4577         * optabs-query.c (can_vec_perm_p): Split into...
4578         (can_vec_perm_var_p, can_vec_perm_const_p): ...these two functions.
4579         (can_mult_highpart_p): Use can_vec_perm_const_p to test whether a
4580         particular selector is valid.
4581         * tree-ssa-forwprop.c (simplify_vector_constructor): Likewise.
4582         * tree-vect-data-refs.c (vect_grouped_store_supported): Likewise.
4583         (vect_grouped_load_supported): Likewise.
4584         (vect_shift_permute_load_chain): Likewise.
4585         * tree-vect-slp.c (vect_build_slp_tree_1): Likewise.
4586         (vect_transform_slp_perm_load): Likewise.
4587         * tree-vect-stmts.c (perm_mask_for_reverse): Likewise.
4588         (vectorizable_bswap): Likewise.
4589         (vect_gen_perm_mask_checked): Likewise.
4590         * fold-const.c (fold_ternary_loc): Likewise.  Don't take
4591         implementations of variable permutation vectors into account
4592         when deciding which selector to use.
4593         * tree-vect-loop.c (have_whole_vector_shift): Don't check whether
4594         vec_perm_const_optab is supported; instead use can_vec_perm_const_p
4595         with a false third argument.
4596         * tree-vect-generic.c (lower_vec_perm): Use can_vec_perm_const_p
4597         to test whether the constant selector is valid and can_vec_perm_var_p
4598         to test whether a variable selector is valid.
4600 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
4602         * optabs-query.h (can_vec_perm_p): Take a const vec_perm_indices *.
4603         * optabs-query.c (can_vec_perm_p): Likewise.
4604         * fold-const.c (fold_vec_perm): Take a const vec_perm_indices &
4605         instead of vec_perm_indices.
4606         * tree-vectorizer.h (vect_gen_perm_mask_any): Likewise,
4607         (vect_gen_perm_mask_checked): Likewise,
4608         * tree-vect-stmts.c (vect_gen_perm_mask_any): Likewise,
4609         (vect_gen_perm_mask_checked): Likewise,
4611 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
4613         * optabs-query.h (qimode_for_vec_perm): Declare.
4614         * optabs-query.c (can_vec_perm_p): Split out qimode search to...
4615         (qimode_for_vec_perm): ...this new function.
4616         * optabs.c (expand_vec_perm): Use qimode_for_vec_perm.
4618 2018-01-02  Aaron Sawdey  <acsawdey@linux.vnet.ibm.com>
4620         * rtlanal.c (canonicalize_condition): Return 0 if final rtx
4621         does not have a conditional at the top.
4623 2018-01-02  Richard Biener  <rguenther@suse.de>
4625         * ipa-inline.c (big_speedup_p): Fix expression.
4627 2018-01-02  Jan Hubicka  <hubicka@ucw.cz>
4629         PR target/81616
4630         * config/i386/x86-tune-costs.h: Increase cost of integer load costs
4631         for generic 4->6.
4633 2018-01-02  Jan Hubicka  <hubicka@ucw.cz>
4635         PR target/81616
4636         Generic tuning.
4637         * x86-tune-costs.h (generic_cost): Reduce cost of FDIV 20->17,
4638         cost of sqrt 20->14, DIVSS 18->13, DIVSD 32->17, SQRtSS 30->14
4639         and SQRTsD 58->18, cond_not_taken_branch_cost. 2->1. Increase
4640         cond_taken_branch_cost 3->4.
4642 2018-01-01  Jakub Jelinek  <jakub@redhat.com>
4644         PR tree-optimization/83581
4645         * tree-loop-distribution.c (pass_loop_distribution::execute): Return
4646         TODO_cleanup_cfg if any changes have been made.
4648         PR middle-end/83608
4649         * expr.c (store_expr_with_bounds): Use simplify_gen_subreg instead of
4650         convert_modes if target mode has the right side, but different mode
4651         class.
4653         PR middle-end/83609
4654         * expr.c (expand_assignment): Fix up a typo in simplify_gen_subreg
4655         last argument when extracting from CONCAT.  If either from_real or
4656         from_imag is NULL, use expansion through memory.  If result is not
4657         a CONCAT and simplify_gen_subreg fails, try to simplify_gen_subreg
4658         the parts directly to inner mode, if even that fails, use expansion
4659         through memory.
4661         PR middle-end/83623
4662         * expmed.c (expand_shift_1): For 2-byte rotates by BITS_PER_UNIT,
4663         check for bswap in mode rather than HImode and use that in expand_unop
4664         too.
4666 Copyright (C) 2018 Free Software Foundation, Inc.
4668 Copying and distribution of this file, with or without modification,
4669 are permitted in any medium without royalty provided the copyright
4670 notice and this notice are preserved.