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