Index: gcc/targhooks.c =================================================================== --- gcc/targhooks.c (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/targhooks.c (.../branches/gcc-4_6-branch) (wersja 185440) @@ -529,6 +529,7 @@ case scalar_to_vec: case cond_branch_not_taken: case vec_perm: + case vec_promote_demote: return 1; case unaligned_load: Index: gcc/DATESTAMP =================================================================== --- gcc/DATESTAMP (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/DATESTAMP (.../branches/gcc-4_6-branch) (wersja 185440) @@ -1 +1 @@ -20120301 +20120315 Index: gcc/target.h =================================================================== --- gcc/target.h (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/target.h (.../branches/gcc-4_6-branch) (wersja 185440) @@ -128,7 +128,8 @@ scalar_to_vec, cond_branch_not_taken, cond_branch_taken, - vec_perm + vec_perm, + vec_promote_demote }; /* Sets of optimization levels at which an option may be enabled by Index: gcc/DEV-PHASE =================================================================== --- gcc/DEV-PHASE (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/DEV-PHASE (.../branches/gcc-4_6-branch) (wersja 185440) @@ -0,0 +1 @@ +prerelease Index: gcc/ChangeLog =================================================================== --- gcc/ChangeLog (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/ChangeLog (.../branches/gcc-4_6-branch) (wersja 185440) @@ -1,3 +1,101 @@ +2012-03-15 Chung-Lin Tang + + Backport from mainline + 2012-03-10 Chung-Lin Tang + + PR rtl-optimization/52528 + * combine.c (can_combine_p): Add setting of subst_low_luid + before call to expand_field_assignment(). + +2012-03-12 John David Anglin + + Backport from mainline + 2011-09-03 John David Anglin + + PR Bug middle-end/50232 + * config/pa/pa.md (return): Define "return" insn pattern. + (epilogue): Use it when no epilogue is needed. + * config/pa/pa.c (pa_can_use_return_insn): New function. + * config/pa/pa-protos.h (pa_can_use_return_insn): Declare. + + Backport for mainline + 2012-01-28 John David Anglin + + PR target/51871 + * config/pa/pa.c (pa_return_addr_rtx): Add support for PA2.0 export + stubs. + +2012-03-06 Michael Meissner + + Backport from mainline + PR target/50310 + * config/rs6000/vector.md (vector_uneq): Add support for + UNEQ, LTGT, ORDERED, and UNORDERED IEEE vector comparisons. + (vector_ltgt): Likewise. + (vector_ordered): Likewise. + (vector_unordered): Likewise. + * config/rs6000/rs6000.c (rs6000_emit_vector_compare_inner): + Likewise. + +2012-03-04 John David Anglin + + Backport from mainline + 2012-03-01 John David Anglin + + PR target/52408 + * config/pa/pa.md (zvdep_imm32): Change type of variable x from int to + unsigned HOST_WIDE_INT. + (zvdep_imm64): Likewise. + (vdepi_ior): Change type of variable x from int to HOST_WIDE_INT. + (vdepi_and): Likewise. + Likewise for unamed 64-bit patterns. + * config/pa/predicates.md (lhs_lshift_cint_operand): Update comment. + +2012-03-03 Eric Botcazou + + PR target/52425 + Backport from mainline + 2011-05-22 Eric Botcazou + + * config/sparc/sparc.c (sparc_delegitimize_address): Handle + UNSPEC_MOVE_PIC pattern. + +2012-03-02 Peter Bergner + + Backport from mainline + 2012-03-02 Peter Bergner + + * config/rs6000/vsx.md (vsx_set_): Reorder operands. + +2012-03-02 Bill Schmidt + Ira Rosen + + PR tree-optimization/50031 + PR tree-optimization/50969 + * targhooks.c (default_builtin_vectorization_cost): Handle + vec_promote_demote. + * target.h (enum vect_cost_for_stmt): Add vec_promote_demote. + * tree-vect-loop.c (vect_get_single_scalar_iteraion_cost): Handle + all types of reduction and pattern statements. + (vect_estimate_min_profitable_iters): Likewise. + * tree-vect-stmts.c (vect_model_promotion_demotion_cost): New function. + (vect_model_store_cost): Use vec_perm rather than vector_stmt for + statement cost. + (vect_model_load_cost): Likewise. + (vect_get_load_cost): Likewise; add dump logic for explicit realigns. + (vectorizable_type_demotion): Call vect_model_promotion_demotion_cost. + (vectorizable_type_promotion): Likewise. + * config/spu/spu.c (spu_builtin_vectorization_cost): Handle + vec_promote_demote. + * config/i386/i386.c (ix86_builtin_vectorization_cost): Likewise. + * config/rs6000/rs6000.c (rs6000_builtin_vectorization_cost): Update + vec_perm for VSX and handle vec_promote_demote. + +2012-03-01 Jakub Jelinek + + * BASE-VER: Set to 4.6.4. + * DEV-PHASE: Set to prerelease. + 2012-03-01 Release Manager * GCC 4.6.3 released. Index: gcc/testsuite/gcc.target/powerpc/pr52457.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/pr52457.c (.../tags/gcc_4_6_3_release) (wersja 0) +++ gcc/testsuite/gcc.target/powerpc/pr52457.c (.../branches/gcc-4_6-branch) (wersja 185440) @@ -0,0 +1,34 @@ +/* { dg-do run { target { powerpc*-*-linux* } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */ +/* { dg-require-effective-target vsx_hw } */ +/* { dg-options "-O1 -mcpu=power7" } */ + +extern void abort (void); + +typedef long long T; +typedef T vl_t __attribute__((vector_size(2 * sizeof (T)))); + +vl_t +buggy_func (T x) +{ + vl_t w; + T *p = (T *)&w; + p[0] = p[1] = x; + return w; +} + +int +main(void) +{ + vl_t rval; + T *pl; + + pl = (T *) &rval; + rval = buggy_func (2); + + if (pl[0] != 2 || pl[1] != 2) + abort (); + + return 0; +} Index: gcc/testsuite/gfortran.dg/intrinsic_8.f90 =================================================================== --- gcc/testsuite/gfortran.dg/intrinsic_8.f90 (.../tags/gcc_4_6_3_release) (wersja 0) +++ gcc/testsuite/gfortran.dg/intrinsic_8.f90 (.../branches/gcc-4_6-branch) (wersja 185440) @@ -0,0 +1,23 @@ +! { dg-do compile } +! +! PR fortran/52452 +! +! Contributed by Roger Ferrer Ibanez +! +PROGRAM test_etime + IMPLICIT NONE + INTRINSIC :: etime + REAL(4) :: tarray(1:2) + REAL(4) :: result + + CALL etime(tarray, result) +END PROGRAM test_etime + +subroutine test_etime2 + IMPLICIT NONE + INTRINSIC :: etime + REAL(4) :: tarray(1:2) + REAL(4) :: result + + result = etime(tarray) +END subroutine test_etime2 Index: gcc/testsuite/gfortran.dg/proc_ptr_34.f90 =================================================================== --- gcc/testsuite/gfortran.dg/proc_ptr_34.f90 (.../tags/gcc_4_6_3_release) (wersja 0) +++ gcc/testsuite/gfortran.dg/proc_ptr_34.f90 (.../branches/gcc-4_6-branch) (wersja 185440) @@ -0,0 +1,79 @@ +! { dg-do compile } +! +! PR fortran/52469 +! +! This was failing as the DECL of the proc pointer "func" +! was used for the interface of the proc-pointer component "my_f_ptr" +! rather than the decl of the proc-pointer target +! +! Contributed by palott@gmail.com +! + +module ExampleFuncs + implicit none + + ! NOTE: "func" is a procedure pointer! + pointer :: func + interface + function func (z) + real :: func + real, intent (in) :: z + end function func + end interface + + type Contains_f_ptr + procedure (func), pointer, nopass :: my_f_ptr + end type Contains_f_ptr +contains + +function f1 (x) + real :: f1 + real, intent (in) :: x + + f1 = 2.0 * x + + return +end function f1 + +function f2 (x) + real :: f2 + real, intent (in) :: x + + f2 = 3.0 * x**2 + + return +end function f2 + +function fancy (func, x) + real :: fancy + real, intent (in) :: x + + interface AFunc + function func (y) + real :: func + real, intent (in) ::y + end function func + end interface AFunc + + fancy = func (x) + 3.3 * x +end function fancy + +end module ExampleFuncs + + +program test_proc_ptr + use ExampleFuncs + implicit none + + type (Contains_f_ptr), dimension (2) :: NewType + + !NewType(1) % my_f_ptr => f1 + NewType(2) % my_f_ptr => f2 + + !write (*, *) NewType(1) % my_f_ptr (3.0), NewType(2) % my_f_ptr (3.0) + write (6, *) NewType(2) % my_f_ptr (3.0) ! < Shall print '27.0' + + stop +end program test_proc_ptr + +! { dg-final { cleanup-modules "examplefuncs" } } Index: gcc/testsuite/ChangeLog =================================================================== --- gcc/testsuite/ChangeLog (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/testsuite/ChangeLog (.../branches/gcc-4_6-branch) (wersja 185440) @@ -1,3 +1,23 @@ +2012-03-10 Tobias Burnus + + PR fortran/52469 + * gfortran.dg/proc_ptr_34.f90: New. + +2012-03-06 Tobias Burnus + + Backport from mainline + 2012-03-02 Tobias Burnus + + PR fortran/52452 + * gfortran.dg/intrinsic_8.f90: New. + +2012-03-02 Peter Bergner + + Backport from mainline + 2012-03-02 Peter Bergner + + * gcc.target/powerpc/pr52457.c: New test. + 2012-03-01 Release Manager * GCC 4.6.3 released. Index: gcc/fortran/ChangeLog =================================================================== --- gcc/fortran/ChangeLog (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/fortran/ChangeLog (.../branches/gcc-4_6-branch) (wersja 185440) @@ -1,3 +1,18 @@ +2012-03-10 Tobias Burnus + + PR fortran/52469 + * trans-types.c (gfc_get_function_type): Handle backend_decl + of a procedure pointer. + +2012-03-06 Tobias Burnus + + Backport from mainline + 2012-03-02 Tobias Burnus + + PR fortran/52452 + * resolve.c (resolve_intrinsic): Don't search for a + function if we know that it is a subroutine. + 2012-03-01 Release Manager * GCC 4.6.3 released. Index: gcc/fortran/trans-types.c =================================================================== --- gcc/fortran/trans-types.c (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/fortran/trans-types.c (.../branches/gcc-4_6-branch) (wersja 185440) @@ -2519,7 +2519,11 @@ || sym->attr.flavor == FL_PROGRAM); if (sym->backend_decl) - return TREE_TYPE (sym->backend_decl); + { + if (sym->attr.proc_pointer) + return TREE_TYPE (TREE_TYPE (sym->backend_decl)); + return TREE_TYPE (sym->backend_decl); + } alternate_return = 0; typelist = NULL_TREE; Index: gcc/fortran/resolve.c =================================================================== --- gcc/fortran/resolve.c (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/fortran/resolve.c (.../branches/gcc-4_6-branch) (wersja 185440) @@ -1452,7 +1452,7 @@ if (sym->intmod_sym_id) isym = gfc_intrinsic_function_by_id ((gfc_isym_id) sym->intmod_sym_id); - else + else if (!sym->attr.subroutine) isym = gfc_find_function (sym->name); if (isym) Index: gcc/BASE-VER =================================================================== --- gcc/BASE-VER (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/BASE-VER (.../branches/gcc-4_6-branch) (wersja 185440) @@ -1 +1 @@ -4.6.3 +4.6.4 Index: gcc/tree-vect-loop.c =================================================================== --- gcc/tree-vect-loop.c (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/tree-vect-loop.c (.../branches/gcc-4_6-branch) (wersja 185440) @@ -2104,7 +2104,8 @@ if (stmt_info && !STMT_VINFO_RELEVANT_P (stmt_info) && (!STMT_VINFO_LIVE_P (stmt_info) - || STMT_VINFO_DEF_TYPE (stmt_info) != vect_reduction_def)) + || !VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE (stmt_info))) + && !STMT_VINFO_IN_PATTERN_P (stmt_info)) continue; if (STMT_VINFO_DATA_REF (vinfo_for_stmt (stmt))) @@ -2251,11 +2252,19 @@ { gimple stmt = gsi_stmt (si); stmt_vec_info stmt_info = vinfo_for_stmt (stmt); + + if (STMT_VINFO_IN_PATTERN_P (stmt_info)) + { + stmt = STMT_VINFO_RELATED_STMT (stmt_info); + stmt_info = vinfo_for_stmt (stmt); + } + /* Skip stmts that are not vectorized inside the loop. */ if (!STMT_VINFO_RELEVANT_P (stmt_info) && (!STMT_VINFO_LIVE_P (stmt_info) - || STMT_VINFO_DEF_TYPE (stmt_info) != vect_reduction_def)) + || !VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE (stmt_info)))) continue; + vec_inside_cost += STMT_VINFO_INSIDE_OF_LOOP_COST (stmt_info) * factor; /* FIXME: for stmts in the inner-loop in outer-loop vectorization, some of the "outside" costs are generated inside the outer-loop. */ Index: gcc/tree-vect-stmts.c =================================================================== --- gcc/tree-vect-stmts.c (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/tree-vect-stmts.c (.../branches/gcc-4_6-branch) (wersja 185440) @@ -623,6 +623,46 @@ } +/* Model cost for type demotion and promotion operations. PWR is normally + zero for single-step promotions and demotions. It will be one if + two-step promotion/demotion is required, and so on. Each additional + step doubles the number of instructions required. */ + +static void +vect_model_promotion_demotion_cost (stmt_vec_info stmt_info, + enum vect_def_type *dt, int pwr) +{ + int i, tmp; + int inside_cost = 0, outside_cost = 0, single_stmt_cost; + + /* The SLP costs were already calculated during SLP tree build. */ + if (PURE_SLP_STMT (stmt_info)) + return; + + single_stmt_cost = vect_get_stmt_cost (vec_promote_demote); + for (i = 0; i < pwr + 1; i++) + { + tmp = (STMT_VINFO_TYPE (stmt_info) == type_promotion_vec_info_type) ? + (i + 1) : i; + inside_cost += vect_pow2 (tmp) * single_stmt_cost; + } + + /* FORNOW: Assuming maximum 2 args per stmts. */ + for (i = 0; i < 2; i++) + { + if (dt[i] == vect_constant_def || dt[i] == vect_external_def) + outside_cost += vect_get_stmt_cost (vector_stmt); + } + + if (vect_print_dump_info (REPORT_COST)) + fprintf (vect_dump, "vect_model_promotion_demotion_cost: inside_cost = %d, " + "outside_cost = %d .", inside_cost, outside_cost); + + /* Set the costs in STMT_INFO. */ + stmt_vinfo_set_inside_of_loop_cost (stmt_info, NULL, inside_cost); + stmt_vinfo_set_outside_of_loop_cost (stmt_info, NULL, outside_cost); +} + /* Function vect_cost_strided_group_size For strided load or store, return the group_size only if it is the first @@ -691,7 +731,7 @@ { /* Uses a high and low interleave operation for each needed permute. */ inside_cost = ncopies * exact_log2(group_size) * group_size - * vect_get_stmt_cost (vector_stmt); + * vect_get_stmt_cost (vec_perm); if (vect_print_dump_info (REPORT_COST)) fprintf (vect_dump, "vect_model_store_cost: strided group_size = %d .", @@ -795,7 +835,7 @@ { /* Uses an even and odd extract operations for each needed permute. */ inside_cost = ncopies * exact_log2(group_size) * group_size - * vect_get_stmt_cost (vector_stmt); + * vect_get_stmt_cost (vec_perm); if (vect_print_dump_info (REPORT_COST)) fprintf (vect_dump, "vect_model_load_cost: strided group_size = %d .", @@ -855,7 +895,7 @@ case dr_explicit_realign: { *inside_cost += ncopies * (2 * vect_get_stmt_cost (vector_load) - + vect_get_stmt_cost (vector_stmt)); + + vect_get_stmt_cost (vec_perm)); /* FIXME: If the misalignment remains fixed across the iterations of the containing loop, the following cost should be added to the @@ -863,6 +903,9 @@ if (targetm.vectorize.builtin_mask_for_load) *inside_cost += vect_get_stmt_cost (vector_stmt); + if (vect_print_dump_info (REPORT_COST)) + fprintf (vect_dump, "vect_model_load_cost: explicit realign"); + break; } case dr_explicit_realign_optimized: @@ -886,7 +929,12 @@ } *inside_cost += ncopies * (vect_get_stmt_cost (vector_load) - + vect_get_stmt_cost (vector_stmt)); + + vect_get_stmt_cost (vec_perm)); + + if (vect_print_dump_info (REPORT_COST)) + fprintf (vect_dump, + "vect_model_load_cost: explicit realign optimized"); + break; } @@ -2919,7 +2967,7 @@ STMT_VINFO_TYPE (stmt_info) = type_demotion_vec_info_type; if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "=== vectorizable_demotion ==="); - vect_model_simple_cost (stmt_info, ncopies, dt, NULL); + vect_model_promotion_demotion_cost (stmt_info, dt, multi_step_cvt); return true; } @@ -3217,7 +3265,7 @@ STMT_VINFO_TYPE (stmt_info) = type_promotion_vec_info_type; if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "=== vectorizable_promotion ==="); - vect_model_simple_cost (stmt_info, 2*ncopies, dt, NULL); + vect_model_promotion_demotion_cost (stmt_info, dt, multi_step_cvt); return true; } Index: gcc/combine.c =================================================================== --- gcc/combine.c (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/combine.c (.../branches/gcc-4_6-branch) (wersja 185440) @@ -1788,6 +1788,10 @@ if (set == 0) return 0; + /* The simplification in expand_field_assignment may call back to + get_last_value, so set safe guard here. */ + subst_low_luid = DF_INSN_LUID (insn); + set = expand_field_assignment (set); src = SET_SRC (set), dest = SET_DEST (set); Index: gcc/config/spu/spu.c =================================================================== --- gcc/config/spu/spu.c (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/config/spu/spu.c (.../branches/gcc-4_6-branch) (wersja 185440) @@ -6794,6 +6794,7 @@ case scalar_to_vec: case cond_branch_not_taken: case vec_perm: + case vec_promote_demote: return 1; case scalar_store: Index: gcc/config/sparc/sparc.c =================================================================== --- gcc/config/sparc/sparc.c (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/config/sparc/sparc.c (.../branches/gcc-4_6-branch) (wersja 185440) @@ -3658,13 +3658,17 @@ { x = delegitimize_mem_from_attrs (x); - if (GET_CODE (x) == LO_SUM - && GET_CODE (XEXP (x, 1)) == UNSPEC - && XINT (XEXP (x, 1), 1) == UNSPEC_TLSLE) - { - x = XVECEXP (XEXP (x, 1), 0, 0); - gcc_assert (GET_CODE (x) == SYMBOL_REF); - } + if (GET_CODE (x) == LO_SUM && GET_CODE (XEXP (x, 1)) == UNSPEC) + switch (XINT (XEXP (x, 1), 1)) + { + case UNSPEC_MOVE_PIC: + case UNSPEC_TLSLE: + x = XVECEXP (XEXP (x, 1), 0, 0); + gcc_assert (GET_CODE (x) == SYMBOL_REF); + break; + default: + break; + } return x; } Index: gcc/config/i386/i386.c =================================================================== --- gcc/config/i386/i386.c (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/config/i386/i386.c (.../branches/gcc-4_6-branch) (wersja 185440) @@ -32823,7 +32823,8 @@ return ix86_cost->cond_not_taken_branch_cost; case vec_perm: - return 1; + case vec_promote_demote: + return ix86_cost->vec_stmt_cost; default: gcc_unreachable (); Index: gcc/config/rs6000/vector.md =================================================================== --- gcc/config/rs6000/vector.md (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/config/rs6000/vector.md (.../branches/gcc-4_6-branch) (wersja 185440) @@ -448,6 +448,94 @@ "VECTOR_UNIT_ALTIVEC_P (mode)" "") +(define_insn_and_split "*vector_uneq" + [(set (match_operand:VEC_F 0 "vfloat_operand" "") + (uneq:VEC_F (match_operand:VEC_F 1 "vfloat_operand" "") + (match_operand:VEC_F 2 "vfloat_operand" "")))] + "VECTOR_UNIT_ALTIVEC_OR_VSX_P (mode)" + "#" + "" + [(set (match_dup 3) + (gt:VEC_F (match_dup 1) + (match_dup 2))) + (set (match_dup 4) + (gt:VEC_F (match_dup 2) + (match_dup 1))) + (set (match_dup 0) + (not:VEC_F (ior:VEC_F (match_dup 3) + (match_dup 4))))] + " +{ + operands[3] = gen_reg_rtx (mode); + operands[4] = gen_reg_rtx (mode); +}") + +(define_insn_and_split "*vector_ltgt" + [(set (match_operand:VEC_F 0 "vfloat_operand" "") + (ltgt:VEC_F (match_operand:VEC_F 1 "vfloat_operand" "") + (match_operand:VEC_F 2 "vfloat_operand" "")))] + "VECTOR_UNIT_ALTIVEC_OR_VSX_P (mode)" + "#" + "" + [(set (match_dup 3) + (gt:VEC_F (match_dup 1) + (match_dup 2))) + (set (match_dup 4) + (gt:VEC_F (match_dup 2) + (match_dup 1))) + (set (match_dup 0) + (ior:VEC_F (match_dup 3) + (match_dup 4)))] + " +{ + operands[3] = gen_reg_rtx (mode); + operands[4] = gen_reg_rtx (mode); +}") + +(define_insn_and_split "*vector_ordered" + [(set (match_operand:VEC_F 0 "vfloat_operand" "") + (ordered:VEC_F (match_operand:VEC_F 1 "vfloat_operand" "") + (match_operand:VEC_F 2 "vfloat_operand" "")))] + "VECTOR_UNIT_ALTIVEC_OR_VSX_P (mode)" + "#" + "" + [(set (match_dup 3) + (ge:VEC_F (match_dup 1) + (match_dup 2))) + (set (match_dup 4) + (ge:VEC_F (match_dup 2) + (match_dup 1))) + (set (match_dup 0) + (ior:VEC_F (match_dup 3) + (match_dup 4)))] + " +{ + operands[3] = gen_reg_rtx (mode); + operands[4] = gen_reg_rtx (mode); +}") + +(define_insn_and_split "*vector_unordered" + [(set (match_operand:VEC_F 0 "vfloat_operand" "") + (unordered:VEC_F (match_operand:VEC_F 1 "vfloat_operand" "") + (match_operand:VEC_F 2 "vfloat_operand" "")))] + "VECTOR_UNIT_ALTIVEC_OR_VSX_P (mode)" + "#" + "" + [(set (match_dup 3) + (ge:VEC_F (match_dup 1) + (match_dup 2))) + (set (match_dup 4) + (ge:VEC_F (match_dup 2) + (match_dup 1))) + (set (match_dup 0) + (not:VEC_F (ior:VEC_F (match_dup 3) + (match_dup 4))))] + " +{ + operands[3] = gen_reg_rtx (mode); + operands[4] = gen_reg_rtx (mode); +}") + ;; Note the arguments for __builtin_altivec_vsel are op2, op1, mask ;; which is in the reverse order that we want (define_expand "vector_select_" Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/config/rs6000/rs6000.c (.../branches/gcc-4_6-branch) (wersja 185440) @@ -3695,12 +3695,23 @@ case vec_to_scalar: case scalar_to_vec: case cond_branch_not_taken: - case vec_perm: return 1; case cond_branch_taken: return 3; + case vec_perm: + if (TARGET_VSX) + return 4; + else + return 1; + + case vec_promote_demote: + if (TARGET_VSX) + return 5; + else + return 1; + case unaligned_load: if (TARGET_VSX && TARGET_ALLOW_MOVMISALIGN) { @@ -17229,6 +17240,10 @@ case EQ: case GT: case GTU: + case ORDERED: + case UNORDERED: + case UNEQ: + case LTGT: mask = gen_reg_rtx (mode); emit_insn (gen_rtx_SET (VOIDmode, mask, Index: gcc/config/rs6000/vsx.md =================================================================== --- gcc/config/rs6000/vsx.md (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/config/rs6000/vsx.md (.../branches/gcc-4_6-branch) (wersja 185440) @@ -1006,9 +1006,9 @@ "VECTOR_MEM_VSX_P (mode)" { if (INTVAL (operands[3]) == 0) - return \"xxpermdi %x0,%x1,%x2,1\"; + return \"xxpermdi %x0,%x2,%x1,1\"; else if (INTVAL (operands[3]) == 1) - return \"xxpermdi %x0,%x2,%x1,0\"; + return \"xxpermdi %x0,%x1,%x2,0\"; else gcc_unreachable (); } Index: gcc/config/pa/predicates.md =================================================================== --- gcc/config/pa/predicates.md (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/config/pa/predicates.md (.../branches/gcc-4_6-branch) (wersja 185440) @@ -421,9 +421,9 @@ (ior (match_operand 0 "register_operand") (match_operand 0 "cint_ior_operand"))) -;; True iff OP is a CONST_INT of the forms 0...0xxxx or -;; 0...01...1xxxx. Such values can be the left hand side x in (x << -;; r), using the zvdepi instruction. +;; True iff OP is a CONST_INT of the forms 0...0xxxx, 0...01...1xxxx, +;; or 1...1xxxx. Such values can be the left hand side x in (x << r), +;; using the zvdepi instruction. (define_predicate "lhs_lshift_cint_operand" (match_code "const_int") Index: gcc/config/pa/pa.md =================================================================== --- gcc/config/pa/pa.md (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/config/pa/pa.md (.../branches/gcc-4_6-branch) (wersja 185440) @@ -6348,7 +6348,7 @@ "" "* { - int x = INTVAL (operands[1]); + unsigned HOST_WIDE_INT x = UINTVAL (operands[1]); operands[2] = GEN_INT (4 + exact_log2 ((x >> 4) + 1)); operands[1] = GEN_INT ((x & 0xf) - 0x10); return \"{zvdepi %1,%2,%0|depwi,z %1,%%sar,%2,%0}\"; @@ -6366,7 +6366,7 @@ "exact_log2 (INTVAL (operands[1]) + 1) > 0" "* { - int x = INTVAL (operands[1]); + HOST_WIDE_INT x = INTVAL (operands[1]); operands[2] = GEN_INT (exact_log2 (x + 1)); return \"{vdepi -1,%2,%0|depwi -1,%%sar,%2,%0}\"; }" @@ -6383,7 +6383,7 @@ "INTVAL (operands[1]) == -2" "* { - int x = INTVAL (operands[1]); + HOST_WIDE_INT x = INTVAL (operands[1]); operands[2] = GEN_INT (exact_log2 ((~x) + 1)); return \"{vdepi 0,%2,%0|depwi 0,%%sar,%2,%0}\"; }" @@ -6447,7 +6447,7 @@ "TARGET_64BIT" "* { - int x = INTVAL (operands[1]); + unsigned HOST_WIDE_INT x = UINTVAL (operands[1]); operands[2] = GEN_INT (4 + exact_log2 ((x >> 4) + 1)); operands[1] = GEN_INT ((x & 0x1f) - 0x20); return \"depdi,z %1,%%sar,%2,%0\"; @@ -6465,7 +6465,7 @@ "TARGET_64BIT && exact_log2 (INTVAL (operands[1]) + 1) > 0" "* { - int x = INTVAL (operands[1]); + HOST_WIDE_INT x = INTVAL (operands[1]); operands[2] = GEN_INT (exact_log2 (x + 1)); return \"depdi -1,%%sar,%2,%0\"; }" @@ -6482,7 +6482,7 @@ "TARGET_64BIT && INTVAL (operands[1]) == -2" "* { - int x = INTVAL (operands[1]); + HOST_WIDE_INT x = INTVAL (operands[1]); operands[2] = GEN_INT (exact_log2 ((~x) + 1)); return \"depdi 0,%%sar,%2,%0\"; }" @@ -6671,6 +6671,20 @@ ;; Unconditional and other jump instructions. +;; Trivial return used when no epilogue is needed. +(define_insn "return" + [(return) + (use (reg:SI 2))] + "pa_can_use_return_insn ()" + "* +{ + if (TARGET_PA_20) + return \"bve%* (%%r2)\"; + return \"bv%* %%r0(%%r2)\"; +}" + [(set_attr "type" "branch") + (set_attr "length" "4")]) + ;; This is used for most returns. (define_insn "return_internal" [(return) @@ -6719,11 +6733,8 @@ rtx x; /* Try to use the trivial return first. Else use the full epilogue. */ - if (reload_completed - && !frame_pointer_needed - && !df_regs_ever_live_p (2) - && (compute_frame_size (get_frame_size (), 0) ? 0 : 1)) - x = gen_return_internal (); + if (pa_can_use_return_insn ()) + x = gen_return (); else { hppa_expand_epilogue (); Index: gcc/config/pa/pa-protos.h =================================================================== --- gcc/config/pa/pa-protos.h (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/config/pa/pa-protos.h (.../branches/gcc-4_6-branch) (wersja 185440) @@ -136,6 +136,7 @@ extern int cint_ok_for_move (HOST_WIDE_INT); extern void hppa_expand_prologue (void); extern void hppa_expand_epilogue (void); +extern bool pa_can_use_return_insn (void); extern int ior_mask_p (unsigned HOST_WIDE_INT); extern void compute_zdepdi_operands (unsigned HOST_WIDE_INT, unsigned *); Index: gcc/config/pa/pa.c =================================================================== --- gcc/config/pa/pa.c (.../tags/gcc_4_6_3_release) (wersja 185440) +++ gcc/config/pa/pa.c (.../branches/gcc-4_6-branch) (wersja 185440) @@ -4442,6 +4442,24 @@ } } +bool +pa_can_use_return_insn (void) +{ + if (!reload_completed) + return false; + + if (frame_pointer_needed) + return false; + + if (df_regs_ever_live_p (2)) + return false; + + if (crtl->profile) + return false; + + return compute_frame_size (get_frame_size (), 0) == 0; +} + rtx hppa_pic_save_rtx (void) { @@ -4586,7 +4604,7 @@ rtx saved_rp; rtx ins; - /* Instruction stream at the normal return address for the export stub: + /* The instruction stream at the return address of a PA1.X export stub is: 0x4bc23fd1 | stub+8: ldw -18(sr0,sp),rp 0x004010a1 | stub+12: ldsid (sr0,rp),r1 @@ -4594,11 +4612,17 @@ 0xe0400002 | stub+20: be,n 0(sr0,rp) 0xe0400002 must be specified as -532676606 so that it won't be - rejected as an invalid immediate operand on 64-bit hosts. */ + rejected as an invalid immediate operand on 64-bit hosts. - HOST_WIDE_INT insns[4] = {0x4bc23fd1, 0x004010a1, 0x00011820, -532676606}; - int i; + The instruction stream at the return address of a PA2.0 export stub is: + 0x4bc23fd1 | stub+8: ldw -18(sr0,sp),rp + 0xe840d002 | stub+12: bve,n (rp) + */ + + HOST_WIDE_INT insns[4]; + int i, len; + if (count != 0) return NULL_RTX; @@ -4620,11 +4644,26 @@ ins = copy_to_reg (gen_rtx_AND (Pmode, rp, MASK_RETURN_ADDR)); label = gen_label_rtx (); + if (TARGET_PA_20) + { + insns[0] = 0x4bc23fd1; + insns[1] = -398405630; + len = 2; + } + else + { + insns[0] = 0x4bc23fd1; + insns[1] = 0x004010a1; + insns[2] = 0x00011820; + insns[3] = -532676606; + len = 4; + } + /* Check the instruction stream at the normal return address for the export stub. If it is an export stub, than our return address is really in -24[frameaddr]. */ - for (i = 0; i < 3; i++) + for (i = 0; i < len; i++) { rtx op0 = gen_rtx_MEM (SImode, plus_constant (ins, i * 4)); rtx op1 = GEN_INT (insns[i]); Index: libstdc++-v3/include/debug/safe_iterator.h =================================================================== --- libstdc++-v3/include/debug/safe_iterator.h (.../tags/gcc_4_6_3_release) (wersja 185440) +++ libstdc++-v3/include/debug/safe_iterator.h (.../branches/gcc-4_6-branch) (wersja 185440) @@ -1,6 +1,6 @@ // Safe iterator implementation -*- C++ -*- -// Copyright (C) 2003, 2004, 2005, 2006, 2009, 2010, 2011 +// Copyright (C) 2003, 2004, 2005, 2006, 2009, 2010, 2011, 2012 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -142,7 +142,25 @@ ._M_iterator(__x, "other")); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ /** + * @brief Move construction. + * @post __x is singular and unattached + */ + _Safe_iterator(_Safe_iterator&& __x) : _M_current() + { + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() + || __x._M_current == _Iterator(), + _M_message(__msg_init_copy_singular) + ._M_iterator(*this, "this") + ._M_iterator(__x, "other")); + std::swap(_M_current, __x._M_current); + this->_M_attach(__x._M_sequence); + __x._M_detach(); + } +#endif + + /** * @brief Converting constructor from a mutable iterator to a * constant iterator. */ @@ -181,7 +199,28 @@ return *this; } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ /** + * @brief Move assignment. + * @post __x is singular and unattached + */ + _Safe_iterator& + operator=(_Safe_iterator&& __x) + { + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() + || __x._M_current == _Iterator(), + _M_message(__msg_copy_singular) + ._M_iterator(*this, "this") + ._M_iterator(__x, "other")); + _M_current = __x._M_current; + _M_attach(__x._M_sequence); + __x._M_detach(); + __x._M_current = _Iterator(); + return *this; + } +#endif + + /** * @brief Iterator dereference. * @pre iterator is dereferenceable */ @@ -415,7 +454,9 @@ /// Is this iterator equal to the sequence's before_begin() iterator if /// any? bool _M_is_before_begin() const - { return _BeforeBeginHelper<_Sequence>::_M_Is(base(), _M_get_sequence()); } + { + return _BeforeBeginHelper<_Sequence>::_M_Is(base(), _M_get_sequence()); + } }; template Index: libstdc++-v3/ChangeLog =================================================================== --- libstdc++-v3/ChangeLog (.../tags/gcc_4_6_3_release) (wersja 185440) +++ libstdc++-v3/ChangeLog (.../branches/gcc-4_6-branch) (wersja 185440) @@ -1,3 +1,10 @@ +2012-03-08 Jonathan Wakely + + PR libstdc++/52433 + * include/debug/safe_iterator.h (_Safe_iterator): Add move + constructor and move assignment operator. + * testsuite/23_containers/vector/debug/52433.cc: New. + 2012-03-01 Release Manager * GCC 4.6.3 released. Index: libstdc++-v3/testsuite/23_containers/vector/debug/52433.cc =================================================================== --- libstdc++-v3/testsuite/23_containers/vector/debug/52433.cc (.../tags/gcc_4_6_3_release) (wersja 0) +++ libstdc++-v3/testsuite/23_containers/vector/debug/52433.cc (.../branches/gcc-4_6-branch) (wersja 185440) @@ -0,0 +1,43 @@ +// Copyright (C) 2012 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . +// +// { dg-require-debug-mode "" } +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// PR libstdc++/52433 + +#include + +struct X +{ + std::vector::iterator i; + + X() = default; + X(const X&) = default; + X(X&&) = default; + X& operator=(const X&) = default; + X& operator=(X&&) = default; +}; + +X test01() +{ + X x; + x = X(); + return x; +} + Index: boehm-gc/configure.ac =================================================================== --- boehm-gc/configure.ac (.../tags/gcc_4_6_3_release) (wersja 185440) +++ boehm-gc/configure.ac (.../branches/gcc-4_6-branch) (wersja 185440) @@ -392,6 +392,7 @@ oldLIBS="$LIBS" LIBS="$LIBS $THREADLIBS" AC_CHECK_FUNCS([pthread_getattr_np]) +AC_CHECK_FUNCS([pthread_get_stackaddr_np]) LIBS="$oldLIBS" # Configuration of machine-dependent code Index: boehm-gc/include/gc_config.h.in =================================================================== --- boehm-gc/include/gc_config.h.in (.../tags/gcc_4_6_3_release) (wersja 185440) +++ boehm-gc/include/gc_config.h.in (.../branches/gcc-4_6-branch) (wersja 185440) @@ -87,6 +87,9 @@ /* Define to 1 if you have the `pthread_getattr_np' function. */ #undef HAVE_PTHREAD_GETATTR_NP +/* Define to 1 if you have the `pthread_get_stackaddr_np_np' function. */ +#undef HAVE_PTHREAD_GET_STACKADDR_NP + /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H Index: boehm-gc/include/private/gcconfig.h =================================================================== --- boehm-gc/include/private/gcconfig.h (.../tags/gcc_4_6_3_release) (wersja 185440) +++ boehm-gc/include/private/gcconfig.h (.../branches/gcc-4_6-branch) (wersja 185440) @@ -1331,7 +1331,11 @@ These aren't used when dyld support is enabled (it is by default) */ # define DATASTART ((ptr_t) get_etext()) # define DATAEND ((ptr_t) get_end()) -# define STACKBOTTOM ((ptr_t) 0xc0000000) +# ifdef HAVE_PTHREAD_GET_STACKADDR_NP +# define STACKBOTTOM (ptr_t)pthread_get_stackaddr_np(pthread_self()) +# else +# define STACKBOTTOM ((ptr_t) 0xc0000000) +# endif # define USE_MMAP # define USE_MMAP_ANON # define USE_ASM_PUSH_REGS @@ -2011,7 +2015,11 @@ These aren't used when dyld support is enabled (it is by default) */ # define DATASTART ((ptr_t) get_etext()) # define DATAEND ((ptr_t) get_end()) -# define STACKBOTTOM ((ptr_t) 0x7fff5fc00000) +# ifdef HAVE_PTHREAD_GET_STACKADDR_NP +# define STACKBOTTOM (ptr_t)pthread_get_stackaddr_np(pthread_self()) +# else +# define STACKBOTTOM ((ptr_t) 0x7fff5fc00000) +# endif # define USE_MMAP # define USE_MMAP_ANON # ifdef GC_DARWIN_THREADS Index: boehm-gc/ChangeLog =================================================================== --- boehm-gc/ChangeLog (.../tags/gcc_4_6_3_release) (wersja 185440) +++ boehm-gc/ChangeLog (.../branches/gcc-4_6-branch) (wersja 185440) @@ -1,3 +1,17 @@ +2012-03-02 Jack Howarth + + Backport from mainline + 2012-02-23 Patrick Marlier + Jack Howarth + + PR boehm-gc/52179 + * include/gc_config.h.in: Undefine HAVE_PTHREAD_GET_STACKADDR_NP. + * include/private/gcconfig.h (DARWIN): Define STACKBOTTOM with + pthread_get_stackaddr_np when available. + * configure.ac (THREADS): Check availability of + pthread_get_stackaddr_np. + * configure: Regenerate. + 2012-03-01 Release Manager * GCC 4.6.3 released. Index: boehm-gc/configure =================================================================== --- boehm-gc/configure (.../tags/gcc_4_6_3_release) (wersja 185440) +++ boehm-gc/configure (.../branches/gcc-4_6-branch) (wersja 185440) @@ -15246,6 +15246,17 @@ fi done +for ac_func in pthread_get_stackaddr_np +do : + ac_fn_c_check_func "$LINENO" "pthread_get_stackaddr_np" "ac_cv_func_pthread_get_stackaddr_np" +if test "x$ac_cv_func_pthread_get_stackaddr_np" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_PTHREAD_GET_STACKADDR_NP 1 +_ACEOF + +fi +done + LIBS="$oldLIBS" # Configuration of machine-dependent code Index: libjava/configure.ac =================================================================== --- libjava/configure.ac (.../tags/gcc_4_6_3_release) (wersja 185440) +++ libjava/configure.ac (.../branches/gcc-4_6-branch) (wersja 185440) @@ -886,14 +886,9 @@ SYSTEMSPEC="-lunicows $SYSTEMSPEC" fi ;; - *-*-darwin9*) + *-*-darwin[[912]]*) SYSTEMSPEC="%{!Zdynamiclib:%{!Zbundle:-allow_stack_execute}}" ;; - *-*-darwin[[12]]*) - # Something is incompatible with pie, would be nice to fix it and - # remove -no_pie. PR49461 - SYSTEMSPEC="-no_pie %{!Zdynamiclib:%{!Zbundle:-allow_stack_execute}}" - ;; *) SYSTEMSPEC= ;; Index: libjava/ChangeLog =================================================================== --- libjava/ChangeLog (.../tags/gcc_4_6_3_release) (wersja 185440) +++ libjava/ChangeLog (.../branches/gcc-4_6-branch) (wersja 185440) @@ -1,3 +1,13 @@ +2012-03-02 Jack Howarth + + Backport from mainline + 2012-02-23 Patrick Marlier + Jack Howarth + + PR target/49461 + * configure.ac (SYSTEMSPEC): No longer pass -no_pie for darwin11. + * configure: Regenerate. + 2012-03-01 Release Manager * GCC 4.6.3 released. Index: libjava/configure =================================================================== --- libjava/configure (.../tags/gcc_4_6_3_release) (wersja 185440) +++ libjava/configure (.../branches/gcc-4_6-branch) (wersja 185440) @@ -19775,14 +19775,9 @@ SYSTEMSPEC="-lunicows $SYSTEMSPEC" fi ;; - *-*-darwin9*) + *-*-darwin[912]*) SYSTEMSPEC="%{!Zdynamiclib:%{!Zbundle:-allow_stack_execute}}" ;; - *-*-darwin[12]*) - # Something is incompatible with pie, would be nice to fix it and - # remove -no_pie. PR49461 - SYSTEMSPEC="-no_pie %{!Zdynamiclib:%{!Zbundle:-allow_stack_execute}}" - ;; *) SYSTEMSPEC= ;;