rs6000: Wrap diff of immediates in const (PR83629)
[official-gcc.git] / gcc / ChangeLog
blob8b5bda301cab911793466230213f6b3c7db3aac4
1 2018-01-10  Segher Boessenkool  <segher@kernel.crashing.org>
3         PR target/83629
4         * config/rs6000/rs6000.md (load_toc_v4_PIC_2, load_toc_v4_PIC_3b,
5         load_toc_v4_PIC_3c): Wrap const term in CONST RTL.
7 2018-01-10  Richard Biener  <rguenther@suse.de>
9         PR debug/83765
10         * dwarf2out.c (gen_subprogram_die): Hoist old_die && declaration
11         early out so it also covers the case where we have a non-NULL
12         origin.
14 2018-01-10  Richard Sandiford  <richard.sandiford@linaro.org>
16         PR tree-optimization/83753
17         * tree-vect-stmts.c (get_group_load_store_type): Use VMAT_CONTIGUOUS
18         for non-strided grouped accesses if the number of elements is 1.
20 2018-01-10  Jan Hubicka  <hubicka@ucw.cz>
22         PR target/81616
23         * i386.c (ix86_vectorize_builtin_gather): Check TARGET_USE_GATHER.
24         * i386.h (TARGET_USE_GATHER): Define.
25         * x86-tune.def (X86_TUNE_USE_GATHER): New.
27 2018-01-10  Martin Liska  <mliska@suse.cz>
29         PR bootstrap/82831
30         * basic-block.h (CLEANUP_NO_PARTITIONING): New define.
31         * bb-reorder.c (pass_reorder_blocks::execute): Do not clean up
32         partitioning.
33         * cfgcleanup.c (try_optimize_cfg): Fix up partitioning if
34         CLEANUP_NO_PARTITIONING is not set.
36 2018-01-10  Richard Sandiford  <richard.sandiford@linaro.org>
38         * doc/rtl.texi: Remove documentation of (const ...) wrappers
39         for vectors, as a partial revert of r254296.
40         * rtl.h (const_vec_p): Delete.
41         (const_vec_duplicate_p): Don't test for vector CONSTs.
42         (unwrap_const_vec_duplicate, const_vec_series_p): Likewise.
43         * expmed.c (make_tree): Likewise.
45         Revert:
46         * common.md (E, F): Use CONSTANT_P instead of checking for
47         CONST_VECTOR.
48         * emit-rtl.c (gen_lowpart_common): Use const_vec_p instead of
49         checking for CONST_VECTOR.
51 2018-01-09  Jan Hubicka  <hubicka@ucw.cz>
53         PR middle-end/83575
54         * predict.c (force_edge_cold): Handle in more sane way edges
55         with no prediction.
57 2018-01-09  Carl Love  <cel@us.ibm.com>
59         * config/rs6002/altivec.md (p8_vmrgow): Add support for V2DI, V2DF,
60         V4SI, V4SF types.
61         (p8_vmrgew): Add support for V2DI, V2DF, V4SF types.
62         * config/rs6000/rs6000-builtin.def: Add definitions for FLOAT2_V2DF,
63         VMRGEW_V2DI, VMRGEW_V2DF, VMRGEW_V4SF, VMRGOW_V4SI, VMRGOW_V4SF,
64         VMRGOW_V2DI, VMRGOW_V2DF.  Remove definition for VMRGOW.
65         * config/rs6000/rs6000-c.c (VSX_BUILTIN_VEC_FLOAT2,
66         P8V_BUILTIN_VEC_VMRGEW, P8V_BUILTIN_VEC_VMRGOW):  Add definitions.
67         * config/rs6000/rs6000-protos.h: Add extern defition for
68         rs6000_generate_float2_double_code.
69         * config/rs6000/rs6000.c (rs6000_generate_float2_double_code): Add
70         function.
71         * config/rs6000/vsx.md (vsx_xvcdpsp): Add define_insn.
72         (float2_v2df): Add define_expand.
74 2018-01-09  Uros Bizjak  <ubizjak@gmail.com>
76         PR target/83628
77         * combine.c (force_int_to_mode) <case ASHIFT>: Use mode instead of
78         op_mode in the force_to_mode call.
80 2018-01-09  Richard Sandiford  <richard.sandiford@linaro.org>
82         * config/aarch64/aarch64.c (aarch64_evpc_trn): Use d.perm.series_p
83         instead of checking each element individually.
84         (aarch64_evpc_uzp): Likewise.
85         (aarch64_evpc_zip): Likewise.
86         (aarch64_evpc_ext): Likewise.
87         (aarch64_evpc_rev): Likewise.
88         (aarch64_evpc_dup): Test the encoding for a single duplicated element,
89         instead of checking each element individually.  Return true without
90         generating rtl if
91         (aarch64_vectorize_vec_perm_const): Use all_from_input_p to test
92         whether all selected elements come from the same input, instead of
93         checking each element individually.  Remove calls to gen_rtx_REG,
94         start_sequence and end_sequence and instead assert that no rtl is
95         generated.
97 2018-01-09  Richard Sandiford  <richard.sandiford@linaro.org>
99         * config/aarch64/aarch64.c (aarch64_legitimate_constant_p): Fix
100         order of HIGH and CONST checks.
102 2018-01-09  Richard Sandiford  <richard.sandiford@linaro.org>
104         * tree-vect-stmts.c (permute_vec_elements): Create a fresh variable
105         if the destination isn't an SSA_NAME.
107 2018-01-09  Richard Biener  <rguenther@suse.de>
109         PR tree-optimization/83668
110         * graphite.c (canonicalize_loop_closed_ssa): Add edge argument,
111         move prologue...
112         (canonicalize_loop_form): ... here, renamed from ...
113         (canonicalize_loop_closed_ssa_form): ... this and amended to
114         swap successor edges for loop exit blocks to make us use
115         the RPO order we need for initial schedule generation.
117 2018-01-09  Joseph Myers  <joseph@codesourcery.com>
119         PR tree-optimization/64811
120         * match.pd: When optimizing comparisons with Inf, avoid
121         introducing or losing exceptions from comparisons with NaN.
123 2018-01-09  Martin Liska  <mliska@suse.cz>
125         PR sanitizer/82517
126         * asan.c (shadow_mem_size): Add gcc_assert.
128 2018-01-09  Georg-Johann Lay  <avr@gjlay.de>
130         Don't save registers in main().
132         PR target/83738
133         * doc/invoke.texi (AVR Options) [-mmain-is-OS_task]: Document it.
134         * config/avr/avr.opt (-mmain-is-OS_task): New target option.
135         * config/avr/avr.c (avr_set_current_function): Don't error if
136         naked, OS_task or OS_main are specified at the same time.
137         (avr_function_ok_for_sibcall): Don't disable sibcalls for OS_task,
138         OS_main.
139         (avr_insert_attributes) [-mmain-is-OS_task] <main>: Add OS_task
140         attribute.
141         * common/config/avr/avr-common.c (avr_option_optimization_table):
142         Switch on -mmain-is-OS_task for optimizing compilations.
144 2018-01-09  Richard Biener  <rguenther@suse.de>
146         PR tree-optimization/83572
147         * graphite.c: Include cfganal.h.
148         (graphite_transform_loops): Connect infinite loops to exit
149         and remove fake edges at the end.
151 2018-01-09  Jan Hubicka  <hubicka@ucw.cz>
153         * ipa-inline.c (edge_badness): Revert accidental checkin.
155 2018-01-09  Jan Hubicka  <hubicka@ucw.cz>
157         PR ipa/80763
158         * ipa-comdats.c (set_comdat_group): Only set comdat group of real
159         symbols; not inline clones.
161 2018-01-09  Jakub Jelinek  <jakub@redhat.com>
163         PR target/83507
164         * modulo-sched.c (schedule_reg_moves): Punt if we'd need to move
165         hard registers.  Formatting fixes.
167         PR preprocessor/83722
168         * gcc.c (try_generate_repro): Pass
169         &temp_stderr_files[RETRY_ICE_ATTEMPTS - 1] rather than
170         &temp_stdout_files[RETRY_ICE_ATTEMPTS - 1] as last argument to
171         do_report_bug.
173 2018-01-08  Monk Chiang  <sh.chiang04@gmail.com>
174             Kito Cheng  <kito.cheng@gmail.com>
176         * config/riscv/riscv.c (machine_function::is_leaf): Remove field.
177         (riscv_leaf_function_p): Delete.
178         (riscv_function_ok_for_sibcall): Return false when TARGET_SAVE_RESTORE.
180 2018-01-08  Aaron Sawdey  <acsawdey@linux.vnet.ibm.com>
182         * config/rs6000/rs6000-string.c (do_load_for_compare_from_addr): New
183         function.
184         (do_ifelse): New function.
185         (do_isel): New function.
186         (do_sub3): New function.
187         (do_add3): New function.
188         (do_load_mask_compare): New function.
189         (do_overlap_load_compare): New function.
190         (expand_compare_loop): New function.
191         (expand_block_compare): Call expand_compare_loop() when appropriate.
192         * config/rs6000/rs6000.opt (-mblock-compare-inline-limit): Change
193         option description.
194         (-mblock-compare-inline-loop-limit): New option.
196 2018-01-08  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
198         PR target/83677
199         * config/rs6000/altivec.md (*altivec_vpermr_<mode>_internal):
200         Reverse order of second and third operands in first alternative.
201         * config/rs6000/rs6000.c (rs6000_expand_vector_set): Reverse order
202         of first and second elements in UNSPEC_VPERMR vector.
203         (altivec_expand_vec_perm_le): Likewise.
205 2017-01-08  Jeff Law  <law@redhat.com>
207         PR rtl-optimizatin/81308
208         * tree-switch-conversion.c (cfg_altered): New file scoped static.
209         (process_switch): If group_case_labels makes a change, then set
210         cfg_altered.
211         (pass_convert_switch::execute): If a switch is converted, then
212         set cfg_altered.  Return TODO_cfg_cleanup if cfg_altered is true.
214         PR rtl-optimization/81308
215         * recog.c (split_all_insns): Conditionally cleanup the CFG after
216         splitting insns.
218 2018-01-08  Vidya Praveen  <vidyapraveen@arm.com>
220         PR target/83663 - Revert r255946
221         * config/aarch64/aarch64.c (aarch64_expand_vector_init): Modify code
222         generation for cases where splatting a value is not useful.
223         * simplify-rtx.c (simplify_ternary_operation): Simplify vec_merge
224         across a vec_duplicate and a paradoxical subreg forming a vector
225         mode to a vec_concat.
227 2018-01-08  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
229         * config/arm/t-aprofile (MULTILIB_MATCHES): Add mapping rules for
230         -march=armv8.3-a variants.
231         * config/arm/t-multilib: Likewise.
232         * config/arm/t-arm-elf: Likewise.  Handle dotprod extension.
234 2018-01-08  Aaron Sawdey  <acsawdey@linux.vnet.ibm.com>
236         * config/rs6000/rs6000.md (cceq_ior_compare): Remove * so I can use it
237         to generate rtl.
238         (cceq_ior_compare_complement): Give it a name so I can use it, and
239         change boolean_or_operator predicate to boolean_operator so it can
240         be used to generate a crand.
241         (eqne): New code iterator.
242         (bd/bd_neg): New code_attrs.
243         (<bd>_<mode>): New name for ctr<mode>_internal[12] now combined into
244         a single define_insn.
245         (<bd>tf_<mode>): A new insn pattern for the conditional form branch
246         decrement (bdnzt/bdnzf/bdzt/bdzf).
247         * config/rs6000/rs6000.c (rs6000_legitimate_combined_insn): Updated
248         with the new names of the branch decrement patterns, and added the
249         names of the branch decrement conditional patterns.
251 2018-01-08  Richard Biener  <rguenther@suse.de>
253         PR tree-optimization/83563
254         * graphite.c (canonicalize_loop_closed_ssa_form): Reset the SCEV
255         cache.
257 2018-01-08  Richard Biener  <rguenther@suse.de>
259         PR middle-end/83713
260         * convert.c (do_narrow): Properly guard TYPE_OVERFLOW_WRAPS checks.
262 2018-01-08  Richard Biener  <rguenther@suse.de>
264         PR tree-optimization/83685
265         * tree-ssa-pre.c (create_expression_by_pieces): Do not insert
266         references to abnormals.
268 2018-01-08  Richard Biener  <rguenther@suse.de>
270         PR lto/83719
271         * dwarf2out.c (output_indirect_strings): Handle empty
272         skeleton_debug_str_hash.
273         (dwarf2out_early_finish): Index strings for -gsplit-dwarf.
275 2018-01-08  Claudiu Zissulescu  <claziss@synopsys.com>
277         * config/arc/arc.c (TARGET_TRAMPOLINE_ADJUST_ADDRESS): Delete.
278         (emit_store_direct): Likewise.
279         (arc_trampoline_adjust_address): Likewise.
280         (arc_asm_trampoline_template): New function.
281         (arc_initialize_trampoline): Use asm_trampoline_template.
282         (TARGET_ASM_TRAMPOLINE_TEMPLATE): Define.
283         * config/arc/arc.h (TRAMPOLINE_SIZE): Adjust to 16.
284         * config/arc/arc.md (flush_icache): Delete pattern.
286 2018-01-08  Claudiu Zissulescu  <claziss@synopsys.com>
288         * config/arc/arc-c.def (__ARC_UNALIGNED__): New define.
289         * config/arc/arc.h (STRICT_ALIGNMENT): Control this macro using
290         munaligned-access.
292 2018-01-08  Sebastian Huber  <sebastian.huber@embedded-brains.de>
294         PR target/83681
295         * config/epiphany/epiphany.h (make_pass_mode_switch_use): Guard
296         by not USED_FOR_TARGET.
297         (make_pass_resolve_sw_modes): Likewise.
299 2018-01-08  Sebastian Huber  <sebastian.huber@embedded-brains.de>
301         * config/nios2/nios2.h (nios2_section_threshold): Guard by not
302         USED_FOR_TARGET.
304 2018-01-08  Richard Biener  <rguenther@suse.de>
306         PR middle-end/83580
307         * tree-data-ref.c (split_constant_offset): Remove STRIP_NOPS.
309 2018-01-08  Richard Biener  <rguenther@suse.de>
311         PR middle-end/83517
312         * match.pd ((t * 2) / 2) -> t): Add missing :c.
314 2018-01-06  Aldy Hernandez  <aldyh@redhat.com>
316         PR middle-end/81897
317         * tree-ssa-uninit.c (compute_control_dep_chain): Do not bail on
318         basic blocks with a small number of successors.
319         (convert_control_dep_chain_into_preds): Improve handling of
320         forwarder blocks.
321         (dump_predicates): Split apart into...
322         (dump_pred_chain): ...here...
323         (dump_pred_info): ...and here.
324         (can_one_predicate_be_invalidated_p): Add debugging printfs.
325         (can_chain_union_be_invalidated_p): Improve check for invalidation
326         of paths.
327         (uninit_uses_cannot_happen): Avoid unnecessary if
328         convert_control_dep_chain_into_preds yielded nothing.
330 2018-01-06  Martin Sebor  <msebor@redhat.com>
332         PR tree-optimization/83640
333         * gimple-ssa-warn-restrict.c (builtin_access::builtin_access): Avoid
334         subtracting negative offset from size.
335         (builtin_access::overlap): Adjust offset bounds of the access to fall
336         within the size of the object if possible.
338 2018-01-06  Richard Sandiford  <richard.sandiford@linaro.org>
340         PR rtl-optimization/83699
341         * expmed.c (extract_bit_field_1): Restrict the vector usage of
342         extract_bit_field_as_subreg to cases in which the extracted
343         value is also a vector.
345         * lra-constraints.c (process_alt_operands): Test for the equivalence
346         substitutions when detecting a possible reload cycle.
348 2018-01-06  Jakub Jelinek  <jakub@redhat.com>
350         PR debug/83480
351         * toplev.c (process_options): Don't enable debug_nonbind_markers_p
352         by default if flag_selective_schedling{,2}.  Formatting fixes.
354         PR rtl-optimization/83682
355         * rtl.h (const_vec_duplicate_p): Only return true for VEC_DUPLICATE
356         if it has non-VECTOR_MODE element mode.
357         (vec_duplicate_p): Likewise.
359         PR middle-end/83694
360         * cfgexpand.c (expand_debug_expr): Punt if mode1 is VOIDmode
361         and bitsize might be greater than MAX_BITSIZE_MODE_ANY_INT.
363 2018-01-05  Jakub Jelinek  <jakub@redhat.com>
365         PR target/83604
366         * config/i386/i386-builtin.def
367         (__builtin_ia32_vgf2p8affineinvqb_v64qi,
368         __builtin_ia32_vgf2p8affineqb_v64qi, __builtin_ia32_vgf2p8mulb_v64qi):
369         Require also OPTION_MASK_ISA_AVX512F in addition to
370         OPTION_MASK_ISA_GFNI.
371         (__builtin_ia32_vgf2p8affineinvqb_v16qi_mask,
372         __builtin_ia32_vgf2p8affineqb_v16qi_mask): Require
373         OPTION_MASK_ISA_AVX512VL instead of OPTION_MASK_ISA_SSE in addition
374         to OPTION_MASK_ISA_GFNI.
375         (__builtin_ia32_vgf2p8mulb_v32qi_mask): Require
376         OPTION_MASK_ISA_AVX512VL in addition to OPTION_MASK_ISA_GFNI and
377         OPTION_MASK_ISA_AVX512BW.
378         (__builtin_ia32_vgf2p8mulb_v16qi_mask): Require
379         OPTION_MASK_ISA_AVX512VL instead of OPTION_MASK_ISA_AVX512BW in
380         addition to OPTION_MASK_ISA_GFNI.
381         (__builtin_ia32_vgf2p8affineinvqb_v16qi,
382         __builtin_ia32_vgf2p8affineqb_v16qi, __builtin_ia32_vgf2p8mulb_v16qi):
383         Require OPTION_MASK_ISA_SSE2 instead of OPTION_MASK_ISA_SSE in addition
384         to OPTION_MASK_ISA_GFNI.
385         * config/i386/i386.c (def_builtin): Change to builtin isa/isa2 being
386         a requirement for all ISAs rather than any of them with a few
387         exceptions.
388         (ix86_add_new_builtins): Clear OPTION_MASK_ISA_64BIT from isa before
389         processing.
390         (ix86_expand_builtin): Require all ISAs from builtin's isa and isa2
391         bitmasks to be enabled with 3 exceptions, instead of requiring any
392         enabled ISA with lots of exceptions.
393         * config/i386/sse.md (vgf2p8affineinvqb_<mode><mask_name>,
394         vgf2p8affineqb_<mode><mask_name>, vgf2p8mulb_<mode><mask_name>):
395         Change avx512bw in isa attribute to avx512f.
396         * config/i386/sgxintrin.h: Add license boilerplate.
397         * config/i386/vaesintrin.h: Likewise.  Fix macro spelling __AVX512F
398         to __AVX512F__ and __AVX512VL to __AVX512VL__.
399         (_mm256_aesdec_epi128, _mm256_aesdeclast_epi128, _mm256_aesenc_epi128,
400         _mm256_aesenclast_epi128): Enable temporarily avx if __AVX__ is not
401         defined.
402         * config/i386/gfniintrin.h (_mm_gf2p8mul_epi8,
403         _mm_gf2p8affineinv_epi64_epi8, _mm_gf2p8affine_epi64_epi8): Enable
404         temporarily sse2 rather than sse if not enabled already.
406         PR target/83604
407         * config/i386/sse.md (VI248_VLBW): Rename to ...
408         (VI248_AVX512VL): ... this.  Don't guard V32HI with TARGET_AVX512BW.
409         (vpshrd_<mode><mask_name>, vpshld_<mode><mask_name>,
410         vpshrdv_<mode>, vpshrdv_<mode>_mask, vpshrdv_<mode>_maskz,
411         vpshrdv_<mode>_maskz_1, vpshldv_<mode>, vpshldv_<mode>_mask,
412         vpshldv_<mode>_maskz, vpshldv_<mode>_maskz_1): Use VI248_AVX512VL
413         mode iterator instead of VI248_VLBW.
415 2018-01-05  Jan Hubicka  <hubicka@ucw.cz>
417         * ipa-fnsummary.c (record_modified_bb_info): Add OP.
418         (record_modified): Skip clobbers; add debug output.
419         (param_change_prob): Use sreal frequencies.
421 2018-01-05  Richard Sandiford  <richard.sandiford@linaro.org>
423         * tree-vect-data-refs.c (vect_compute_data_ref_alignment): Don't
424         punt for user-aligned variables.
426 2018-01-05  Richard Sandiford  <richard.sandiford@linaro.org>
428         * tree-chrec.c (chrec_contains_symbols): Return true for
429         POLY_INT_CST.
431 2018-01-05  Sudakshina Das  <sudi.das@arm.com>
433         PR target/82439
434         * simplify-rtx.c (simplify_relational_operation_1): Add simplifications
435         of (x|y) == x for BICS pattern.
437 2018-01-05  Jakub Jelinek  <jakub@redhat.com>
439         PR tree-optimization/83605
440         * gimple-ssa-strength-reduction.c: Include tree-eh.h.
441         (find_candidates_dom_walker::before_dom_children): Ignore stmts that
442         can throw.
444 2018-01-05  Sebastian Huber  <sebastian.huber@embedded-brains.de>
446         * config.gcc (epiphany-*-elf*): Add (epiphany-*-rtems*) configuration.
447         * config/epiphany/rtems.h: New file.
449 2018-01-04  Jakub Jelinek  <jakub@redhat.com>
450             Uros Bizjak  <ubizjak@gmail.com>
452         PR target/83554
453         * config/i386/i386.md (*<rotate_insn>hi3_1 splitter): Use
454         QIreg_operand instead of register_operand predicate.
455         * config/i386/i386.c (ix86_rop_should_change_byte_p,
456         set_rop_modrm_reg_bits, ix86_mitigate_rop): Use -mmitigate-rop in
457         comments instead of -fmitigate[-_]rop.
459 2018-01-04  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
461         PR bootstrap/81926
462         * cgraphunit.c (symbol_table::compile): Switch to text_section
463         before calling assembly_start debug hook.
464         * run-rtl-passes.c (run_rtl_passes): Likewise.
465         Include output.h.
467 2018-01-04  Richard Sandiford  <richard.sandiford@linaro.org>
469         * tree-vrp.c (extract_range_from_binary_expr_1): Check
470         range_int_cst_p rather than !symbolic_range_p before calling
471         extract_range_from_multiplicative_op_1.
473 2017-01-04  Jeff Law  <law@redhat.com>
475         * tree-ssa-math-opts.c (execute_cse_reciprocals_1): Remove
476         redundant test in assertion.
478 2018-01-04  Richard Sandiford  <richard.sandiford@linaro.org>
480         * doc/rtl.texi: Document machine_mode wrapper classes.
482 2018-01-04  Richard Sandiford  <richard.sandiford@linaro.org>
484         * fold-const.c (fold_ternary_loc): Check tree_fits_uhwi_p before
485         using tree_to_uhwi.
487 2018-01-04  Richard Sandiford  <richard.sandiford@linaro.org>
489         * tree-ssa-forwprop.c (is_combined_permutation_identity): Allow
490         the VEC_PERM_EXPR fold to fail.
492 2018-01-04  Jakub Jelinek  <jakub@redhat.com>
494         PR debug/83585
495         * bb-reorder.c (insert_section_boundary_note): Set has_bb_partition
496         to switched_sections.
498 2018-01-04  Richard Sandiford  <richard.sandiford@linaro.org>
500         PR target/83680
501         * config/arm/arm.c (arm_vectorize_vec_perm_const): Fix inverted
502         test for d.testing.
504 2018-01-04  Peter Bergner  <bergner@vnet.ibm.com>
506         PR target/83387
507         * config/rs6000/rs6000.c (rs6000_discover_homogeneous_aggregate): Do not
508         allow arguments in FP registers if TARGET_HARD_FLOAT is false.
510 2018-01-04  Jakub Jelinek  <jakub@redhat.com>
512         PR debug/83666
513         * cfgexpand.c (expand_dbeug_expr) <case BIT_FIELD_REF>: Punt if mode
514         is BLKmode and bitpos not zero or mode change is needed.
516 2018-01-04  Richard Sandiford  <richard.sandiford@linaro.org>
518         PR target/83675
519         * config/sparc/sparc.c (sparc_vectorize_vec_perm_const): Require
520         TARGET_VIS2.
522 2018-01-04  Uros Bizjak  <ubizjak@gmail.com>
524         PR target/83628
525         * config/alpha/alpha.md (*sadd<modesuffix>): Use ASHIFT
526         instead of MULT rtx.  Update all corresponding splitters.
527         (*saddl_se): Ditto.
528         (*ssub<modesuffix>): Ditto.
529         (*ssubl_se): Ditto.
530         (*cmp_sadd_di): Update split patterns.
531         (*cmp_sadd_si): Ditto.
532         (*cmp_sadd_sidi): Ditto.
533         (*cmp_ssub_di): Ditto.
534         (*cmp_ssub_si): Ditto.
535         (*cmp_ssub_sidi): Ditto.
536         * config/alpha/predicates.md (const23_operand): New predicate.
537         * config/alpha/alpha.c (alpha_rtx_costs) [PLUS, MINUS]:
538         Look for ASHIFT, not MULT inner operand.
539         (alpha_split_conditional_move): Update for *sadd<modesuffix> change.
541 2018-01-04  Martin Liska  <mliska@suse.cz>
543         PR gcov-profile/83669
544         * gcov.c (output_intermediate_file): Add version to intermediate
545         gcov file.
546         * doc/gcov.texi: Document new field 'version' in intermediate
547         file format. Fix location of '-k' option of gcov command.
549 2018-01-04  Martin Liska  <mliska@suse.cz>
551         PR ipa/82352
552         * ipa-icf.c (sem_function::merge): Do not cross comdat boundary.
554 2018-01-04  Jakub Jelinek  <jakub@redhat.com>
556         * gimple-ssa-sprintf.c (parse_directive): Cast second dir.len to uhwi.
558 2018-01-03  Martin Sebor  <msebor@redhat.com>
560         PR tree-optimization/83655
561         * gimple-ssa-warn-restrict.c (wrestrict_dom_walker::check_call): Avoid
562         checking calls with invalid arguments.
564 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
566         * tree-vect-stmts.c (vect_get_store_rhs): New function.
567         (vectorizable_mask_load_store): Delete.
568         (vectorizable_call): Return false for masked loads and stores.
569         (vectorizable_store): Handle IFN_MASK_STORE.  Use vect_get_store_rhs
570         instead of gimple_assign_rhs1.
571         (vectorizable_load): Handle IFN_MASK_LOAD.
572         (vect_transform_stmt): Don't set is_store for call_vec_info_type.
574 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
576         * tree-vect-stmts.c (vect_build_gather_load_calls): New function,
577         split out from..,
578         (vectorizable_mask_load_store): ...here.
579         (vectorizable_load): ...and here.
581 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
583         * tree-vect-stmts.c (vect_build_all_ones_mask)
584         (vect_build_zero_merge_argument): New functions, split out from...
585         (vectorizable_load): ...here.
587 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
589         * tree-vect-stmts.c (vect_check_store_rhs): New function,
590         split out from...
591         (vectorizable_mask_load_store): ...here.
592         (vectorizable_store): ...and here.
594 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
596         * tree-vect-stmts.c (vect_check_load_store_mask): New function,
597         split out from...
598         (vectorizable_mask_load_store): ...here.
600 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
602         * tree-vectorizer.h (vec_load_store_type): Moved from tree-vec-stmts.c
603         (vect_model_store_cost): Take a vec_load_store_type instead of a
604         vect_def_type.
605         * tree-vect-stmts.c (vec_load_store_type): Move to tree-vectorizer.h.
606         (vect_model_store_cost): Take a vec_load_store_type instead of a
607         vect_def_type.
608         (vectorizable_mask_load_store): Update accordingly.
609         (vectorizable_store): Likewise.
610         * tree-vect-slp.c (vect_analyze_slp_cost_1): Update accordingly.
612 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
614         * tree-vect-loop.c (vect_transform_loop): Stub out scalar
615         IFN_MASK_LOAD calls here rather than...
616         * tree-vect-stmts.c (vectorizable_mask_load_store): ...here.
618 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
619             Alan Hayward  <alan.hayward@arm.com>
620             David Sherwood  <david.sherwood@arm.com>
622         * expmed.c (extract_bit_field_1): For vector extracts,
623         fall back to extract_bit_field_as_subreg if vec_extract
624         isn't available.
626 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
627             Alan Hayward  <alan.hayward@arm.com>
628             David Sherwood  <david.sherwood@arm.com>
630         * lra-spills.c (pseudo_reg_slot_compare): Sort slots by whether
631         they are variable or constant sized.
632         (assign_stack_slot_num_and_sort_pseudos): Don't reuse variable-sized
633         slots for constant-sized data.
635 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
636             Alan Hayward  <alan.hayward@arm.com>
637             David Sherwood  <david.sherwood@arm.com>
639         * tree-vect-patterns.c (vect_recog_mask_conversion_pattern): When
640         handling COND_EXPRs with boolean comparisons, try to find a better
641         basis for the mask type than the boolean itself.
643 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
645         * doc/rtl.texi (MAX_BITSIZE_MODE_ANY_MODE): Describe how the default
646         is calculated and how it can be overridden.
647         * genmodes.c (max_bitsize_mode_any_mode): New variable.
648         (create_modes): Initialize it from MAX_BITSIZE_MODE_ANY_MODE,
649         if defined.
650         (emit_max_int): Use it to set the output MAX_BITSIZE_MODE_ANY_MODE,
651         if nonzero.
653 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
654             Alan Hayward  <alan.hayward@arm.com>
655             David Sherwood  <david.sherwood@arm.com>
657         * config/aarch64/aarch64-protos.h (aarch64_output_simd_mov_immediate):
658         Remove the mode argument.
659         (aarch64_simd_valid_immediate): Remove the mode and inverse
660         arguments.
661         * config/aarch64/iterators.md (bitsize): New iterator.
662         * config/aarch64/aarch64-simd.md (*aarch64_simd_mov<mode>, and<mode>3)
663         (ior<mode>3): Update calls to aarch64_output_simd_mov_immediate.
664         * config/aarch64/constraints.md (Do, Db, Dn): Update calls to
665         aarch64_simd_valid_immediate.
666         * config/aarch64/predicates.md (aarch64_reg_or_orr_imm): Likewise.
667         (aarch64_reg_or_bic_imm): Likewise.
668         * config/aarch64/aarch64.c (simd_immediate_info): Replace mvn
669         with an insn_type enum and msl with a modifier_type enum.
670         Replace element_width with a scalar_mode.  Change the shift
671         to unsigned int.  Add constructors for scalar_float_mode and
672         scalar_int_mode elements.
673         (aarch64_vect_float_const_representable_p): Delete.
674         (aarch64_can_const_movi_rtx_p)
675         (aarch64_simd_scalar_immediate_valid_for_move)
676         (aarch64_simd_make_constant): Update call to
677         aarch64_simd_valid_immediate.
678         (aarch64_advsimd_valid_immediate_hs): New function.
679         (aarch64_advsimd_valid_immediate): Likewise.
680         (aarch64_simd_valid_immediate): Remove mode and inverse
681         arguments.  Rewrite to use the above.  Use const_vec_duplicate_p
682         to detect duplicated constants and use aarch64_float_const_zero_rtx_p
683         and aarch64_float_const_representable_p on the result.
684         (aarch64_output_simd_mov_immediate): Remove mode argument.
685         Update call to aarch64_simd_valid_immediate and use of
686         simd_immediate_info.
687         (aarch64_output_scalar_simd_mov_immediate): Update call
688         accordingly.
690 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
691             Alan Hayward  <alan.hayward@arm.com>
692             David Sherwood  <david.sherwood@arm.com>
694         * machmode.h (mode_precision): Prefix with CONST_MODE_PRECISION.
695         (mode_nunits): Likewise CONST_MODE_NUNITS.
696         * machmode.def (ADJUST_NUNITS): Document.
697         * genmodes.c (mode_data::need_nunits_adj): New field.
698         (blank_mode): Update accordingly.
699         (adj_nunits): New variable.
700         (print_maybe_const_decl): Replace CATEGORY with a NEEDS_ADJ
701         parameter.
702         (emit_mode_size_inline): Set need_bytesize_adj for all modes
703         listed in adj_nunits.
704         (emit_mode_nunits_inline): Set need_nunits_adj for all modes
705         listed in adj_nunits.  Don't emit case statements for such modes.
706         (emit_insn_modes_h): Emit definitions of CONST_MODE_NUNITS
707         and CONST_MODE_PRECISION.  Make CONST_MODE_SIZE expand to
708         nothing if adj_nunits is nonnull.
709         (emit_mode_precision, emit_mode_nunits): Use print_maybe_const_decl.
710         (emit_mode_unit_size, emit_mode_base_align, emit_mode_ibit)
711         (emit_mode_fbit): Update use of print_maybe_const_decl.
712         (emit_move_size): Likewise.  Treat the array as non-const
713         if adj_nunits.
714         (emit_mode_adjustments): Handle adj_nunits.
716 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
718         * machmode.def (VECTOR_MODES_WITH_PREFIX): Document.
719         * genmodes.c (VECTOR_MODES_WITH_PREFIX): New macro.
720         (VECTOR_MODES): Use it.
721         (make_vector_modes): Take the prefix as an argument.
723 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
724             Alan Hayward  <alan.hayward@arm.com>
725             David Sherwood  <david.sherwood@arm.com>
727         * mode-classes.def (MODE_VECTOR_BOOL): New mode class.
728         * machmode.h (INTEGRAL_MODE_P, VECTOR_MODE_P): Return true
729         for MODE_VECTOR_BOOL.
730         * machmode.def (VECTOR_BOOL_MODE): Document.
731         * genmodes.c (VECTOR_BOOL_MODE): New macro.
732         (make_vector_bool_mode): New function.
733         (complete_mode, emit_mode_wider, emit_mode_adjustments): Handle
734         MODE_VECTOR_BOOL.
735         * lto-streamer-in.c (lto_input_mode_table): Likewise.
736         * rtx-vector-builder.c (rtx_vector_builder::find_cached_value):
737         Likewise.
738         * stor-layout.c (int_mode_for_mode): Likewise.
739         * tree.c (build_vector_type_for_mode): Likewise.
740         * varasm.c (output_constant_pool_2): Likewise.
741         * emit-rtl.c (init_emit_once): Make sure that CONST1_RTX (BImode) and
742         CONSTM1_RTX (BImode) are the same thing.  Initialize const_tiny_rtx
743         for MODE_VECTOR_BOOL.
744         * expr.c (expand_expr_real_1): Use VECTOR_MODE_P instead of a list
745         of mode class checks.
746         * tree-vect-generic.c (expand_vector_operation): Use VECTOR_MODE_P
747         instead of a list of mode class checks.
748         (expand_vector_scalar_condition): Likewise.
749         (type_for_widest_vector_mode): Handle BImode as an inner mode.
751 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
752             Alan Hayward  <alan.hayward@arm.com>
753             David Sherwood  <david.sherwood@arm.com>
755         * machmode.h (mode_size): Change from unsigned short to
756         poly_uint16_pod.
757         (mode_to_bytes): Return a poly_uint16 rather than an unsigned short.
758         (GET_MODE_SIZE): Return a constant if ONLY_FIXED_SIZE_MODES,
759         or if measurement_type is not polynomial.
760         (fixed_size_mode::includes_p): Check for constant-sized modes.
761         * genmodes.c (emit_mode_size_inline): Make mode_size_inline
762         return a poly_uint16 rather than an unsigned short.
763         (emit_mode_size): Change the type of mode_size from unsigned short
764         to poly_uint16_pod.  Use ZERO_COEFFS for the initializer.
765         (emit_mode_adjustments): Cope with polynomial vector sizes.
766         * lto-streamer-in.c (lto_input_mode_table): Use bp_unpack_poly_value
767         for GET_MODE_SIZE.
768         * lto-streamer-out.c (lto_write_mode_table): Use bp_pack_poly_value
769         for GET_MODE_SIZE.
770         * auto-inc-dec.c (try_merge): Treat GET_MODE_SIZE as polynomial.
771         * builtins.c (expand_ifn_atomic_compare_exchange_into_call): Likewise.
772         * caller-save.c (setup_save_areas): Likewise.
773         (replace_reg_with_saved_mem): Likewise.
774         * calls.c (emit_library_call_value_1): Likewise.
775         * combine-stack-adj.c (combine_stack_adjustments_for_block): Likewise.
776         * combine.c (simplify_set, make_extraction, simplify_shift_const_1)
777         (gen_lowpart_for_combine): Likewise.
778         * convert.c (convert_to_integer_1): Likewise.
779         * cse.c (equiv_constant, cse_insn): Likewise.
780         * cselib.c (autoinc_split, cselib_hash_rtx): Likewise.
781         (cselib_subst_to_values): Likewise.
782         * dce.c (word_dce_process_block): Likewise.
783         * df-problems.c (df_word_lr_mark_ref): Likewise.
784         * dwarf2cfi.c (init_one_dwarf_reg_size): Likewise.
785         * dwarf2out.c (multiple_reg_loc_descriptor, mem_loc_descriptor)
786         (concat_loc_descriptor, concatn_loc_descriptor, loc_descriptor)
787         (rtl_for_decl_location): Likewise.
788         * emit-rtl.c (gen_highpart, widen_memory_access): Likewise.
789         * expmed.c (extract_bit_field_1, extract_integral_bit_field): Likewise.
790         * expr.c (emit_group_load_1, clear_storage_hints): Likewise.
791         (emit_move_complex, emit_move_multi_word, emit_push_insn): Likewise.
792         (expand_expr_real_1): Likewise.
793         * function.c (assign_parm_setup_block_p, assign_parm_setup_block)
794         (pad_below): Likewise.
795         * gimple-fold.c (optimize_atomic_compare_exchange_p): Likewise.
796         * gimple-ssa-store-merging.c (rhs_valid_for_store_merging_p): Likewise.
797         * ira.c (get_subreg_tracking_sizes): Likewise.
798         * ira-build.c (ira_create_allocno_objects): Likewise.
799         * ira-color.c (coalesced_pseudo_reg_slot_compare): Likewise.
800         (ira_sort_regnos_for_alter_reg): Likewise.
801         * ira-costs.c (record_operand_costs): Likewise.
802         * lower-subreg.c (interesting_mode_p, simplify_gen_subreg_concatn)
803         (resolve_simple_move): Likewise.
804         * lra-constraints.c (get_reload_reg, operands_match_p): Likewise.
805         (process_addr_reg, simplify_operand_subreg, curr_insn_transform)
806         (lra_constraints): Likewise.
807         (CONST_POOL_OK_P): Reject variable-sized modes.
808         * lra-spills.c (slot, assign_mem_slot, pseudo_reg_slot_compare)
809         (add_pseudo_to_slot, lra_spill): Likewise.
810         * omp-low.c (omp_clause_aligned_alignment): Likewise.
811         * optabs-query.c (get_best_extraction_insn): Likewise.
812         * optabs-tree.c (expand_vec_cond_expr_p): Likewise.
813         * optabs.c (expand_vec_perm_var, expand_vec_cond_expr): Likewise.
814         (expand_mult_highpart, valid_multiword_target_p): Likewise.
815         * recog.c (offsettable_address_addr_space_p): Likewise.
816         * regcprop.c (maybe_mode_change): Likewise.
817         * reginfo.c (choose_hard_reg_mode, record_subregs_of_mode): Likewise.
818         * regrename.c (build_def_use): Likewise.
819         * regstat.c (dump_reg_info): Likewise.
820         * reload.c (complex_word_subreg_p, push_reload, find_dummy_reload)
821         (find_reloads, find_reloads_subreg_address): Likewise.
822         * reload1.c (eliminate_regs_1): Likewise.
823         * rtlanal.c (for_each_inc_dec_find_inc_dec, rtx_cost): Likewise.
824         * simplify-rtx.c (avoid_constant_pool_reference): Likewise.
825         (simplify_binary_operation_1, simplify_subreg): Likewise.
826         * targhooks.c (default_function_arg_padding): Likewise.
827         (default_hard_regno_nregs, default_class_max_nregs): Likewise.
828         * tree-cfg.c (verify_gimple_assign_binary): Likewise.
829         (verify_gimple_assign_ternary): Likewise.
830         * tree-inline.c (estimate_move_cost): Likewise.
831         * tree-ssa-forwprop.c (simplify_vector_constructor): Likewise.
832         * tree-ssa-loop-ivopts.c (add_autoinc_candidates): Likewise.
833         (get_address_cost_ainc): Likewise.
834         * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Likewise.
835         (vect_supportable_dr_alignment): Likewise.
836         * tree-vect-loop.c (vect_determine_vectorization_factor): Likewise.
837         (vectorizable_reduction): Likewise.
838         * tree-vect-stmts.c (vectorizable_assignment, vectorizable_shift)
839         (vectorizable_operation, vectorizable_load): Likewise.
840         * tree.c (build_same_sized_truth_vector_type): Likewise.
841         * valtrack.c (cleanup_auto_inc_dec): Likewise.
842         * var-tracking.c (emit_note_insn_var_location): Likewise.
843         * config/arc/arc.h (ASM_OUTPUT_CASE_END): Use as_a <scalar_int_mode>.
844         (ADDR_VEC_ALIGN): Likewise.
846 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
847             Alan Hayward  <alan.hayward@arm.com>
848             David Sherwood  <david.sherwood@arm.com>
850         * machmode.h (mode_to_bits): Return a poly_uint16 rather than an
851         unsigned short.
852         (GET_MODE_BITSIZE): Return a constant if ONLY_FIXED_SIZE_MODES,
853         or if measurement_type is polynomial.
854         * calls.c (shift_return_value): Treat GET_MODE_BITSIZE as polynomial.
855         * combine.c (make_extraction): Likewise.
856         * dse.c (find_shift_sequence): Likewise.
857         * dwarf2out.c (mem_loc_descriptor): Likewise.
858         * expmed.c (store_integral_bit_field, extract_bit_field_1): Likewise.
859         (extract_bit_field, extract_low_bits): Likewise.
860         * expr.c (convert_move, convert_modes, emit_move_insn_1): Likewise.
861         (optimize_bitfield_assignment_op, expand_assignment): Likewise.
862         (store_expr_with_bounds, store_field, expand_expr_real_1): Likewise.
863         * fold-const.c (optimize_bit_field_compare, merge_ranges): Likewise.
864         * gimple-fold.c (optimize_atomic_compare_exchange_p): Likewise.
865         * reload.c (find_reloads): Likewise.
866         * reload1.c (alter_reg): Likewise.
867         * stor-layout.c (bitwise_mode_for_mode, compute_record_mode): Likewise.
868         * targhooks.c (default_secondary_memory_needed_mode): Likewise.
869         * tree-if-conv.c (predicate_mem_writes): Likewise.
870         * tree-ssa-strlen.c (handle_builtin_memcmp): Likewise.
871         * tree-vect-patterns.c (adjust_bool_pattern): Likewise.
872         * tree-vect-stmts.c (vectorizable_simd_clone_call): Likewise.
873         * valtrack.c (dead_debug_insert_temp): Likewise.
874         * varasm.c (mergeable_constant_section): Likewise.
875         * config/sh/sh.h (LOCAL_ALIGNMENT): Use as_a <fixed_size_mode>.
877 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
878             Alan Hayward  <alan.hayward@arm.com>
879             David Sherwood  <david.sherwood@arm.com>
881         * expr.c (expand_assignment): Cope with polynomial mode sizes
882         when assigning to a CONCAT.
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         * machmode.h (mode_precision): Change from unsigned short to
889         poly_uint16_pod.
890         (mode_to_precision): Return a poly_uint16 rather than an unsigned
891         short.
892         (GET_MODE_PRECISION): Return a constant if ONLY_FIXED_SIZE_MODES,
893         or if measurement_type is not polynomial.
894         (HWI_COMPUTABLE_MODE_P): Turn into a function.  Optimize the case
895         in which the mode is already known to be a scalar_int_mode.
896         * genmodes.c (emit_mode_precision): Change the type of mode_precision
897         from unsigned short to poly_uint16_pod.  Use ZERO_COEFFS for the
898         initializer.
899         * lto-streamer-in.c (lto_input_mode_table): Use bp_unpack_poly_value
900         for GET_MODE_PRECISION.
901         * lto-streamer-out.c (lto_write_mode_table): Use bp_pack_poly_value
902         for GET_MODE_PRECISION.
903         * combine.c (update_rsp_from_reg_equal): Treat GET_MODE_PRECISION
904         as polynomial.
905         (try_combine, find_split_point, combine_simplify_rtx): Likewise.
906         (expand_field_assignment, make_extraction): Likewise.
907         (make_compound_operation_int, record_dead_and_set_regs_1): Likewise.
908         (get_last_value): Likewise.
909         * convert.c (convert_to_integer_1): Likewise.
910         * cse.c (cse_insn): Likewise.
911         * expr.c (expand_expr_real_1): Likewise.
912         * lra-constraints.c (simplify_operand_subreg): Likewise.
913         * optabs-query.c (can_atomic_load_p): Likewise.
914         * optabs.c (expand_atomic_load): Likewise.
915         (expand_atomic_store): Likewise.
916         * ree.c (combine_reaching_defs): Likewise.
917         * rtl.h (partial_subreg_p, paradoxical_subreg_p): Likewise.
918         * rtlanal.c (nonzero_bits1, lsb_bitfield_op_p): Likewise.
919         * tree.h (type_has_mode_precision_p): Likewise.
920         * ubsan.c (instrument_si_overflow): Likewise.
922 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
923             Alan Hayward  <alan.hayward@arm.com>
924             David Sherwood  <david.sherwood@arm.com>
926         * tree.h (TYPE_VECTOR_SUBPARTS): Turn into a function and handle
927         polynomial numbers of units.
928         (SET_TYPE_VECTOR_SUBPARTS): Likewise.
929         (valid_vector_subparts_p): New function.
930         (build_vector_type): Remove temporary shim and take the number
931         of units as a poly_uint64 rather than an int.
932         (build_opaque_vector_type): Take the number of units as a
933         poly_uint64 rather than an int.
934         * tree.c (build_vector_from_ctor): Handle polynomial
935         TYPE_VECTOR_SUBPARTS.
936         (type_hash_canon_hash, type_cache_hasher::equal): Likewise.
937         (uniform_vector_p, vector_type_mode, build_vector): Likewise.
938         (build_vector_from_val): If the number of units is variable,
939         use build_vec_duplicate_cst for constant operands and
940         VEC_DUPLICATE_EXPR otherwise.
941         (make_vector_type): Remove temporary is_constant ().
942         (build_vector_type, build_opaque_vector_type): Take the number of
943         units as a poly_uint64 rather than an int.
944         (check_vector_cst): Handle polynomial TYPE_VECTOR_SUBPARTS and
945         VECTOR_CST_NELTS.
946         * cfgexpand.c (expand_debug_expr): Likewise.
947         * expr.c (count_type_elements, categorize_ctor_elements_1): Likewise.
948         (store_constructor, expand_expr_real_1): Likewise.
949         (const_scalar_mask_from_tree): Likewise.
950         * fold-const-call.c (fold_const_reduction): Likewise.
951         * fold-const.c (const_binop, const_unop, fold_convert_const): Likewise.
952         (operand_equal_p, fold_vec_perm, fold_ternary_loc): Likewise.
953         (native_encode_vector, vec_cst_ctor_to_array): Likewise.
954         (fold_relational_const): Likewise.
955         (native_interpret_vector): Likewise.  Change the size from an
956         int to an unsigned int.
957         * gimple-fold.c (gimple_fold_stmt_to_constant_1): Handle polynomial
958         TYPE_VECTOR_SUBPARTS.
959         (gimple_fold_indirect_ref, gimple_build_vector): Likewise.
960         (gimple_build_vector_from_val): Use VEC_DUPLICATE_EXPR when
961         duplicating a non-constant operand into a variable-length vector.
962         * hsa-brig.c (hsa_op_immed::emit_to_buffer): Handle polynomial
963         TYPE_VECTOR_SUBPARTS and VECTOR_CST_NELTS.
964         * ipa-icf.c (sem_variable::equals): Likewise.
965         * match.pd: Likewise.
966         * omp-simd-clone.c (simd_clone_subparts): Likewise.
967         * print-tree.c (print_node): Likewise.
968         * stor-layout.c (layout_type): Likewise.
969         * targhooks.c (default_builtin_vectorization_cost): Likewise.
970         * tree-cfg.c (verify_gimple_comparison): Likewise.
971         (verify_gimple_assign_binary): Likewise.
972         (verify_gimple_assign_ternary): Likewise.
973         (verify_gimple_assign_single): Likewise.
974         * tree-pretty-print.c (dump_generic_node): Likewise.
975         * tree-ssa-forwprop.c (simplify_vector_constructor): Likewise.
976         (simplify_bitfield_ref, is_combined_permutation_identity): Likewise.
977         * tree-vect-data-refs.c (vect_permute_store_chain): Likewise.
978         (vect_grouped_load_supported, vect_permute_load_chain): Likewise.
979         (vect_shift_permute_load_chain): Likewise.
980         * tree-vect-generic.c (nunits_for_known_piecewise_op): Likewise.
981         (expand_vector_condition, optimize_vector_constructor): Likewise.
982         (lower_vec_perm, get_compute_type): Likewise.
983         * tree-vect-loop.c (vect_determine_vectorization_factor): Likewise.
984         (get_initial_defs_for_reduction, vect_transform_loop): Likewise.
985         * tree-vect-patterns.c (vect_recog_bool_pattern): Likewise.
986         (vect_recog_mask_conversion_pattern): Likewise.
987         * tree-vect-slp.c (vect_supported_load_permutation_p): Likewise.
988         (vect_get_constant_vectors, vect_transform_slp_perm_load): Likewise.
989         * tree-vect-stmts.c (perm_mask_for_reverse): Likewise.
990         (get_group_load_store_type, vectorizable_mask_load_store): Likewise.
991         (vectorizable_bswap, simd_clone_subparts, vectorizable_assignment)
992         (vectorizable_shift, vectorizable_operation, vectorizable_store)
993         (vectorizable_load, vect_is_simple_cond, vectorizable_comparison)
994         (supportable_widening_operation): Likewise.
995         (supportable_narrowing_operation): Likewise.
996         * tree-vector-builder.c (tree_vector_builder::binary_encoded_nelts):
997         Likewise.
998         * varasm.c (output_constant): Likewise.
1000 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1001             Alan Hayward  <alan.hayward@arm.com>
1002             David Sherwood  <david.sherwood@arm.com>
1004         * tree-vect-data-refs.c (vect_permute_store_chain): Reorganize
1005         so that both the length == 3 and length != 3 cases set up their
1006         own permute vectors.  Add comments explaining why we know the
1007         number of elements is constant.
1008         (vect_permute_load_chain): Likewise.
1010 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1011             Alan Hayward  <alan.hayward@arm.com>
1012             David Sherwood  <david.sherwood@arm.com>
1014         * machmode.h (mode_nunits): Change from unsigned char to
1015         poly_uint16_pod.
1016         (ONLY_FIXED_SIZE_MODES): New macro.
1017         (pod_mode::measurement_type, scalar_int_mode::measurement_type)
1018         (scalar_float_mode::measurement_type, scalar_mode::measurement_type)
1019         (complex_mode::measurement_type, fixed_size_mode::measurement_type):
1020         New typedefs.
1021         (mode_to_nunits): Return a poly_uint16 rather than an unsigned short.
1022         (GET_MODE_NUNITS): Return a constant if ONLY_FIXED_SIZE_MODES,
1023         or if measurement_type is not polynomial.
1024         * genmodes.c (ZERO_COEFFS): New macro.
1025         (emit_mode_nunits_inline): Make mode_nunits_inline return a
1026         poly_uint16.
1027         (emit_mode_nunits): Change the type of mode_nunits to poly_uint16_pod.
1028         Use ZERO_COEFFS when emitting initializers.
1029         * data-streamer.h (bp_pack_poly_value): New function.
1030         (bp_unpack_poly_value): Likewise.
1031         * lto-streamer-in.c (lto_input_mode_table): Use bp_unpack_poly_value
1032         for GET_MODE_NUNITS.
1033         * lto-streamer-out.c (lto_write_mode_table): Use bp_pack_poly_value
1034         for GET_MODE_NUNITS.
1035         * tree.c (make_vector_type): Remove temporary shim and make
1036         the real function take the number of units as a poly_uint64
1037         rather than an int.
1038         (build_vector_type_for_mode): Handle polynomial nunits.
1039         * dwarf2out.c (loc_descriptor, add_const_value_attribute): Likewise.
1040         * emit-rtl.c (const_vec_series_p_1): Likewise.
1041         (gen_rtx_CONST_VECTOR): Likewise.
1042         * fold-const.c (test_vec_duplicate_folding): Likewise.
1043         * genrecog.c (validate_pattern): Likewise.
1044         * optabs-query.c (can_vec_perm_var_p, can_mult_highpart_p): Likewise.
1045         * optabs-tree.c (expand_vec_cond_expr_p): Likewise.
1046         * optabs.c (expand_vector_broadcast, expand_binop_directly): Likewise.
1047         (shift_amt_for_vec_perm_mask, expand_vec_perm_var): Likewise.
1048         (expand_vec_cond_expr, expand_mult_highpart): Likewise.
1049         * rtlanal.c (subreg_get_info): Likewise.
1050         * tree-vect-data-refs.c (vect_grouped_store_supported): Likewise.
1051         (vect_grouped_load_supported): Likewise.
1052         * tree-vect-generic.c (type_for_widest_vector_mode): Likewise.
1053         * tree-vect-loop.c (have_whole_vector_shift): Likewise.
1054         * simplify-rtx.c (simplify_unary_operation_1): Likewise.
1055         (simplify_const_unary_operation, simplify_binary_operation_1)
1056         (simplify_const_binary_operation, simplify_ternary_operation)
1057         (test_vector_ops_duplicate, test_vector_ops): Likewise.
1058         (simplify_immed_subreg): Use GET_MODE_NUNITS on a fixed_size_mode
1059         instead of CONST_VECTOR_NUNITS.
1060         * varasm.c (output_constant_pool_2): Likewise.
1061         * rtx-vector-builder.c (rtx_vector_builder::build): Only include the
1062         explicit-encoded elements in the XVEC for variable-length vectors.
1064 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1066         * lra-constraints.c (curr_insn_transform): Use partial_subreg_p.
1068 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1069             Alan Hayward  <alan.hayward@arm.com>
1070             David Sherwood  <david.sherwood@arm.com>
1072         * coretypes.h (fixed_size_mode): Declare.
1073         (fixed_size_mode_pod): New typedef.
1074         * builtins.h (target_builtins::x_apply_args_mode)
1075         (target_builtins::x_apply_result_mode): Change type to
1076         fixed_size_mode_pod.
1077         * builtins.c (apply_args_size, apply_result_size, result_vector)
1078         (expand_builtin_apply_args_1, expand_builtin_apply)
1079         (expand_builtin_return): Update accordingly.
1081 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1083         * cse.c (hash_rtx_cb): Hash only the encoded elements.
1084         * cselib.c (cselib_hash_rtx): Likewise.
1085         * expmed.c (make_tree): Build VECTOR_CSTs directly from the
1086         CONST_VECTOR encoding.
1088 2017-01-03  Jakub Jelinek  <jakub@redhat.com>
1089             Jeff Law  <law@redhat.com>
1091         PR target/83641
1092         * config/i386/i386.c (ix86_adjust_stack_and_probe_stack_clash): For
1093         noreturn probe, use gen_pop instead of ix86_emit_restore_reg_using_pop,
1094         only set RTX_FRAME_RELATED_P on both the push and pop if cfa_reg is sp
1095         and add REG_CFA_ADJUST_CFA notes in that case to both insns.
1097         PR target/83641
1098         * config/i386/i386.c (ix86_adjust_stack_and_probe_stack_clash): Do not
1099         explicitly probe *sp in a noreturn function if there were any callee
1100         register saves or frame pointer is needed.
1102 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
1104         PR debug/83621
1105         * cfgexpand.c (expand_debug_expr): Return NULL if mode is
1106         BLKmode for ternary, binary or unary expressions.
1108         PR debug/83645
1109         * var-tracking.c (delete_vta_debug_insn): New inline function.
1110         (delete_vta_debug_insns): Add USE_CFG argument, if true, walk just
1111         insns from get_insns () to NULL instead of each bb separately.
1112         Use delete_vta_debug_insn.  No longer static.
1113         (vt_debug_insns_local, variable_tracking_main_1): Adjust
1114         delete_vta_debug_insns callers.
1115         * rtl.h (delete_vta_debug_insns): Declare.
1116         * final.c (rest_of_handle_final): Call delete_vta_debug_insns
1117         instead of variable_tracking_main.
1119 2018-01-03  Martin Sebor  <msebor@redhat.com>
1121         PR tree-optimization/83603
1122         * calls.c (maybe_warn_nonstring_arg): Avoid accessing function
1123         arguments past the endof the argument list in functions declared
1124         without a prototype.
1125         * gimple-ssa-warn-restrict.c (wrestrict_dom_walker::check_call):
1126         Avoid checking when arguments are null.
1128 2018-01-03  Martin Sebor  <msebor@redhat.com>
1130         PR c/83559
1131         * doc/extend.texi (attribute const): Fix a typo.
1132         * ipa-pure-const.c ((warn_function_const, warn_function_pure): Avoid
1133         issuing -Wsuggest-attribute for void functions.
1135 2018-01-03  Martin Sebor  <msebor@redhat.com>
1137         * gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref): Use
1138         offset_int::from instead of wide_int::to_shwi.
1139         (maybe_diag_overlap): Remove assertion.
1140         Use HOST_WIDE_INT_PRINT_DEC instead of %lli.
1141         * gimple-ssa-sprintf.c (format_directive): Same.
1142         (parse_directive): Same.
1143         (sprintf_dom_walker::compute_format_length): Same.
1144         (try_substitute_return_value): Same.
1146 2017-01-03  Jeff Law  <law@redhat.com>
1148         PR middle-end/83654
1149         * explow.c (anti_adjust_stack_and_probe_stack_clash): Test a
1150         non-constant residual for zero at runtime and avoid probing in
1151         that case.  Reorganize code for trailing problem to mirror handling
1152         of the residual.
1154 2018-01-03  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
1156         PR tree-optimization/83501
1157         * tree-ssa-strlen.c (get_string_cst): New.
1158         (handle_char_store): Call get_string_cst.
1160 2018-01-03  Martin Liska  <mliska@suse.cz>
1162         PR tree-optimization/83593
1163         * tree-ssa-strlen.c: Include tree-cfg.h.
1164         (strlen_check_and_optimize_stmt): Add new argument cleanup_eh.
1165         (strlen_dom_walker): Add new member variable m_cleanup_cfg.
1166         (strlen_dom_walker::strlen_dom_walker): Initialize m_cleanup_cfg
1167         to false.
1168         (strlen_dom_walker::before_dom_children): Call
1169         gimple_purge_dead_eh_edges. Dump tranformation with details
1170         dump flags.
1171         (strlen_dom_walker::before_dom_children): Update call by adding
1172         new argument cleanup_eh.
1173         (pass_strlen::execute): Return TODO_cleanup_cfg if needed.
1175 2018-01-03  Martin Liska  <mliska@suse.cz>
1177         PR ipa/83549
1178         * cif-code.def (VARIADIC_THUNK): New enum value.
1179         * ipa-fnsummary.c (compute_fn_summary): Do not inline variadic
1180         thunks.
1182 2018-01-03  Jan Beulich  <jbeulich@suse.com>
1184         * sse.md (mov<mode>_internal): Tighten condition for when to use
1185         vmovdqu<ssescalarsize> for TI and OI modes.
1187 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
1189         Update copyright years.
1191 2018-01-03  Martin Liska  <mliska@suse.cz>
1193         PR ipa/83594
1194         * ipa-visibility.c (function_and_variable_visibility): Skip
1195         functions with noipa attribure.
1197 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
1199         * gcc.c (process_command): Update copyright notice dates.
1200         * gcov-dump.c (print_version): Ditto.
1201         * gcov.c (print_version): Ditto.
1202         * gcov-tool.c (print_version): Ditto.
1203         * gengtype.c (create_file): Ditto.
1204         * doc/cpp.texi: Bump @copying's copyright year.
1205         * doc/cppinternals.texi: Ditto.
1206         * doc/gcc.texi: Ditto.
1207         * doc/gccint.texi: Ditto.
1208         * doc/gcov.texi: Ditto.
1209         * doc/install.texi: Ditto.
1210         * doc/invoke.texi: Ditto.
1212 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1214         * vector-builder.h (vector_builder::m_full_nelts): Change from
1215         unsigned int to poly_uint64.
1216         (vector_builder::full_nelts): Update prototype accordingly.
1217         (vector_builder::new_vector): Likewise.
1218         (vector_builder::encoded_full_vector_p): Handle polynomial full_nelts.
1219         (vector_builder::operator ==): Likewise.
1220         (vector_builder::finalize): Likewise.
1221         * int-vector-builder.h (int_vector_builder::int_vector_builder):
1222         Take the number of elements as a poly_uint64 rather than an
1223         unsigned int.
1224         * vec-perm-indices.h (vec_perm_indices::m_nelts_per_input): Change
1225         from unsigned int to poly_uint64.
1226         (vec_perm_indices::vec_perm_indices): Update prototype accordingly.
1227         (vec_perm_indices::new_vector): Likewise.
1228         (vec_perm_indices::length): Likewise.
1229         (vec_perm_indices::nelts_per_input): Likewise.
1230         (vec_perm_indices::input_nelts): Likewise.
1231         * vec-perm-indices.c (vec_perm_indices::new_vector): Take the
1232         number of elements per input as a poly_uint64 rather than an
1233         unsigned int.  Use the original encoding for variable-length
1234         vectors, rather than clamping each individual element.
1235         For the second and subsequent elements in each pattern,
1236         clamp the step and base before clamping their sum.
1237         (vec_perm_indices::series_p): Handle polynomial element counts.
1238         (vec_perm_indices::all_in_range_p): Likewise.
1239         (vec_perm_indices_to_tree): Likewise.
1240         (vec_perm_indices_to_rtx): Likewise.
1241         * tree-vect-stmts.c (vect_gen_perm_mask_any): Likewise.
1242         * tree-vector-builder.c (tree_vector_builder::new_unary_operation)
1243         (tree_vector_builder::new_binary_operation): Handle polynomial
1244         element counts.  Return false if we need to know the number
1245         of elements at compile time.
1246         * fold-const.c (fold_vec_perm): Punt if the number of elements
1247         isn't known at compile time.
1249 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1251         * vec-perm-indices.h (vec_perm_builder): Change element type
1252         from HOST_WIDE_INT to poly_int64.
1253         (vec_perm_indices::element_type): Update accordingly.
1254         (vec_perm_indices::clamp): Handle polynomial element_types.
1255         * vec-perm-indices.c (vec_perm_indices::series_p): Likewise.
1256         (vec_perm_indices::all_in_range_p): Likewise.
1257         (tree_to_vec_perm_builder): Check for poly_int64 trees rather
1258         than shwi trees.
1259         * vector-builder.h (vector_builder::stepped_sequence_p): Handle
1260         polynomial vec_perm_indices element types.
1261         * int-vector-builder.h (int_vector_builder::equal_p): Likewise.
1262         * fold-const.c (fold_vec_perm): Likewise.
1263         * optabs.c (shift_amt_for_vec_perm_mask): Likewise.
1264         * tree-vect-generic.c (lower_vec_perm): Likewise.
1265         * tree-vect-slp.c (vect_transform_slp_perm_load): Likewise.
1266         * config/aarch64/aarch64.c (aarch64_evpc_tbl): Cast d->perm
1267         element type to HOST_WIDE_INT.
1269 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1270             Alan Hayward  <alan.hayward@arm.com>
1271             David Sherwood  <david.sherwood@arm.com>
1273         * alias.c (addr_side_effect_eval): Take the size as a poly_int64
1274         rather than an int.  Use plus_constant.
1275         (memrefs_conflict_p): Take the sizes as poly_int64s rather than ints.
1276         Take the offset "c" as a poly_int64 rather than a HOST_WIDE_INT.
1278 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1279             Alan Hayward  <alan.hayward@arm.com>
1280             David Sherwood  <david.sherwood@arm.com>
1282         * calls.c (emit_call_1, expand_call): Change struct_value_size from
1283         a HOST_WIDE_INT to a poly_int64.
1285 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1286             Alan Hayward  <alan.hayward@arm.com>
1287             David Sherwood  <david.sherwood@arm.com>
1289         * calls.c (load_register_parameters): Cope with polynomial
1290         mode sizes.  Require a constant size for BLKmode parameters
1291         that aren't described by a PARALLEL.  If BLOCK_REG_PADDING
1292         forces a parameter to be padded at the lsb end in order to
1293         fill a complete number of words, require the parameter size
1294         to be ordered wrt UNITS_PER_WORD.
1296 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1297             Alan Hayward  <alan.hayward@arm.com>
1298             David Sherwood  <david.sherwood@arm.com>
1300         * reload1.c (spill_stack_slot_width): Change element type
1301         from unsigned int to poly_uint64_pod.
1302         (alter_reg): Treat mode sizes as polynomial.
1304 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1305             Alan Hayward  <alan.hayward@arm.com>
1306             David Sherwood  <david.sherwood@arm.com>
1308         * reload.c (complex_word_subreg_p): New function.
1309         (reload_inner_reg_of_subreg, push_reload): Use it.
1311 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1312             Alan Hayward  <alan.hayward@arm.com>
1313             David Sherwood  <david.sherwood@arm.com>
1315         * lra-constraints.c (process_alt_operands): Reject matched
1316         operands whose sizes aren't ordered.
1317         (match_reload): Refer to this check here.
1319 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1320             Alan Hayward  <alan.hayward@arm.com>
1321             David Sherwood  <david.sherwood@arm.com>
1323         * builtins.c (expand_ifn_atomic_compare_exchange_into_call): Assert
1324         that the mode size is in the set {1, 2, 4, 8, 16}.
1326 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1327             Alan Hayward  <alan.hayward@arm.com>
1328             David Sherwood  <david.sherwood@arm.com>
1330         * var-tracking.c (adjust_mems): Treat mode sizes as polynomial.
1331         Use plus_constant instead of gen_rtx_PLUS.
1333 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1334             Alan Hayward  <alan.hayward@arm.com>
1335             David Sherwood  <david.sherwood@arm.com>
1337         * config/cr16/cr16-protos.h (cr16_push_rounding): Declare.
1338         * config/cr16/cr16.h (PUSH_ROUNDING): Move implementation to...
1339         * config/cr16/cr16.c (cr16_push_rounding): ...this new function.
1340         * config/h8300/h8300-protos.h (h8300_push_rounding): Declare.
1341         * config/h8300/h8300.h (PUSH_ROUNDING): Move implementation to...
1342         * config/h8300/h8300.c (h8300_push_rounding): ...this new function.
1343         * config/i386/i386-protos.h (ix86_push_rounding): Declare.
1344         * config/i386/i386.h (PUSH_ROUNDING): Move implementation to...
1345         * config/i386/i386.c (ix86_push_rounding): ...this new function.
1346         * config/m32c/m32c-protos.h (m32c_push_rounding): Take and return
1347         a poly_int64.
1348         * config/m32c/m32c.c (m32c_push_rounding): Likewise.
1349         * config/m68k/m68k-protos.h (m68k_push_rounding): Declare.
1350         * config/m68k/m68k.h (PUSH_ROUNDING): Move implementation to...
1351         * config/m68k/m68k.c (m68k_push_rounding): ...this new function.
1352         * config/pdp11/pdp11-protos.h (pdp11_push_rounding): Declare.
1353         * config/pdp11/pdp11.h (PUSH_ROUNDING): Move implementation to...
1354         * config/pdp11/pdp11.c (pdp11_push_rounding): ...this new function.
1355         * config/stormy16/stormy16-protos.h (xstormy16_push_rounding): Declare.
1356         * config/stormy16/stormy16.h (PUSH_ROUNDING): Move implementation to...
1357         * config/stormy16/stormy16.c (xstormy16_push_rounding): ...this new
1358         function.
1359         * expr.c (emit_move_resolve_push): Treat the input and result
1360         of PUSH_ROUNDING as a poly_int64.
1361         (emit_move_complex_push, emit_single_push_insn_1): Likewise.
1362         (emit_push_insn): Likewise.
1363         * lra-eliminations.c (mark_not_eliminable): Likewise.
1364         * recog.c (push_operand): Likewise.
1365         * reload1.c (elimination_effects): Likewise.
1366         * rtlanal.c (nonzero_bits1): Likewise.
1367         * calls.c (store_one_arg): Likewise.  Require the padding to be
1368         known at compile time.
1370 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1371             Alan Hayward  <alan.hayward@arm.com>
1372             David Sherwood  <david.sherwood@arm.com>
1374         * expr.c (emit_single_push_insn_1): Treat mode sizes as polynomial.
1375         Use plus_constant instead of gen_rtx_PLUS.
1377 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1378             Alan Hayward  <alan.hayward@arm.com>
1379             David Sherwood  <david.sherwood@arm.com>
1381         * auto-inc-dec.c (set_inc_state): Take the mode size as a poly_int64
1382         rather than an int.
1384 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1385             Alan Hayward  <alan.hayward@arm.com>
1386             David Sherwood  <david.sherwood@arm.com>
1388         * expr.c (expand_expr_real_1): Use tree_to_poly_uint64
1389         instead of int_size_in_bytes when handling VIEW_CONVERT_EXPRs
1390         via stack temporaries.  Treat the mode size as polynomial too.
1392 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1393             Alan Hayward  <alan.hayward@arm.com>
1394             David Sherwood  <david.sherwood@arm.com>
1396         * expr.c (expand_expr_real_2): When handling conversions involving
1397         unions, apply tree_to_poly_uint64 to the TYPE_SIZE rather than
1398         multiplying int_size_in_bytes by BITS_PER_UNIT.  Treat GET_MODE_BISIZE
1399         as a poly_uint64 too.
1401 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1402             Alan Hayward  <alan.hayward@arm.com>
1403             David Sherwood  <david.sherwood@arm.com>
1405         * rtlanal.c (subreg_get_info): Handle polynomial mode sizes.
1407 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1408             Alan Hayward  <alan.hayward@arm.com>
1409             David Sherwood  <david.sherwood@arm.com>
1411         * combine.c (can_change_dest_mode): Handle polynomial
1412         REGMODE_NATURAL_SIZE.
1413         * expmed.c (store_bit_field_1): Likewise.
1414         * expr.c (store_constructor): Likewise.
1415         * emit-rtl.c (validate_subreg): Operate on polynomial mode sizes
1416         and polynomial REGMODE_NATURAL_SIZE.
1417         (gen_lowpart_common): Likewise.
1418         * reginfo.c (record_subregs_of_mode): Likewise.
1419         * rtlanal.c (read_modify_subreg_p): Likewise.
1421 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1422             Alan Hayward  <alan.hayward@arm.com>
1423             David Sherwood  <david.sherwood@arm.com>
1425         * internal-fn.c (expand_vector_ubsan_overflow): Handle polynomial
1426         numbers of elements.
1428 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1429             Alan Hayward  <alan.hayward@arm.com>
1430             David Sherwood  <david.sherwood@arm.com>
1432         * match.pd: Cope with polynomial numbers of vector elements.
1434 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1435             Alan Hayward  <alan.hayward@arm.com>
1436             David Sherwood  <david.sherwood@arm.com>
1438         * fold-const.c (fold_indirect_ref_1): Handle polynomial offsets
1439         in a POINTER_PLUS_EXPR.
1441 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1442             Alan Hayward  <alan.hayward@arm.com>
1443             David Sherwood  <david.sherwood@arm.com>
1445         * omp-simd-clone.c (simd_clone_subparts): New function.
1446         (simd_clone_init_simd_arrays): Use it instead of TYPE_VECTOR_SUBPARTS.
1447         (ipa_simd_modify_function_body): Likewise.
1449 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1450             Alan Hayward  <alan.hayward@arm.com>
1451             David Sherwood  <david.sherwood@arm.com>
1453         * tree-vect-generic.c (nunits_for_known_piecewise_op): New function.
1454         (expand_vector_piecewise): Use it instead of TYPE_VECTOR_SUBPARTS.
1455         (expand_vector_addition, add_rshift, expand_vector_divmod): Likewise.
1456         (expand_vector_condition, vector_element): Likewise.
1457         (subparts_gt): New function.
1458         (get_compute_type): Use subparts_gt.
1459         (count_type_subparts): Delete.
1460         (expand_vector_operations_1): Use subparts_gt instead of
1461         count_type_subparts.
1463 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1464             Alan Hayward  <alan.hayward@arm.com>
1465             David Sherwood  <david.sherwood@arm.com>
1467         * tree-vect-data-refs.c (vect_no_alias_p): Replace with...
1468         (vect_compile_time_alias): ...this new function.  Do the calculation
1469         on poly_ints rather than trees.
1470         (vect_prune_runtime_alias_test_list): Update call accordingly.
1472 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1473             Alan Hayward  <alan.hayward@arm.com>
1474             David Sherwood  <david.sherwood@arm.com>
1476         * tree-vect-slp.c (vect_build_slp_tree_1): Handle polynomial
1477         numbers of units.
1478         (vect_schedule_slp_instance): Likewise.
1480 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1481             Alan Hayward  <alan.hayward@arm.com>
1482             David Sherwood  <david.sherwood@arm.com>
1484         * tree-vect-slp.c (vect_get_and_check_slp_defs): Reject
1485         constant and extern definitions for variable-length vectors.
1486         (vect_get_constant_vectors): Note that the number of units
1487         is known to be constant.
1489 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1490             Alan Hayward  <alan.hayward@arm.com>
1491             David Sherwood  <david.sherwood@arm.com>
1493         * tree-vect-stmts.c (vectorizable_conversion): Treat the number
1494         of units as polynomial.  Choose between WIDE and NARROW based
1495         on multiple_p.
1497 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1498             Alan Hayward  <alan.hayward@arm.com>
1499             David Sherwood  <david.sherwood@arm.com>
1501         * tree-vect-stmts.c (simd_clone_subparts): New function.
1502         (vectorizable_simd_clone_call): Use it instead of TYPE_VECTOR_SUBPARTS.
1504 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1505             Alan Hayward  <alan.hayward@arm.com>
1506             David Sherwood  <david.sherwood@arm.com>
1508         * tree-vect-stmts.c (vectorizable_call): Treat the number of
1509         vectors as polynomial.  Use build_index_vector for
1510         IFN_GOMP_SIMD_LANE.
1512 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1513             Alan Hayward  <alan.hayward@arm.com>
1514             David Sherwood  <david.sherwood@arm.com>
1516         * tree-vect-stmts.c (get_load_store_type): Treat the number of
1517         units as polynomial.  Reject VMAT_ELEMENTWISE and VMAT_STRIDED_SLP
1518         for variable-length vectors.
1519         (vectorizable_mask_load_store): Treat the number of units as
1520         polynomial, asserting that it is constant if the condition has
1521         already been enforced.
1522         (vectorizable_store, vectorizable_load): Likewise.
1524 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1525             Alan Hayward  <alan.hayward@arm.com>
1526             David Sherwood  <david.sherwood@arm.com>
1528         * tree-vect-loop.c (vectorizable_live_operation): Treat the number
1529         of units as polynomial.  Punt if we can't tell at compile time
1530         which vector contains the final result.
1532 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1533             Alan Hayward  <alan.hayward@arm.com>
1534             David Sherwood  <david.sherwood@arm.com>
1536         * tree-vect-loop.c (vectorizable_induction): Treat the number
1537         of units as polynomial.  Punt on SLP inductions.  Use an integer
1538         VEC_SERIES_EXPR for variable-length integer reductions.  Use a
1539         cast of such a series for variable-length floating-point
1540         reductions.
1542 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1543             Alan Hayward  <alan.hayward@arm.com>
1544             David Sherwood  <david.sherwood@arm.com>
1546         * tree.h (build_index_vector): Declare.
1547         * tree.c (build_index_vector): New function.
1548         * tree-vect-loop.c (get_initial_defs_for_reduction): Treat the number
1549         of units as polynomial, forcibly converting it to a constant if
1550         vectorizable_reduction has already enforced the condition.
1551         (vect_create_epilog_for_reduction): Likewise.  Use build_index_vector
1552         to create a {1,2,3,...} vector.
1553         (vectorizable_reduction): Treat the number of units as polynomial.
1554         Choose vectype_in based on the largest scalar element size rather
1555         than the smallest number of units.  Enforce the restrictions
1556         relied on above.
1558 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1559             Alan Hayward  <alan.hayward@arm.com>
1560             David Sherwood  <david.sherwood@arm.com>
1562         * tree-vect-data-refs.c (vector_alignment_reachable_p): Treat the
1563         number of units as polynomial.
1565 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1566             Alan Hayward  <alan.hayward@arm.com>
1567             David Sherwood  <david.sherwood@arm.com>
1569         * target.h (vector_sizes, auto_vector_sizes): New typedefs.
1570         * target.def (autovectorize_vector_sizes): Return the vector sizes
1571         by pointer, using vector_sizes rather than a bitmask.
1572         * targhooks.h (default_autovectorize_vector_sizes): Update accordingly.
1573         * targhooks.c (default_autovectorize_vector_sizes): Likewise.
1574         * config/aarch64/aarch64.c (aarch64_autovectorize_vector_sizes):
1575         Likewise.
1576         * config/arc/arc.c (arc_autovectorize_vector_sizes): Likewise.
1577         * config/arm/arm.c (arm_autovectorize_vector_sizes): Likewise.
1578         * config/i386/i386.c (ix86_autovectorize_vector_sizes): Likewise.
1579         * config/mips/mips.c (mips_autovectorize_vector_sizes): Likewise.
1580         * omp-general.c (omp_max_vf): Likewise.
1581         * omp-low.c (omp_clause_aligned_alignment): Likewise.
1582         * optabs-query.c (can_vec_mask_load_store_p): Likewise.
1583         * tree-vect-loop.c (vect_analyze_loop): Likewise.
1584         * tree-vect-slp.c (vect_slp_bb): Likewise.
1585         * doc/tm.texi: Regenerate.
1586         * tree-vectorizer.h (current_vector_size): Change from an unsigned int
1587         to a poly_uint64.
1588         * tree-vect-stmts.c (get_vectype_for_scalar_type_and_size): Take
1589         the vector size as a poly_uint64 rather than an unsigned int.
1590         (current_vector_size): Change from an unsigned int to a poly_uint64.
1591         (get_vectype_for_scalar_type): Update accordingly.
1592         * tree.h (build_truth_vector_type): Take the size and number of
1593         units as a poly_uint64 rather than an unsigned int.
1594         (build_vector_type): Add a temporary overload that takes
1595         the number of units as a poly_uint64 rather than an unsigned int.
1596         * tree.c (make_vector_type): Likewise.
1597         (build_truth_vector_type): Take the number of units as a poly_uint64
1598         rather than an unsigned int.
1600 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1601             Alan Hayward  <alan.hayward@arm.com>
1602             David Sherwood  <david.sherwood@arm.com>
1604         * target.def (get_mask_mode): Take the number of units and length
1605         as poly_uint64s rather than unsigned ints.
1606         * targhooks.h (default_get_mask_mode): Update accordingly.
1607         * targhooks.c (default_get_mask_mode): Likewise.
1608         * config/i386/i386.c (ix86_get_mask_mode): Likewise.
1609         * doc/tm.texi: Regenerate.
1611 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1612             Alan Hayward  <alan.hayward@arm.com>
1613             David Sherwood  <david.sherwood@arm.com>
1615         * omp-general.h (omp_max_vf): Return a poly_uint64 instead of an int.
1616         * omp-general.c (omp_max_vf): Likewise.
1617         * omp-expand.c (omp_adjust_chunk_size): Update call to omp_max_vf.
1618         (expand_omp_simd): Handle polynomial safelen.
1619         * omp-low.c (omplow_simd_context): Add a default constructor.
1620         (omplow_simd_context::max_vf): Change from int to poly_uint64.
1621         (lower_rec_simd_input_clauses): Update accordingly.
1622         (lower_rec_input_clauses): Likewise.
1624 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1625             Alan Hayward  <alan.hayward@arm.com>
1626             David Sherwood  <david.sherwood@arm.com>
1628         * tree-vectorizer.h (vect_nunits_for_cost): New function.
1629         * tree-vect-loop.c (vect_model_reduction_cost): Use it.
1630         * tree-vect-slp.c (vect_analyze_slp_cost_1): Likewise.
1631         (vect_analyze_slp_cost): Likewise.
1632         * tree-vect-stmts.c (vect_model_store_cost): Likewise.
1633         (vect_model_load_cost): Likewise.
1635 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1636             Alan Hayward  <alan.hayward@arm.com>
1637             David Sherwood  <david.sherwood@arm.com>
1639         * tree-vect-slp.c (vect_record_max_nunits, vect_build_slp_tree_1)
1640         (vect_build_slp_tree_2, vect_build_slp_tree): Change max_nunits
1641         from an unsigned int * to a poly_uint64_pod *.
1642         (calculate_unrolling_factor): New function.
1643         (vect_analyze_slp_instance): Use it.  Track polynomial max_nunits.
1645 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1646             Alan Hayward  <alan.hayward@arm.com>
1647             David Sherwood  <david.sherwood@arm.com>
1649         * tree-vectorizer.h (_slp_instance::unrolling_factor): Change
1650         from an unsigned int to a poly_uint64.
1651         (_loop_vec_info::slp_unrolling_factor): Likewise.
1652         (_loop_vec_info::vectorization_factor): Change from an int
1653         to a poly_uint64.
1654         (MAX_VECTORIZATION_FACTOR): Bump from 64 to INT_MAX.
1655         (vect_get_num_vectors): New function.
1656         (vect_update_max_nunits, vect_vf_for_cost): Likewise.
1657         (vect_get_num_copies): Use vect_get_num_vectors.
1658         (vect_analyze_data_ref_dependences): Change max_vf from an int *
1659         to an unsigned int *.
1660         (vect_analyze_data_refs): Change min_vf from an int * to a
1661         poly_uint64 *.
1662         (vect_transform_slp_perm_load): Take the vf as a poly_uint64 rather
1663         than an unsigned HOST_WIDE_INT.
1664         * tree-vect-data-refs.c (vect_analyze_possibly_independent_ddr)
1665         (vect_analyze_data_ref_dependence): Change max_vf from an int *
1666         to an unsigned int *.
1667         (vect_analyze_data_ref_dependences): Likewise.
1668         (vect_compute_data_ref_alignment): Handle polynomial vf.
1669         (vect_enhance_data_refs_alignment): Likewise.
1670         (vect_prune_runtime_alias_test_list): Likewise.
1671         (vect_shift_permute_load_chain): Likewise.
1672         (vect_supportable_dr_alignment): Likewise.
1673         (dependence_distance_ge_vf): Take the vectorization factor as a
1674         poly_uint64 rather than an unsigned HOST_WIDE_INT.
1675         (vect_analyze_data_refs): Change min_vf from an int * to a
1676         poly_uint64 *.
1677         * tree-vect-loop-manip.c (vect_gen_scalar_loop_niters): Take
1678         vfm1 as a poly_uint64 rather than an int.  Make the same change
1679         for the returned bound_scalar.
1680         (vect_gen_vector_loop_niters): Handle polynomial vf.
1681         (vect_do_peeling): Likewise.  Update call to
1682         vect_gen_scalar_loop_niters and handle polynomial bound_scalars.
1683         (vect_gen_vector_loop_niters_mult_vf): Assert that the vf must
1684         be constant.
1685         * tree-vect-loop.c (vect_determine_vectorization_factor)
1686         (vect_update_vf_for_slp, vect_analyze_loop_2): Handle polynomial vf.
1687         (vect_get_known_peeling_cost): Likewise.
1688         (vect_estimate_min_profitable_iters, vectorizable_reduction): Likewise.
1689         (vect_worthwhile_without_simd_p, vectorizable_induction): Likewise.
1690         (vect_transform_loop): Likewise.  Use the lowest possible VF when
1691         updating the upper bounds of the loop.
1692         (vect_min_worthwhile_factor): Make static.  Return an unsigned int
1693         rather than an int.
1694         * tree-vect-slp.c (vect_attempt_slp_rearrange_stmts): Cope with
1695         polynomial unroll factors.
1696         (vect_analyze_slp_cost_1, vect_analyze_slp_instance): Likewise.
1697         (vect_make_slp_decision): Likewise.
1698         (vect_supported_load_permutation_p): Likewise, and polynomial
1699         vf too.
1700         (vect_analyze_slp_cost): Handle polynomial vf.
1701         (vect_slp_analyze_node_operations): Likewise.
1702         (vect_slp_analyze_bb_1): Likewise.
1703         (vect_transform_slp_perm_load): Take the vf as a poly_uint64 rather
1704         than an unsigned HOST_WIDE_INT.
1705         * tree-vect-stmts.c (vectorizable_simd_clone_call, vectorizable_store)
1706         (vectorizable_load): Handle polynomial vf.
1707         * tree-vectorizer.c (simduid_to_vf::vf): Change from an int to
1708         a poly_uint64.
1709         (adjust_simduid_builtins, shrink_simd_arrays): Update accordingly.
1711 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1712             Alan Hayward  <alan.hayward@arm.com>
1713             David Sherwood  <david.sherwood@arm.com>
1715         * match.pd: Handle bit operations involving three constants
1716         and try to fold one pair.
1718 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
1720         * tree-vect-loop-manip.c: Include gimple-fold.h.
1721         (slpeel_make_loop_iterate_ntimes): Add step, final_iv and
1722         niters_maybe_zero parameters.  Handle other cases besides a step of 1.
1723         (vect_gen_vector_loop_niters): Add a step_vector_ptr parameter.
1724         Add a path that uses a step of VF instead of 1, but disable it
1725         for now.
1726         (vect_do_peeling): Add step_vector, niters_vector_mult_vf_var
1727         and niters_no_overflow parameters.  Update calls to
1728         slpeel_make_loop_iterate_ntimes and vect_gen_vector_loop_niters.
1729         Create a new SSA name if the latter choses to use a ste other
1730         than zero, and return it via niters_vector_mult_vf_var.
1731         * tree-vect-loop.c (vect_transform_loop): Update calls to
1732         vect_do_peeling, vect_gen_vector_loop_niters and
1733         slpeel_make_loop_iterate_ntimes.
1734         * tree-vectorizer.h (slpeel_make_loop_iterate_ntimes, vect_do_peeling)
1735         (vect_gen_vector_loop_niters): Update declarations after above changes.
1737 2018-01-02  Michael Meissner  <meissner@linux.vnet.ibm.com>
1739         * config/rs6000/rs6000.md (floor<mode>2): Add support for IEEE
1740         128-bit round to integer instructions.
1741         (ceil<mode>2): Likewise.
1742         (btrunc<mode>2): Likewise.
1743         (round<mode>2): Likewise.
1745 2018-01-02  Aaron Sawdey  <acsawdey@linux.vnet.ibm.com>
1747         * config/rs6000/rs6000-string.c (expand_block_move): Allow the use of
1748         unaligned VSX load/store on P8/P9.
1749         (expand_block_clear): Allow the use of unaligned VSX
1750         load/store on P8/P9.
1752 2018-01-02  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
1754         * config/rs6000/rs6000-p8swap.c (swap_feeds_both_load_and_store):
1755         New function.
1756         (rs6000_analyze_swaps): Mark a web unoptimizable if it contains a
1757         swap associated with both a load and a store.
1759 2018-01-02  Andrew Waterman  <andrew@sifive.com>
1761         * config/riscv/linux.h (ICACHE_FLUSH_FUNC): New.
1762         * config/riscv/riscv.md (clear_cache): Use it.
1764 2018-01-02  Artyom Skrobov  <tyomitch@gmail.com>
1766         * web.c: Remove out-of-date comment.
1768 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1770         * expr.c (fixup_args_size_notes): Check that any existing
1771         REG_ARGS_SIZE notes are correct, and don't try to re-add them.
1772         (emit_single_push_insn_1): Move stack_pointer_delta adjustment to...
1773         (emit_single_push_insn): ...here.
1775 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1777         * rtl.h (CONST_VECTOR_ELT): Redefine to const_vector_elt.
1778         (const_vector_encoded_nelts): New function.
1779         (CONST_VECTOR_NUNITS): Redefine to use GET_MODE_NUNITS.
1780         (const_vector_int_elt, const_vector_elt): Declare.
1781         * emit-rtl.c (const_vector_int_elt_1): New function.
1782         (const_vector_elt): Likewise.
1783         * simplify-rtx.c (simplify_immed_subreg): Avoid taking the address
1784         of CONST_VECTOR_ELT.
1786 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1788         * expr.c: Include rtx-vector-builder.h.
1789         (const_vector_mask_from_tree): Use rtx_vector_builder and operate
1790         directly on the tree encoding.
1791         (const_vector_from_tree): Likewise.
1792         * optabs.c: Include rtx-vector-builder.h.
1793         (expand_vec_perm_var): Use rtx_vector_builder and create a repeating
1794         sequence of "u" values.
1795         * vec-perm-indices.c: Include rtx-vector-builder.h.
1796         (vec_perm_indices_to_rtx): Use rtx_vector_builder and operate
1797         directly on the vec_perm_indices encoding.
1799 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1801         * doc/rtl.texi (const_vector): Describe new encoding scheme.
1802         * Makefile.in (OBJS): Add rtx-vector-builder.o.
1803         * rtx-vector-builder.h: New file.
1804         * rtx-vector-builder.c: Likewise.
1805         * rtl.h (rtx_def::u2): Add a const_vector field.
1806         (CONST_VECTOR_NPATTERNS): New macro.
1807         (CONST_VECTOR_NELTS_PER_PATTERN): Likewise.
1808         (CONST_VECTOR_DUPLICATE_P): Likewise.
1809         (CONST_VECTOR_STEPPED_P): Likewise.
1810         (CONST_VECTOR_ENCODED_ELT): Likewise.
1811         (const_vec_duplicate_p): Check for a duplicated vector encoding.
1812         (unwrap_const_vec_duplicate): Likewise.
1813         (const_vec_series_p): Check for a non-duplicated vector encoding.
1814         Say that the function only returns true for integer vectors.
1815         * emit-rtl.c: Include rtx-vector-builder.h.
1816         (gen_const_vec_duplicate_1): Delete.
1817         (gen_const_vector): Call gen_const_vec_duplicate instead of
1818         gen_const_vec_duplicate_1.
1819         (const_vec_series_p_1): Operate directly on the CONST_VECTOR encoding.
1820         (gen_const_vec_duplicate): Use rtx_vector_builder.
1821         (gen_const_vec_series): Likewise.
1822         (gen_rtx_CONST_VECTOR): Likewise.
1823         * config/powerpcspe/powerpcspe.c: Include rtx-vector-builder.h.
1824         (swap_const_vector_halves): Take an rtx pointer rather than rtx.
1825         Build a new vector rather than modifying a CONST_VECTOR in-place.
1826         (handle_special_swappables): Update call accordingly.
1827         * config/rs6000/rs6000-p8swap.c: Include rtx-vector-builder.h.
1828         (swap_const_vector_halves): Take an rtx pointer rather than rtx.
1829         Build a new vector rather than modifying a CONST_VECTOR in-place.
1830         (handle_special_swappables): Update call accordingly.
1832 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1834         * simplify-rtx.c (simplify_const_binary_operation): Use
1835         CONST_VECTOR_ELT instead of XVECEXP.
1837 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1839         * tree-cfg.c (verify_gimple_assign_ternary): Allow the size of
1840         the selector elements to be different from the data elements
1841         if the selector is a VECTOR_CST.
1842         * tree-vect-stmts.c (vect_gen_perm_mask_any): Use a vector of
1843         ssizetype for the selector.
1845 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1847         * optabs.c (shift_amt_for_vec_perm_mask): Try using series_p
1848         before testing each element individually.
1849         * tree-vect-generic.c (lower_vec_perm): Likewise.
1851 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1853         * selftest.h (selftest::vec_perm_indices_c_tests): Declare.
1854         * selftest-run-tests.c (selftest::run_tests): Call it.
1855         * vector-builder.h (vector_builder::operator ==): New function.
1856         (vector_builder::operator !=): Likewise.
1857         * vec-perm-indices.h (vec_perm_indices::series_p): Declare.
1858         (vec_perm_indices::all_from_input_p): New function.
1859         * vec-perm-indices.c (vec_perm_indices::series_p): Likewise.
1860         (test_vec_perm_12, selftest::vec_perm_indices_c_tests): Likewise.
1861         * fold-const.c (fold_ternary_loc): Use tree_to_vec_perm_builder
1862         instead of reading the VECTOR_CST directly.  Detect whether both
1863         vector inputs are the same before constructing the vec_perm_indices,
1864         and update the number of inputs argument accordingly.  Use the
1865         utility functions added above.  Only construct sel2 if we need to.
1867 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1869         * optabs.c (expand_vec_perm_var): Use an explicit encoding for
1870         the broadcast of the low byte.
1871         (expand_mult_highpart): Use an explicit encoding for the permutes.
1872         * optabs-query.c (can_mult_highpart_p): Likewise.
1873         * tree-vect-loop.c (calc_vec_perm_mask_for_shift): Likewise.
1874         * tree-vect-stmts.c (perm_mask_for_reverse): Likewise.
1875         (vectorizable_bswap): Likewise.
1876         * tree-vect-data-refs.c (vect_grouped_store_supported): Use an
1877         explicit encoding for the power-of-2 permutes.
1878         (vect_permute_store_chain): Likewise.
1879         (vect_grouped_load_supported): Likewise.
1880         (vect_permute_load_chain): Likewise.
1882 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1884         * vec-perm-indices.h (vec_perm_indices_to_tree): Declare.
1885         * vec-perm-indices.c (vec_perm_indices_to_tree): New function.
1886         * tree-ssa-forwprop.c (simplify_vector_constructor): Use it.
1887         * tree-vect-slp.c (vect_transform_slp_perm_load): Likewise.
1888         * tree-vect-stmts.c (vectorizable_bswap): Likewise.
1889         (vect_gen_perm_mask_any): Likewise.
1891 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1893         * int-vector-builder.h: New file.
1894         * vec-perm-indices.h: Include int-vector-builder.h.
1895         (vec_perm_indices): Redefine as an int_vector_builder.
1896         (auto_vec_perm_indices): Delete.
1897         (vec_perm_builder): Redefine as a stand-alone class.
1898         (vec_perm_indices::vec_perm_indices): New function.
1899         (vec_perm_indices::clamp): Likewise.
1900         * vec-perm-indices.c: Include fold-const.h and tree-vector-builder.h.
1901         (vec_perm_indices::new_vector): New function.
1902         (vec_perm_indices::new_expanded_vector): Update for new
1903         vec_perm_indices class.
1904         (vec_perm_indices::rotate_inputs): New function.
1905         (vec_perm_indices::all_in_range_p): Operate directly on the
1906         encoded form, without computing elided elements.
1907         (tree_to_vec_perm_builder): Operate directly on the VECTOR_CST
1908         encoding.  Update for new vec_perm_indices class.
1909         * optabs.c (expand_vec_perm_const): Create a vec_perm_indices for
1910         the given vec_perm_builder.
1911         (expand_vec_perm_var): Update vec_perm_builder constructor.
1912         (expand_mult_highpart): Use vec_perm_builder instead of
1913         auto_vec_perm_indices.
1914         * optabs-query.c (can_mult_highpart_p): Use vec_perm_builder and
1915         vec_perm_indices instead of auto_vec_perm_indices.  Use a single
1916         or double series encoding as appropriate.
1917         * fold-const.c (fold_ternary_loc): Use vec_perm_builder and
1918         vec_perm_indices instead of auto_vec_perm_indices.
1919         * tree-ssa-forwprop.c (simplify_vector_constructor): Likewise.
1920         * tree-vect-data-refs.c (vect_grouped_store_supported): Likewise.
1921         (vect_permute_store_chain): Likewise.
1922         (vect_grouped_load_supported): Likewise.
1923         (vect_permute_load_chain): Likewise.
1924         (vect_shift_permute_load_chain): Likewise.
1925         * tree-vect-slp.c (vect_build_slp_tree_1): Likewise.
1926         (vect_transform_slp_perm_load): Likewise.
1927         (vect_schedule_slp_instance): Likewise.
1928         * tree-vect-stmts.c (perm_mask_for_reverse): Likewise.
1929         (vectorizable_mask_load_store): Likewise.
1930         (vectorizable_bswap): Likewise.
1931         (vectorizable_store): Likewise.
1932         (vectorizable_load): Likewise.
1933         * tree-vect-generic.c (lower_vec_perm): Use vec_perm_builder and
1934         vec_perm_indices instead of auto_vec_perm_indices.  Use
1935         tree_to_vec_perm_builder to read the vector from a tree.
1936         * tree-vect-loop.c (calc_vec_perm_mask_for_shift): Take a
1937         vec_perm_builder instead of a vec_perm_indices.
1938         (have_whole_vector_shift): Use vec_perm_builder and
1939         vec_perm_indices instead of auto_vec_perm_indices.  Leave the
1940         truncation to calc_vec_perm_mask_for_shift.
1941         (vect_create_epilog_for_reduction): Likewise.
1942         * config/aarch64/aarch64.c (expand_vec_perm_d::perm): Change
1943         from auto_vec_perm_indices to vec_perm_indices.
1944         (aarch64_expand_vec_perm_const_1): Use rotate_inputs on d.perm
1945         instead of changing individual elements.
1946         (aarch64_vectorize_vec_perm_const): Use new_vector to install
1947         the vector in d.perm.
1948         * config/arm/arm.c (expand_vec_perm_d::perm): Change
1949         from auto_vec_perm_indices to vec_perm_indices.
1950         (arm_expand_vec_perm_const_1): Use rotate_inputs on d.perm
1951         instead of changing individual elements.
1952         (arm_vectorize_vec_perm_const): Use new_vector to install
1953         the vector in d.perm.
1954         * config/powerpcspe/powerpcspe.c (rs6000_expand_extract_even):
1955         Update vec_perm_builder constructor.
1956         (rs6000_expand_interleave): Likewise.
1957         * config/rs6000/rs6000.c (rs6000_expand_extract_even): Likewise.
1958         (rs6000_expand_interleave): Likewise.
1960 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1962         * optabs-query.c (can_vec_perm_var_p): Check whether lowering
1963         to qimode could truncate the indices.
1964         * optabs.c (expand_vec_perm_var): Likewise.
1966 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
1968         * Makefile.in (OBJS): Add vec-perm-indices.o.
1969         * vec-perm-indices.h: New file.
1970         * vec-perm-indices.c: Likewise.
1971         * target.h (vec_perm_indices): Replace with a forward class
1972         declaration.
1973         (auto_vec_perm_indices): Move to vec-perm-indices.h.
1974         * optabs.h: Include vec-perm-indices.h.
1975         (expand_vec_perm): Delete.
1976         (selector_fits_mode_p, expand_vec_perm_var): Declare.
1977         (expand_vec_perm_const): Declare.
1978         * target.def (vec_perm_const_ok): Replace with...
1979         (vec_perm_const): ...this new hook.
1980         * doc/tm.texi.in (TARGET_VECTORIZE_VEC_PERM_CONST_OK): Replace with...
1981         (TARGET_VECTORIZE_VEC_PERM_CONST): ...this new hook.
1982         * doc/tm.texi: Regenerate.
1983         * optabs.def (vec_perm_const): Delete.
1984         * doc/md.texi (vec_perm_const): Likewise.
1985         (vec_perm): Refer to TARGET_VECTORIZE_VEC_PERM_CONST.
1986         * expr.c (expand_expr_real_2): Use expand_vec_perm_const rather than
1987         expand_vec_perm for constant permutation vectors.  Assert that
1988         the mode of variable permutation vectors is the integer equivalent
1989         of the mode that is being permuted.
1990         * optabs-query.h (selector_fits_mode_p): Declare.
1991         * optabs-query.c: Include vec-perm-indices.h.
1992         (selector_fits_mode_p): New function.
1993         (can_vec_perm_const_p): Check whether targetm.vectorize.vec_perm_const
1994         is defined, instead of checking whether the vec_perm_const_optab
1995         exists.  Use targetm.vectorize.vec_perm_const instead of
1996         targetm.vectorize.vec_perm_const_ok.  Check whether the indices
1997         fit in the vector mode before using a variable permute.
1998         * optabs.c (shift_amt_for_vec_perm_mask): Take a mode and a
1999         vec_perm_indices instead of an rtx.
2000         (expand_vec_perm): Replace with...
2001         (expand_vec_perm_const): ...this new function.  Take the selector
2002         as a vec_perm_indices rather than an rtx.  Also take the mode of
2003         the selector.  Update call to shift_amt_for_vec_perm_mask.
2004         Use targetm.vectorize.vec_perm_const instead of vec_perm_const_optab.
2005         Use vec_perm_indices::new_expanded_vector to expand the original
2006         selector into bytes.  Check whether the indices fit in the vector
2007         mode before using a variable permute.
2008         (expand_vec_perm_var): Make global.
2009         (expand_mult_highpart): Use expand_vec_perm_const.
2010         * fold-const.c: Includes vec-perm-indices.h.
2011         * tree-ssa-forwprop.c: Likewise.
2012         * tree-vect-data-refs.c: Likewise.
2013         * tree-vect-generic.c: Likewise.
2014         * tree-vect-loop.c: Likewise.
2015         * tree-vect-slp.c: Likewise.
2016         * tree-vect-stmts.c: Likewise.
2017         * config/aarch64/aarch64-protos.h (aarch64_expand_vec_perm_const):
2018         Delete.
2019         * config/aarch64/aarch64-simd.md (vec_perm_const<mode>): Delete.
2020         * config/aarch64/aarch64.c (aarch64_expand_vec_perm_const)
2021         (aarch64_vectorize_vec_perm_const_ok): Fuse into...
2022         (aarch64_vectorize_vec_perm_const): ...this new function.
2023         (TARGET_VECTORIZE_VEC_PERM_CONST_OK): Delete.
2024         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
2025         * config/arm/arm-protos.h (arm_expand_vec_perm_const): Delete.
2026         * config/arm/vec-common.md (vec_perm_const<mode>): Delete.
2027         * config/arm/arm.c (TARGET_VECTORIZE_VEC_PERM_CONST_OK): Delete.
2028         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
2029         (arm_expand_vec_perm_const, arm_vectorize_vec_perm_const_ok): Merge
2030         into...
2031         (arm_vectorize_vec_perm_const): ...this new function.  Explicitly
2032         check for NEON modes.
2033         * config/i386/i386-protos.h (ix86_expand_vec_perm_const): Delete.
2034         * config/i386/sse.md (VEC_PERM_CONST, vec_perm_const<mode>): Delete.
2035         * config/i386/i386.c (ix86_expand_vec_perm_const_1): Update comment.
2036         (ix86_expand_vec_perm_const, ix86_vectorize_vec_perm_const_ok): Merge
2037         into...
2038         (ix86_vectorize_vec_perm_const): ...this new function.  Incorporate
2039         the old VEC_PERM_CONST conditions.
2040         * config/ia64/ia64-protos.h (ia64_expand_vec_perm_const): Delete.
2041         * config/ia64/vect.md (vec_perm_const<mode>): Delete.
2042         * config/ia64/ia64.c (ia64_expand_vec_perm_const)
2043         (ia64_vectorize_vec_perm_const_ok): Merge into...
2044         (ia64_vectorize_vec_perm_const): ...this new function.
2045         * config/mips/loongson.md (vec_perm_const<mode>): Delete.
2046         * config/mips/mips-msa.md (vec_perm_const<mode>): Delete.
2047         * config/mips/mips-ps-3d.md (vec_perm_constv2sf): Delete.
2048         * config/mips/mips-protos.h (mips_expand_vec_perm_const): Delete.
2049         * config/mips/mips.c (mips_expand_vec_perm_const)
2050         (mips_vectorize_vec_perm_const_ok): Merge into...
2051         (mips_vectorize_vec_perm_const): ...this new function.
2052         * config/powerpcspe/altivec.md (vec_perm_constv16qi): Delete.
2053         * config/powerpcspe/paired.md (vec_perm_constv2sf): Delete.
2054         * config/powerpcspe/spe.md (vec_perm_constv2si): Delete.
2055         * config/powerpcspe/vsx.md (vec_perm_const<mode>): Delete.
2056         * config/powerpcspe/powerpcspe-protos.h (altivec_expand_vec_perm_const)
2057         (rs6000_expand_vec_perm_const): Delete.
2058         * config/powerpcspe/powerpcspe.c (TARGET_VECTORIZE_VEC_PERM_CONST_OK):
2059         Delete.
2060         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
2061         (altivec_expand_vec_perm_const_le): Take each operand individually.
2062         Operate on constant selectors rather than rtxes.
2063         (altivec_expand_vec_perm_const): Likewise.  Update call to
2064         altivec_expand_vec_perm_const_le.
2065         (rs6000_expand_vec_perm_const): Delete.
2066         (rs6000_vectorize_vec_perm_const_ok): Delete.
2067         (rs6000_vectorize_vec_perm_const): New function.
2068         (rs6000_do_expand_vec_perm): Take a vec_perm_builder instead of
2069         an element count and rtx array.
2070         (rs6000_expand_extract_even): Update call accordingly.
2071         (rs6000_expand_interleave): Likewise.
2072         * config/rs6000/altivec.md (vec_perm_constv16qi): Delete.
2073         * config/rs6000/paired.md (vec_perm_constv2sf): Delete.
2074         * config/rs6000/vsx.md (vec_perm_const<mode>): Delete.
2075         * config/rs6000/rs6000-protos.h (altivec_expand_vec_perm_const)
2076         (rs6000_expand_vec_perm_const): Delete.
2077         * config/rs6000/rs6000.c (TARGET_VECTORIZE_VEC_PERM_CONST_OK): Delete.
2078         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
2079         (altivec_expand_vec_perm_const_le): Take each operand individually.
2080         Operate on constant selectors rather than rtxes.
2081         (altivec_expand_vec_perm_const): Likewise.  Update call to
2082         altivec_expand_vec_perm_const_le.
2083         (rs6000_expand_vec_perm_const): Delete.
2084         (rs6000_vectorize_vec_perm_const_ok): Delete.
2085         (rs6000_vectorize_vec_perm_const): New function.  Remove stray
2086         reference to the SPE evmerge intructions.
2087         (rs6000_do_expand_vec_perm): Take a vec_perm_builder instead of
2088         an element count and rtx array.
2089         (rs6000_expand_extract_even): Update call accordingly.
2090         (rs6000_expand_interleave): Likewise.
2091         * config/sparc/sparc.md (vec_perm_constv8qi): Delete in favor of...
2092         * config/sparc/sparc.c (sparc_vectorize_vec_perm_const): ...this
2093         new function.
2094         (TARGET_VECTORIZE_VEC_PERM_CONST): Redefine.
2096 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
2098         * optabs.c (expand_vec_perm_1): Assert that SEL has an integer
2099         vector mode and that that mode matches the mode of the data
2100         being permuted.
2101         (expand_vec_perm): Split handling of non-CONST_VECTOR selectors
2102         out into expand_vec_perm_var.  Do all CONST_VECTOR handling here,
2103         directly using expand_vec_perm_1 when forcing selectors into
2104         registers.
2105         (expand_vec_perm_var): New function, split out from expand_vec_perm.
2107 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
2109         * optabs-query.h (can_vec_perm_p): Delete.
2110         (can_vec_perm_var_p, can_vec_perm_const_p): Declare.
2111         * optabs-query.c (can_vec_perm_p): Split into...
2112         (can_vec_perm_var_p, can_vec_perm_const_p): ...these two functions.
2113         (can_mult_highpart_p): Use can_vec_perm_const_p to test whether a
2114         particular selector is valid.
2115         * tree-ssa-forwprop.c (simplify_vector_constructor): Likewise.
2116         * tree-vect-data-refs.c (vect_grouped_store_supported): Likewise.
2117         (vect_grouped_load_supported): Likewise.
2118         (vect_shift_permute_load_chain): Likewise.
2119         * tree-vect-slp.c (vect_build_slp_tree_1): Likewise.
2120         (vect_transform_slp_perm_load): Likewise.
2121         * tree-vect-stmts.c (perm_mask_for_reverse): Likewise.
2122         (vectorizable_bswap): Likewise.
2123         (vect_gen_perm_mask_checked): Likewise.
2124         * fold-const.c (fold_ternary_loc): Likewise.  Don't take
2125         implementations of variable permutation vectors into account
2126         when deciding which selector to use.
2127         * tree-vect-loop.c (have_whole_vector_shift): Don't check whether
2128         vec_perm_const_optab is supported; instead use can_vec_perm_const_p
2129         with a false third argument.
2130         * tree-vect-generic.c (lower_vec_perm): Use can_vec_perm_const_p
2131         to test whether the constant selector is valid and can_vec_perm_var_p
2132         to test whether a variable selector is valid.
2134 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
2136         * optabs-query.h (can_vec_perm_p): Take a const vec_perm_indices *.
2137         * optabs-query.c (can_vec_perm_p): Likewise.
2138         * fold-const.c (fold_vec_perm): Take a const vec_perm_indices &
2139         instead of vec_perm_indices.
2140         * tree-vectorizer.h (vect_gen_perm_mask_any): Likewise,
2141         (vect_gen_perm_mask_checked): Likewise,
2142         * tree-vect-stmts.c (vect_gen_perm_mask_any): Likewise,
2143         (vect_gen_perm_mask_checked): Likewise,
2145 2018-01-02  Richard Sandiford  <richard.sandiford@linaro.org>
2147         * optabs-query.h (qimode_for_vec_perm): Declare.
2148         * optabs-query.c (can_vec_perm_p): Split out qimode search to...
2149         (qimode_for_vec_perm): ...this new function.
2150         * optabs.c (expand_vec_perm): Use qimode_for_vec_perm.
2152 2018-01-02  Aaron Sawdey  <acsawdey@linux.vnet.ibm.com>
2154         * rtlanal.c (canonicalize_condition): Return 0 if final rtx
2155         does not have a conditional at the top.
2157 2018-01-02  Richard Biener  <rguenther@suse.de>
2159         * ipa-inline.c (big_speedup_p): Fix expression.
2161 2018-01-02  Jan Hubicka  <hubicka@ucw.cz>
2163         PR target/81616
2164         * config/i386/x86-tune-costs.h: Increase cost of integer load costs
2165         for generic 4->6.
2167 2018-01-02  Jan Hubicka  <hubicka@ucw.cz>
2169         PR target/81616
2170         Generic tuning.
2171         * x86-tune-costs.h (generic_cost): Reduce cost of FDIV 20->17,
2172         cost of sqrt 20->14, DIVSS 18->13, DIVSD 32->17, SQRtSS 30->14
2173         and SQRTsD 58->18, cond_not_taken_branch_cost. 2->1. Increase
2174         cond_taken_branch_cost 3->4.
2176 2018-01-01  Jakub Jelinek  <jakub@redhat.com>
2178         PR tree-optimization/83581
2179         * tree-loop-distribution.c (pass_loop_distribution::execute): Return
2180         TODO_cleanup_cfg if any changes have been made.
2182         PR middle-end/83608
2183         * expr.c (store_expr_with_bounds): Use simplify_gen_subreg instead of
2184         convert_modes if target mode has the right side, but different mode
2185         class.
2187         PR middle-end/83609
2188         * expr.c (expand_assignment): Fix up a typo in simplify_gen_subreg
2189         last argument when extracting from CONCAT.  If either from_real or
2190         from_imag is NULL, use expansion through memory.  If result is not
2191         a CONCAT and simplify_gen_subreg fails, try to simplify_gen_subreg
2192         the parts directly to inner mode, if even that fails, use expansion
2193         through memory.
2195         PR middle-end/83623
2196         * expmed.c (expand_shift_1): For 2-byte rotates by BITS_PER_UNIT,
2197         check for bswap in mode rather than HImode and use that in expand_unop
2198         too.
2200 Copyright (C) 2018 Free Software Foundation, Inc.
2202 Copying and distribution of this file, with or without modification,
2203 are permitted in any medium without royalty provided the copyright
2204 notice and this notice are preserved.