poly_int: vect_permute_load/store_chain
[official-gcc.git] / gcc / ChangeLog
blobf17884d3f9772c2807b9e81b68ec18aa6047907e
1 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
2             Alan Hayward  <alan.hayward@arm.com>
3             David Sherwood  <david.sherwood@arm.com>
5         * tree-vect-data-refs.c (vect_permute_store_chain): Reorganize
6         so that both the length == 3 and length != 3 cases set up their
7         own permute vectors.  Add comments explaining why we know the
8         number of elements is constant.
9         (vect_permute_load_chain): Likewise.
11 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
12             Alan Hayward  <alan.hayward@arm.com>
13             David Sherwood  <david.sherwood@arm.com>
15         * machmode.h (mode_nunits): Change from unsigned char to
16         poly_uint16_pod.
17         (ONLY_FIXED_SIZE_MODES): New macro.
18         (pod_mode::measurement_type, scalar_int_mode::measurement_type)
19         (scalar_float_mode::measurement_type, scalar_mode::measurement_type)
20         (complex_mode::measurement_type, fixed_size_mode::measurement_type):
21         New typedefs.
22         (mode_to_nunits): Return a poly_uint16 rather than an unsigned short.
23         (GET_MODE_NUNITS): Return a constant if ONLY_FIXED_SIZE_MODES,
24         or if measurement_type is not polynomial.
25         * genmodes.c (ZERO_COEFFS): New macro.
26         (emit_mode_nunits_inline): Make mode_nunits_inline return a
27         poly_uint16.
28         (emit_mode_nunits): Change the type of mode_nunits to poly_uint16_pod.
29         Use ZERO_COEFFS when emitting initializers.
30         * data-streamer.h (bp_pack_poly_value): New function.
31         (bp_unpack_poly_value): Likewise.
32         * lto-streamer-in.c (lto_input_mode_table): Use bp_unpack_poly_value
33         for GET_MODE_NUNITS.
34         * lto-streamer-out.c (lto_write_mode_table): Use bp_pack_poly_value
35         for GET_MODE_NUNITS.
36         * tree.c (make_vector_type): Remove temporary shim and make
37         the real function take the number of units as a poly_uint64
38         rather than an int.
39         (build_vector_type_for_mode): Handle polynomial nunits.
40         * dwarf2out.c (loc_descriptor, add_const_value_attribute): Likewise.
41         * emit-rtl.c (const_vec_series_p_1): Likewise.
42         (gen_rtx_CONST_VECTOR): Likewise.
43         * fold-const.c (test_vec_duplicate_folding): Likewise.
44         * genrecog.c (validate_pattern): Likewise.
45         * optabs-query.c (can_vec_perm_var_p, can_mult_highpart_p): Likewise.
46         * optabs-tree.c (expand_vec_cond_expr_p): Likewise.
47         * optabs.c (expand_vector_broadcast, expand_binop_directly): Likewise.
48         (shift_amt_for_vec_perm_mask, expand_vec_perm_var): Likewise.
49         (expand_vec_cond_expr, expand_mult_highpart): Likewise.
50         * rtlanal.c (subreg_get_info): Likewise.
51         * tree-vect-data-refs.c (vect_grouped_store_supported): Likewise.
52         (vect_grouped_load_supported): Likewise.
53         * tree-vect-generic.c (type_for_widest_vector_mode): Likewise.
54         * tree-vect-loop.c (have_whole_vector_shift): Likewise.
55         * simplify-rtx.c (simplify_unary_operation_1): Likewise.
56         (simplify_const_unary_operation, simplify_binary_operation_1)
57         (simplify_const_binary_operation, simplify_ternary_operation)
58         (test_vector_ops_duplicate, test_vector_ops): Likewise.
59         (simplify_immed_subreg): Use GET_MODE_NUNITS on a fixed_size_mode
60         instead of CONST_VECTOR_NUNITS.
61         * varasm.c (output_constant_pool_2): Likewise.
62         * rtx-vector-builder.c (rtx_vector_builder::build): Only include the
63         explicit-encoded elements in the XVEC for variable-length vectors.
65 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
67         * lra-constraints.c (curr_insn_transform): Use partial_subreg_p.
69 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
70             Alan Hayward  <alan.hayward@arm.com>
71             David Sherwood  <david.sherwood@arm.com>
73         * coretypes.h (fixed_size_mode): Declare.
74         (fixed_size_mode_pod): New typedef.
75         * builtins.h (target_builtins::x_apply_args_mode)
76         (target_builtins::x_apply_result_mode): Change type to
77         fixed_size_mode_pod.
78         * builtins.c (apply_args_size, apply_result_size, result_vector)
79         (expand_builtin_apply_args_1, expand_builtin_apply)
80         (expand_builtin_return): Update accordingly.
82 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
84         * cse.c (hash_rtx_cb): Hash only the encoded elements.
85         * cselib.c (cselib_hash_rtx): Likewise.
86         * expmed.c (make_tree): Build VECTOR_CSTs directly from the
87         CONST_VECTOR encoding.
89 2017-01-03  Jakub Jelinek  <jakub@redhat.com>
90             Jeff Law  <law@redhat.com>
92         PR target/83641
93         * config/i386/i386.c (ix86_adjust_stack_and_probe_stack_clash): For
94         noreturn probe, use gen_pop instead of ix86_emit_restore_reg_using_pop,
95         only set RTX_FRAME_RELATED_P on both the push and pop if cfa_reg is sp
96         and add REG_CFA_ADJUST_CFA notes in that case to both insns.
98         PR target/83641
99         * config/i386/i386.c (ix86_adjust_stack_and_probe_stack_clash): Do not
100         explicitly probe *sp in a noreturn function if there were any callee
101         register saves or frame pointer is needed.
103 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
105         PR debug/83621
106         * cfgexpand.c (expand_debug_expr): Return NULL if mode is
107         BLKmode for ternary, binary or unary expressions.
109         PR debug/83645
110         * var-tracking.c (delete_vta_debug_insn): New inline function.
111         (delete_vta_debug_insns): Add USE_CFG argument, if true, walk just
112         insns from get_insns () to NULL instead of each bb separately.
113         Use delete_vta_debug_insn.  No longer static.
114         (vt_debug_insns_local, variable_tracking_main_1): Adjust
115         delete_vta_debug_insns callers.
116         * rtl.h (delete_vta_debug_insns): Declare.
117         * final.c (rest_of_handle_final): Call delete_vta_debug_insns
118         instead of variable_tracking_main.
120 2018-01-03  Martin Sebor  <msebor@redhat.com>
122         PR c/83559
123         * doc/extend.texi (attribute const): Fix a typo.
124         * ipa-pure-const.c ((warn_function_const, warn_function_pure): Avoid
125         issuing -Wsuggest-attribute for void functions.
127 2018-01-03  Martin Sebor  <msebor@redhat.com>
129         * gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref): Use
130         offset_int::from instead of wide_int::to_shwi.
131         (maybe_diag_overlap): Remove assertion.
132         Use HOST_WIDE_INT_PRINT_DEC instead of %lli.
133         * gimple-ssa-sprintf.c (format_directive): Same.
134         (parse_directive): Same.
135         (sprintf_dom_walker::compute_format_length): Same.
136         (try_substitute_return_value): Same.
138 2017-01-03  Jeff Law  <law@redhat.com>
140         PR middle-end/83654
141         * explow.c (anti_adjust_stack_and_probe_stack_clash): Test a
142         non-constant residual for zero at runtime and avoid probing in
143         that case.  Reorganize code for trailing problem to mirror handling
144         of the residual.
146 2018-01-03  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
148         PR tree-optimization/83501
149         * tree-ssa-strlen.c (get_string_cst): New.
150         (handle_char_store): Call get_string_cst.
152 2018-01-03  Martin Liska  <mliska@suse.cz>
154         PR tree-optimization/83593
155         * tree-ssa-strlen.c: Include tree-cfg.h.
156         (strlen_check_and_optimize_stmt): Add new argument cleanup_eh.
157         (strlen_dom_walker): Add new member variable m_cleanup_cfg.
158         (strlen_dom_walker::strlen_dom_walker): Initialize m_cleanup_cfg
159         to false.
160         (strlen_dom_walker::before_dom_children): Call
161         gimple_purge_dead_eh_edges. Dump tranformation with details
162         dump flags.
163         (strlen_dom_walker::before_dom_children): Update call by adding
164         new argument cleanup_eh.
165         (pass_strlen::execute): Return TODO_cleanup_cfg if needed.
167 2018-01-03  Martin Liska  <mliska@suse.cz>
169         PR ipa/83549
170         * cif-code.def (VARIADIC_THUNK): New enum value.
171         * ipa-fnsummary.c (compute_fn_summary): Do not inline variadic
172         thunks.
174 2018-01-03  Jan Beulich  <jbeulich@suse.com>
176         * sse.md (mov<mode>_internal): Tighten condition for when to use
177         vmovdqu<ssescalarsize> for TI and OI modes.
179 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
181         Update copyright years.
183 2018-01-03  Martin Liska  <mliska@suse.cz>
185         PR ipa/83594
186         * ipa-visibility.c (function_and_variable_visibility): Skip
187         functions with noipa attribure.
189 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
191         * gcc.c (process_command): Update copyright notice dates.
192         * gcov-dump.c (print_version): Ditto.
193         * gcov.c (print_version): Ditto.
194         * gcov-tool.c (print_version): Ditto.
195         * gengtype.c (create_file): Ditto.
196         * doc/cpp.texi: Bump @copying's copyright year.
197         * doc/cppinternals.texi: Ditto.
198         * doc/gcc.texi: Ditto.
199         * doc/gccint.texi: Ditto.
200         * doc/gcov.texi: Ditto.
201         * doc/install.texi: Ditto.
202         * doc/invoke.texi: Ditto.
204 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
206         * vector-builder.h (vector_builder::m_full_nelts): Change from
207         unsigned int to poly_uint64.
208         (vector_builder::full_nelts): Update prototype accordingly.
209         (vector_builder::new_vector): Likewise.
210         (vector_builder::encoded_full_vector_p): Handle polynomial full_nelts.
211         (vector_builder::operator ==): Likewise.
212         (vector_builder::finalize): Likewise.
213         * int-vector-builder.h (int_vector_builder::int_vector_builder):
214         Take the number of elements as a poly_uint64 rather than an
215         unsigned int.
216         * vec-perm-indices.h (vec_perm_indices::m_nelts_per_input): Change
217         from unsigned int to poly_uint64.
218         (vec_perm_indices::vec_perm_indices): Update prototype accordingly.
219         (vec_perm_indices::new_vector): Likewise.
220         (vec_perm_indices::length): Likewise.
221         (vec_perm_indices::nelts_per_input): Likewise.
222         (vec_perm_indices::input_nelts): Likewise.
223         * vec-perm-indices.c (vec_perm_indices::new_vector): Take the
224         number of elements per input as a poly_uint64 rather than an
225         unsigned int.  Use the original encoding for variable-length
226         vectors, rather than clamping each individual element.
227         For the second and subsequent elements in each pattern,
228         clamp the step and base before clamping their sum.
229         (vec_perm_indices::series_p): Handle polynomial element counts.
230         (vec_perm_indices::all_in_range_p): Likewise.
231         (vec_perm_indices_to_tree): Likewise.
232         (vec_perm_indices_to_rtx): Likewise.
233         * tree-vect-stmts.c (vect_gen_perm_mask_any): Likewise.
234         * tree-vector-builder.c (tree_vector_builder::new_unary_operation)
235         (tree_vector_builder::new_binary_operation): Handle polynomial
236         element counts.  Return false if we need to know the number
237         of elements at compile time.
238         * fold-const.c (fold_vec_perm): Punt if the number of elements
239         isn't known at compile time.
241 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
243         * vec-perm-indices.h (vec_perm_builder): Change element type
244         from HOST_WIDE_INT to poly_int64.
245         (vec_perm_indices::element_type): Update accordingly.
246         (vec_perm_indices::clamp): Handle polynomial element_types.
247         * vec-perm-indices.c (vec_perm_indices::series_p): Likewise.
248         (vec_perm_indices::all_in_range_p): Likewise.
249         (tree_to_vec_perm_builder): Check for poly_int64 trees rather
250         than shwi trees.
251         * vector-builder.h (vector_builder::stepped_sequence_p): Handle
252         polynomial vec_perm_indices element types.
253         * int-vector-builder.h (int_vector_builder::equal_p): Likewise.
254         * fold-const.c (fold_vec_perm): Likewise.
255         * optabs.c (shift_amt_for_vec_perm_mask): Likewise.
256         * tree-vect-generic.c (lower_vec_perm): Likewise.
257         * tree-vect-slp.c (vect_transform_slp_perm_load): Likewise.
258         * config/aarch64/aarch64.c (aarch64_evpc_tbl): Cast d->perm
259         element type to HOST_WIDE_INT.
261 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
262             Alan Hayward  <alan.hayward@arm.com>
263             David Sherwood  <david.sherwood@arm.com>
265         * alias.c (addr_side_effect_eval): Take the size as a poly_int64
266         rather than an int.  Use plus_constant.
267         (memrefs_conflict_p): Take the sizes as poly_int64s rather than ints.
268         Take the offset "c" as a poly_int64 rather than a HOST_WIDE_INT.
270 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
271             Alan Hayward  <alan.hayward@arm.com>
272             David Sherwood  <david.sherwood@arm.com>
274         * calls.c (emit_call_1, expand_call): Change struct_value_size from
275         a HOST_WIDE_INT to a poly_int64.
277 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
278             Alan Hayward  <alan.hayward@arm.com>
279             David Sherwood  <david.sherwood@arm.com>
281         * calls.c (load_register_parameters): Cope with polynomial
282         mode sizes.  Require a constant size for BLKmode parameters
283         that aren't described by a PARALLEL.  If BLOCK_REG_PADDING
284         forces a parameter to be padded at the lsb end in order to
285         fill a complete number of words, require the parameter size
286         to be ordered wrt UNITS_PER_WORD.
288 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
289             Alan Hayward  <alan.hayward@arm.com>
290             David Sherwood  <david.sherwood@arm.com>
292         * reload1.c (spill_stack_slot_width): Change element type
293         from unsigned int to poly_uint64_pod.
294         (alter_reg): Treat mode sizes as polynomial.
296 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
297             Alan Hayward  <alan.hayward@arm.com>
298             David Sherwood  <david.sherwood@arm.com>
300         * reload.c (complex_word_subreg_p): New function.
301         (reload_inner_reg_of_subreg, push_reload): Use it.
303 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
304             Alan Hayward  <alan.hayward@arm.com>
305             David Sherwood  <david.sherwood@arm.com>
307         * lra-constraints.c (process_alt_operands): Reject matched
308         operands whose sizes aren't ordered.
309         (match_reload): Refer to this check here.
311 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
312             Alan Hayward  <alan.hayward@arm.com>
313             David Sherwood  <david.sherwood@arm.com>
315         * builtins.c (expand_ifn_atomic_compare_exchange_into_call): Assert
316         that the mode size is in the set {1, 2, 4, 8, 16}.
318 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
319             Alan Hayward  <alan.hayward@arm.com>
320             David Sherwood  <david.sherwood@arm.com>
322         * var-tracking.c (adjust_mems): Treat mode sizes as polynomial.
323         Use plus_constant instead of gen_rtx_PLUS.
325 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
326             Alan Hayward  <alan.hayward@arm.com>
327             David Sherwood  <david.sherwood@arm.com>
329         * config/cr16/cr16-protos.h (cr16_push_rounding): Declare.
330         * config/cr16/cr16.h (PUSH_ROUNDING): Move implementation to...
331         * config/cr16/cr16.c (cr16_push_rounding): ...this new function.
332         * config/h8300/h8300-protos.h (h8300_push_rounding): Declare.
333         * config/h8300/h8300.h (PUSH_ROUNDING): Move implementation to...
334         * config/h8300/h8300.c (h8300_push_rounding): ...this new function.
335         * config/i386/i386-protos.h (ix86_push_rounding): Declare.
336         * config/i386/i386.h (PUSH_ROUNDING): Move implementation to...
337         * config/i386/i386.c (ix86_push_rounding): ...this new function.
338         * config/m32c/m32c-protos.h (m32c_push_rounding): Take and return
339         a poly_int64.
340         * config/m32c/m32c.c (m32c_push_rounding): Likewise.
341         * config/m68k/m68k-protos.h (m68k_push_rounding): Declare.
342         * config/m68k/m68k.h (PUSH_ROUNDING): Move implementation to...
343         * config/m68k/m68k.c (m68k_push_rounding): ...this new function.
344         * config/pdp11/pdp11-protos.h (pdp11_push_rounding): Declare.
345         * config/pdp11/pdp11.h (PUSH_ROUNDING): Move implementation to...
346         * config/pdp11/pdp11.c (pdp11_push_rounding): ...this new function.
347         * config/stormy16/stormy16-protos.h (xstormy16_push_rounding): Declare.
348         * config/stormy16/stormy16.h (PUSH_ROUNDING): Move implementation to...
349         * config/stormy16/stormy16.c (xstormy16_push_rounding): ...this new
350         function.
351         * expr.c (emit_move_resolve_push): Treat the input and result
352         of PUSH_ROUNDING as a poly_int64.
353         (emit_move_complex_push, emit_single_push_insn_1): Likewise.
354         (emit_push_insn): Likewise.
355         * lra-eliminations.c (mark_not_eliminable): Likewise.
356         * recog.c (push_operand): Likewise.
357         * reload1.c (elimination_effects): Likewise.
358         * rtlanal.c (nonzero_bits1): Likewise.
359         * calls.c (store_one_arg): Likewise.  Require the padding to be
360         known at compile time.
362 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
363             Alan Hayward  <alan.hayward@arm.com>
364             David Sherwood  <david.sherwood@arm.com>
366         * expr.c (emit_single_push_insn_1): Treat mode sizes as polynomial.
367         Use plus_constant instead of gen_rtx_PLUS.
369 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
370             Alan Hayward  <alan.hayward@arm.com>
371             David Sherwood  <david.sherwood@arm.com>
373         * auto-inc-dec.c (set_inc_state): Take the mode size as a poly_int64
374         rather than an int.
376 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
377             Alan Hayward  <alan.hayward@arm.com>
378             David Sherwood  <david.sherwood@arm.com>
380         * expr.c (expand_expr_real_1): Use tree_to_poly_uint64
381         instead of int_size_in_bytes when handling VIEW_CONVERT_EXPRs
382         via stack temporaries.  Treat the mode size as polynomial too.
384 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
385             Alan Hayward  <alan.hayward@arm.com>
386             David Sherwood  <david.sherwood@arm.com>
388         * expr.c (expand_expr_real_2): When handling conversions involving
389         unions, apply tree_to_poly_uint64 to the TYPE_SIZE rather than
390         multiplying int_size_in_bytes by BITS_PER_UNIT.  Treat GET_MODE_BISIZE
391         as a poly_uint64 too.
393 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
394             Alan Hayward  <alan.hayward@arm.com>
395             David Sherwood  <david.sherwood@arm.com>
397         * rtlanal.c (subreg_get_info): Handle polynomial mode sizes.
399 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
400             Alan Hayward  <alan.hayward@arm.com>
401             David Sherwood  <david.sherwood@arm.com>
403         * combine.c (can_change_dest_mode): Handle polynomial
404         REGMODE_NATURAL_SIZE.
405         * expmed.c (store_bit_field_1): Likewise.
406         * expr.c (store_constructor): Likewise.
407         * emit-rtl.c (validate_subreg): Operate on polynomial mode sizes
408         and polynomial REGMODE_NATURAL_SIZE.
409         (gen_lowpart_common): Likewise.
410         * reginfo.c (record_subregs_of_mode): Likewise.
411         * rtlanal.c (read_modify_subreg_p): Likewise.
413 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
414             Alan Hayward  <alan.hayward@arm.com>
415             David Sherwood  <david.sherwood@arm.com>
417         * internal-fn.c (expand_vector_ubsan_overflow): Handle polynomial
418         numbers of elements.
420 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
421             Alan Hayward  <alan.hayward@arm.com>
422             David Sherwood  <david.sherwood@arm.com>
424         * match.pd: Cope with polynomial numbers of vector elements.
426 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
427             Alan Hayward  <alan.hayward@arm.com>
428             David Sherwood  <david.sherwood@arm.com>
430         * fold-const.c (fold_indirect_ref_1): Handle polynomial offsets
431         in a POINTER_PLUS_EXPR.
433 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
434             Alan Hayward  <alan.hayward@arm.com>
435             David Sherwood  <david.sherwood@arm.com>
437         * omp-simd-clone.c (simd_clone_subparts): New function.
438         (simd_clone_init_simd_arrays): Use it instead of TYPE_VECTOR_SUBPARTS.
439         (ipa_simd_modify_function_body): Likewise.
441 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
442             Alan Hayward  <alan.hayward@arm.com>
443             David Sherwood  <david.sherwood@arm.com>
445         * tree-vect-generic.c (nunits_for_known_piecewise_op): New function.
446         (expand_vector_piecewise): Use it instead of TYPE_VECTOR_SUBPARTS.
447         (expand_vector_addition, add_rshift, expand_vector_divmod): Likewise.
448         (expand_vector_condition, vector_element): Likewise.
449         (subparts_gt): New function.
450         (get_compute_type): Use subparts_gt.
451         (count_type_subparts): Delete.
452         (expand_vector_operations_1): Use subparts_gt instead of
453         count_type_subparts.
455 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
456             Alan Hayward  <alan.hayward@arm.com>
457             David Sherwood  <david.sherwood@arm.com>
459         * tree-vect-data-refs.c (vect_no_alias_p): Replace with...
460         (vect_compile_time_alias): ...this new function.  Do the calculation
461         on poly_ints rather than trees.
462         (vect_prune_runtime_alias_test_list): Update call accordingly.
464 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
465             Alan Hayward  <alan.hayward@arm.com>
466             David Sherwood  <david.sherwood@arm.com>
468         * tree-vect-slp.c (vect_build_slp_tree_1): Handle polynomial
469         numbers of units.
470         (vect_schedule_slp_instance): Likewise.
472 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
473             Alan Hayward  <alan.hayward@arm.com>
474             David Sherwood  <david.sherwood@arm.com>
476         * tree-vect-slp.c (vect_get_and_check_slp_defs): Reject
477         constant and extern definitions for variable-length vectors.
478         (vect_get_constant_vectors): Note that the number of units
479         is known to be constant.
481 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
482             Alan Hayward  <alan.hayward@arm.com>
483             David Sherwood  <david.sherwood@arm.com>
485         * tree-vect-stmts.c (vectorizable_conversion): Treat the number
486         of units as polynomial.  Choose between WIDE and NARROW based
487         on multiple_p.
489 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
490             Alan Hayward  <alan.hayward@arm.com>
491             David Sherwood  <david.sherwood@arm.com>
493         * tree-vect-stmts.c (simd_clone_subparts): New function.
494         (vectorizable_simd_clone_call): Use it instead of TYPE_VECTOR_SUBPARTS.
496 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
497             Alan Hayward  <alan.hayward@arm.com>
498             David Sherwood  <david.sherwood@arm.com>
500         * tree-vect-stmts.c (vectorizable_call): Treat the number of
501         vectors as polynomial.  Use build_index_vector for
502         IFN_GOMP_SIMD_LANE.
504 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
505             Alan Hayward  <alan.hayward@arm.com>
506             David Sherwood  <david.sherwood@arm.com>
508         * tree-vect-stmts.c (get_load_store_type): Treat the number of
509         units as polynomial.  Reject VMAT_ELEMENTWISE and VMAT_STRIDED_SLP
510         for variable-length vectors.
511         (vectorizable_mask_load_store): Treat the number of units as
512         polynomial, asserting that it is constant if the condition has
513         already been enforced.
514         (vectorizable_store, vectorizable_load): Likewise.
516 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
517             Alan Hayward  <alan.hayward@arm.com>
518             David Sherwood  <david.sherwood@arm.com>
520         * tree-vect-loop.c (vectorizable_live_operation): Treat the number
521         of units as polynomial.  Punt if we can't tell at compile time
522         which vector contains the final result.
524 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
525             Alan Hayward  <alan.hayward@arm.com>
526             David Sherwood  <david.sherwood@arm.com>
528         * tree-vect-loop.c (vectorizable_induction): Treat the number
529         of units as polynomial.  Punt on SLP inductions.  Use an integer
530         VEC_SERIES_EXPR for variable-length integer reductions.  Use a
531         cast of such a series for variable-length floating-point
532         reductions.
534 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
535             Alan Hayward  <alan.hayward@arm.com>
536             David Sherwood  <david.sherwood@arm.com>
538         * tree.h (build_index_vector): Declare.
539         * tree.c (build_index_vector): New function.
540         * tree-vect-loop.c (get_initial_defs_for_reduction): Treat the number
541         of units as polynomial, forcibly converting it to a constant if
542         vectorizable_reduction has already enforced the condition.
543         (vect_create_epilog_for_reduction): Likewise.  Use build_index_vector
544         to create a {1,2,3,...} vector.
545         (vectorizable_reduction): Treat the number of units as polynomial.
546         Choose vectype_in based on the largest scalar element size rather
547         than the smallest number of units.  Enforce the restrictions
548         relied on above.
550 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
551             Alan Hayward  <alan.hayward@arm.com>
552             David Sherwood  <david.sherwood@arm.com>
554         * tree-vect-data-refs.c (vector_alignment_reachable_p): Treat the
555         number of units as polynomial.
557 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
558             Alan Hayward  <alan.hayward@arm.com>
559             David Sherwood  <david.sherwood@arm.com>
561         * target.h (vector_sizes, auto_vector_sizes): New typedefs.
562         * target.def (autovectorize_vector_sizes): Return the vector sizes
563         by pointer, using vector_sizes rather than a bitmask.
564         * targhooks.h (default_autovectorize_vector_sizes): Update accordingly.
565         * targhooks.c (default_autovectorize_vector_sizes): Likewise.
566         * config/aarch64/aarch64.c (aarch64_autovectorize_vector_sizes):
567         Likewise.
568         * config/arc/arc.c (arc_autovectorize_vector_sizes): Likewise.
569         * config/arm/arm.c (arm_autovectorize_vector_sizes): Likewise.
570         * config/i386/i386.c (ix86_autovectorize_vector_sizes): Likewise.
571         * config/mips/mips.c (mips_autovectorize_vector_sizes): Likewise.
572         * omp-general.c (omp_max_vf): Likewise.
573         * omp-low.c (omp_clause_aligned_alignment): Likewise.
574         * optabs-query.c (can_vec_mask_load_store_p): Likewise.
575         * tree-vect-loop.c (vect_analyze_loop): Likewise.
576         * tree-vect-slp.c (vect_slp_bb): Likewise.
577         * doc/tm.texi: Regenerate.
578         * tree-vectorizer.h (current_vector_size): Change from an unsigned int
579         to a poly_uint64.
580         * tree-vect-stmts.c (get_vectype_for_scalar_type_and_size): Take
581         the vector size as a poly_uint64 rather than an unsigned int.
582         (current_vector_size): Change from an unsigned int to a poly_uint64.
583         (get_vectype_for_scalar_type): Update accordingly.
584         * tree.h (build_truth_vector_type): Take the size and number of
585         units as a poly_uint64 rather than an unsigned int.
586         (build_vector_type): Add a temporary overload that takes
587         the number of units as a poly_uint64 rather than an unsigned int.
588         * tree.c (make_vector_type): Likewise.
589         (build_truth_vector_type): Take the number of units as a poly_uint64
590         rather than an unsigned int.
592 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
593             Alan Hayward  <alan.hayward@arm.com>
594             David Sherwood  <david.sherwood@arm.com>
596         * target.def (get_mask_mode): Take the number of units and length
597         as poly_uint64s rather than unsigned ints.
598         * targhooks.h (default_get_mask_mode): Update accordingly.
599         * targhooks.c (default_get_mask_mode): Likewise.
600         * config/i386/i386.c (ix86_get_mask_mode): Likewise.
601         * doc/tm.texi: Regenerate.
603 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
604             Alan Hayward  <alan.hayward@arm.com>
605             David Sherwood  <david.sherwood@arm.com>
607         * omp-general.h (omp_max_vf): Return a poly_uint64 instead of an int.
608         * omp-general.c (omp_max_vf): Likewise.
609         * omp-expand.c (omp_adjust_chunk_size): Update call to omp_max_vf.
610         (expand_omp_simd): Handle polynomial safelen.
611         * omp-low.c (omplow_simd_context): Add a default constructor.
612         (omplow_simd_context::max_vf): Change from int to poly_uint64.
613         (lower_rec_simd_input_clauses): Update accordingly.
614         (lower_rec_input_clauses): Likewise.
616 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
617             Alan Hayward  <alan.hayward@arm.com>
618             David Sherwood  <david.sherwood@arm.com>
620         * tree-vectorizer.h (vect_nunits_for_cost): New function.
621         * tree-vect-loop.c (vect_model_reduction_cost): Use it.
622         * tree-vect-slp.c (vect_analyze_slp_cost_1): Likewise.
623         (vect_analyze_slp_cost): Likewise.
624         * tree-vect-stmts.c (vect_model_store_cost): Likewise.
625         (vect_model_load_cost): Likewise.
627 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
628             Alan Hayward  <alan.hayward@arm.com>
629             David Sherwood  <david.sherwood@arm.com>
631         * tree-vect-slp.c (vect_record_max_nunits, vect_build_slp_tree_1)
632         (vect_build_slp_tree_2, vect_build_slp_tree): Change max_nunits
633         from an unsigned int * to a poly_uint64_pod *.
634         (calculate_unrolling_factor): New function.
635         (vect_analyze_slp_instance): Use it.  Track polynomial max_nunits.
637 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
638             Alan Hayward  <alan.hayward@arm.com>
639             David Sherwood  <david.sherwood@arm.com>
641         * tree-vectorizer.h (_slp_instance::unrolling_factor): Change
642         from an unsigned int to a poly_uint64.
643         (_loop_vec_info::slp_unrolling_factor): Likewise.
644         (_loop_vec_info::vectorization_factor): Change from an int
645         to a poly_uint64.
646         (MAX_VECTORIZATION_FACTOR): Bump from 64 to INT_MAX.
647         (vect_get_num_vectors): New function.
648         (vect_update_max_nunits, vect_vf_for_cost): Likewise.
649         (vect_get_num_copies): Use vect_get_num_vectors.
650         (vect_analyze_data_ref_dependences): Change max_vf from an int *
651         to an unsigned int *.
652         (vect_analyze_data_refs): Change min_vf from an int * to a
653         poly_uint64 *.
654         (vect_transform_slp_perm_load): Take the vf as a poly_uint64 rather
655         than an unsigned HOST_WIDE_INT.
656         * tree-vect-data-refs.c (vect_analyze_possibly_independent_ddr)
657         (vect_analyze_data_ref_dependence): Change max_vf from an int *
658         to an unsigned int *.
659         (vect_analyze_data_ref_dependences): Likewise.
660         (vect_compute_data_ref_alignment): Handle polynomial vf.
661         (vect_enhance_data_refs_alignment): Likewise.
662         (vect_prune_runtime_alias_test_list): Likewise.
663         (vect_shift_permute_load_chain): Likewise.
664         (vect_supportable_dr_alignment): Likewise.
665         (dependence_distance_ge_vf): Take the vectorization factor as a
666         poly_uint64 rather than an unsigned HOST_WIDE_INT.
667         (vect_analyze_data_refs): Change min_vf from an int * to a
668         poly_uint64 *.
669         * tree-vect-loop-manip.c (vect_gen_scalar_loop_niters): Take
670         vfm1 as a poly_uint64 rather than an int.  Make the same change
671         for the returned bound_scalar.
672         (vect_gen_vector_loop_niters): Handle polynomial vf.
673         (vect_do_peeling): Likewise.  Update call to
674         vect_gen_scalar_loop_niters and handle polynomial bound_scalars.
675         (vect_gen_vector_loop_niters_mult_vf): Assert that the vf must
676         be constant.
677         * tree-vect-loop.c (vect_determine_vectorization_factor)
678         (vect_update_vf_for_slp, vect_analyze_loop_2): Handle polynomial vf.
679         (vect_get_known_peeling_cost): Likewise.
680         (vect_estimate_min_profitable_iters, vectorizable_reduction): Likewise.
681         (vect_worthwhile_without_simd_p, vectorizable_induction): Likewise.
682         (vect_transform_loop): Likewise.  Use the lowest possible VF when
683         updating the upper bounds of the loop.
684         (vect_min_worthwhile_factor): Make static.  Return an unsigned int
685         rather than an int.
686         * tree-vect-slp.c (vect_attempt_slp_rearrange_stmts): Cope with
687         polynomial unroll factors.
688         (vect_analyze_slp_cost_1, vect_analyze_slp_instance): Likewise.
689         (vect_make_slp_decision): Likewise.
690         (vect_supported_load_permutation_p): Likewise, and polynomial
691         vf too.
692         (vect_analyze_slp_cost): Handle polynomial vf.
693         (vect_slp_analyze_node_operations): Likewise.
694         (vect_slp_analyze_bb_1): Likewise.
695         (vect_transform_slp_perm_load): Take the vf as a poly_uint64 rather
696         than an unsigned HOST_WIDE_INT.
697         * tree-vect-stmts.c (vectorizable_simd_clone_call, vectorizable_store)
698         (vectorizable_load): Handle polynomial vf.
699         * tree-vectorizer.c (simduid_to_vf::vf): Change from an int to
700         a poly_uint64.
701         (adjust_simduid_builtins, shrink_simd_arrays): Update accordingly.
703 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
704             Alan Hayward  <alan.hayward@arm.com>
705             David Sherwood  <david.sherwood@arm.com>
707         * match.pd: Handle bit operations involving three constants
708         and try to fold one pair.
710 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
712         * tree-vect-loop-manip.c: Include gimple-fold.h.
713         (slpeel_make_loop_iterate_ntimes): Add step, final_iv and
714         niters_maybe_zero parameters.  Handle other cases besides a step of 1.
715         (vect_gen_vector_loop_niters): Add a step_vector_ptr parameter.
716         Add a path that uses a step of VF instead of 1, but disable it
717         for now.
718         (vect_do_peeling): Add step_vector, niters_vector_mult_vf_var
719         and niters_no_overflow parameters.  Update calls to
720         slpeel_make_loop_iterate_ntimes and vect_gen_vector_loop_niters.
721         Create a new SSA name if the latter choses to use a ste other
722         than zero, and return it via niters_vector_mult_vf_var.
723         * tree-vect-loop.c (vect_transform_loop): Update calls to
724         vect_do_peeling, vect_gen_vector_loop_niters and
725         slpeel_make_loop_iterate_ntimes.
726         * tree-vectorizer.h (slpeel_make_loop_iterate_ntimes, vect_do_peeling)
727         (vect_gen_vector_loop_niters): Update declarations after above changes.
729 2018-01-02  Michael Meissner  <meissner@linux.vnet.ibm.com>
731         * config/rs6000/rs6000.md (floor<mode>2): Add support for IEEE
732         128-bit round to integer instructions.
733         (ceil<mode>2): Likewise.
734         (btrunc<mode>2): Likewise.
735         (round<mode>2): Likewise.
737 2018-01-02  Aaron Sawdey  <acsawdey@linux.vnet.ibm.com>
739         * config/rs6000/rs6000-string.c (expand_block_move): Allow the use of
740         unaligned VSX load/store on P8/P9.
741         (expand_block_clear): Allow the use of unaligned VSX
742         load/store on P8/P9.
744 2018-01-02  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
746         * config/rs6000/rs6000-p8swap.c (swap_feeds_both_load_and_store):
747         New function.
748         (rs6000_analyze_swaps): Mark a web unoptimizable if it contains a
749         swap associated with both a load and a store.
751 2018-01-02  Andrew Waterman  <andrew@sifive.com>
753         * config/riscv/linux.h (ICACHE_FLUSH_FUNC): New.
754         * config/riscv/riscv.md (clear_cache): Use it.
756 2018-01-02  Artyom Skrobov  <tyomitch@gmail.com>
758         * web.c: Remove out-of-date comment.
760 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
762         * expr.c (fixup_args_size_notes): Check that any existing
763         REG_ARGS_SIZE notes are correct, and don't try to re-add them.
764         (emit_single_push_insn_1): Move stack_pointer_delta adjustment to...
765         (emit_single_push_insn): ...here.
767 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
769         * rtl.h (CONST_VECTOR_ELT): Redefine to const_vector_elt.
770         (const_vector_encoded_nelts): New function.
771         (CONST_VECTOR_NUNITS): Redefine to use GET_MODE_NUNITS.
772         (const_vector_int_elt, const_vector_elt): Declare.
773         * emit-rtl.c (const_vector_int_elt_1): New function.
774         (const_vector_elt): Likewise.
775         * simplify-rtx.c (simplify_immed_subreg): Avoid taking the address
776         of CONST_VECTOR_ELT.
778 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
780         * expr.c: Include rtx-vector-builder.h.
781         (const_vector_mask_from_tree): Use rtx_vector_builder and operate
782         directly on the tree encoding.
783         (const_vector_from_tree): Likewise.
784         * optabs.c: Include rtx-vector-builder.h.
785         (expand_vec_perm_var): Use rtx_vector_builder and create a repeating
786         sequence of "u" values.
787         * vec-perm-indices.c: Include rtx-vector-builder.h.
788         (vec_perm_indices_to_rtx): Use rtx_vector_builder and operate
789         directly on the vec_perm_indices encoding.
791 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
793         * doc/rtl.texi (const_vector): Describe new encoding scheme.
794         * Makefile.in (OBJS): Add rtx-vector-builder.o.
795         * rtx-vector-builder.h: New file.
796         * rtx-vector-builder.c: Likewise.
797         * rtl.h (rtx_def::u2): Add a const_vector field.
798         (CONST_VECTOR_NPATTERNS): New macro.
799         (CONST_VECTOR_NELTS_PER_PATTERN): Likewise.
800         (CONST_VECTOR_DUPLICATE_P): Likewise.
801         (CONST_VECTOR_STEPPED_P): Likewise.
802         (CONST_VECTOR_ENCODED_ELT): Likewise.
803         (const_vec_duplicate_p): Check for a duplicated vector encoding.
804         (unwrap_const_vec_duplicate): Likewise.
805         (const_vec_series_p): Check for a non-duplicated vector encoding.
806         Say that the function only returns true for integer vectors.
807         * emit-rtl.c: Include rtx-vector-builder.h.
808         (gen_const_vec_duplicate_1): Delete.
809         (gen_const_vector): Call gen_const_vec_duplicate instead of
810         gen_const_vec_duplicate_1.
811         (const_vec_series_p_1): Operate directly on the CONST_VECTOR encoding.
812         (gen_const_vec_duplicate): Use rtx_vector_builder.
813         (gen_const_vec_series): Likewise.
814         (gen_rtx_CONST_VECTOR): Likewise.
815         * config/powerpcspe/powerpcspe.c: Include rtx-vector-builder.h.
816         (swap_const_vector_halves): Take an rtx pointer rather than rtx.
817         Build a new vector rather than modifying a CONST_VECTOR in-place.
818         (handle_special_swappables): Update call accordingly.
819         * config/rs6000/rs6000-p8swap.c: Include rtx-vector-builder.h.
820         (swap_const_vector_halves): Take an rtx pointer rather than rtx.
821         Build a new vector rather than modifying a CONST_VECTOR in-place.
822         (handle_special_swappables): Update call accordingly.
824 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
826         * simplify-rtx.c (simplify_const_binary_operation): Use
827         CONST_VECTOR_ELT instead of XVECEXP.
829 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
831         * tree-cfg.c (verify_gimple_assign_ternary): Allow the size of
832         the selector elements to be different from the data elements
833         if the selector is a VECTOR_CST.
834         * tree-vect-stmts.c (vect_gen_perm_mask_any): Use a vector of
835         ssizetype for the selector.
837 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
839         * optabs.c (shift_amt_for_vec_perm_mask): Try using series_p
840         before testing each element individually.
841         * tree-vect-generic.c (lower_vec_perm): Likewise.
843 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
845         * selftest.h (selftest::vec_perm_indices_c_tests): Declare.
846         * selftest-run-tests.c (selftest::run_tests): Call it.
847         * vector-builder.h (vector_builder::operator ==): New function.
848         (vector_builder::operator !=): Likewise.
849         * vec-perm-indices.h (vec_perm_indices::series_p): Declare.
850         (vec_perm_indices::all_from_input_p): New function.
851         * vec-perm-indices.c (vec_perm_indices::series_p): Likewise.
852         (test_vec_perm_12, selftest::vec_perm_indices_c_tests): Likewise.
853         * fold-const.c (fold_ternary_loc): Use tree_to_vec_perm_builder
854         instead of reading the VECTOR_CST directly.  Detect whether both
855         vector inputs are the same before constructing the vec_perm_indices,
856         and update the number of inputs argument accordingly.  Use the
857         utility functions added above.  Only construct sel2 if we need to.
859 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
861         * optabs.c (expand_vec_perm_var): Use an explicit encoding for
862         the broadcast of the low byte.
863         (expand_mult_highpart): Use an explicit encoding for the permutes.
864         * optabs-query.c (can_mult_highpart_p): Likewise.
865         * tree-vect-loop.c (calc_vec_perm_mask_for_shift): Likewise.
866         * tree-vect-stmts.c (perm_mask_for_reverse): Likewise.
867         (vectorizable_bswap): Likewise.
868         * tree-vect-data-refs.c (vect_grouped_store_supported): Use an
869         explicit encoding for the power-of-2 permutes.
870         (vect_permute_store_chain): Likewise.
871         (vect_grouped_load_supported): Likewise.
872         (vect_permute_load_chain): Likewise.
874 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
876         * vec-perm-indices.h (vec_perm_indices_to_tree): Declare.
877         * vec-perm-indices.c (vec_perm_indices_to_tree): New function.
878         * tree-ssa-forwprop.c (simplify_vector_constructor): Use it.
879         * tree-vect-slp.c (vect_transform_slp_perm_load): Likewise.
880         * tree-vect-stmts.c (vectorizable_bswap): Likewise.
881         (vect_gen_perm_mask_any): Likewise.
883 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
885         * int-vector-builder.h: New file.
886         * vec-perm-indices.h: Include int-vector-builder.h.
887         (vec_perm_indices): Redefine as an int_vector_builder.
888         (auto_vec_perm_indices): Delete.
889         (vec_perm_builder): Redefine as a stand-alone class.
890         (vec_perm_indices::vec_perm_indices): New function.
891         (vec_perm_indices::clamp): Likewise.
892         * vec-perm-indices.c: Include fold-const.h and tree-vector-builder.h.
893         (vec_perm_indices::new_vector): New function.
894         (vec_perm_indices::new_expanded_vector): Update for new
895         vec_perm_indices class.
896         (vec_perm_indices::rotate_inputs): New function.
897         (vec_perm_indices::all_in_range_p): Operate directly on the
898         encoded form, without computing elided elements.
899         (tree_to_vec_perm_builder): Operate directly on the VECTOR_CST
900         encoding.  Update for new vec_perm_indices class.
901         * optabs.c (expand_vec_perm_const): Create a vec_perm_indices for
902         the given vec_perm_builder.
903         (expand_vec_perm_var): Update vec_perm_builder constructor.
904         (expand_mult_highpart): Use vec_perm_builder instead of
905         auto_vec_perm_indices.
906         * optabs-query.c (can_mult_highpart_p): Use vec_perm_builder and
907         vec_perm_indices instead of auto_vec_perm_indices.  Use a single
908         or double series encoding as appropriate.
909         * fold-const.c (fold_ternary_loc): Use vec_perm_builder and
910         vec_perm_indices instead of auto_vec_perm_indices.
911         * tree-ssa-forwprop.c (simplify_vector_constructor): Likewise.
912         * tree-vect-data-refs.c (vect_grouped_store_supported): Likewise.
913         (vect_permute_store_chain): Likewise.
914         (vect_grouped_load_supported): Likewise.
915         (vect_permute_load_chain): Likewise.
916         (vect_shift_permute_load_chain): Likewise.
917         * tree-vect-slp.c (vect_build_slp_tree_1): Likewise.
918         (vect_transform_slp_perm_load): Likewise.
919         (vect_schedule_slp_instance): Likewise.
920         * tree-vect-stmts.c (perm_mask_for_reverse): Likewise.
921         (vectorizable_mask_load_store): Likewise.
922         (vectorizable_bswap): Likewise.
923         (vectorizable_store): Likewise.
924         (vectorizable_load): Likewise.
925         * tree-vect-generic.c (lower_vec_perm): Use vec_perm_builder and
926         vec_perm_indices instead of auto_vec_perm_indices.  Use
927         tree_to_vec_perm_builder to read the vector from a tree.
928         * tree-vect-loop.c (calc_vec_perm_mask_for_shift): Take a
929         vec_perm_builder instead of a vec_perm_indices.
930         (have_whole_vector_shift): Use vec_perm_builder and
931         vec_perm_indices instead of auto_vec_perm_indices.  Leave the
932         truncation to calc_vec_perm_mask_for_shift.
933         (vect_create_epilog_for_reduction): Likewise.
934         * config/aarch64/aarch64.c (expand_vec_perm_d::perm): Change
935         from auto_vec_perm_indices to vec_perm_indices.
936         (aarch64_expand_vec_perm_const_1): Use rotate_inputs on d.perm
937         instead of changing individual elements.
938         (aarch64_vectorize_vec_perm_const): Use new_vector to install
939         the vector in d.perm.
940         * config/arm/arm.c (expand_vec_perm_d::perm): Change
941         from auto_vec_perm_indices to vec_perm_indices.
942         (arm_expand_vec_perm_const_1): Use rotate_inputs on d.perm
943         instead of changing individual elements.
944         (arm_vectorize_vec_perm_const): Use new_vector to install
945         the vector in d.perm.
946         * config/powerpcspe/powerpcspe.c (rs6000_expand_extract_even):
947         Update vec_perm_builder constructor.
948         (rs6000_expand_interleave): Likewise.
949         * config/rs6000/rs6000.c (rs6000_expand_extract_even): Likewise.
950         (rs6000_expand_interleave): Likewise.
952 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
954         * optabs-query.c (can_vec_perm_var_p): Check whether lowering
955         to qimode could truncate the indices.
956         * optabs.c (expand_vec_perm_var): Likewise.
958 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
960         * Makefile.in (OBJS): Add vec-perm-indices.o.
961         * vec-perm-indices.h: New file.
962         * vec-perm-indices.c: Likewise.
963         * target.h (vec_perm_indices): Replace with a forward class
964         declaration.
965         (auto_vec_perm_indices): Move to vec-perm-indices.h.
966         * optabs.h: Include vec-perm-indices.h.
967         (expand_vec_perm): Delete.
968         (selector_fits_mode_p, expand_vec_perm_var): Declare.
969         (expand_vec_perm_const): Declare.
970         * target.def (vec_perm_const_ok): Replace with...
971         (vec_perm_const): ...this new hook.
972         * doc/tm.texi.in (TARGET_VECTORIZE_VEC_PERM_CONST_OK): Replace with...
973         (TARGET_VECTORIZE_VEC_PERM_CONST): ...this new hook.
974         * doc/tm.texi: Regenerate.
975         * optabs.def (vec_perm_const): Delete.
976         * doc/md.texi (vec_perm_const): Likewise.
977         (vec_perm): Refer to TARGET_VECTORIZE_VEC_PERM_CONST.
978         * expr.c (expand_expr_real_2): Use expand_vec_perm_const rather than
979         expand_vec_perm for constant permutation vectors.  Assert that
980         the mode of variable permutation vectors is the integer equivalent
981         of the mode that is being permuted.
982         * optabs-query.h (selector_fits_mode_p): Declare.
983         * optabs-query.c: Include vec-perm-indices.h.
984         (selector_fits_mode_p): New function.
985         (can_vec_perm_const_p): Check whether targetm.vectorize.vec_perm_const
986         is defined, instead of checking whether the vec_perm_const_optab
987         exists.  Use targetm.vectorize.vec_perm_const instead of
988         targetm.vectorize.vec_perm_const_ok.  Check whether the indices
989         fit in the vector mode before using a variable permute.
990         * optabs.c (shift_amt_for_vec_perm_mask): Take a mode and a
991         vec_perm_indices instead of an rtx.
992         (expand_vec_perm): Replace with...
993         (expand_vec_perm_const): ...this new function.  Take the selector
994         as a vec_perm_indices rather than an rtx.  Also take the mode of
995         the selector.  Update call to shift_amt_for_vec_perm_mask.
996         Use targetm.vectorize.vec_perm_const instead of vec_perm_const_optab.
997         Use vec_perm_indices::new_expanded_vector to expand the original
998         selector into bytes.  Check whether the indices fit in the vector
999         mode before using a variable permute.
1000         (expand_vec_perm_var): Make global.
1001         (expand_mult_highpart): Use expand_vec_perm_const.
1002         * fold-const.c: Includes vec-perm-indices.h.
1003         * tree-ssa-forwprop.c: Likewise.
1004         * tree-vect-data-refs.c: Likewise.
1005         * tree-vect-generic.c: Likewise.
1006         * tree-vect-loop.c: Likewise.
1007         * tree-vect-slp.c: Likewise.
1008         * tree-vect-stmts.c: Likewise.
1009         * config/aarch64/aarch64-protos.h (aarch64_expand_vec_perm_const):
1010         Delete.
1011         * config/aarch64/aarch64-simd.md (vec_perm_const<mode>): Delete.
1012         * config/aarch64/aarch64.c (aarch64_expand_vec_perm_const)
1013         (aarch64_vectorize_vec_perm_const_ok): Fuse into...
1014         (aarch64_vectorize_vec_perm_const): ...this new function.
1015         (TARGET_VECTORIZE_VEC_PERM_CONST_OK): Delete.
1016         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
1017         * config/arm/arm-protos.h (arm_expand_vec_perm_const): Delete.
1018         * config/arm/vec-common.md (vec_perm_const<mode>): Delete.
1019         * config/arm/arm.c (TARGET_VECTORIZE_VEC_PERM_CONST_OK): Delete.
1020         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
1021         (arm_expand_vec_perm_const, arm_vectorize_vec_perm_const_ok): Merge
1022         into...
1023         (arm_vectorize_vec_perm_const): ...this new function.  Explicitly
1024         check for NEON modes.
1025         * config/i386/i386-protos.h (ix86_expand_vec_perm_const): Delete.
1026         * config/i386/sse.md (VEC_PERM_CONST, vec_perm_const<mode>): Delete.
1027         * config/i386/i386.c (ix86_expand_vec_perm_const_1): Update comment.
1028         (ix86_expand_vec_perm_const, ix86_vectorize_vec_perm_const_ok): Merge
1029         into...
1030         (ix86_vectorize_vec_perm_const): ...this new function.  Incorporate
1031         the old VEC_PERM_CONST conditions.
1032         * config/ia64/ia64-protos.h (ia64_expand_vec_perm_const): Delete.
1033         * config/ia64/vect.md (vec_perm_const<mode>): Delete.
1034         * config/ia64/ia64.c (ia64_expand_vec_perm_const)
1035         (ia64_vectorize_vec_perm_const_ok): Merge into...
1036         (ia64_vectorize_vec_perm_const): ...this new function.
1037         * config/mips/loongson.md (vec_perm_const<mode>): Delete.
1038         * config/mips/mips-msa.md (vec_perm_const<mode>): Delete.
1039         * config/mips/mips-ps-3d.md (vec_perm_constv2sf): Delete.
1040         * config/mips/mips-protos.h (mips_expand_vec_perm_const): Delete.
1041         * config/mips/mips.c (mips_expand_vec_perm_const)
1042         (mips_vectorize_vec_perm_const_ok): Merge into...
1043         (mips_vectorize_vec_perm_const): ...this new function.
1044         * config/powerpcspe/altivec.md (vec_perm_constv16qi): Delete.
1045         * config/powerpcspe/paired.md (vec_perm_constv2sf): Delete.
1046         * config/powerpcspe/spe.md (vec_perm_constv2si): Delete.
1047         * config/powerpcspe/vsx.md (vec_perm_const<mode>): Delete.
1048         * config/powerpcspe/powerpcspe-protos.h (altivec_expand_vec_perm_const)
1049         (rs6000_expand_vec_perm_const): Delete.
1050         * config/powerpcspe/powerpcspe.c (TARGET_VECTORIZE_VEC_PERM_CONST_OK):
1051         Delete.
1052         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
1053         (altivec_expand_vec_perm_const_le): Take each operand individually.
1054         Operate on constant selectors rather than rtxes.
1055         (altivec_expand_vec_perm_const): Likewise.  Update call to
1056         altivec_expand_vec_perm_const_le.
1057         (rs6000_expand_vec_perm_const): Delete.
1058         (rs6000_vectorize_vec_perm_const_ok): Delete.
1059         (rs6000_vectorize_vec_perm_const): New function.
1060         (rs6000_do_expand_vec_perm): Take a vec_perm_builder instead of
1061         an element count and rtx array.
1062         (rs6000_expand_extract_even): Update call accordingly.
1063         (rs6000_expand_interleave): Likewise.
1064         * config/rs6000/altivec.md (vec_perm_constv16qi): Delete.
1065         * config/rs6000/paired.md (vec_perm_constv2sf): Delete.
1066         * config/rs6000/vsx.md (vec_perm_const<mode>): Delete.
1067         * config/rs6000/rs6000-protos.h (altivec_expand_vec_perm_const)
1068         (rs6000_expand_vec_perm_const): Delete.
1069         * config/rs6000/rs6000.c (TARGET_VECTORIZE_VEC_PERM_CONST_OK): Delete.
1070         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
1071         (altivec_expand_vec_perm_const_le): Take each operand individually.
1072         Operate on constant selectors rather than rtxes.
1073         (altivec_expand_vec_perm_const): Likewise.  Update call to
1074         altivec_expand_vec_perm_const_le.
1075         (rs6000_expand_vec_perm_const): Delete.
1076         (rs6000_vectorize_vec_perm_const_ok): Delete.
1077         (rs6000_vectorize_vec_perm_const): New function.  Remove stray
1078         reference to the SPE evmerge intructions.
1079         (rs6000_do_expand_vec_perm): Take a vec_perm_builder instead of
1080         an element count and rtx array.
1081         (rs6000_expand_extract_even): Update call accordingly.
1082         (rs6000_expand_interleave): Likewise.
1083         * config/sparc/sparc.md (vec_perm_constv8qi): Delete in favor of...
1084         * config/sparc/sparc.c (sparc_vectorize_vec_perm_const): ...this
1085         new function.
1086         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
1088 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1090         * optabs.c (expand_vec_perm_1): Assert that SEL has an integer
1091         vector mode and that that mode matches the mode of the data
1092         being permuted.
1093         (expand_vec_perm): Split handling of non-CONST_VECTOR selectors
1094         out into expand_vec_perm_var.  Do all CONST_VECTOR handling here,
1095         directly using expand_vec_perm_1 when forcing selectors into
1096         registers.
1097         (expand_vec_perm_var): New function, split out from expand_vec_perm.
1099 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1101         * optabs-query.h (can_vec_perm_p): Delete.
1102         (can_vec_perm_var_p, can_vec_perm_const_p): Declare.
1103         * optabs-query.c (can_vec_perm_p): Split into...
1104         (can_vec_perm_var_p, can_vec_perm_const_p): ...these two functions.
1105         (can_mult_highpart_p): Use can_vec_perm_const_p to test whether a
1106         particular selector is valid.
1107         * tree-ssa-forwprop.c (simplify_vector_constructor): Likewise.
1108         * tree-vect-data-refs.c (vect_grouped_store_supported): Likewise.
1109         (vect_grouped_load_supported): Likewise.
1110         (vect_shift_permute_load_chain): Likewise.
1111         * tree-vect-slp.c (vect_build_slp_tree_1): Likewise.
1112         (vect_transform_slp_perm_load): Likewise.
1113         * tree-vect-stmts.c (perm_mask_for_reverse): Likewise.
1114         (vectorizable_bswap): Likewise.
1115         (vect_gen_perm_mask_checked): Likewise.
1116         * fold-const.c (fold_ternary_loc): Likewise.  Don't take
1117         implementations of variable permutation vectors into account
1118         when deciding which selector to use.
1119         * tree-vect-loop.c (have_whole_vector_shift): Don't check whether
1120         vec_perm_const_optab is supported; instead use can_vec_perm_const_p
1121         with a false third argument.
1122         * tree-vect-generic.c (lower_vec_perm): Use can_vec_perm_const_p
1123         to test whether the constant selector is valid and can_vec_perm_var_p
1124         to test whether a variable selector is valid.
1126 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1128         * optabs-query.h (can_vec_perm_p): Take a const vec_perm_indices *.
1129         * optabs-query.c (can_vec_perm_p): Likewise.
1130         * fold-const.c (fold_vec_perm): Take a const vec_perm_indices &
1131         instead of vec_perm_indices.
1132         * tree-vectorizer.h (vect_gen_perm_mask_any): Likewise,
1133         (vect_gen_perm_mask_checked): Likewise,
1134         * tree-vect-stmts.c (vect_gen_perm_mask_any): Likewise,
1135         (vect_gen_perm_mask_checked): Likewise,
1137 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1139         * optabs-query.h (qimode_for_vec_perm): Declare.
1140         * optabs-query.c (can_vec_perm_p): Split out qimode search to...
1141         (qimode_for_vec_perm): ...this new function.
1142         * optabs.c (expand_vec_perm): Use qimode_for_vec_perm.
1144 2018-01-02  Aaron Sawdey  <acsawdey@linux.vnet.ibm.com>
1146         * rtlanal.c (canonicalize_condition): Return 0 if final rtx
1147         does not have a conditional at the top.
1149 2018-01-02  Richard Biener  <rguenther@suse.de>
1151         * ipa-inline.c (big_speedup_p): Fix expression.
1153 2018-01-02  Jan Hubicka  <hubicka@ucw.cz>
1155         PR target/81616
1156         * config/i386/x86-tune-costs.h: Increase cost of integer load costs
1157         for generic 4->6.
1159 2018-01-02  Jan Hubicka  <hubicka@ucw.cz>
1161         PR target/81616
1162         Generic tuning.
1163         * x86-tune-costs.h (generic_cost): Reduce cost of FDIV 20->17,
1164         cost of sqrt 20->14, DIVSS 18->13, DIVSD 32->17, SQRtSS 30->14
1165         and SQRTsD 58->18, cond_not_taken_branch_cost. 2->1. Increase
1166         cond_taken_branch_cost 3->4.
1168 2018-01-01  Jakub Jelinek  <jakub@redhat.com>
1170         PR tree-optimization/83581
1171         * tree-loop-distribution.c (pass_loop_distribution::execute): Return
1172         TODO_cleanup_cfg if any changes have been made.
1174         PR middle-end/83608
1175         * expr.c (store_expr_with_bounds): Use simplify_gen_subreg instead of
1176         convert_modes if target mode has the right side, but different mode
1177         class.
1179         PR middle-end/83609
1180         * expr.c (expand_assignment): Fix up a typo in simplify_gen_subreg
1181         last argument when extracting from CONCAT.  If either from_real or
1182         from_imag is NULL, use expansion through memory.  If result is not
1183         a CONCAT and simplify_gen_subreg fails, try to simplify_gen_subreg
1184         the parts directly to inner mode, if even that fails, use expansion
1185         through memory.
1187         PR middle-end/83623
1188         * expmed.c (expand_shift_1): For 2-byte rotates by BITS_PER_UNIT,
1189         check for bswap in mode rather than HImode and use that in expand_unop
1190         too.
1192 Copyright (C) 2018 Free Software Foundation, Inc.
1194 Copying and distribution of this file, with or without modification,
1195 are permitted in any medium without royalty provided the copyright
1196 notice and this notice are preserved.