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