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