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