1. 05 Sep, 2017 28 commits
    • Make mode_for_size_tree return an opt_mode · 798014c5
      ...for consistency with mode_for_size
      
      2017-09-05  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* stor-layout.h (mode_for_size_tree): Return an opt_mode.
      	* stor-layout.c (mode_for_size_tree): Likewise.
      	(mode_for_array): Update accordingly.
      	(layout_decl): Likewise.
      	(compute_record_mode): Likewise.  Only set the mode once.
      
      gcc/ada/
      	* gcc-interface/utils.c (make_packable_type): Update call to
      	mode_for_size_tree.
      
      From-SVN: r251732
      Richard Sandiford committed
    • Make targetm.get_mask_mode return an opt_mode · 3981fbb6
      ...for consistency with mode_for_vector.
      
      2017-09-05  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* target.def (get_mask_mode): Change return type to opt_mode.
      	Expand commentary.
      	* doc/tm.texi: Regenerate.
      	* targhooks.h (default_get_mask_mode): Return an opt_mode.
      	* targhooks.c (default_get_mask_mode): Likewise.
      	* config/i386/i386.c (ix86_get_mask_mode): Likewise.
      	* optabs-query.c (can_vec_mask_load_store_p): Update use of
      	targetm.get_mask_mode.
      	* tree.c (build_truth_vector_type): Likewise.
      
      From-SVN: r251731
      Richard Sandiford committed
    • Make mode_for_vector return an opt_mode · 9da15d40
      ...following on from the mode_for_size change.  The patch also removes
      machmode.h versions of the stor-layout.c comments, since the comments
      in the .c file are more complete.
      
      2017-09-05  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* machmode.h (mode_for_vector): Return an opt_mode.
      	* stor-layout.c (mode_for_vector): Likewise.
      	(mode_for_int_vector): Update accordingly.
      	(layout_type): Likewise.
      	* config/i386/i386.c (emit_memmov): Likewise.
      	(ix86_expand_set_or_movmem): Likewise.
      	(ix86_expand_vector_init): Likewise.
      	(ix86_get_mask_mode): Likewise.
      	* config/powerpcspe/powerpcspe.c (rs6000_expand_vec_perm_const_1):
      	Likewise.
      	* config/rs6000/rs6000.c (rs6000_expand_vec_perm_const_1): Likewise.
      	* expmed.c (extract_bit_field_1): Likewise.
      	* expr.c (expand_expr_real_2): Likewise.
      	* optabs-query.c (can_vec_perm_p): Likewise.
      	(can_vec_mask_load_store_p): Likewise.
      	* optabs.c (expand_vec_perm): Likewise.
      	* targhooks.c (default_get_mask_mode): Likewise.
      	* tree-vect-stmts.c (vectorizable_store): Likewise.
      	(vectorizable_load): Likewise.
      	(get_vectype_for_scalar_type_and_size): Likewise.
      
      From-SVN: r251730
      Richard Sandiford committed
    • Add mode_for_int_vector helper functions · ddc203a7
      There are at least a few places that want to create an integer vector
      with a specified element size and element count, or to create the
      integer equivalent of an existing mode.  This patch adds helpers
      for doing that.
      
      The require ()s are all used in functions that go on to emit
      instructions that use the result as a vector mode.
      
      2017-09-05  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* machmode.h (mode_for_int_vector): New function.
      	* stor-layout.c (mode_for_int_vector): Likewise.
      	* config/aarch64/aarch64.c (aarch64_emit_approx_sqrt): Use it.
      	* config/powerpcspe/powerpcspe.c (rs6000_do_expand_vec_perm): Likewise.
      	* config/rs6000/rs6000.c (rs6000_do_expand_vec_perm): Likewise.
      	* config/s390/s390.c (s390_expand_vec_compare_cc): Likewise.
      	(s390_expand_vcond): Likewise.
      
      From-SVN: r251729
      Richard Sandiford committed
    • Make mode_for_size return an opt_mode · 61b2290a
      ...to make it consistent with int_mode_for_size etc.
      
      require () seems like the right choice in replace_reg_with_saved_mem
      because we use the chosen mode for saving and restoring registers,
      which cannot be done in BLKmode.  Similarly require () seems like
      the right choice in calls related to secondary memory reloads (the ones
      in config/, and in get_secondary_mem) because the reload must always
      have a defined mode, which e.g. determines the size of the slot.
      
      We can use require () in simplify_subreg_concatn and assemble_integer
      because it isn't meaningful to create a subreg with BLKmode (for one
      thing, we couldn't tell then whether it was partial, paradoxical, etc.).
      
      make_fract_type and make_accum_type must find a mode because that's
      what distinguishes accumulator FIXED_POINT_TYPEs from fractional
      FIXED_POINT_TYPEs.
      
      2017-09-05  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* machmode.h (opt_machine_mode): New type.
      	(opt_mode<T>): Allow construction from anything that can be
      	converted to a T.
      	(is_a, as_a, dyn_cast): Add overloads for opt_mode.
      	(mode_for_size): Return an opt_machine_mode.
      	* stor-layout.c (mode_for_size): Likewise.
      	(mode_for_size_tree): Update call accordingly.
      	(bitwise_mode_for_mode): Likewise.
      	(make_fract_type): Likewise.
      	(make_accum_type): Likewise.
      	* caller-save.c (replace_reg_with_saved_mem): Update call
      	accordingly.
      	* config/alpha/alpha.h (SECONDARY_MEMORY_NEEDED_MODE): Likewise.
      	* config/i386/i386.h (SECONDARY_MEMORY_NEEDED_MODE): Likewise.
      	* config/s390/s390.h (SECONDARY_MEMORY_NEEDED_MODE): Likewise.
      	* config/sparc/sparc.h (SECONDARY_MEMORY_NEEDED_MODE): Likewise.
      	* expmed.c (extract_bit_field_1): Likewise.
      	* reload.c (get_secondary_mem): Likewise.
      	* varasm.c (assemble_integer): Likewise.
      	* lower-subreg.c (simplify_subreg_concatn): Likewise.  Move
      	early-out.
      
      From-SVN: r251728
      Richard Sandiford committed
    • (decimal_)float_mode_for_size in real.h · 7773dca7
      This patch makes the binary float macros in real.h use
      float_mode_for_size and adds a corresponding decimal_float_mode_for_size
      for the decimal macros.
      
      2017-09-05  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* machmode.h (decimal_float_mode_for_size): New function.
      	* real.h (REAL_VALUE_TO_TARGET_LONG_DOUBLE): Use float_mode_for_size.
      	(REAL_VALUE_TO_TARGET_DOUBLE): Likewise.
      	(REAL_VALUE_TO_TARGET_SINGLE): Likewise.
      	(REAL_VALUE_TO_TARGET_DECIMAL128): Use decimal_float_mode_for_size.
      	(REAL_VALUE_TO_TARGET_DECIMAL64): Likewise.
      	(REAL_VALUE_TO_TARGET_DECIMAL32): Likewise.
      
      From-SVN: r251727
      Richard Sandiford committed
    • Make more use of int_mode_for_size · f4b31647
      This patch converts more places that could use int_mode_for_size instead
      of mode_for_size.  This is in preparation for an upcoming patch that
      makes mode_for_size itself return an opt_mode.
      
      require () seems like the right choice in expand_builtin_powi
      because we have got past the point of backing out.  We go on to do:
      
        op1 = expand_expr (arg1, NULL_RTX, mode2, EXPAND_NORMAL);
        if (GET_MODE (op1) != mode2)
          op1 = convert_to_mode (mode2, op1, 0);
      
      which would be invalid for (and have failed for) BLKmode.
      
      In get_builtin_sync_mode and expand_ifn_atomic_compare_exchange,
      the possible bitsizes are {8, 16, 32, 64, 128}, all of which give
      target-independent integer modes (up to TImode).  The comment above
      the call in get_builtin_sync_mode makes clear that an integer mode
      must be found.
      
      We can use require () in expand_builtin_atomic_clear and
      expand_builtin_atomic_test_and_set because there's always an integer
      mode for the boolean type.  The same goes for the POINTER_SIZE request
      in layout_type.  Similarly we can use require () in combine_instructions
      and gen_lowpart_common because there's always an integer mode for
      HOST_BITS_PER_WIDE_INT (DImode when BITS_PER_UNIT == 8), and
      HOST_BITS_PER_DOUBLE_INT (TImode).
      
      The calls in aarch64_function_value, arm_function_value,
      aapcs_allocate_return_reg and mips_function_value_1 are handling
      cases in which a big-endian target passes or returns values at
      the most significant end of a register.  In each case the ABI
      constrains the size to a small amount and does not handle
      non-power-of-2 sizes wider than a word.
      
      The calls in c6x_expand_movmem, i386.c:emit_memset,
      lm32_block_move_inline, microblaze_block_move_straight and
      mips_block_move_straight are dealing with expansions of
      block memory operations using register-wise operations,
      and those registers must have non-BLK mode.
      
      The reason for using require () in ix86_expand_sse_cmp,
      mips_expand_ins_as_unaligned_store, spu.c:adjust_operand and
      spu_emit_branch_and_set is that we go on to emit non-call
      instructions that use registers of that mode, which wouldn't
      be valid for BLKmode.
      
      2017-09-05  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* builtins.c (expand_builtin_powi): Use int_mode_for_size.
      	(get_builtin_sync_mode): Likewise.
      	(expand_ifn_atomic_compare_exchange): Likewise.
      	(expand_builtin_atomic_clear): Likewise.
      	(expand_builtin_atomic_test_and_set): Likewise.
      	(fold_builtin_atomic_always_lock_free): Likewise.
      	* calls.c (compute_argument_addresses): Likewise.
      	(emit_library_call_value_1): Likewise.
      	(store_one_arg): Likewise.
      	* combine.c (combine_instructions): Likewise.
      	* config/aarch64/aarch64.c (aarch64_function_value): Likewise.
      	* config/arm/arm.c (arm_function_value): Likewise.
      	(aapcs_allocate_return_reg): Likewise.
      	* config/c6x/c6x.c (c6x_expand_movmem): Likewise.
      	* config/i386/i386.c (construct_container): Likewise.
      	(ix86_gimplify_va_arg): Likewise.
      	(ix86_expand_sse_cmp): Likewise.
      	(emit_memmov): Likewise.
      	(emit_memset): Likewise.
      	(expand_small_movmem_or_setmem): Likewise.
      	(ix86_expand_pextr): Likewise.
      	(ix86_expand_pinsr): Likewise.
      	* config/lm32/lm32.c (lm32_block_move_inline): Likewise.
      	* config/microblaze/microblaze.c (microblaze_block_move_straight):
      	Likewise.
      	* config/mips/mips.c (mips_function_value_1) Likewise.
      	(mips_block_move_straight): Likewise.
      	(mips_expand_ins_as_unaligned_store): Likewise.
      	* config/powerpcspe/powerpcspe.c
      	(rs6000_darwin64_record_arg_advance_flush): Likewise.
      	(rs6000_darwin64_record_arg_flush): Likewise.
      	* config/rs6000/rs6000.c
      	(rs6000_darwin64_record_arg_advance_flush): Likewise.
      	(rs6000_darwin64_record_arg_flush): Likewise.
      	* config/sparc/sparc.c (sparc_function_arg_1): Likewise.
      	(sparc_function_value_1): Likewise.
      	* config/spu/spu.c (adjust_operand): Likewise.
      	(spu_emit_branch_or_set): Likewise.
      	(arith_immediate_p): Likewise.
      	* emit-rtl.c (gen_lowpart_common): Likewise.
      	* expr.c (expand_expr_real_1): Likewise.
      	* function.c (assign_parm_setup_block): Likewise.
      	* gimple-ssa-store-merging.c (encode_tree_to_bitpos): Likewise.
      	* reload1.c (alter_reg): Likewise.
      	* stor-layout.c (mode_for_vector): Likewise.
      	(layout_type): Likewise.
      
      gcc/ada/
      	* gcc-interface/utils2.c (build_load_modify_store):
      	Use int_mode_for_size.
      
      From-SVN: r251726
      Richard Sandiford committed
    • Make more use of int_mode_for_mode · 636bfdfa
      This patch converts more places that could use int_mode_for_mode
      instead of mode_for_size.  This is in preparation for an upcoming
      patch that makes mode_for_size itself return an opt_mode.
      
      The reason for using required () in exp2_immediate_p is that
      we go on to do:
      
          trunc_int_for_mode (..., int_mode)
      
      which would be invalid for (and have failed for) BLKmode.
      
      The reason for using required () in spu_convert_move and
      resolve_simple_move is that we go on to use registers of
      the returned mode in non-call rtl instructions, which would
      be invalid for BLKmode.
      
      2017-09-05  Richard Sandiford  <richard.sandiford@linaro.org>
      
      gcc/
      	* config/spu/spu.c (exp2_immediate_p): Use int_mode_for_mode.
      	(spu_convert_move): Likewise.
      	* lower-subreg.c (resolve_simple_move): Likewise.
      
      From-SVN: r251725
      Richard Sandiford committed
    • class.c (unreverse_member_declarations): Remove extraneous if. · 36560e9e
      	* class.c (unreverse_member_declarations): Remove extraneous if.
      	* pt.c (push_template_decl_real): Use string concatenation, not
      	\<newline>.  Add %<..%>.
      
      From-SVN: r251724
      Nathan Sidwell committed
    • re PR target/81833 (PowerPC: VSX: Miscompiles ffmpeg's scalarproduct_int16_vsx at -O1) · 55b2ce1c
      [gcc]
      
      2017-09-05  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
      
      	PR target/81833
      	* config/rs6000/altivec.md (altivec_vsum2sws): Convert from a
      	define_insn to a define_expand.
      	(altivec_vsum2sws_direct): New define_insn.
      	(altivec_vsumsws): Convert from a define_insn to a define_expand.
      
      [gcc/testsuite]
      
      2017-09-05  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
      
      	PR target/81833
      	* gcc.target/powerpc/pr81833-1.c: New file.
      	* gcc.target/powerpc/pr81833-2.c: New file.
      
      From-SVN: r251723
      Bill Schmidt committed
    • Improve max_insns_skipped logic · e5fc06a3
      Improve the logic when setting max_insns_skipped.  Limit the maximum size of IT
      to MAX_INSN_PER_IT_BLOCK as otherwise multiple IT instructions are needed,
      increasing codesize.  Given 4 works well for Thumb-2, use the same limit for ARM
      for consistency.
      
          gcc/
      	* config/arm/arm.c (arm_option_params_internal): Improve setting of
      	max_insns_skipped.
      
      From-SVN: r251720
      Wilco Dijkstra committed
    • i386: Avoid stack realignment if possible · f174328e
      ix86_finalize_stack_frame_flags has been extended to eliminate frame
      pointer when the new stack frame isn't needed with and without
      -maccumulate-outgoing-args as well as -fomit-frame-pointer.  Since stack
      access with larger alignment may be optimized out, to decide if stack
      realignment is needed, we need to not only check for stack frame access,
      but also verify the alignment of stack frame access.  Since alignment of
      memory access via arg_pointer is set up by caller, not by callee, we
      should find the maximum stack alignment from the stack frame access
      instructions via stack pointer and frame pointrer to avoid stack
      realignment when stack alignment needed is less than incoming stack
      boundary.
      
      gcc/
      
      	PR target/59501
      	PR target/81624
      	PR target/81769
      	* config/i386/i386.c (ix86_finalize_stack_frame_flags): Don't
      	realign stack if stack alignment needed is less than incoming
      	stack boundary.
      
      gcc/testsuite/
      
      	PR target/59501
      	PR target/81624
      	PR target/81769
      	* gcc.target/i386/pr59501-4a.c: Remove xfail.
      	* gcc.target/i386/pr81769-1a.c: New test.
      	* gcc.target/i386/pr81769-1b.c: Likewise.
      	* gcc.target/i386/pr81769-2.c: Likewise.
      
      From-SVN: r251718
      H.J. Lu committed
    • re PR sanitizer/82072 (sanitizer does not detect an overflow from LLONG_MIN) · c253525e
      	PR sanitizer/82072
      	* convert.c (convert_to_integer_1) <case NEGATE_EXPR>: Move the ubsan
      	check earlier.
      
      	* c-c++-common/ubsan/pr82072-2.c: New test.
      
      From-SVN: r251717
      Marek Polacek committed
    • re PR c++/81942 (ICE on empty constexpr constructor with C++14) · d49318d9
      /cp
      2017-09-05  Paolo Carlini  <paolo.carlini@oracle.com>
      
      	PR c++/81942
      	* cp-tree.h (LABEL_DECL_CDTOR): Add and document.
      	* decl.c (start_preparsed_function): Set LABEL_DECL_CDTOR when
      	creating cdtor_label.
      	* constexpr.c (returns): Add the case of a constructor/destructor
      	returning via a LABEL_DECL_CDTOR label.
      	(cxx_eval_constant_expression, case [GOTO_EXPR]): Likewise.
      
      /testsuite
      2017-09-05  Paolo Carlini  <paolo.carlini@oracle.com>
      
      	PR c++/81942
      	* g++.dg/cpp1y/constexpr-return3.C: New.
      
      From-SVN: r251714
      Paolo Carlini committed
    • Improve alloca alignment · ae85ad3a
      This patch improves alloca alignment.  Currently alloca reserves
      too much space as it aligns twice, and generates unnecessary stack
      alignment code.
      
      When the requested alignment is lower than the stack alignment, no
      extra alignment is needed.  If the requested alignment is higher,
      we need to increase the size by the difference of the requested 
      alignment and the stack alignment.  As a result, the alloca alignment
      is exactly as expected:
      
      alloca (16):
      	sub	sp, sp, #16
      	mov	x1, sp
      
      alloca (x):
      	add	x0, x0, 15
      	and	x0, x0, -16
      	sub	sp, sp, x0
      	mov	x0, sp
      
      __builtin_alloca_with_align (x, 512):
      	add	x0, x0, 63
      	and	x0, x0, -16
      	sub	sp, sp, x0
      	add	x0, sp, 63
      	and	x0, x0, -64
      
          gcc/
      	* explow.c (get_dynamic_stack_size): Improve dynamic alignment.
      
      From-SVN: r251713
      Wilco Dijkstra committed
    • re PR c++/82084 (ICE: constructing wstring with -O3) · 54c43004
      2017-09-05  Richard Biener  <rguenther@suse.de>
      
      	PR tree-optimization/82084
      	* fold-const.c (can_native_encode_string_p): Handle wide characters.
      
      From-SVN: r251711
      Richard Biener committed
    • re PR ada/62235 (segmentation fault on Ada 2012 code) · d3b080bc
      	PR ada/62235
      	* gcc-interface/decl.c (gnat_to_gnu_entity): Skip regular processing
      	for Itypes that are E_Record_Subtype with a cloned subtype.
      	<E_Record_Subtype>: Use the DECL of the cloned type directly, if any.
      
      From-SVN: r251706
      Eric Botcazou committed
    • trans.c (convert_with_check): Use a custom base type if the base type of the… · a4f7374e
      trans.c (convert_with_check): Use a custom base type if the base type of the expression has a different...
      
      	* gcc-interface/trans.c (convert_with_check): Use a custom base type
      	if the base type of the expression has a different machine mode.
      	Rename a couple of parameters and local variable.
      
      From-SVN: r251705
      Eric Botcazou committed
    • trans.c (Attribute_to_gnu): Do not strip conversions around prefixes that are not references. · 3fd9ae96
      	* gcc-interface/trans.c (Attribute_to_gnu) <Attr_Address>: Do not strip
      	conversions around prefixes that are not references.
      
      From-SVN: r251704
      Eric Botcazou committed
    • utils.c (unchecked_convert): When the result type is a non-biased integral type with size 0... · 1f073c92
      	* gcc-interface/utils.c (unchecked_convert): When the result type is a
      	non-biased integral type with size 0, set the result to 0 directly.
      
      From-SVN: r251701
      Eric Botcazou committed
    • gigi.h (renaming_from_generic_instantiation_p): Turn to · 7ed9919d
      	* gcc-interface/gigi.h (renaming_from_generic_instantiation_p): Turn to
      	(renaming_from_instantiation_p): ...this.
      	* gcc-interface/decl.c (gnat_to_gnu_entity): Use inline predicate
      	instead of explicit tests on kind of entities.  Adjust for renaming.
      	(gnat_to_gnu_profile_type): Likewise.
      	(gnat_to_gnu_subprog_type): Likewise.
      	* gcc-interface/trans.c (Identifier_to_gnu): Likewise.
      	(Case_Statement_to_gnu): Likewise.
      	(gnat_to_gnu): Likewise.
      	(process_freeze_entity): Likewise.
      	(process_type): Likewise.
      	(add_stmt_with_node): Adjust for renaming.
      	* gcc-interface/utils.c (gnat_pushdecl): Adjust for renaming.
      	(renaming_from_generic_instantiation_p): Rename to...
      	(renaming_from_instantiation_p): ...this.  Use inline predicate.
      	(pad_type_hasher::keep_cache_entry): Fold.
      
      From-SVN: r251700
      Eric Botcazou committed
    • trans.c (adjust_for_implicit_deref): New function. · 806fcf71
      	* gcc-interface/trans.c (adjust_for_implicit_deref): New function.
      	(gnat_to_gnu) <N_Explicit_Dereference>: Translate result type first.
      	(N_Indexed_Component): Invoke adjust_for_implicit_deref on the prefix.
      	(N_Slice): Likewise.
      	(N_Selected_Component): Likewise.  Do not try again to translate it.
      	(N_Free_Statement): Invoke adjust_for_implicit_deref on the expression.
      
      From-SVN: r251699
      Eric Botcazou committed
    • repinfo.ads: Document new treatment of dynamic values. · e45f84a5
      	* repinfo.ads: Document new treatment of dynamic values.
      	(TCode): Bump upper bound to 29.
      	(Dynamic_Val): New constant set to 29.
      	* repinfo.adb (Print_Expr) <Dynamic_Val>: New case.
      	(Rep_Value)  <Dynamic_Val>: Likewise.
      	* repinfo.h (Dynamic_Val): New macro.
      	* gcc-interface/decl.c (annotate_value): Tidy up and cache result for
      	DECL_P nodes too.
      	<INTEGER_CST>: Set TCODE instead of recursing.
      	<COMPONENT_REF>: Set TCODE instead of calling Create_Node manually.
      	<VAR_DECL>: New case.
      	<MULT_EXPR, PLUS_EXPR>: Fold conversions into inner operations.
      	<BIT_AND_EXPR>: Adjust.
      	<CALL_EXPR>: Do not fall through.
      
      From-SVN: r251698
      Eric Botcazou committed
    • trans.c (Call_to_gnu): If this is a function call and there is no target... · 6a9db54c
      	* gcc-interface/trans.c (Call_to_gnu): If this is a function call and
      	there is no target, do not create a temporary for the return value for
      	an allocator either.
      
      From-SVN: r251695
      Eric Botcazou committed
    • re PR tree-optimization/82102 (ICE: Segmentation fault in… · a0f8cad6
      re PR tree-optimization/82102 (ICE: Segmentation fault in /home/arnd/git/gcc/gcc/tree-ssa-pre.c:4863)
      
      2017-09-05  Richard Biener  <rguenther@suse.de>
      
      	PR tree-optimization/82102
      	* tree-ssa-pre.c (fini_eliminate): Check if lhs is NULL.
      
      	* gcc.dg/torture/pr82102.c: New testcase.
      
      From-SVN: r251692
      Richard Biener committed
    • trans.c (pos_to_constructor): Skip conversions to an unconstrained array type. · babf697a
      	* gcc-interface/trans.c (pos_to_constructor): Skip conversions to an
      	unconstrained array type.
      
      From-SVN: r251691
      Eric Botcazou committed
    • Learn CFG cleanup to transform single case switches to gcond. · 02e637d8
      2017-09-05  Martin Liska  <mliska@suse.cz>
      
      	PR tree-optimization/82032
      	* tree-cfg.c (generate_range_test): New function.
      	* tree-cfg.h (generate_range_test): Declared here.
      	* tree-cfgcleanup.c (convert_single_case_switch): New function.
      	(cleanup_control_expr_graph): Use it.
      	* tree-switch-conversion.c (try_switch_expansion): Remove
      	assert.
      	(emit_case_nodes): Use generate_range_test.
      2017-09-05  Martin Liska  <mliska@suse.cz>
      
      	PR tree-optimization/82032
      	* g++.dg/other/pr82032.C: New test.
      	* gcc.dg/tree-ssa/pr68198.c: Update scanned pattern.
      	* gcc.dg/tree-ssa/vrp34.c: Likewise.
      	* gcc.dg/switch-10.c: Likewise.
      
      From-SVN: r251690
      Martin Liska committed
    • Daily bump. · b471c5c6
      From-SVN: r251689
      GCC Administrator committed
  2. 04 Sep, 2017 12 commits
    • mpx-os-support.h: New file. · bc394e5a
      	* gcc.target/i386/mpx/mpx-os-support.h: New file.
      	* gcc.target/i386/mpx/mpx-check.h: Include mpx-os-support.h.
      
      From-SVN: r251683
      Uros Bizjak committed
    • re PR target/82098 (internal compiler error: in elimination_costs_in_insn, at… · fc3664b1
      re PR target/82098 (internal compiler error: in elimination_costs_in_insn, at reload1.c:3616, -march=i686)
      
      	PR target/82098
      	* config/i386/i386.md (*<btsc><mode>_mask): Add
      	TARGET_USE_BT to insn constraint.
      	(*btr<mode>_mask): Ditto.
      
      From-SVN: r251682
      Uros Bizjak committed
    • Fix ldrd offsets · c9244494
      Fix the ldrd offsets of Thumb-2 - for TARGET_LDRD the range is +-1020,
      without -252..4096.  This reduces the number of addressing instructions
      when using DI mode operations (such as in PR77308).
      
          gcc/
      	* config/arm/arm.c (arm_legitimate_index_p): Add comment.
      	(thumb2_legitimate_index_p): Use correct range for DI/DF mode.
      
      From-SVN: r251681
      Wilco Dijkstra committed
    • PR libstdc++/79162 implement LWG 2946 and LWG 2758 · df66af3b
      2017-09-04  Daniel Kruegler  <daniel.kruegler@gmail.com>
      
      	PR libstdc++/79162
      	Implement LWG 2946, LWG 2758's resolution missed further corrections
      	* include/bits/basic_string.h (basic_string::compare): Add missing
      	required noexcept specifications.
      	(basic_string): Introduce internal _S_to_string_view and __sv_wrapper
      	for implicit string_view conversion.
      	(basic_string::basic_string): Fix explicit string_view conversion by
      	implicit conversion using _S_to_string_view and __sv_wrapper.
      	(basic_string): Introduce internal basic_string(__sv_wrapper, Alloc)
      	constructor.
      	(basic_string): Fix operator=(T) template by operator=(const T&)
      	template for uncopyable types (PR 79162).
      	(basic_string::operator+=, basic_string::append, basic_string::assign)
      	(basic_string::insert, basic_string::replace, basic_string::find)
      	(basic_string::rfind, basic_string::find_first_of)
      	(basic_string::find_last_of, basic_string::find_first_not_of)
      	(basic_string::find_last_not_of, basic_string::compare): Replace
      	__sv_type argument by template const T& (LWG 2946) and correct
      	documentation describing __sv_type argument.
      	(basic_string::find, basic_string::rfind, basic_string::find_first_of)
      	(basic_string::find_last_of, basic_string::find_first_not_of)
      	(basic_string::find_last_not_of, basic_string::compare): Replace
      	unconditional noexcept specification by conditional noexcept
      	specification to partially balance the removal of noexcept by LWG 2946.
      	* testsuite/21_strings/basic_string/79162.cc: New.
      	* testsuite/21_strings/basic_string/lwg2946.cc: New.
      
      From-SVN: r251664
      Daniel Kruegler committed
    • re PR target/77308 (surprisingly large stack usage for sha512 on arm) · 9afacf39
      2017-09-04  Bernd Edlinger  <bernd.edlinger@hotmail.de>
      
              PR target/77308
              * config/arm/arm.md (*arm_adddi3, *arm_subdi3): Split early except for
              TARGET_NEON and TARGET_IWMMXT.
              (anddi3, iordi3, xordi3, one_cmpldi2): Split while expanding except for
              TARGET_NEON and TARGET_IWMMXT.
              (*one_cmpldi2_insn): Moved the body of one_cmpldi2 here.
      
      testsuite:
      2017-09-04  Bernd Edlinger  <bernd.edlinger@hotmail.de>
      
              PR target/77308
              * gcc.target/arm/pr77308-1.c: New test.
      
      From-SVN: r251663
      Bernd Edlinger committed
    • * config/i386/i386-protos.h (ix86_tls_address_pattern_p) New prototype. · f3648f7d
      	(ix86_rewrite_tls_address): Ditto.
      	* config/i386/i386.c (ix86_tls_address_pattern_p) New function.
      	(ix86_rewrite_tls_address_1): Ditto.
      	(ix86_rewrite_tls_address): Ditto.
      	* config/i386/predicates.md (tls_address_pattern): New predicate.
      	* config/i386/i386.md (TLS address splitter): New splitter.
      
      From-SVN: r251662
      Uros Bizjak committed
    • re PR c++/82084 (ICE: constructing wstring with -O3) · 11a82e25
      2017-09-04  Richard Biener  <rguenther@suse.de>
      
      	PR tree-optimization/82084
      	* fold-const.h (can_native_encode_string_p): Declare.
      	* fold-const.c (can_native_encode_string_p): Factor out from ...
      	(native_encode_string): ... here.
      	* tree-vect-stmts.c (vectorizable_store): Call it to avoid
      	vectorizing stores from constants we later cannot handle.
      
      	* g++.dg/torture/pr82084.C: New testcase.
      
      From-SVN: r251661
      Richard Biener committed
    • re PR c/81783 (-Wtautological-compare could do better) · bc7fe952
      	PR c/81783
      	* c-warn.c (warn_tautological_bitwise_comparison): New function.
      	(warn_tautological_cmp): Call it.
      
      	* doc/invoke.texi: Update -Wtautological-compare documentation.
      
      	* c-c++-common/Wtautological-compare-5.c: New test.
      
      From-SVN: r251660
      Marek Polacek committed
    • re PR tree-optimization/64910 (tree reassociation results in poor code) · 8713d0f1
      2017-09-03  Jeff Law  <law@redhat.com>
      
      	PR tree-optimization/64910
      	* tree-ssa-reassoc.c (reassociate_bb): For bitwise binary ops,
      	swap the first and last operand if the last is a constant.
      
      	PR tree-optimization/64910
      	* gcc.dg/tree-ssa/pr64910-2.c: New test.
      
      From-SVN: r251659
      Jeff Law committed
    • re PR sanitizer/82072 (sanitizer does not detect an overflow from LLONG_MIN) · 8d2b48ae
      	PR sanitizer/82072
      	* convert.c (do_narrow): When sanitizing signed integer overflows,
      	bail out for signed types.
      	(convert_to_integer_1) <case NEGATE_EXPR>: Likewise.
      
      	* c-c++-common/ubsan/pr82072.c: New test.
      
      From-SVN: r251651
      Marek Polacek committed
    • re PR tree-optimization/82060 (ICE in refs_may_alias_p_1 with devirtualization enabled) · e910a9b1
      2017-09-04  Richard Biener  <rguenther@suse.de>
      
      	PR tree-optimization/82060
      	* tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
      	Move devirtualization after stmt folding and before EH/AB/noreturn
      	cleanup to get the stmt refs canonicalized.  Use a bool instead
      	of gimple_modified_p since that doesn't work for NOPs.  Schedule
      	NOPs generated by folding for removal.
      
      	* g++.dg/torture/pr82060.C: New testcase.
      
      From-SVN: r251650
      Richard Biener committed
    • Turn FUNCTION_ARG_PADDING into a target hook · 76b0cbf8
      This involved renaming the rather general-sounding "enum direction" to
      "enum pad_direction" to avoid a conflict with the Fortran frontend.
      
      2017-09-04  Richard Sandiford  <richard.sandiford@linaro.org>
      	    Alan Hayward  <alan.hayward@arm.com>
      	    David Sherwood  <david.sherwood@arm.com>
      
      gcc/
      	* coretypes.h (pad_direction): New enum.
      	* defaults.h (DEFAULT_FUNCTION_ARG_PADDING): Delete.
      	(FUNCTION_ARG_PADDING): Likewise.
      	* target.def (function_arg_padding): New hook.
      	* targhooks.h (default_function_arg_padding): Declare.
      	* targhooks.c (default_function_arg_padding): New function.
      	* doc/tm.texi.in (FUNCTION_ARG_PADDING): Replace with...
      	(TARGET_FUNCTION_ARG_PADDING): ...this.
      	* doc/tm.texi: Regenerate.
      	* calls.c (store_unaligned_arguments_into_pseudos): Use pad_direction
      	instead of direction.
      	(compute_argument_addresses): Likewise.
      	(load_register_parameters): Likewise.
      	(emit_library_call_value_1): Likewise.
      	(store_one_arg): Use targetm.calls.function_arg_padding instead
      	of FUNCTION_ARG_PADDING.
      	(must_pass_in_stack_var_size_or_pad): Likewise.
      	* expr.c (emit_group_load_1): Use pad_direction instead of direction.
      	(emit_group_store): Likewise.
      	(emit_single_push_insn_1): Use targetm.calls.function_arg_padding
      	instead of FUNCTION_ARG_PADDING.
      	(emit_push_insn): Likewise, and propagate enum change throughout
      	function.
      	* function.h (direction): Delete.
      	(locate_and_pad_arg_data::where_pad): Use pad_direction instead
      	of direction.
      	* function.c (assign_parm_find_stack_rtl): Likewise.
      	(assign_parm_setup_block_p): Likewise.
      	(assign_parm_setup_block): Likewise.
      	(gimplify_parameters): Likewise.
      	(locate_and_pad_parm): Use targetm.calls.function_arg_padding
      	instead of FUNCTION_ARG_PADDING, and propagate enum change throughout
      	function.
      	* config/aarch64/aarch64.h (FUNCTION_ARG_PADDING): Delete.
      	(BLOCK_REG_PADDING): Use pad_direction instead of direction.
      	* config/aarch64/aarch64-protos.h (aarch64_pad_arg_upward): Delete.
      	* config/aarch64/aarch64.c (aarch64_pad_arg_upward): Replace with...
      	(aarch64_function_arg_padding): ...this new function.
      	(aarch64_gimplify_va_arg_expr): Use pad_direction instead of direction.
      	(TARGET_FUNCTION_ARG_PADDING): Redefine.
      	* config/arm/arm.h (FUNCTION_ARG_PADDING): Delete.
      	(BLOCK_REG_PADDING): Use pad_direction instead of direction.
      	* config/arm/arm-protos.h (arm_pad_arg_upward): Delete.
      	* config/arm/arm.c (TARGET_FUNCTION_ARG_PADDING): Redefine.
      	(arm_pad_arg_upward): Replace with...
      	(arm_function_arg_padding): ...this new function.
      	* config/c6x/c6x.h (BLOCK_REG_PADDING): Use pad_direction instead
      	of direction.
      	* config/ia64/hpux.h (FUNCTION_ARG_PADDING): Delete.
      	* config/ia64/ia64-protos.h (ia64_hpux_function_arg_padding): Delete.
      	* config/ia64/ia64.c (TARGET_FUNCTION_ARG_PADDING): Redefine.
      	(ia64_hpux_function_arg_padding): Replace with...
      	(ia64_function_arg_padding): ...this new function.  Use pad_direction
      	instead of direction.  Check for TARGET_HPUX.
      	* config/iq2000/iq2000.h (FUNCTION_ARG_PADDING): Delete.
      	* config/iq2000/iq2000.c (TARGET_FUNCTION_ARG_PADDING): Redefine.
      	(iq2000_function_arg_padding): New function.
      	* config/mips/mips-protos.h (mips_pad_arg_upward): Delete.
      	* config/mips/mips.c (mips_pad_arg_upward): Replace with...
      	(mips_function_arg_padding): ...this new function.
      	(mips_pad_reg_upward): Update accordingly.
      	(TARGET_FUNCTION_ARG_PADDING): Redefine.
      	* config/mips/mips.h (PAD_VARARGS_DOWN): Use
      	targetm.calls.function_arg_padding.
      	(FUNCTION_ARG_PADDING): Delete.
      	(BLOCK_REG_PADDING): Use pad_direction instead of direction.
      	* config/nios2/nios2.h (FUNCTION_ARG_PADDING): Delete.
      	(PAD_VARARGS_DOWN): Use targetm.calls.function_arg_padding.
      	* config/nios2/nios2-protos.h (nios2_function_arg_padding): Delete.
      	(nios2_block_reg_padding): Return pad_direction instead of direction.
      	* config/nios2/nios2.c (nios2_block_reg_padding): Return pad_direction
      	instead of direction.
      	(nios2_function_arg_padding): Likewise.  Make static.
      	(TARGET_FUNCTION_ARG_PADDING): Redefine.
      	* config/pa/pa.h (FUNCTION_ARG_PADDING): Delete.
      	(BLOCK_REG_PADDING): Use targetm.calls.function_arg_padding.
      	* config/pa/pa-protos.h (pa_function_arg_padding): Delete.
      	* config/pa/pa.c (TARGET_FUNCTION_ARG_PADDING): Redefine.
      	(pa_function_arg_padding): Make static.  Return pad_direction instead
      	of direction.
      	* config/powerpcspe/powerpcspe.h (FUNCTION_ARG_PADDING): Delete.
      	(PAD_VARARGS_DOWN): Use targetm.calls.function_arg_padding.
      	* config/powerpcspe/aix.h (BLOCK_REG_PADDING): Use pad_direction
      	instead of direction.  Use targetm.calls.function_arg_padding.
      	* config/powerpcspe/darwin.h (BLOCK_REG_PADDING): Likewise.
      	* config/powerpcspe/freebsd64.h (BLOCK_REG_PADDING): Likewise.
      	* config/powerpcspe/linux64.h (BLOCK_REG_PADDING): Likewise.
      	* config/powerpcspe/powerpcspe-protos.h (function_arg_padding): Delete.
      	* config/powerpcspe/powerpcspe.c (TARGET_FUNCTION_ARG_PADDING):
      	Redefine.
      	(function_arg_padding): Rename to...
      	(rs6000_function_arg_padding): ...this.  Make static.  Return
      	pad_direction instead of direction.
      	(rs6000_return_in_msb): Use rs6000_function_arg_padding.
      	* config/rs6000/rs6000.h (FUNCTION_ARG_PADDING): Delete.
      	(PAD_VARARGS_DOWN): Use targetm.calls.function_arg_padding.
      	* config/rs6000/aix.h (BLOCK_REG_PADDING): Use pad_direction
      	instead of direction.  Use targetm.calls.function_arg_padding.
      	* config/rs6000/darwin.h (BLOCK_REG_PADDING): Likewise.
      	* config/rs6000/freebsd64.h (BLOCK_REG_PADDING): Likewise.
      	* config/rs6000/linux64.h (BLOCK_REG_PADDING): Likewise.
      	* config/rs6000/rs6000-protos.h (function_arg_padding): Delete.
      	* config/rs6000/rs6000.c (TARGET_FUNCTION_ARG_PADDING): Redefine.
      	(function_arg_padding): Rename to...
      	(rs6000_function_arg_padding): ...this.  Make static.  Return
      	pad_direction instead of direction.
      	(rs6000_return_in_msb): Use rs6000_function_arg_padding.
      	* config/s390/s390.h (FUNCTION_ARG_PADDING): Delete.
      	* config/s390/s390.c (s390_function_arg_padding): New function.
      	(TARGET_FUNCTION_ARG_PADDING): Redefine.
      	* config/sparc/sparc.h (FUNCTION_ARG_PADDING): Delete.
      	* config/sparc/sparc-protos.h (function_arg_padding): Delete.
      	* config/sparc/sparc.c (TARGET_FUNCTION_ARG_PADDING): Redefine.
      	(function_arg_padding): Rename to...
      	(sparc_function_arg_padding): ...this.  Make static.  Return
      	pad_direction instead of direction.
      	* config/spu/spu.h (FUNCTION_ARG_PADDING): Delete.
      	* config/spu/spu.c (spu_function_arg_padding): New function.
      	(TARGET_FUNCTION_ARG_PADDING): Redefine.
      	* system.h (FUNCTION_ARG_PADDING): Poison.
      
      Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
      Co-Authored-By: David Sherwood <david.sherwood@arm.com>
      
      From-SVN: r251648
      Richard Sandiford committed