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