Improve spilling for variable-width slots
[official-gcc.git] / gcc / ChangeLog
bloba151f622738a0253a8a5c024276f81b9ecee26ef
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         * lra-spills.c (pseudo_reg_slot_compare): Sort slots by whether
6         they are variable or constant sized.
7         (assign_stack_slot_num_and_sort_pseudos): Don't reuse variable-sized
8         slots for constant-sized data.
10 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
11             Alan Hayward  <alan.hayward@arm.com>
12             David Sherwood  <david.sherwood@arm.com>
14         * tree-vect-patterns.c (vect_recog_mask_conversion_pattern): When
15         handling COND_EXPRs with boolean comparisons, try to find a better
16         basis for the mask type than the boolean itself.
18 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
20         * doc/rtl.texi (MAX_BITSIZE_MODE_ANY_MODE): Describe how the default
21         is calculated and how it can be overridden.
22         * genmodes.c (max_bitsize_mode_any_mode): New variable.
23         (create_modes): Initialize it from MAX_BITSIZE_MODE_ANY_MODE,
24         if defined.
25         (emit_max_int): Use it to set the output MAX_BITSIZE_MODE_ANY_MODE,
26         if nonzero.
28 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
29             Alan Hayward  <alan.hayward@arm.com>
30             David Sherwood  <david.sherwood@arm.com>
32         * config/aarch64/aarch64-protos.h (aarch64_output_simd_mov_immediate):
33         Remove the mode argument.
34         (aarch64_simd_valid_immediate): Remove the mode and inverse
35         arguments.
36         * config/aarch64/iterators.md (bitsize): New iterator.
37         * config/aarch64/aarch64-simd.md (*aarch64_simd_mov<mode>, and<mode>3)
38         (ior<mode>3): Update calls to aarch64_output_simd_mov_immediate.
39         * config/aarch64/constraints.md (Do, Db, Dn): Update calls to
40         aarch64_simd_valid_immediate.
41         * config/aarch64/predicates.md (aarch64_reg_or_orr_imm): Likewise.
42         (aarch64_reg_or_bic_imm): Likewise.
43         * config/aarch64/aarch64.c (simd_immediate_info): Replace mvn
44         with an insn_type enum and msl with a modifier_type enum.
45         Replace element_width with a scalar_mode.  Change the shift
46         to unsigned int.  Add constructors for scalar_float_mode and
47         scalar_int_mode elements.
48         (aarch64_vect_float_const_representable_p): Delete.
49         (aarch64_can_const_movi_rtx_p)
50         (aarch64_simd_scalar_immediate_valid_for_move)
51         (aarch64_simd_make_constant): Update call to
52         aarch64_simd_valid_immediate.
53         (aarch64_advsimd_valid_immediate_hs): New function.
54         (aarch64_advsimd_valid_immediate): Likewise.
55         (aarch64_simd_valid_immediate): Remove mode and inverse
56         arguments.  Rewrite to use the above.  Use const_vec_duplicate_p
57         to detect duplicated constants and use aarch64_float_const_zero_rtx_p
58         and aarch64_float_const_representable_p on the result.
59         (aarch64_output_simd_mov_immediate): Remove mode argument.
60         Update call to aarch64_simd_valid_immediate and use of
61         simd_immediate_info.
62         (aarch64_output_scalar_simd_mov_immediate): Update call
63         accordingly.
65 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
66             Alan Hayward  <alan.hayward@arm.com>
67             David Sherwood  <david.sherwood@arm.com>
69         * machmode.h (mode_precision): Prefix with CONST_MODE_PRECISION.
70         (mode_nunits): Likewise CONST_MODE_NUNITS.
71         * machmode.def (ADJUST_NUNITS): Document.
72         * genmodes.c (mode_data::need_nunits_adj): New field.
73         (blank_mode): Update accordingly.
74         (adj_nunits): New variable.
75         (print_maybe_const_decl): Replace CATEGORY with a NEEDS_ADJ
76         parameter.
77         (emit_mode_size_inline): Set need_bytesize_adj for all modes
78         listed in adj_nunits.
79         (emit_mode_nunits_inline): Set need_nunits_adj for all modes
80         listed in adj_nunits.  Don't emit case statements for such modes.
81         (emit_insn_modes_h): Emit definitions of CONST_MODE_NUNITS
82         and CONST_MODE_PRECISION.  Make CONST_MODE_SIZE expand to
83         nothing if adj_nunits is nonnull.
84         (emit_mode_precision, emit_mode_nunits): Use print_maybe_const_decl.
85         (emit_mode_unit_size, emit_mode_base_align, emit_mode_ibit)
86         (emit_mode_fbit): Update use of print_maybe_const_decl.
87         (emit_move_size): Likewise.  Treat the array as non-const
88         if adj_nunits.
89         (emit_mode_adjustments): Handle adj_nunits.
91 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
93         * machmode.def (VECTOR_MODES_WITH_PREFIX): Document.
94         * genmodes.c (VECTOR_MODES_WITH_PREFIX): New macro.
95         (VECTOR_MODES): Use it.
96         (make_vector_modes): Take the prefix as an argument.
98 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
99             Alan Hayward  <alan.hayward@arm.com>
100             David Sherwood  <david.sherwood@arm.com>
102         * mode-classes.def (MODE_VECTOR_BOOL): New mode class.
103         * machmode.h (INTEGRAL_MODE_P, VECTOR_MODE_P): Return true
104         for MODE_VECTOR_BOOL.
105         * machmode.def (VECTOR_BOOL_MODE): Document.
106         * genmodes.c (VECTOR_BOOL_MODE): New macro.
107         (make_vector_bool_mode): New function.
108         (complete_mode, emit_mode_wider, emit_mode_adjustments): Handle
109         MODE_VECTOR_BOOL.
110         * lto-streamer-in.c (lto_input_mode_table): Likewise.
111         * rtx-vector-builder.c (rtx_vector_builder::find_cached_value):
112         Likewise.
113         * stor-layout.c (int_mode_for_mode): Likewise.
114         * tree.c (build_vector_type_for_mode): Likewise.
115         * varasm.c (output_constant_pool_2): Likewise.
116         * emit-rtl.c (init_emit_once): Make sure that CONST1_RTX (BImode) and
117         CONSTM1_RTX (BImode) are the same thing.  Initialize const_tiny_rtx
118         for MODE_VECTOR_BOOL.
119         * expr.c (expand_expr_real_1): Use VECTOR_MODE_P instead of a list
120         of mode class checks.
121         * tree-vect-generic.c (expand_vector_operation): Use VECTOR_MODE_P
122         instead of a list of mode class checks.
123         (expand_vector_scalar_condition): Likewise.
124         (type_for_widest_vector_mode): Handle BImode as an inner mode.
126 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
127             Alan Hayward  <alan.hayward@arm.com>
128             David Sherwood  <david.sherwood@arm.com>
130         * machmode.h (mode_size): Change from unsigned short to
131         poly_uint16_pod.
132         (mode_to_bytes): Return a poly_uint16 rather than an unsigned short.
133         (GET_MODE_SIZE): Return a constant if ONLY_FIXED_SIZE_MODES,
134         or if measurement_type is not polynomial.
135         (fixed_size_mode::includes_p): Check for constant-sized modes.
136         * genmodes.c (emit_mode_size_inline): Make mode_size_inline
137         return a poly_uint16 rather than an unsigned short.
138         (emit_mode_size): Change the type of mode_size from unsigned short
139         to poly_uint16_pod.  Use ZERO_COEFFS for the initializer.
140         (emit_mode_adjustments): Cope with polynomial vector sizes.
141         * lto-streamer-in.c (lto_input_mode_table): Use bp_unpack_poly_value
142         for GET_MODE_SIZE.
143         * lto-streamer-out.c (lto_write_mode_table): Use bp_pack_poly_value
144         for GET_MODE_SIZE.
145         * auto-inc-dec.c (try_merge): Treat GET_MODE_SIZE as polynomial.
146         * builtins.c (expand_ifn_atomic_compare_exchange_into_call): Likewise.
147         * caller-save.c (setup_save_areas): Likewise.
148         (replace_reg_with_saved_mem): Likewise.
149         * calls.c (emit_library_call_value_1): Likewise.
150         * combine-stack-adj.c (combine_stack_adjustments_for_block): Likewise.
151         * combine.c (simplify_set, make_extraction, simplify_shift_const_1)
152         (gen_lowpart_for_combine): Likewise.
153         * convert.c (convert_to_integer_1): Likewise.
154         * cse.c (equiv_constant, cse_insn): Likewise.
155         * cselib.c (autoinc_split, cselib_hash_rtx): Likewise.
156         (cselib_subst_to_values): Likewise.
157         * dce.c (word_dce_process_block): Likewise.
158         * df-problems.c (df_word_lr_mark_ref): Likewise.
159         * dwarf2cfi.c (init_one_dwarf_reg_size): Likewise.
160         * dwarf2out.c (multiple_reg_loc_descriptor, mem_loc_descriptor)
161         (concat_loc_descriptor, concatn_loc_descriptor, loc_descriptor)
162         (rtl_for_decl_location): Likewise.
163         * emit-rtl.c (gen_highpart, widen_memory_access): Likewise.
164         * expmed.c (extract_bit_field_1, extract_integral_bit_field): Likewise.
165         * expr.c (emit_group_load_1, clear_storage_hints): Likewise.
166         (emit_move_complex, emit_move_multi_word, emit_push_insn): Likewise.
167         (expand_expr_real_1): Likewise.
168         * function.c (assign_parm_setup_block_p, assign_parm_setup_block)
169         (pad_below): Likewise.
170         * gimple-fold.c (optimize_atomic_compare_exchange_p): Likewise.
171         * gimple-ssa-store-merging.c (rhs_valid_for_store_merging_p): Likewise.
172         * ira.c (get_subreg_tracking_sizes): Likewise.
173         * ira-build.c (ira_create_allocno_objects): Likewise.
174         * ira-color.c (coalesced_pseudo_reg_slot_compare): Likewise.
175         (ira_sort_regnos_for_alter_reg): Likewise.
176         * ira-costs.c (record_operand_costs): Likewise.
177         * lower-subreg.c (interesting_mode_p, simplify_gen_subreg_concatn)
178         (resolve_simple_move): Likewise.
179         * lra-constraints.c (get_reload_reg, operands_match_p): Likewise.
180         (process_addr_reg, simplify_operand_subreg, curr_insn_transform)
181         (lra_constraints): Likewise.
182         (CONST_POOL_OK_P): Reject variable-sized modes.
183         * lra-spills.c (slot, assign_mem_slot, pseudo_reg_slot_compare)
184         (add_pseudo_to_slot, lra_spill): Likewise.
185         * omp-low.c (omp_clause_aligned_alignment): Likewise.
186         * optabs-query.c (get_best_extraction_insn): Likewise.
187         * optabs-tree.c (expand_vec_cond_expr_p): Likewise.
188         * optabs.c (expand_vec_perm_var, expand_vec_cond_expr): Likewise.
189         (expand_mult_highpart, valid_multiword_target_p): Likewise.
190         * recog.c (offsettable_address_addr_space_p): Likewise.
191         * regcprop.c (maybe_mode_change): Likewise.
192         * reginfo.c (choose_hard_reg_mode, record_subregs_of_mode): Likewise.
193         * regrename.c (build_def_use): Likewise.
194         * regstat.c (dump_reg_info): Likewise.
195         * reload.c (complex_word_subreg_p, push_reload, find_dummy_reload)
196         (find_reloads, find_reloads_subreg_address): Likewise.
197         * reload1.c (eliminate_regs_1): Likewise.
198         * rtlanal.c (for_each_inc_dec_find_inc_dec, rtx_cost): Likewise.
199         * simplify-rtx.c (avoid_constant_pool_reference): Likewise.
200         (simplify_binary_operation_1, simplify_subreg): Likewise.
201         * targhooks.c (default_function_arg_padding): Likewise.
202         (default_hard_regno_nregs, default_class_max_nregs): Likewise.
203         * tree-cfg.c (verify_gimple_assign_binary): Likewise.
204         (verify_gimple_assign_ternary): Likewise.
205         * tree-inline.c (estimate_move_cost): Likewise.
206         * tree-ssa-forwprop.c (simplify_vector_constructor): Likewise.
207         * tree-ssa-loop-ivopts.c (add_autoinc_candidates): Likewise.
208         (get_address_cost_ainc): Likewise.
209         * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Likewise.
210         (vect_supportable_dr_alignment): Likewise.
211         * tree-vect-loop.c (vect_determine_vectorization_factor): Likewise.
212         (vectorizable_reduction): Likewise.
213         * tree-vect-stmts.c (vectorizable_assignment, vectorizable_shift)
214         (vectorizable_operation, vectorizable_load): Likewise.
215         * tree.c (build_same_sized_truth_vector_type): Likewise.
216         * valtrack.c (cleanup_auto_inc_dec): Likewise.
217         * var-tracking.c (emit_note_insn_var_location): Likewise.
218         * config/arc/arc.h (ASM_OUTPUT_CASE_END): Use as_a <scalar_int_mode>.
219         (ADDR_VEC_ALIGN): Likewise.
221 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
222             Alan Hayward  <alan.hayward@arm.com>
223             David Sherwood  <david.sherwood@arm.com>
225         * machmode.h (mode_to_bits): Return a poly_uint16 rather than an
226         unsigned short.
227         (GET_MODE_BITSIZE): Return a constant if ONLY_FIXED_SIZE_MODES,
228         or if measurement_type is polynomial.
229         * calls.c (shift_return_value): Treat GET_MODE_BITSIZE as polynomial.
230         * combine.c (make_extraction): Likewise.
231         * dse.c (find_shift_sequence): Likewise.
232         * dwarf2out.c (mem_loc_descriptor): Likewise.
233         * expmed.c (store_integral_bit_field, extract_bit_field_1): Likewise.
234         (extract_bit_field, extract_low_bits): Likewise.
235         * expr.c (convert_move, convert_modes, emit_move_insn_1): Likewise.
236         (optimize_bitfield_assignment_op, expand_assignment): Likewise.
237         (store_expr_with_bounds, store_field, expand_expr_real_1): Likewise.
238         * fold-const.c (optimize_bit_field_compare, merge_ranges): Likewise.
239         * gimple-fold.c (optimize_atomic_compare_exchange_p): Likewise.
240         * reload.c (find_reloads): Likewise.
241         * reload1.c (alter_reg): Likewise.
242         * stor-layout.c (bitwise_mode_for_mode, compute_record_mode): Likewise.
243         * targhooks.c (default_secondary_memory_needed_mode): Likewise.
244         * tree-if-conv.c (predicate_mem_writes): Likewise.
245         * tree-ssa-strlen.c (handle_builtin_memcmp): Likewise.
246         * tree-vect-patterns.c (adjust_bool_pattern): Likewise.
247         * tree-vect-stmts.c (vectorizable_simd_clone_call): Likewise.
248         * valtrack.c (dead_debug_insert_temp): Likewise.
249         * varasm.c (mergeable_constant_section): Likewise.
250         * config/sh/sh.h (LOCAL_ALIGNMENT): Use as_a <fixed_size_mode>.
252 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
253             Alan Hayward  <alan.hayward@arm.com>
254             David Sherwood  <david.sherwood@arm.com>
256         * expr.c (expand_assignment): Cope with polynomial mode sizes
257         when assigning to a CONCAT.
259 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
260             Alan Hayward  <alan.hayward@arm.com>
261             David Sherwood  <david.sherwood@arm.com>
263         * machmode.h (mode_precision): Change from unsigned short to
264         poly_uint16_pod.
265         (mode_to_precision): Return a poly_uint16 rather than an unsigned
266         short.
267         (GET_MODE_PRECISION): Return a constant if ONLY_FIXED_SIZE_MODES,
268         or if measurement_type is not polynomial.
269         (HWI_COMPUTABLE_MODE_P): Turn into a function.  Optimize the case
270         in which the mode is already known to be a scalar_int_mode.
271         * genmodes.c (emit_mode_precision): Change the type of mode_precision
272         from unsigned short to poly_uint16_pod.  Use ZERO_COEFFS for the
273         initializer.
274         * lto-streamer-in.c (lto_input_mode_table): Use bp_unpack_poly_value
275         for GET_MODE_PRECISION.
276         * lto-streamer-out.c (lto_write_mode_table): Use bp_pack_poly_value
277         for GET_MODE_PRECISION.
278         * combine.c (update_rsp_from_reg_equal): Treat GET_MODE_PRECISION
279         as polynomial.
280         (try_combine, find_split_point, combine_simplify_rtx): Likewise.
281         (expand_field_assignment, make_extraction): Likewise.
282         (make_compound_operation_int, record_dead_and_set_regs_1): Likewise.
283         (get_last_value): Likewise.
284         * convert.c (convert_to_integer_1): Likewise.
285         * cse.c (cse_insn): Likewise.
286         * expr.c (expand_expr_real_1): Likewise.
287         * lra-constraints.c (simplify_operand_subreg): Likewise.
288         * optabs-query.c (can_atomic_load_p): Likewise.
289         * optabs.c (expand_atomic_load): Likewise.
290         (expand_atomic_store): Likewise.
291         * ree.c (combine_reaching_defs): Likewise.
292         * rtl.h (partial_subreg_p, paradoxical_subreg_p): Likewise.
293         * rtlanal.c (nonzero_bits1, lsb_bitfield_op_p): Likewise.
294         * tree.h (type_has_mode_precision_p): Likewise.
295         * ubsan.c (instrument_si_overflow): Likewise.
297 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
298             Alan Hayward  <alan.hayward@arm.com>
299             David Sherwood  <david.sherwood@arm.com>
301         * tree.h (TYPE_VECTOR_SUBPARTS): Turn into a function and handle
302         polynomial numbers of units.
303         (SET_TYPE_VECTOR_SUBPARTS): Likewise.
304         (valid_vector_subparts_p): New function.
305         (build_vector_type): Remove temporary shim and take the number
306         of units as a poly_uint64 rather than an int.
307         (build_opaque_vector_type): Take the number of units as a
308         poly_uint64 rather than an int.
309         * tree.c (build_vector_from_ctor): Handle polynomial
310         TYPE_VECTOR_SUBPARTS.
311         (type_hash_canon_hash, type_cache_hasher::equal): Likewise.
312         (uniform_vector_p, vector_type_mode, build_vector): Likewise.
313         (build_vector_from_val): If the number of units is variable,
314         use build_vec_duplicate_cst for constant operands and
315         VEC_DUPLICATE_EXPR otherwise.
316         (make_vector_type): Remove temporary is_constant ().
317         (build_vector_type, build_opaque_vector_type): Take the number of
318         units as a poly_uint64 rather than an int.
319         (check_vector_cst): Handle polynomial TYPE_VECTOR_SUBPARTS and
320         VECTOR_CST_NELTS.
321         * cfgexpand.c (expand_debug_expr): Likewise.
322         * expr.c (count_type_elements, categorize_ctor_elements_1): Likewise.
323         (store_constructor, expand_expr_real_1): Likewise.
324         (const_scalar_mask_from_tree): Likewise.
325         * fold-const-call.c (fold_const_reduction): Likewise.
326         * fold-const.c (const_binop, const_unop, fold_convert_const): Likewise.
327         (operand_equal_p, fold_vec_perm, fold_ternary_loc): Likewise.
328         (native_encode_vector, vec_cst_ctor_to_array): Likewise.
329         (fold_relational_const): Likewise.
330         (native_interpret_vector): Likewise.  Change the size from an
331         int to an unsigned int.
332         * gimple-fold.c (gimple_fold_stmt_to_constant_1): Handle polynomial
333         TYPE_VECTOR_SUBPARTS.
334         (gimple_fold_indirect_ref, gimple_build_vector): Likewise.
335         (gimple_build_vector_from_val): Use VEC_DUPLICATE_EXPR when
336         duplicating a non-constant operand into a variable-length vector.
337         * hsa-brig.c (hsa_op_immed::emit_to_buffer): Handle polynomial
338         TYPE_VECTOR_SUBPARTS and VECTOR_CST_NELTS.
339         * ipa-icf.c (sem_variable::equals): Likewise.
340         * match.pd: Likewise.
341         * omp-simd-clone.c (simd_clone_subparts): Likewise.
342         * print-tree.c (print_node): Likewise.
343         * stor-layout.c (layout_type): Likewise.
344         * targhooks.c (default_builtin_vectorization_cost): Likewise.
345         * tree-cfg.c (verify_gimple_comparison): Likewise.
346         (verify_gimple_assign_binary): Likewise.
347         (verify_gimple_assign_ternary): Likewise.
348         (verify_gimple_assign_single): Likewise.
349         * tree-pretty-print.c (dump_generic_node): Likewise.
350         * tree-ssa-forwprop.c (simplify_vector_constructor): Likewise.
351         (simplify_bitfield_ref, is_combined_permutation_identity): Likewise.
352         * tree-vect-data-refs.c (vect_permute_store_chain): Likewise.
353         (vect_grouped_load_supported, vect_permute_load_chain): Likewise.
354         (vect_shift_permute_load_chain): Likewise.
355         * tree-vect-generic.c (nunits_for_known_piecewise_op): Likewise.
356         (expand_vector_condition, optimize_vector_constructor): Likewise.
357         (lower_vec_perm, get_compute_type): Likewise.
358         * tree-vect-loop.c (vect_determine_vectorization_factor): Likewise.
359         (get_initial_defs_for_reduction, vect_transform_loop): Likewise.
360         * tree-vect-patterns.c (vect_recog_bool_pattern): Likewise.
361         (vect_recog_mask_conversion_pattern): Likewise.
362         * tree-vect-slp.c (vect_supported_load_permutation_p): Likewise.
363         (vect_get_constant_vectors, vect_transform_slp_perm_load): Likewise.
364         * tree-vect-stmts.c (perm_mask_for_reverse): Likewise.
365         (get_group_load_store_type, vectorizable_mask_load_store): Likewise.
366         (vectorizable_bswap, simd_clone_subparts, vectorizable_assignment)
367         (vectorizable_shift, vectorizable_operation, vectorizable_store)
368         (vectorizable_load, vect_is_simple_cond, vectorizable_comparison)
369         (supportable_widening_operation): Likewise.
370         (supportable_narrowing_operation): Likewise.
371         * tree-vector-builder.c (tree_vector_builder::binary_encoded_nelts):
372         Likewise.
373         * varasm.c (output_constant): Likewise.
375 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
376             Alan Hayward  <alan.hayward@arm.com>
377             David Sherwood  <david.sherwood@arm.com>
379         * tree-vect-data-refs.c (vect_permute_store_chain): Reorganize
380         so that both the length == 3 and length != 3 cases set up their
381         own permute vectors.  Add comments explaining why we know the
382         number of elements is constant.
383         (vect_permute_load_chain): Likewise.
385 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
386             Alan Hayward  <alan.hayward@arm.com>
387             David Sherwood  <david.sherwood@arm.com>
389         * machmode.h (mode_nunits): Change from unsigned char to
390         poly_uint16_pod.
391         (ONLY_FIXED_SIZE_MODES): New macro.
392         (pod_mode::measurement_type, scalar_int_mode::measurement_type)
393         (scalar_float_mode::measurement_type, scalar_mode::measurement_type)
394         (complex_mode::measurement_type, fixed_size_mode::measurement_type):
395         New typedefs.
396         (mode_to_nunits): Return a poly_uint16 rather than an unsigned short.
397         (GET_MODE_NUNITS): Return a constant if ONLY_FIXED_SIZE_MODES,
398         or if measurement_type is not polynomial.
399         * genmodes.c (ZERO_COEFFS): New macro.
400         (emit_mode_nunits_inline): Make mode_nunits_inline return a
401         poly_uint16.
402         (emit_mode_nunits): Change the type of mode_nunits to poly_uint16_pod.
403         Use ZERO_COEFFS when emitting initializers.
404         * data-streamer.h (bp_pack_poly_value): New function.
405         (bp_unpack_poly_value): Likewise.
406         * lto-streamer-in.c (lto_input_mode_table): Use bp_unpack_poly_value
407         for GET_MODE_NUNITS.
408         * lto-streamer-out.c (lto_write_mode_table): Use bp_pack_poly_value
409         for GET_MODE_NUNITS.
410         * tree.c (make_vector_type): Remove temporary shim and make
411         the real function take the number of units as a poly_uint64
412         rather than an int.
413         (build_vector_type_for_mode): Handle polynomial nunits.
414         * dwarf2out.c (loc_descriptor, add_const_value_attribute): Likewise.
415         * emit-rtl.c (const_vec_series_p_1): Likewise.
416         (gen_rtx_CONST_VECTOR): Likewise.
417         * fold-const.c (test_vec_duplicate_folding): Likewise.
418         * genrecog.c (validate_pattern): Likewise.
419         * optabs-query.c (can_vec_perm_var_p, can_mult_highpart_p): Likewise.
420         * optabs-tree.c (expand_vec_cond_expr_p): Likewise.
421         * optabs.c (expand_vector_broadcast, expand_binop_directly): Likewise.
422         (shift_amt_for_vec_perm_mask, expand_vec_perm_var): Likewise.
423         (expand_vec_cond_expr, expand_mult_highpart): Likewise.
424         * rtlanal.c (subreg_get_info): Likewise.
425         * tree-vect-data-refs.c (vect_grouped_store_supported): Likewise.
426         (vect_grouped_load_supported): Likewise.
427         * tree-vect-generic.c (type_for_widest_vector_mode): Likewise.
428         * tree-vect-loop.c (have_whole_vector_shift): Likewise.
429         * simplify-rtx.c (simplify_unary_operation_1): Likewise.
430         (simplify_const_unary_operation, simplify_binary_operation_1)
431         (simplify_const_binary_operation, simplify_ternary_operation)
432         (test_vector_ops_duplicate, test_vector_ops): Likewise.
433         (simplify_immed_subreg): Use GET_MODE_NUNITS on a fixed_size_mode
434         instead of CONST_VECTOR_NUNITS.
435         * varasm.c (output_constant_pool_2): Likewise.
436         * rtx-vector-builder.c (rtx_vector_builder::build): Only include the
437         explicit-encoded elements in the XVEC for variable-length vectors.
439 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
441         * lra-constraints.c (curr_insn_transform): Use partial_subreg_p.
443 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
444             Alan Hayward  <alan.hayward@arm.com>
445             David Sherwood  <david.sherwood@arm.com>
447         * coretypes.h (fixed_size_mode): Declare.
448         (fixed_size_mode_pod): New typedef.
449         * builtins.h (target_builtins::x_apply_args_mode)
450         (target_builtins::x_apply_result_mode): Change type to
451         fixed_size_mode_pod.
452         * builtins.c (apply_args_size, apply_result_size, result_vector)
453         (expand_builtin_apply_args_1, expand_builtin_apply)
454         (expand_builtin_return): Update accordingly.
456 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
458         * cse.c (hash_rtx_cb): Hash only the encoded elements.
459         * cselib.c (cselib_hash_rtx): Likewise.
460         * expmed.c (make_tree): Build VECTOR_CSTs directly from the
461         CONST_VECTOR encoding.
463 2017-01-03  Jakub Jelinek  <jakub@redhat.com>
464             Jeff Law  <law@redhat.com>
466         PR target/83641
467         * config/i386/i386.c (ix86_adjust_stack_and_probe_stack_clash): For
468         noreturn probe, use gen_pop instead of ix86_emit_restore_reg_using_pop,
469         only set RTX_FRAME_RELATED_P on both the push and pop if cfa_reg is sp
470         and add REG_CFA_ADJUST_CFA notes in that case to both insns.
472         PR target/83641
473         * config/i386/i386.c (ix86_adjust_stack_and_probe_stack_clash): Do not
474         explicitly probe *sp in a noreturn function if there were any callee
475         register saves or frame pointer is needed.
477 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
479         PR debug/83621
480         * cfgexpand.c (expand_debug_expr): Return NULL if mode is
481         BLKmode for ternary, binary or unary expressions.
483         PR debug/83645
484         * var-tracking.c (delete_vta_debug_insn): New inline function.
485         (delete_vta_debug_insns): Add USE_CFG argument, if true, walk just
486         insns from get_insns () to NULL instead of each bb separately.
487         Use delete_vta_debug_insn.  No longer static.
488         (vt_debug_insns_local, variable_tracking_main_1): Adjust
489         delete_vta_debug_insns callers.
490         * rtl.h (delete_vta_debug_insns): Declare.
491         * final.c (rest_of_handle_final): Call delete_vta_debug_insns
492         instead of variable_tracking_main.
494 2018-01-03  Martin Sebor  <msebor@redhat.com>
496         PR c/83559
497         * doc/extend.texi (attribute const): Fix a typo.
498         * ipa-pure-const.c ((warn_function_const, warn_function_pure): Avoid
499         issuing -Wsuggest-attribute for void functions.
501 2018-01-03  Martin Sebor  <msebor@redhat.com>
503         * gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref): Use
504         offset_int::from instead of wide_int::to_shwi.
505         (maybe_diag_overlap): Remove assertion.
506         Use HOST_WIDE_INT_PRINT_DEC instead of %lli.
507         * gimple-ssa-sprintf.c (format_directive): Same.
508         (parse_directive): Same.
509         (sprintf_dom_walker::compute_format_length): Same.
510         (try_substitute_return_value): Same.
512 2017-01-03  Jeff Law  <law@redhat.com>
514         PR middle-end/83654
515         * explow.c (anti_adjust_stack_and_probe_stack_clash): Test a
516         non-constant residual for zero at runtime and avoid probing in
517         that case.  Reorganize code for trailing problem to mirror handling
518         of the residual.
520 2018-01-03  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
522         PR tree-optimization/83501
523         * tree-ssa-strlen.c (get_string_cst): New.
524         (handle_char_store): Call get_string_cst.
526 2018-01-03  Martin Liska  <mliska@suse.cz>
528         PR tree-optimization/83593
529         * tree-ssa-strlen.c: Include tree-cfg.h.
530         (strlen_check_and_optimize_stmt): Add new argument cleanup_eh.
531         (strlen_dom_walker): Add new member variable m_cleanup_cfg.
532         (strlen_dom_walker::strlen_dom_walker): Initialize m_cleanup_cfg
533         to false.
534         (strlen_dom_walker::before_dom_children): Call
535         gimple_purge_dead_eh_edges. Dump tranformation with details
536         dump flags.
537         (strlen_dom_walker::before_dom_children): Update call by adding
538         new argument cleanup_eh.
539         (pass_strlen::execute): Return TODO_cleanup_cfg if needed.
541 2018-01-03  Martin Liska  <mliska@suse.cz>
543         PR ipa/83549
544         * cif-code.def (VARIADIC_THUNK): New enum value.
545         * ipa-fnsummary.c (compute_fn_summary): Do not inline variadic
546         thunks.
548 2018-01-03  Jan Beulich  <jbeulich@suse.com>
550         * sse.md (mov<mode>_internal): Tighten condition for when to use
551         vmovdqu<ssescalarsize> for TI and OI modes.
553 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
555         Update copyright years.
557 2018-01-03  Martin Liska  <mliska@suse.cz>
559         PR ipa/83594
560         * ipa-visibility.c (function_and_variable_visibility): Skip
561         functions with noipa attribure.
563 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
565         * gcc.c (process_command): Update copyright notice dates.
566         * gcov-dump.c (print_version): Ditto.
567         * gcov.c (print_version): Ditto.
568         * gcov-tool.c (print_version): Ditto.
569         * gengtype.c (create_file): Ditto.
570         * doc/cpp.texi: Bump @copying's copyright year.
571         * doc/cppinternals.texi: Ditto.
572         * doc/gcc.texi: Ditto.
573         * doc/gccint.texi: Ditto.
574         * doc/gcov.texi: Ditto.
575         * doc/install.texi: Ditto.
576         * doc/invoke.texi: Ditto.
578 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
580         * vector-builder.h (vector_builder::m_full_nelts): Change from
581         unsigned int to poly_uint64.
582         (vector_builder::full_nelts): Update prototype accordingly.
583         (vector_builder::new_vector): Likewise.
584         (vector_builder::encoded_full_vector_p): Handle polynomial full_nelts.
585         (vector_builder::operator ==): Likewise.
586         (vector_builder::finalize): Likewise.
587         * int-vector-builder.h (int_vector_builder::int_vector_builder):
588         Take the number of elements as a poly_uint64 rather than an
589         unsigned int.
590         * vec-perm-indices.h (vec_perm_indices::m_nelts_per_input): Change
591         from unsigned int to poly_uint64.
592         (vec_perm_indices::vec_perm_indices): Update prototype accordingly.
593         (vec_perm_indices::new_vector): Likewise.
594         (vec_perm_indices::length): Likewise.
595         (vec_perm_indices::nelts_per_input): Likewise.
596         (vec_perm_indices::input_nelts): Likewise.
597         * vec-perm-indices.c (vec_perm_indices::new_vector): Take the
598         number of elements per input as a poly_uint64 rather than an
599         unsigned int.  Use the original encoding for variable-length
600         vectors, rather than clamping each individual element.
601         For the second and subsequent elements in each pattern,
602         clamp the step and base before clamping their sum.
603         (vec_perm_indices::series_p): Handle polynomial element counts.
604         (vec_perm_indices::all_in_range_p): Likewise.
605         (vec_perm_indices_to_tree): Likewise.
606         (vec_perm_indices_to_rtx): Likewise.
607         * tree-vect-stmts.c (vect_gen_perm_mask_any): Likewise.
608         * tree-vector-builder.c (tree_vector_builder::new_unary_operation)
609         (tree_vector_builder::new_binary_operation): Handle polynomial
610         element counts.  Return false if we need to know the number
611         of elements at compile time.
612         * fold-const.c (fold_vec_perm): Punt if the number of elements
613         isn't known at compile time.
615 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
617         * vec-perm-indices.h (vec_perm_builder): Change element type
618         from HOST_WIDE_INT to poly_int64.
619         (vec_perm_indices::element_type): Update accordingly.
620         (vec_perm_indices::clamp): Handle polynomial element_types.
621         * vec-perm-indices.c (vec_perm_indices::series_p): Likewise.
622         (vec_perm_indices::all_in_range_p): Likewise.
623         (tree_to_vec_perm_builder): Check for poly_int64 trees rather
624         than shwi trees.
625         * vector-builder.h (vector_builder::stepped_sequence_p): Handle
626         polynomial vec_perm_indices element types.
627         * int-vector-builder.h (int_vector_builder::equal_p): Likewise.
628         * fold-const.c (fold_vec_perm): Likewise.
629         * optabs.c (shift_amt_for_vec_perm_mask): Likewise.
630         * tree-vect-generic.c (lower_vec_perm): Likewise.
631         * tree-vect-slp.c (vect_transform_slp_perm_load): Likewise.
632         * config/aarch64/aarch64.c (aarch64_evpc_tbl): Cast d->perm
633         element type to HOST_WIDE_INT.
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         * alias.c (addr_side_effect_eval): Take the size as a poly_int64
640         rather than an int.  Use plus_constant.
641         (memrefs_conflict_p): Take the sizes as poly_int64s rather than ints.
642         Take the offset "c" as a poly_int64 rather than a HOST_WIDE_INT.
644 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
645             Alan Hayward  <alan.hayward@arm.com>
646             David Sherwood  <david.sherwood@arm.com>
648         * calls.c (emit_call_1, expand_call): Change struct_value_size from
649         a HOST_WIDE_INT to a poly_int64.
651 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
652             Alan Hayward  <alan.hayward@arm.com>
653             David Sherwood  <david.sherwood@arm.com>
655         * calls.c (load_register_parameters): Cope with polynomial
656         mode sizes.  Require a constant size for BLKmode parameters
657         that aren't described by a PARALLEL.  If BLOCK_REG_PADDING
658         forces a parameter to be padded at the lsb end in order to
659         fill a complete number of words, require the parameter size
660         to be ordered wrt UNITS_PER_WORD.
662 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
663             Alan Hayward  <alan.hayward@arm.com>
664             David Sherwood  <david.sherwood@arm.com>
666         * reload1.c (spill_stack_slot_width): Change element type
667         from unsigned int to poly_uint64_pod.
668         (alter_reg): Treat mode sizes as polynomial.
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         * reload.c (complex_word_subreg_p): New function.
675         (reload_inner_reg_of_subreg, push_reload): Use it.
677 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
678             Alan Hayward  <alan.hayward@arm.com>
679             David Sherwood  <david.sherwood@arm.com>
681         * lra-constraints.c (process_alt_operands): Reject matched
682         operands whose sizes aren't ordered.
683         (match_reload): Refer to this check here.
685 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
686             Alan Hayward  <alan.hayward@arm.com>
687             David Sherwood  <david.sherwood@arm.com>
689         * builtins.c (expand_ifn_atomic_compare_exchange_into_call): Assert
690         that the mode size is in the set {1, 2, 4, 8, 16}.
692 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
693             Alan Hayward  <alan.hayward@arm.com>
694             David Sherwood  <david.sherwood@arm.com>
696         * var-tracking.c (adjust_mems): Treat mode sizes as polynomial.
697         Use plus_constant instead of gen_rtx_PLUS.
699 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
700             Alan Hayward  <alan.hayward@arm.com>
701             David Sherwood  <david.sherwood@arm.com>
703         * config/cr16/cr16-protos.h (cr16_push_rounding): Declare.
704         * config/cr16/cr16.h (PUSH_ROUNDING): Move implementation to...
705         * config/cr16/cr16.c (cr16_push_rounding): ...this new function.
706         * config/h8300/h8300-protos.h (h8300_push_rounding): Declare.
707         * config/h8300/h8300.h (PUSH_ROUNDING): Move implementation to...
708         * config/h8300/h8300.c (h8300_push_rounding): ...this new function.
709         * config/i386/i386-protos.h (ix86_push_rounding): Declare.
710         * config/i386/i386.h (PUSH_ROUNDING): Move implementation to...
711         * config/i386/i386.c (ix86_push_rounding): ...this new function.
712         * config/m32c/m32c-protos.h (m32c_push_rounding): Take and return
713         a poly_int64.
714         * config/m32c/m32c.c (m32c_push_rounding): Likewise.
715         * config/m68k/m68k-protos.h (m68k_push_rounding): Declare.
716         * config/m68k/m68k.h (PUSH_ROUNDING): Move implementation to...
717         * config/m68k/m68k.c (m68k_push_rounding): ...this new function.
718         * config/pdp11/pdp11-protos.h (pdp11_push_rounding): Declare.
719         * config/pdp11/pdp11.h (PUSH_ROUNDING): Move implementation to...
720         * config/pdp11/pdp11.c (pdp11_push_rounding): ...this new function.
721         * config/stormy16/stormy16-protos.h (xstormy16_push_rounding): Declare.
722         * config/stormy16/stormy16.h (PUSH_ROUNDING): Move implementation to...
723         * config/stormy16/stormy16.c (xstormy16_push_rounding): ...this new
724         function.
725         * expr.c (emit_move_resolve_push): Treat the input and result
726         of PUSH_ROUNDING as a poly_int64.
727         (emit_move_complex_push, emit_single_push_insn_1): Likewise.
728         (emit_push_insn): Likewise.
729         * lra-eliminations.c (mark_not_eliminable): Likewise.
730         * recog.c (push_operand): Likewise.
731         * reload1.c (elimination_effects): Likewise.
732         * rtlanal.c (nonzero_bits1): Likewise.
733         * calls.c (store_one_arg): Likewise.  Require the padding to be
734         known at compile time.
736 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
737             Alan Hayward  <alan.hayward@arm.com>
738             David Sherwood  <david.sherwood@arm.com>
740         * expr.c (emit_single_push_insn_1): Treat mode sizes as polynomial.
741         Use plus_constant instead of gen_rtx_PLUS.
743 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
744             Alan Hayward  <alan.hayward@arm.com>
745             David Sherwood  <david.sherwood@arm.com>
747         * auto-inc-dec.c (set_inc_state): Take the mode size as a poly_int64
748         rather than an int.
750 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
751             Alan Hayward  <alan.hayward@arm.com>
752             David Sherwood  <david.sherwood@arm.com>
754         * expr.c (expand_expr_real_1): Use tree_to_poly_uint64
755         instead of int_size_in_bytes when handling VIEW_CONVERT_EXPRs
756         via stack temporaries.  Treat the mode size as polynomial too.
758 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
759             Alan Hayward  <alan.hayward@arm.com>
760             David Sherwood  <david.sherwood@arm.com>
762         * expr.c (expand_expr_real_2): When handling conversions involving
763         unions, apply tree_to_poly_uint64 to the TYPE_SIZE rather than
764         multiplying int_size_in_bytes by BITS_PER_UNIT.  Treat GET_MODE_BISIZE
765         as a poly_uint64 too.
767 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
768             Alan Hayward  <alan.hayward@arm.com>
769             David Sherwood  <david.sherwood@arm.com>
771         * rtlanal.c (subreg_get_info): Handle polynomial mode sizes.
773 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
774             Alan Hayward  <alan.hayward@arm.com>
775             David Sherwood  <david.sherwood@arm.com>
777         * combine.c (can_change_dest_mode): Handle polynomial
778         REGMODE_NATURAL_SIZE.
779         * expmed.c (store_bit_field_1): Likewise.
780         * expr.c (store_constructor): Likewise.
781         * emit-rtl.c (validate_subreg): Operate on polynomial mode sizes
782         and polynomial REGMODE_NATURAL_SIZE.
783         (gen_lowpart_common): Likewise.
784         * reginfo.c (record_subregs_of_mode): Likewise.
785         * rtlanal.c (read_modify_subreg_p): Likewise.
787 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
788             Alan Hayward  <alan.hayward@arm.com>
789             David Sherwood  <david.sherwood@arm.com>
791         * internal-fn.c (expand_vector_ubsan_overflow): Handle polynomial
792         numbers of elements.
794 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
795             Alan Hayward  <alan.hayward@arm.com>
796             David Sherwood  <david.sherwood@arm.com>
798         * match.pd: Cope with polynomial numbers of vector elements.
800 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
801             Alan Hayward  <alan.hayward@arm.com>
802             David Sherwood  <david.sherwood@arm.com>
804         * fold-const.c (fold_indirect_ref_1): Handle polynomial offsets
805         in a POINTER_PLUS_EXPR.
807 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
808             Alan Hayward  <alan.hayward@arm.com>
809             David Sherwood  <david.sherwood@arm.com>
811         * omp-simd-clone.c (simd_clone_subparts): New function.
812         (simd_clone_init_simd_arrays): Use it instead of TYPE_VECTOR_SUBPARTS.
813         (ipa_simd_modify_function_body): Likewise.
815 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
816             Alan Hayward  <alan.hayward@arm.com>
817             David Sherwood  <david.sherwood@arm.com>
819         * tree-vect-generic.c (nunits_for_known_piecewise_op): New function.
820         (expand_vector_piecewise): Use it instead of TYPE_VECTOR_SUBPARTS.
821         (expand_vector_addition, add_rshift, expand_vector_divmod): Likewise.
822         (expand_vector_condition, vector_element): Likewise.
823         (subparts_gt): New function.
824         (get_compute_type): Use subparts_gt.
825         (count_type_subparts): Delete.
826         (expand_vector_operations_1): Use subparts_gt instead of
827         count_type_subparts.
829 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
830             Alan Hayward  <alan.hayward@arm.com>
831             David Sherwood  <david.sherwood@arm.com>
833         * tree-vect-data-refs.c (vect_no_alias_p): Replace with...
834         (vect_compile_time_alias): ...this new function.  Do the calculation
835         on poly_ints rather than trees.
836         (vect_prune_runtime_alias_test_list): Update call accordingly.
838 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
839             Alan Hayward  <alan.hayward@arm.com>
840             David Sherwood  <david.sherwood@arm.com>
842         * tree-vect-slp.c (vect_build_slp_tree_1): Handle polynomial
843         numbers of units.
844         (vect_schedule_slp_instance): Likewise.
846 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
847             Alan Hayward  <alan.hayward@arm.com>
848             David Sherwood  <david.sherwood@arm.com>
850         * tree-vect-slp.c (vect_get_and_check_slp_defs): Reject
851         constant and extern definitions for variable-length vectors.
852         (vect_get_constant_vectors): Note that the number of units
853         is known to be constant.
855 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
856             Alan Hayward  <alan.hayward@arm.com>
857             David Sherwood  <david.sherwood@arm.com>
859         * tree-vect-stmts.c (vectorizable_conversion): Treat the number
860         of units as polynomial.  Choose between WIDE and NARROW based
861         on multiple_p.
863 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
864             Alan Hayward  <alan.hayward@arm.com>
865             David Sherwood  <david.sherwood@arm.com>
867         * tree-vect-stmts.c (simd_clone_subparts): New function.
868         (vectorizable_simd_clone_call): Use it instead of TYPE_VECTOR_SUBPARTS.
870 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
871             Alan Hayward  <alan.hayward@arm.com>
872             David Sherwood  <david.sherwood@arm.com>
874         * tree-vect-stmts.c (vectorizable_call): Treat the number of
875         vectors as polynomial.  Use build_index_vector for
876         IFN_GOMP_SIMD_LANE.
878 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
879             Alan Hayward  <alan.hayward@arm.com>
880             David Sherwood  <david.sherwood@arm.com>
882         * tree-vect-stmts.c (get_load_store_type): Treat the number of
883         units as polynomial.  Reject VMAT_ELEMENTWISE and VMAT_STRIDED_SLP
884         for variable-length vectors.
885         (vectorizable_mask_load_store): Treat the number of units as
886         polynomial, asserting that it is constant if the condition has
887         already been enforced.
888         (vectorizable_store, vectorizable_load): Likewise.
890 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
891             Alan Hayward  <alan.hayward@arm.com>
892             David Sherwood  <david.sherwood@arm.com>
894         * tree-vect-loop.c (vectorizable_live_operation): Treat the number
895         of units as polynomial.  Punt if we can't tell at compile time
896         which vector contains the final result.
898 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
899             Alan Hayward  <alan.hayward@arm.com>
900             David Sherwood  <david.sherwood@arm.com>
902         * tree-vect-loop.c (vectorizable_induction): Treat the number
903         of units as polynomial.  Punt on SLP inductions.  Use an integer
904         VEC_SERIES_EXPR for variable-length integer reductions.  Use a
905         cast of such a series for variable-length floating-point
906         reductions.
908 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
909             Alan Hayward  <alan.hayward@arm.com>
910             David Sherwood  <david.sherwood@arm.com>
912         * tree.h (build_index_vector): Declare.
913         * tree.c (build_index_vector): New function.
914         * tree-vect-loop.c (get_initial_defs_for_reduction): Treat the number
915         of units as polynomial, forcibly converting it to a constant if
916         vectorizable_reduction has already enforced the condition.
917         (vect_create_epilog_for_reduction): Likewise.  Use build_index_vector
918         to create a {1,2,3,...} vector.
919         (vectorizable_reduction): Treat the number of units as polynomial.
920         Choose vectype_in based on the largest scalar element size rather
921         than the smallest number of units.  Enforce the restrictions
922         relied on above.
924 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
925             Alan Hayward  <alan.hayward@arm.com>
926             David Sherwood  <david.sherwood@arm.com>
928         * tree-vect-data-refs.c (vector_alignment_reachable_p): Treat the
929         number of units as polynomial.
931 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
932             Alan Hayward  <alan.hayward@arm.com>
933             David Sherwood  <david.sherwood@arm.com>
935         * target.h (vector_sizes, auto_vector_sizes): New typedefs.
936         * target.def (autovectorize_vector_sizes): Return the vector sizes
937         by pointer, using vector_sizes rather than a bitmask.
938         * targhooks.h (default_autovectorize_vector_sizes): Update accordingly.
939         * targhooks.c (default_autovectorize_vector_sizes): Likewise.
940         * config/aarch64/aarch64.c (aarch64_autovectorize_vector_sizes):
941         Likewise.
942         * config/arc/arc.c (arc_autovectorize_vector_sizes): Likewise.
943         * config/arm/arm.c (arm_autovectorize_vector_sizes): Likewise.
944         * config/i386/i386.c (ix86_autovectorize_vector_sizes): Likewise.
945         * config/mips/mips.c (mips_autovectorize_vector_sizes): Likewise.
946         * omp-general.c (omp_max_vf): Likewise.
947         * omp-low.c (omp_clause_aligned_alignment): Likewise.
948         * optabs-query.c (can_vec_mask_load_store_p): Likewise.
949         * tree-vect-loop.c (vect_analyze_loop): Likewise.
950         * tree-vect-slp.c (vect_slp_bb): Likewise.
951         * doc/tm.texi: Regenerate.
952         * tree-vectorizer.h (current_vector_size): Change from an unsigned int
953         to a poly_uint64.
954         * tree-vect-stmts.c (get_vectype_for_scalar_type_and_size): Take
955         the vector size as a poly_uint64 rather than an unsigned int.
956         (current_vector_size): Change from an unsigned int to a poly_uint64.
957         (get_vectype_for_scalar_type): Update accordingly.
958         * tree.h (build_truth_vector_type): Take the size and number of
959         units as a poly_uint64 rather than an unsigned int.
960         (build_vector_type): Add a temporary overload that takes
961         the number of units as a poly_uint64 rather than an unsigned int.
962         * tree.c (make_vector_type): Likewise.
963         (build_truth_vector_type): Take the number of units as a poly_uint64
964         rather than an unsigned int.
966 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
967             Alan Hayward  <alan.hayward@arm.com>
968             David Sherwood  <david.sherwood@arm.com>
970         * target.def (get_mask_mode): Take the number of units and length
971         as poly_uint64s rather than unsigned ints.
972         * targhooks.h (default_get_mask_mode): Update accordingly.
973         * targhooks.c (default_get_mask_mode): Likewise.
974         * config/i386/i386.c (ix86_get_mask_mode): Likewise.
975         * doc/tm.texi: Regenerate.
977 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
978             Alan Hayward  <alan.hayward@arm.com>
979             David Sherwood  <david.sherwood@arm.com>
981         * omp-general.h (omp_max_vf): Return a poly_uint64 instead of an int.
982         * omp-general.c (omp_max_vf): Likewise.
983         * omp-expand.c (omp_adjust_chunk_size): Update call to omp_max_vf.
984         (expand_omp_simd): Handle polynomial safelen.
985         * omp-low.c (omplow_simd_context): Add a default constructor.
986         (omplow_simd_context::max_vf): Change from int to poly_uint64.
987         (lower_rec_simd_input_clauses): Update accordingly.
988         (lower_rec_input_clauses): Likewise.
990 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
991             Alan Hayward  <alan.hayward@arm.com>
992             David Sherwood  <david.sherwood@arm.com>
994         * tree-vectorizer.h (vect_nunits_for_cost): New function.
995         * tree-vect-loop.c (vect_model_reduction_cost): Use it.
996         * tree-vect-slp.c (vect_analyze_slp_cost_1): Likewise.
997         (vect_analyze_slp_cost): Likewise.
998         * tree-vect-stmts.c (vect_model_store_cost): Likewise.
999         (vect_model_load_cost): Likewise.
1001 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1002             Alan Hayward  <alan.hayward@arm.com>
1003             David Sherwood  <david.sherwood@arm.com>
1005         * tree-vect-slp.c (vect_record_max_nunits, vect_build_slp_tree_1)
1006         (vect_build_slp_tree_2, vect_build_slp_tree): Change max_nunits
1007         from an unsigned int * to a poly_uint64_pod *.
1008         (calculate_unrolling_factor): New function.
1009         (vect_analyze_slp_instance): Use it.  Track polynomial max_nunits.
1011 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1012             Alan Hayward  <alan.hayward@arm.com>
1013             David Sherwood  <david.sherwood@arm.com>
1015         * tree-vectorizer.h (_slp_instance::unrolling_factor): Change
1016         from an unsigned int to a poly_uint64.
1017         (_loop_vec_info::slp_unrolling_factor): Likewise.
1018         (_loop_vec_info::vectorization_factor): Change from an int
1019         to a poly_uint64.
1020         (MAX_VECTORIZATION_FACTOR): Bump from 64 to INT_MAX.
1021         (vect_get_num_vectors): New function.
1022         (vect_update_max_nunits, vect_vf_for_cost): Likewise.
1023         (vect_get_num_copies): Use vect_get_num_vectors.
1024         (vect_analyze_data_ref_dependences): Change max_vf from an int *
1025         to an unsigned int *.
1026         (vect_analyze_data_refs): Change min_vf from an int * to a
1027         poly_uint64 *.
1028         (vect_transform_slp_perm_load): Take the vf as a poly_uint64 rather
1029         than an unsigned HOST_WIDE_INT.
1030         * tree-vect-data-refs.c (vect_analyze_possibly_independent_ddr)
1031         (vect_analyze_data_ref_dependence): Change max_vf from an int *
1032         to an unsigned int *.
1033         (vect_analyze_data_ref_dependences): Likewise.
1034         (vect_compute_data_ref_alignment): Handle polynomial vf.
1035         (vect_enhance_data_refs_alignment): Likewise.
1036         (vect_prune_runtime_alias_test_list): Likewise.
1037         (vect_shift_permute_load_chain): Likewise.
1038         (vect_supportable_dr_alignment): Likewise.
1039         (dependence_distance_ge_vf): Take the vectorization factor as a
1040         poly_uint64 rather than an unsigned HOST_WIDE_INT.
1041         (vect_analyze_data_refs): Change min_vf from an int * to a
1042         poly_uint64 *.
1043         * tree-vect-loop-manip.c (vect_gen_scalar_loop_niters): Take
1044         vfm1 as a poly_uint64 rather than an int.  Make the same change
1045         for the returned bound_scalar.
1046         (vect_gen_vector_loop_niters): Handle polynomial vf.
1047         (vect_do_peeling): Likewise.  Update call to
1048         vect_gen_scalar_loop_niters and handle polynomial bound_scalars.
1049         (vect_gen_vector_loop_niters_mult_vf): Assert that the vf must
1050         be constant.
1051         * tree-vect-loop.c (vect_determine_vectorization_factor)
1052         (vect_update_vf_for_slp, vect_analyze_loop_2): Handle polynomial vf.
1053         (vect_get_known_peeling_cost): Likewise.
1054         (vect_estimate_min_profitable_iters, vectorizable_reduction): Likewise.
1055         (vect_worthwhile_without_simd_p, vectorizable_induction): Likewise.
1056         (vect_transform_loop): Likewise.  Use the lowest possible VF when
1057         updating the upper bounds of the loop.
1058         (vect_min_worthwhile_factor): Make static.  Return an unsigned int
1059         rather than an int.
1060         * tree-vect-slp.c (vect_attempt_slp_rearrange_stmts): Cope with
1061         polynomial unroll factors.
1062         (vect_analyze_slp_cost_1, vect_analyze_slp_instance): Likewise.
1063         (vect_make_slp_decision): Likewise.
1064         (vect_supported_load_permutation_p): Likewise, and polynomial
1065         vf too.
1066         (vect_analyze_slp_cost): Handle polynomial vf.
1067         (vect_slp_analyze_node_operations): Likewise.
1068         (vect_slp_analyze_bb_1): Likewise.
1069         (vect_transform_slp_perm_load): Take the vf as a poly_uint64 rather
1070         than an unsigned HOST_WIDE_INT.
1071         * tree-vect-stmts.c (vectorizable_simd_clone_call, vectorizable_store)
1072         (vectorizable_load): Handle polynomial vf.
1073         * tree-vectorizer.c (simduid_to_vf::vf): Change from an int to
1074         a poly_uint64.
1075         (adjust_simduid_builtins, shrink_simd_arrays): Update accordingly.
1077 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1078             Alan Hayward  <alan.hayward@arm.com>
1079             David Sherwood  <david.sherwood@arm.com>
1081         * match.pd: Handle bit operations involving three constants
1082         and try to fold one pair.
1084 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1086         * tree-vect-loop-manip.c: Include gimple-fold.h.
1087         (slpeel_make_loop_iterate_ntimes): Add step, final_iv and
1088         niters_maybe_zero parameters.  Handle other cases besides a step of 1.
1089         (vect_gen_vector_loop_niters): Add a step_vector_ptr parameter.
1090         Add a path that uses a step of VF instead of 1, but disable it
1091         for now.
1092         (vect_do_peeling): Add step_vector, niters_vector_mult_vf_var
1093         and niters_no_overflow parameters.  Update calls to
1094         slpeel_make_loop_iterate_ntimes and vect_gen_vector_loop_niters.
1095         Create a new SSA name if the latter choses to use a ste other
1096         than zero, and return it via niters_vector_mult_vf_var.
1097         * tree-vect-loop.c (vect_transform_loop): Update calls to
1098         vect_do_peeling, vect_gen_vector_loop_niters and
1099         slpeel_make_loop_iterate_ntimes.
1100         * tree-vectorizer.h (slpeel_make_loop_iterate_ntimes, vect_do_peeling)
1101         (vect_gen_vector_loop_niters): Update declarations after above changes.
1103 2018-01-02  Michael Meissner  <meissner@linux.vnet.ibm.com>
1105         * config/rs6000/rs6000.md (floor<mode>2): Add support for IEEE
1106         128-bit round to integer instructions.
1107         (ceil<mode>2): Likewise.
1108         (btrunc<mode>2): Likewise.
1109         (round<mode>2): Likewise.
1111 2018-01-02  Aaron Sawdey  <acsawdey@linux.vnet.ibm.com>
1113         * config/rs6000/rs6000-string.c (expand_block_move): Allow the use of
1114         unaligned VSX load/store on P8/P9.
1115         (expand_block_clear): Allow the use of unaligned VSX
1116         load/store on P8/P9.
1118 2018-01-02  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
1120         * config/rs6000/rs6000-p8swap.c (swap_feeds_both_load_and_store):
1121         New function.
1122         (rs6000_analyze_swaps): Mark a web unoptimizable if it contains a
1123         swap associated with both a load and a store.
1125 2018-01-02  Andrew Waterman  <andrew@sifive.com>
1127         * config/riscv/linux.h (ICACHE_FLUSH_FUNC): New.
1128         * config/riscv/riscv.md (clear_cache): Use it.
1130 2018-01-02  Artyom Skrobov  <tyomitch@gmail.com>
1132         * web.c: Remove out-of-date comment.
1134 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1136         * expr.c (fixup_args_size_notes): Check that any existing
1137         REG_ARGS_SIZE notes are correct, and don't try to re-add them.
1138         (emit_single_push_insn_1): Move stack_pointer_delta adjustment to...
1139         (emit_single_push_insn): ...here.
1141 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1143         * rtl.h (CONST_VECTOR_ELT): Redefine to const_vector_elt.
1144         (const_vector_encoded_nelts): New function.
1145         (CONST_VECTOR_NUNITS): Redefine to use GET_MODE_NUNITS.
1146         (const_vector_int_elt, const_vector_elt): Declare.
1147         * emit-rtl.c (const_vector_int_elt_1): New function.
1148         (const_vector_elt): Likewise.
1149         * simplify-rtx.c (simplify_immed_subreg): Avoid taking the address
1150         of CONST_VECTOR_ELT.
1152 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1154         * expr.c: Include rtx-vector-builder.h.
1155         (const_vector_mask_from_tree): Use rtx_vector_builder and operate
1156         directly on the tree encoding.
1157         (const_vector_from_tree): Likewise.
1158         * optabs.c: Include rtx-vector-builder.h.
1159         (expand_vec_perm_var): Use rtx_vector_builder and create a repeating
1160         sequence of "u" values.
1161         * vec-perm-indices.c: Include rtx-vector-builder.h.
1162         (vec_perm_indices_to_rtx): Use rtx_vector_builder and operate
1163         directly on the vec_perm_indices encoding.
1165 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1167         * doc/rtl.texi (const_vector): Describe new encoding scheme.
1168         * Makefile.in (OBJS): Add rtx-vector-builder.o.
1169         * rtx-vector-builder.h: New file.
1170         * rtx-vector-builder.c: Likewise.
1171         * rtl.h (rtx_def::u2): Add a const_vector field.
1172         (CONST_VECTOR_NPATTERNS): New macro.
1173         (CONST_VECTOR_NELTS_PER_PATTERN): Likewise.
1174         (CONST_VECTOR_DUPLICATE_P): Likewise.
1175         (CONST_VECTOR_STEPPED_P): Likewise.
1176         (CONST_VECTOR_ENCODED_ELT): Likewise.
1177         (const_vec_duplicate_p): Check for a duplicated vector encoding.
1178         (unwrap_const_vec_duplicate): Likewise.
1179         (const_vec_series_p): Check for a non-duplicated vector encoding.
1180         Say that the function only returns true for integer vectors.
1181         * emit-rtl.c: Include rtx-vector-builder.h.
1182         (gen_const_vec_duplicate_1): Delete.
1183         (gen_const_vector): Call gen_const_vec_duplicate instead of
1184         gen_const_vec_duplicate_1.
1185         (const_vec_series_p_1): Operate directly on the CONST_VECTOR encoding.
1186         (gen_const_vec_duplicate): Use rtx_vector_builder.
1187         (gen_const_vec_series): Likewise.
1188         (gen_rtx_CONST_VECTOR): Likewise.
1189         * config/powerpcspe/powerpcspe.c: Include rtx-vector-builder.h.
1190         (swap_const_vector_halves): Take an rtx pointer rather than rtx.
1191         Build a new vector rather than modifying a CONST_VECTOR in-place.
1192         (handle_special_swappables): Update call accordingly.
1193         * config/rs6000/rs6000-p8swap.c: Include rtx-vector-builder.h.
1194         (swap_const_vector_halves): Take an rtx pointer rather than rtx.
1195         Build a new vector rather than modifying a CONST_VECTOR in-place.
1196         (handle_special_swappables): Update call accordingly.
1198 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1200         * simplify-rtx.c (simplify_const_binary_operation): Use
1201         CONST_VECTOR_ELT instead of XVECEXP.
1203 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1205         * tree-cfg.c (verify_gimple_assign_ternary): Allow the size of
1206         the selector elements to be different from the data elements
1207         if the selector is a VECTOR_CST.
1208         * tree-vect-stmts.c (vect_gen_perm_mask_any): Use a vector of
1209         ssizetype for the selector.
1211 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1213         * optabs.c (shift_amt_for_vec_perm_mask): Try using series_p
1214         before testing each element individually.
1215         * tree-vect-generic.c (lower_vec_perm): Likewise.
1217 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1219         * selftest.h (selftest::vec_perm_indices_c_tests): Declare.
1220         * selftest-run-tests.c (selftest::run_tests): Call it.
1221         * vector-builder.h (vector_builder::operator ==): New function.
1222         (vector_builder::operator !=): Likewise.
1223         * vec-perm-indices.h (vec_perm_indices::series_p): Declare.
1224         (vec_perm_indices::all_from_input_p): New function.
1225         * vec-perm-indices.c (vec_perm_indices::series_p): Likewise.
1226         (test_vec_perm_12, selftest::vec_perm_indices_c_tests): Likewise.
1227         * fold-const.c (fold_ternary_loc): Use tree_to_vec_perm_builder
1228         instead of reading the VECTOR_CST directly.  Detect whether both
1229         vector inputs are the same before constructing the vec_perm_indices,
1230         and update the number of inputs argument accordingly.  Use the
1231         utility functions added above.  Only construct sel2 if we need to.
1233 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1235         * optabs.c (expand_vec_perm_var): Use an explicit encoding for
1236         the broadcast of the low byte.
1237         (expand_mult_highpart): Use an explicit encoding for the permutes.
1238         * optabs-query.c (can_mult_highpart_p): Likewise.
1239         * tree-vect-loop.c (calc_vec_perm_mask_for_shift): Likewise.
1240         * tree-vect-stmts.c (perm_mask_for_reverse): Likewise.
1241         (vectorizable_bswap): Likewise.
1242         * tree-vect-data-refs.c (vect_grouped_store_supported): Use an
1243         explicit encoding for the power-of-2 permutes.
1244         (vect_permute_store_chain): Likewise.
1245         (vect_grouped_load_supported): Likewise.
1246         (vect_permute_load_chain): Likewise.
1248 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1250         * vec-perm-indices.h (vec_perm_indices_to_tree): Declare.
1251         * vec-perm-indices.c (vec_perm_indices_to_tree): New function.
1252         * tree-ssa-forwprop.c (simplify_vector_constructor): Use it.
1253         * tree-vect-slp.c (vect_transform_slp_perm_load): Likewise.
1254         * tree-vect-stmts.c (vectorizable_bswap): Likewise.
1255         (vect_gen_perm_mask_any): Likewise.
1257 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1259         * int-vector-builder.h: New file.
1260         * vec-perm-indices.h: Include int-vector-builder.h.
1261         (vec_perm_indices): Redefine as an int_vector_builder.
1262         (auto_vec_perm_indices): Delete.
1263         (vec_perm_builder): Redefine as a stand-alone class.
1264         (vec_perm_indices::vec_perm_indices): New function.
1265         (vec_perm_indices::clamp): Likewise.
1266         * vec-perm-indices.c: Include fold-const.h and tree-vector-builder.h.
1267         (vec_perm_indices::new_vector): New function.
1268         (vec_perm_indices::new_expanded_vector): Update for new
1269         vec_perm_indices class.
1270         (vec_perm_indices::rotate_inputs): New function.
1271         (vec_perm_indices::all_in_range_p): Operate directly on the
1272         encoded form, without computing elided elements.
1273         (tree_to_vec_perm_builder): Operate directly on the VECTOR_CST
1274         encoding.  Update for new vec_perm_indices class.
1275         * optabs.c (expand_vec_perm_const): Create a vec_perm_indices for
1276         the given vec_perm_builder.
1277         (expand_vec_perm_var): Update vec_perm_builder constructor.
1278         (expand_mult_highpart): Use vec_perm_builder instead of
1279         auto_vec_perm_indices.
1280         * optabs-query.c (can_mult_highpart_p): Use vec_perm_builder and
1281         vec_perm_indices instead of auto_vec_perm_indices.  Use a single
1282         or double series encoding as appropriate.
1283         * fold-const.c (fold_ternary_loc): Use vec_perm_builder and
1284         vec_perm_indices instead of auto_vec_perm_indices.
1285         * tree-ssa-forwprop.c (simplify_vector_constructor): Likewise.
1286         * tree-vect-data-refs.c (vect_grouped_store_supported): Likewise.
1287         (vect_permute_store_chain): Likewise.
1288         (vect_grouped_load_supported): Likewise.
1289         (vect_permute_load_chain): Likewise.
1290         (vect_shift_permute_load_chain): Likewise.
1291         * tree-vect-slp.c (vect_build_slp_tree_1): Likewise.
1292         (vect_transform_slp_perm_load): Likewise.
1293         (vect_schedule_slp_instance): Likewise.
1294         * tree-vect-stmts.c (perm_mask_for_reverse): Likewise.
1295         (vectorizable_mask_load_store): Likewise.
1296         (vectorizable_bswap): Likewise.
1297         (vectorizable_store): Likewise.
1298         (vectorizable_load): Likewise.
1299         * tree-vect-generic.c (lower_vec_perm): Use vec_perm_builder and
1300         vec_perm_indices instead of auto_vec_perm_indices.  Use
1301         tree_to_vec_perm_builder to read the vector from a tree.
1302         * tree-vect-loop.c (calc_vec_perm_mask_for_shift): Take a
1303         vec_perm_builder instead of a vec_perm_indices.
1304         (have_whole_vector_shift): Use vec_perm_builder and
1305         vec_perm_indices instead of auto_vec_perm_indices.  Leave the
1306         truncation to calc_vec_perm_mask_for_shift.
1307         (vect_create_epilog_for_reduction): Likewise.
1308         * config/aarch64/aarch64.c (expand_vec_perm_d::perm): Change
1309         from auto_vec_perm_indices to vec_perm_indices.
1310         (aarch64_expand_vec_perm_const_1): Use rotate_inputs on d.perm
1311         instead of changing individual elements.
1312         (aarch64_vectorize_vec_perm_const): Use new_vector to install
1313         the vector in d.perm.
1314         * config/arm/arm.c (expand_vec_perm_d::perm): Change
1315         from auto_vec_perm_indices to vec_perm_indices.
1316         (arm_expand_vec_perm_const_1): Use rotate_inputs on d.perm
1317         instead of changing individual elements.
1318         (arm_vectorize_vec_perm_const): Use new_vector to install
1319         the vector in d.perm.
1320         * config/powerpcspe/powerpcspe.c (rs6000_expand_extract_even):
1321         Update vec_perm_builder constructor.
1322         (rs6000_expand_interleave): Likewise.
1323         * config/rs6000/rs6000.c (rs6000_expand_extract_even): Likewise.
1324         (rs6000_expand_interleave): Likewise.
1326 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1328         * optabs-query.c (can_vec_perm_var_p): Check whether lowering
1329         to qimode could truncate the indices.
1330         * optabs.c (expand_vec_perm_var): Likewise.
1332 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1334         * Makefile.in (OBJS): Add vec-perm-indices.o.
1335         * vec-perm-indices.h: New file.
1336         * vec-perm-indices.c: Likewise.
1337         * target.h (vec_perm_indices): Replace with a forward class
1338         declaration.
1339         (auto_vec_perm_indices): Move to vec-perm-indices.h.
1340         * optabs.h: Include vec-perm-indices.h.
1341         (expand_vec_perm): Delete.
1342         (selector_fits_mode_p, expand_vec_perm_var): Declare.
1343         (expand_vec_perm_const): Declare.
1344         * target.def (vec_perm_const_ok): Replace with...
1345         (vec_perm_const): ...this new hook.
1346         * doc/tm.texi.in (TARGET_VECTORIZE_VEC_PERM_CONST_OK): Replace with...
1347         (TARGET_VECTORIZE_VEC_PERM_CONST): ...this new hook.
1348         * doc/tm.texi: Regenerate.
1349         * optabs.def (vec_perm_const): Delete.
1350         * doc/md.texi (vec_perm_const): Likewise.
1351         (vec_perm): Refer to TARGET_VECTORIZE_VEC_PERM_CONST.
1352         * expr.c (expand_expr_real_2): Use expand_vec_perm_const rather than
1353         expand_vec_perm for constant permutation vectors.  Assert that
1354         the mode of variable permutation vectors is the integer equivalent
1355         of the mode that is being permuted.
1356         * optabs-query.h (selector_fits_mode_p): Declare.
1357         * optabs-query.c: Include vec-perm-indices.h.
1358         (selector_fits_mode_p): New function.
1359         (can_vec_perm_const_p): Check whether targetm.vectorize.vec_perm_const
1360         is defined, instead of checking whether the vec_perm_const_optab
1361         exists.  Use targetm.vectorize.vec_perm_const instead of
1362         targetm.vectorize.vec_perm_const_ok.  Check whether the indices
1363         fit in the vector mode before using a variable permute.
1364         * optabs.c (shift_amt_for_vec_perm_mask): Take a mode and a
1365         vec_perm_indices instead of an rtx.
1366         (expand_vec_perm): Replace with...
1367         (expand_vec_perm_const): ...this new function.  Take the selector
1368         as a vec_perm_indices rather than an rtx.  Also take the mode of
1369         the selector.  Update call to shift_amt_for_vec_perm_mask.
1370         Use targetm.vectorize.vec_perm_const instead of vec_perm_const_optab.
1371         Use vec_perm_indices::new_expanded_vector to expand the original
1372         selector into bytes.  Check whether the indices fit in the vector
1373         mode before using a variable permute.
1374         (expand_vec_perm_var): Make global.
1375         (expand_mult_highpart): Use expand_vec_perm_const.
1376         * fold-const.c: Includes vec-perm-indices.h.
1377         * tree-ssa-forwprop.c: Likewise.
1378         * tree-vect-data-refs.c: Likewise.
1379         * tree-vect-generic.c: Likewise.
1380         * tree-vect-loop.c: Likewise.
1381         * tree-vect-slp.c: Likewise.
1382         * tree-vect-stmts.c: Likewise.
1383         * config/aarch64/aarch64-protos.h (aarch64_expand_vec_perm_const):
1384         Delete.
1385         * config/aarch64/aarch64-simd.md (vec_perm_const<mode>): Delete.
1386         * config/aarch64/aarch64.c (aarch64_expand_vec_perm_const)
1387         (aarch64_vectorize_vec_perm_const_ok): Fuse into...
1388         (aarch64_vectorize_vec_perm_const): ...this new function.
1389         (TARGET_VECTORIZE_VEC_PERM_CONST_OK): Delete.
1390         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
1391         * config/arm/arm-protos.h (arm_expand_vec_perm_const): Delete.
1392         * config/arm/vec-common.md (vec_perm_const<mode>): Delete.
1393         * config/arm/arm.c (TARGET_VECTORIZE_VEC_PERM_CONST_OK): Delete.
1394         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
1395         (arm_expand_vec_perm_const, arm_vectorize_vec_perm_const_ok): Merge
1396         into...
1397         (arm_vectorize_vec_perm_const): ...this new function.  Explicitly
1398         check for NEON modes.
1399         * config/i386/i386-protos.h (ix86_expand_vec_perm_const): Delete.
1400         * config/i386/sse.md (VEC_PERM_CONST, vec_perm_const<mode>): Delete.
1401         * config/i386/i386.c (ix86_expand_vec_perm_const_1): Update comment.
1402         (ix86_expand_vec_perm_const, ix86_vectorize_vec_perm_const_ok): Merge
1403         into...
1404         (ix86_vectorize_vec_perm_const): ...this new function.  Incorporate
1405         the old VEC_PERM_CONST conditions.
1406         * config/ia64/ia64-protos.h (ia64_expand_vec_perm_const): Delete.
1407         * config/ia64/vect.md (vec_perm_const<mode>): Delete.
1408         * config/ia64/ia64.c (ia64_expand_vec_perm_const)
1409         (ia64_vectorize_vec_perm_const_ok): Merge into...
1410         (ia64_vectorize_vec_perm_const): ...this new function.
1411         * config/mips/loongson.md (vec_perm_const<mode>): Delete.
1412         * config/mips/mips-msa.md (vec_perm_const<mode>): Delete.
1413         * config/mips/mips-ps-3d.md (vec_perm_constv2sf): Delete.
1414         * config/mips/mips-protos.h (mips_expand_vec_perm_const): Delete.
1415         * config/mips/mips.c (mips_expand_vec_perm_const)
1416         (mips_vectorize_vec_perm_const_ok): Merge into...
1417         (mips_vectorize_vec_perm_const): ...this new function.
1418         * config/powerpcspe/altivec.md (vec_perm_constv16qi): Delete.
1419         * config/powerpcspe/paired.md (vec_perm_constv2sf): Delete.
1420         * config/powerpcspe/spe.md (vec_perm_constv2si): Delete.
1421         * config/powerpcspe/vsx.md (vec_perm_const<mode>): Delete.
1422         * config/powerpcspe/powerpcspe-protos.h (altivec_expand_vec_perm_const)
1423         (rs6000_expand_vec_perm_const): Delete.
1424         * config/powerpcspe/powerpcspe.c (TARGET_VECTORIZE_VEC_PERM_CONST_OK):
1425         Delete.
1426         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
1427         (altivec_expand_vec_perm_const_le): Take each operand individually.
1428         Operate on constant selectors rather than rtxes.
1429         (altivec_expand_vec_perm_const): Likewise.  Update call to
1430         altivec_expand_vec_perm_const_le.
1431         (rs6000_expand_vec_perm_const): Delete.
1432         (rs6000_vectorize_vec_perm_const_ok): Delete.
1433         (rs6000_vectorize_vec_perm_const): New function.
1434         (rs6000_do_expand_vec_perm): Take a vec_perm_builder instead of
1435         an element count and rtx array.
1436         (rs6000_expand_extract_even): Update call accordingly.
1437         (rs6000_expand_interleave): Likewise.
1438         * config/rs6000/altivec.md (vec_perm_constv16qi): Delete.
1439         * config/rs6000/paired.md (vec_perm_constv2sf): Delete.
1440         * config/rs6000/vsx.md (vec_perm_const<mode>): Delete.
1441         * config/rs6000/rs6000-protos.h (altivec_expand_vec_perm_const)
1442         (rs6000_expand_vec_perm_const): Delete.
1443         * config/rs6000/rs6000.c (TARGET_VECTORIZE_VEC_PERM_CONST_OK): Delete.
1444         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
1445         (altivec_expand_vec_perm_const_le): Take each operand individually.
1446         Operate on constant selectors rather than rtxes.
1447         (altivec_expand_vec_perm_const): Likewise.  Update call to
1448         altivec_expand_vec_perm_const_le.
1449         (rs6000_expand_vec_perm_const): Delete.
1450         (rs6000_vectorize_vec_perm_const_ok): Delete.
1451         (rs6000_vectorize_vec_perm_const): New function.  Remove stray
1452         reference to the SPE evmerge intructions.
1453         (rs6000_do_expand_vec_perm): Take a vec_perm_builder instead of
1454         an element count and rtx array.
1455         (rs6000_expand_extract_even): Update call accordingly.
1456         (rs6000_expand_interleave): Likewise.
1457         * config/sparc/sparc.md (vec_perm_constv8qi): Delete in favor of...
1458         * config/sparc/sparc.c (sparc_vectorize_vec_perm_const): ...this
1459         new function.
1460         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
1462 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1464         * optabs.c (expand_vec_perm_1): Assert that SEL has an integer
1465         vector mode and that that mode matches the mode of the data
1466         being permuted.
1467         (expand_vec_perm): Split handling of non-CONST_VECTOR selectors
1468         out into expand_vec_perm_var.  Do all CONST_VECTOR handling here,
1469         directly using expand_vec_perm_1 when forcing selectors into
1470         registers.
1471         (expand_vec_perm_var): New function, split out from expand_vec_perm.
1473 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1475         * optabs-query.h (can_vec_perm_p): Delete.
1476         (can_vec_perm_var_p, can_vec_perm_const_p): Declare.
1477         * optabs-query.c (can_vec_perm_p): Split into...
1478         (can_vec_perm_var_p, can_vec_perm_const_p): ...these two functions.
1479         (can_mult_highpart_p): Use can_vec_perm_const_p to test whether a
1480         particular selector is valid.
1481         * tree-ssa-forwprop.c (simplify_vector_constructor): Likewise.
1482         * tree-vect-data-refs.c (vect_grouped_store_supported): Likewise.
1483         (vect_grouped_load_supported): Likewise.
1484         (vect_shift_permute_load_chain): Likewise.
1485         * tree-vect-slp.c (vect_build_slp_tree_1): Likewise.
1486         (vect_transform_slp_perm_load): Likewise.
1487         * tree-vect-stmts.c (perm_mask_for_reverse): Likewise.
1488         (vectorizable_bswap): Likewise.
1489         (vect_gen_perm_mask_checked): Likewise.
1490         * fold-const.c (fold_ternary_loc): Likewise.  Don't take
1491         implementations of variable permutation vectors into account
1492         when deciding which selector to use.
1493         * tree-vect-loop.c (have_whole_vector_shift): Don't check whether
1494         vec_perm_const_optab is supported; instead use can_vec_perm_const_p
1495         with a false third argument.
1496         * tree-vect-generic.c (lower_vec_perm): Use can_vec_perm_const_p
1497         to test whether the constant selector is valid and can_vec_perm_var_p
1498         to test whether a variable selector is valid.
1500 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1502         * optabs-query.h (can_vec_perm_p): Take a const vec_perm_indices *.
1503         * optabs-query.c (can_vec_perm_p): Likewise.
1504         * fold-const.c (fold_vec_perm): Take a const vec_perm_indices &
1505         instead of vec_perm_indices.
1506         * tree-vectorizer.h (vect_gen_perm_mask_any): Likewise,
1507         (vect_gen_perm_mask_checked): Likewise,
1508         * tree-vect-stmts.c (vect_gen_perm_mask_any): Likewise,
1509         (vect_gen_perm_mask_checked): Likewise,
1511 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1513         * optabs-query.h (qimode_for_vec_perm): Declare.
1514         * optabs-query.c (can_vec_perm_p): Split out qimode search to...
1515         (qimode_for_vec_perm): ...this new function.
1516         * optabs.c (expand_vec_perm): Use qimode_for_vec_perm.
1518 2018-01-02  Aaron Sawdey  <acsawdey@linux.vnet.ibm.com>
1520         * rtlanal.c (canonicalize_condition): Return 0 if final rtx
1521         does not have a conditional at the top.
1523 2018-01-02  Richard Biener  <rguenther@suse.de>
1525         * ipa-inline.c (big_speedup_p): Fix expression.
1527 2018-01-02  Jan Hubicka  <hubicka@ucw.cz>
1529         PR target/81616
1530         * config/i386/x86-tune-costs.h: Increase cost of integer load costs
1531         for generic 4->6.
1533 2018-01-02  Jan Hubicka  <hubicka@ucw.cz>
1535         PR target/81616
1536         Generic tuning.
1537         * x86-tune-costs.h (generic_cost): Reduce cost of FDIV 20->17,
1538         cost of sqrt 20->14, DIVSS 18->13, DIVSD 32->17, SQRtSS 30->14
1539         and SQRTsD 58->18, cond_not_taken_branch_cost. 2->1. Increase
1540         cond_taken_branch_cost 3->4.
1542 2018-01-01  Jakub Jelinek  <jakub@redhat.com>
1544         PR tree-optimization/83581
1545         * tree-loop-distribution.c (pass_loop_distribution::execute): Return
1546         TODO_cleanup_cfg if any changes have been made.
1548         PR middle-end/83608
1549         * expr.c (store_expr_with_bounds): Use simplify_gen_subreg instead of
1550         convert_modes if target mode has the right side, but different mode
1551         class.
1553         PR middle-end/83609
1554         * expr.c (expand_assignment): Fix up a typo in simplify_gen_subreg
1555         last argument when extracting from CONCAT.  If either from_real or
1556         from_imag is NULL, use expansion through memory.  If result is not
1557         a CONCAT and simplify_gen_subreg fails, try to simplify_gen_subreg
1558         the parts directly to inner mode, if even that fails, use expansion
1559         through memory.
1561         PR middle-end/83623
1562         * expmed.c (expand_shift_1): For 2-byte rotates by BITS_PER_UNIT,
1563         check for bswap in mode rather than HImode and use that in expand_unop
1564         too.
1566 Copyright (C) 2018 Free Software Foundation, Inc.
1568 Copying and distribution of this file, with or without modification,
1569 are permitted in any medium without royalty provided the copyright
1570 notice and this notice are preserved.