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