Re: [Patch][gcc-4_7-branch] Backport trunk revision 187838 into gcc-4_7-branch
2013/5/19 Ian Lance Taylor : > On Fri, May 17, 2013 at 7:29 PM, Chung-Ju Wu wrote: >> Ping: http://gcc.gnu.org/ml/gcc-patches/2013-05/msg00429.html >> >> The patch is to fix dependency issue of libgcc Makefile.in >> by adding 'rm libgcc_tm.stamp' in the clean rule. >> >> That was fixed on main trunk (r187838) but not on gcc-4_7-branch. >> Since gcc-4_7-branch is still open, is it OK to backport r187838 >> into gcc-4_7-branch? > > It's OK with me but in general I think the release managers need to > approve backports. > > Ian Thanks Ian's approval for the libgcc part. Hi, Richard, here is the mail for my patch: http://gcc.gnu.org/ml/gcc-patches/2013-05/msg00429.html The patch doesn't add any new feature to gcc-4_7-branch. It just fixes the dependency issue in libgcc Makefile.in. Is it OK to do backport? Best regards, jasonwucj
Re: [patch] install host specific {bits,ext}/opt_random.h headers in host specific c++ incdir
Tests that now fail, but worked before: ext/random/arcsine_distribution/cons/default.cc (test for excess errors) ext/random/arcsine_distribution/cons/parms.cc (test for excess errors) ext/random/arcsine_distribution/operators/equal.cc (test for excess errors) ext/random/arcsine_distribution/operators/inequal.cc (test for excess errors) ext/random/arcsine_distribution/operators/serialize.cc (test for excess errors) ext/random/arcsine_distribution/requirements/explicit_instantiation/1.cc (test for excess errors) ext/random/arcsine_distribution/requirements/typedefs.cc (test for excess errors) ext/random/beta_distribution/cons/default.cc (test for excess errors) ext/random/beta_distribution/cons/parms.cc (test for excess errors) ext/random/beta_distribution/operators/equal.cc (test for excess errors) ext/random/beta_distribution/operators/inequal.cc (test for excess errors) ext/random/beta_distribution/operators/serialize.cc (test for excess errors) ext/random/beta_distribution/requirements/explicit_instantiation/1.cc (test for excess errors) ext/random/beta_distribution/requirements/typedefs.cc (test for excess errors) ext/random/hoyt_distribution/cons/default.cc (test for excess errors) ext/random/hoyt_distribution/cons/parms.cc (test for excess errors) ext/random/hoyt_distribution/operators/equal.cc (test for excess errors) ext/random/hoyt_distribution/operators/inequal.cc (test for excess errors) ext/random/hoyt_distribution/operators/serialize.cc (test for excess errors) ext/random/hoyt_distribution/requirements/explicit_instantiation/1.cc (test for excess errors) ext/random/hoyt_distribution/requirements/typedefs.cc (test for excess errors) ext/random/k_distribution/cons/default.cc (test for excess errors) ext/random/k_distribution/cons/parms.cc (test for excess errors) ext/random/k_distribution/operators/equal.cc (test for excess errors) ext/random/k_distribution/operators/inequal.cc (test for excess errors) ext/random/k_distribution/operators/serialize.cc (test for excess errors) ext/random/k_distribution/requirements/explicit_instantiation/1.cc (test for excess errors) ext/random/k_distribution/requirements/typedefs.cc (test for excess errors) ext/random/nakagami_distribution/cons/default.cc (test for excess errors) ext/random/nakagami_distribution/cons/parms.cc (test for excess errors) ext/random/nakagami_distribution/operators/equal.cc (test for excess errors) ext/random/nakagami_distribution/operators/inequal.cc (test for excess errors) ext/random/nakagami_distribution/operators/serialize.cc (test for excess errors) ext/random/nakagami_distribution/requirements/explicit_instantiation/1.cc (test for excess errors) ext/random/nakagami_distribution/requirements/typedefs.cc (test for excess errors) ext/random/normal_mv_distribution/cons/default.cc (test for excess errors) ext/random/normal_mv_distribution/cons/parms.cc (test for excess errors) ext/random/normal_mv_distribution/operators/equal.cc (test for excess errors) ext/random/normal_mv_distribution/operators/inequal.cc (test for excess errors) ext/random/normal_mv_distribution/operators/serialize.cc (test for excess errors) ext/random/normal_mv_distribution/requirements/explicit_instantiation/1.cc (test for excess errors) ext/random/normal_mv_distribution/requirements/typedefs.cc (test for excess errors) ext/random/pareto_distribution/cons/default.cc (test for excess errors) ext/random/pareto_distribution/cons/parms.cc (test for excess errors) ext/random/pareto_distribution/operators/equal.cc (test for excess errors) ext/random/pareto_distribution/operators/inequal.cc (test for excess errors) ext/random/pareto_distribution/operators/serialize.cc (test for excess errors) ext/random/pareto_distribution/requirements/explicit_instantiation/1.cc (test for excess errors) ext/random/pareto_distribution/requirements/typedefs.cc (test for excess errors) ext/random/rice_distribution/cons/default.cc (test for excess errors) ext/random/rice_distribution/cons/parms.cc (test for excess errors) ext/random/rice_distribution/operators/equal.cc (test for excess errors) ext/random/rice_distribution/operators/inequal.cc (test for excess errors) ext/random/rice_distribution/operators/serialize.cc (test for excess errors) ext/random/rice_distribution/requirements/explicit_instantiation/1.cc (test for excess errors) ext/random/rice_distribution/requirements/typedefs.cc (test for excess errors) ext/random/simd_fast_mersenne_twister_engine/cons/copy.cc (test for excess errors) ext/random/simd_fast_mersenne_twister_engine/cons/default.cc (test for excess errors) ext/random/simd_fast_mersenne_twister_engine/cons/seed1.cc (test for excess errors) ext/random/simd_fast_mersenne_twister_engine/cons/seed2.cc (test for excess errors) ext/random/simd_fast_mersenne_twister_engine/cons/seed_seq.cc (test for excess errors) ext/random/simd_fast_mersenne_twister_engine/operators/equal.cc (test for excess errors) ext/random/simd_fast_mersenne_twister_engine/operators
Re: [patch] install host specific {bits,ext}/opt_random.h headers in host specific c++ incdir
On 05/19/2013 11:35 AM, Andreas Schwab wrote: Tests that now fail, but worked before: Thanks Andreas. Matthias, please revert ASAP, thanks. Paolo.
[MIPS, committed] Remove 64-bit microMIPS multilibs from mips*-sde-elf
The microMIPS patch added microMIPS multilibs to mips*-sde-elf. The 32-bit ones build fine, but the 64-bit ones don't, at least not with FSF binutils. My impression from: http://www.cygwin.com/ml/binutils/2010-07/msg00405.html was that this is expected -- 32-bit has been extensively tested, but the 64-bit side was more theoretical at this stage. This patch therefore disables the 64-bit microMIPS multilibs, as is already done for MIPS16. Tested on mips*-sde-elf and applied. We should consider reverting it once 64-bit microMIPS is known to work and be useful for at least one core. Thanks, Richard gcc/ * config/mips/t-sde: Don't build 64-bit microMIPS multilibs. Index: gcc/config/mips/t-sde === --- gcc/config/mips/t-sde 2013-03-20 21:01:21.674584349 + +++ gcc/config/mips/t-sde 2013-05-18 20:47:11.293525699 +0100 @@ -27,9 +27,11 @@ else MULTILIB_EXCLUSIONS := !mips32r2/mfp64 endif -# Don't build 64-bit MIPS16 multilibs. +# Don't build 64-bit MIPS16 and microMIPS multilibs. ifneq ($(filter MIPS_ISA_DEFAULT=6%,$(tm_defines)),) MULTILIB_EXCLUSIONS += !mips32/!mips32r2/mips16 +MULTILIB_EXCLUSIONS += !mips32/!mips32r2/mmicromips else MULTILIB_EXCLUSIONS += mips64/mips16 mips64r2/mips16 +MULTILIB_EXCLUSIONS += mips64/mmicromips mips64r2/mmicromips endif
[MIPS, committed] Fix compile/20001226-1.c for MIPS16
gcc.c-torture/compile/20001226-1.c started failing for MIPS16 after the microMIPS patch. This was because the patch added a new check of "extended_mips16" at the top of the "length" attribute, before the check for branch lengths, and because "extended_mips16" was still set to "yes" for branch instructions. However, it was really my fault for not removing the branch check from extended_mips16 when adding the long branch support. Fixed as follows. Tested on mipsisa32-sde-elf and applied. Richard gcc/ * config/mips/mips.md (extended_mips16): Remove branch case. (length): Remove duplicated extended_mips16 test. Index: gcc/config/mips/mips.md === --- gcc/config/mips/mips.md 2013-05-19 10:57:13.399153082 +0100 +++ gcc/config/mips/mips.md 2013-05-19 10:57:24.039233504 +0100 @@ -407,7 +407,6 @@ (define_attr "cnv_mode" "unknown,I2S,I2D ;; Is this an extended instruction in mips16 mode? (define_attr "extended_mips16" "no,yes" (if_then_else (ior (eq_attr "move_type" "sll0") -(eq_attr "type" "branch") (eq_attr "jal" "direct")) (const_string "yes") (const_string "no"))) @@ -586,10 +585,6 @@ (define_attr "length" "" (const_int 32) ] (const_int 48)) - (and (eq_attr "extended_mips16" "yes") - (match_test "TARGET_MIPS16")) - (const_int 8) - ;; "Ghost" instructions occupy no space. (eq_attr "type" "ghost") (const_int 0)
[MIPS, committed] Give MIPS16 instruction lengths directly
The .md "length" attributes for MIPS16 instructions have traditionally been double their real values, with a compensating: if (TARGET_MIPS16) length /= 2; in ADJUST_INSN_LENGTH. This was probably the most expedient way of doing things way back when, because many patterns specified the length directly. However, these days the length is often inferred from other attributes like extended_mips16, and this doubling trick probably hinders more than it helps. E.g. I notice that we don't double the size of the constant table patterns, so I think they ended up being too small. Doubling also made the branch calculations more confusing, since the ranges had to be specified in real units, but the resulting branch lengths had to be specified in doubled units. This patch instead specifies the real lengths directly. This involves adding a macro to give the length of a nop insn, and since microMIPS also has 16-bit NOPs, I used TARGET_COMPRESSION rather than TARGET_MIPS16. Also, the JR in a microMIPS long branch sequence is 2 bytes rather than 4. Tested on mipsisa32-sde-elf and applied. Richard gcc/ * config/mips/mips.h (BASE_INSN_LENGTH, NOP_INSN_LENGTH): New macros. * config/mips/mips.c (mips_symbol_insns, mips_address_insns) (mips_const_insns, mips_split_const_insns, mips_load_store_insns) (mips_idiv_insns): Update the comments to say that the returned instruction counts are in units of BASE_INSN_LENGTH. (mips_adjust_insn_length): Multiply the mips_load_label_num_insns by BASE_INSN_LENGTH rather than 4. Add the jump separately, using 2 rather than 4 as the length of indirect MIPS16 and microMIPS jumps. Use NOP_INSN_LENGTH rather than 4 as the length of a NOP. Don't divide MIPS16 lengths by 2. (mips16_split_long_branches): Assume a branch is long if the length is greater than 4 rather than 8. * config/mips/mips.md (length): Give MIPS16 lengths directly, rather than multiplying them by 2. Multiply instruction counts by BASE_INSN_LENGTH rather than 4. (*jump_mips16, tls_get_tp_mips16_) (*tls_get_tp_mips16_call_): Divide lengths by 2. Index: gcc/config/mips/mips.h === --- gcc/config/mips/mips.h 2013-05-19 11:05:09.987763980 +0100 +++ gcc/config/mips/mips.h 2013-05-19 11:10:32.138190186 +0100 @@ -2439,6 +2439,14 @@ #define AVOID_CCMODE_COPIES #define BRANCH_COST(speed_p, predictable_p) mips_branch_cost #define LOGICAL_OP_NON_SHORT_CIRCUIT 0 +/* The MIPS port has several functions that return an instruction count. + Multiplying the count by this value gives the number of bytes that + the instructions occupy. */ +#define BASE_INSN_LENGTH (TARGET_MIPS16 ? 2 : 4) + +/* The length of a NOP in bytes. */ +#define NOP_INSN_LENGTH (TARGET_COMPRESSION ? 2 : 4) + /* If defined, modifies the length assigned to instruction INSN as a function of the context in which it is used. LENGTH is an lvalue that contains the initially computed length of the insn and should Index: gcc/config/mips/mips.c === --- gcc/config/mips/mips.c 2013-05-19 11:05:09.987763980 +0100 +++ gcc/config/mips/mips.c 2013-05-19 11:10:32.137190179 +0100 @@ -2007,7 +2007,7 @@ mips_symbol_insns_1 (enum mips_symbol_ty values of mode MODE to or from addresses of type TYPE. Return 0 if the given type of symbol is not valid in addresses. - In both cases, treat extended MIPS16 instructions as two instructions. */ + In both cases, instruction counts are based off BASE_INSN_LENGTH. */ static int mips_symbol_insns (enum mips_symbol_type type, enum machine_mode mode) @@ -2334,12 +2334,11 @@ mips16_unextended_reference_p (enum mach } /* Return the number of instructions needed to load or store a value - of mode MODE at address X. Return 0 if X isn't valid for MODE. + of mode MODE at address X, assuming that BASE_INSN_LENGTH is the + length of one instruction. Return 0 if X isn't valid for MODE. Assume that multiword moves may need to be split into word moves if MIGHT_SPLIT_P, otherwise assume that a single load or store is - enough. - - For MIPS16 code, count extended instructions as two instructions. */ + enough. */ int mips_address_insns (rtx x, enum machine_mode mode, bool might_split_p) @@ -2441,7 +2440,8 @@ umips_12bit_offset_address_p (rtx x, enu && UMIPS_12BIT_OFFSET_P (INTVAL (addr.offset))); } -/* Return the number of instructions needed to load constant X. +/* Return the number of instructions needed to load constant X, + assuming that BASE_INSN_LENGTH is the length of one instruction. Return 0 if X isn't a valid constant. */ int @@ -2524,7 +2524,8 @@ mips_const_insns (rtx x) /* X is a doubleword constant that can be handled by splitting it into two words and loading each
Re: GCC does not support *mmintrin.h with function specific opts
On Sat, May 18, 2013 at 6:00 AM, Sriraman Tallam wrote: >>> > I don't really understand why you made the change to x86intrin.h instead >>> > of >>> > making it inside each *mmintrin.h header. The code would be the same size, >>> > it would let us include smmintrin.h directly if we wanted to, and >>> > x86intrin.h would also automatically work. >>> >>> Right, I should have done that instead! >> >> Yeah, definitely. For the standalone headers, which have currently >> guards inside of it, please replace it by the larger snippets >> involving #pragma, and in the x86intrin.h/immintrin.h headers include those >> unconditionally, instead of just if is defined. >> For the non-standalone headers (newer ones like avxintrin.h), replace >> the #ifdef in immintrin.h/x86intrin.h with larger snippets. > > > * I did mostly as suggested except that even for avx and avx2 headers > I did not see the harm in doing it in the header itself. AVX header > did not have the "#ifndef _AVXINTRIN_H_INCLUDED" which I added before > doing this. I have added test cases to show it is doing the right > thing for avx. > * I also found that when the caller to these intrinsics do not have > the right target attribute, an error is raised in -O2 mode but not in > -O0 mode. I have fixed this with a patch to ipa-inline.c, please see > if this is alright. Test case intrinsics_5.c checks if an error is > raised. > * LZCNT needed to be handled which is done now. * common/config/i386/i386-common.c: Handle LZCNT. The above part is OK for mainline and release patches. Please commit LZCNT part as a separate patch to mainline. Also, please get middle-end part reviewed and committed before we proceed with target-dependent part. Thanks, Uros.
Re: [v3] Fix libstdc++/54577
On 19 May 2013 01:25, Paolo Carlini wrote: > On 05/19/2013 02:09 AM, Jonathan Wakely wrote: >> >> On 10 May 2013 15:17, Paolo Carlini wrote: >>> >>> Hi, >>> >>> this is the issue about the signatures of the erase member functions of >>> the >>> sequence containers. >> >> This only does the erase() functions, is there any reason not to do >> the same for the insert() functions too, which was also changed by >> N2350? > > I can't imagine any reason, no. Apparently people wanted erase first and we > also had a Bugzilla, thus I found the time to do those. Surely sooner or > later we have to fix all the signatures. OK, cool, I might do it soon. I wanted to add std::vector::emplace() (for LWG 2187) and wanted insert(const_iterator, bool).
[C++ Patch] PR 57327
Hi, a simple issue noticed by Jon, swap the arguments to inform. Tested x86_64-linux. Thanks, Paolo. /cp 2013-05-19 Paolo Carlini PR c++/57327 * pt.c (unify_no_common_base): Swap arg and parm arguments to inform. /testsuite 2013-05-19 Paolo Carlini PR c++/57327 * g++.dg/template/error50.C: New. Index: cp/pt.c === --- cp/pt.c (revision 199076) +++ cp/pt.c (working copy) @@ -5375,7 +5375,7 @@ unify_no_common_base (bool explain_p, enum templat { case tbr_ambiguous_baseclass: inform (input_location, " %qT is an ambiguous base class of %qT", - arg, parm); + parm, arg); break; default: inform (input_location, " %qT is not derived from %qT", arg, parm); Index: testsuite/g++.dg/template/error50.C === --- testsuite/g++.dg/template/error50.C (revision 0) +++ testsuite/g++.dg/template/error50.C (working copy) @@ -0,0 +1,19 @@ +// PR c++/57327 + +template +struct A {}; + +template +void f(A&) {} + +struct B : A {}; + +struct C : A {}; + +struct D : B, C {}; + +int main() +{ + D d; + f(d); // { dg-error "no matching" } +}// { dg-message "'A' is an ambiguous base" "" { target *-*-* } 18 }
[patch] Implement N3670, std::get for tuples and pairs
* include/std/tuple (get): Implement N3670. * include/std/utility (get): Likewise. * testsuite/20_util/pair/get.cc: Move to ... * testsuite/20_util/pair/astuple/get.cc: Here. * testsuite/20_util/pair/astuple/astuple.cc: New. * testsuite/20_util/pair/astuple/constexpr_get.cc: New. * testsuite/20_util/pair/astuple/constexpr_get_by_type.cc: New. * testsuite/20_util/pair/astuple/get_by_type.cc: New. * testsuite/20_util/pair/astuple/get_by_type_neg.cc: New. * testsuite/20_util/pair/astuple/get_neg.cc: New. * testsuite/20_util/tuple/element_access/constexpr_get_by_type.cc: New. * testsuite/20_util/tuple/element_access/get2_by_type.cc: New. * testsuite/20_util/tuple/element_access/get_by_type.cc: New. Tested x86_64-linux, committed to trunk. commit 336fca0d178e8717f5cb9de45ce26d1cf70e3b06 Author: Jonathan Wakely Date: Sun May 19 13:54:45 2013 +0100 * include/std/tuple (get): Implement N3670. * include/std/utility (get): Likewise. * testsuite/20_util/pair/get.cc: Move to ... * testsuite/20_util/pair/astuple/get.cc: Here. * testsuite/20_util/pair/astuple/astuple.cc: New. * testsuite/20_util/pair/astuple/constexpr_get.cc: New. * testsuite/20_util/pair/astuple/constexpr_get_by_type.cc: New. * testsuite/20_util/pair/astuple/get_by_type.cc: New. * testsuite/20_util/pair/astuple/get_by_type_neg.cc: New. * testsuite/20_util/pair/astuple/get_neg.cc: New. * testsuite/20_util/tuple/element_access/constexpr_get_by_type.cc: New. * testsuite/20_util/tuple/element_access/get2_by_type.cc: New. * testsuite/20_util/tuple/element_access/get_by_type.cc: New. diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index ee2b2e1..69f5bd1 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -772,6 +772,33 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return std::forward>::type&&>(get<__i>(__t)); } +#if __cplusplus > 201103L + template +constexpr typename __add_ref<_Head>::type +__get_helper2(_Tuple_impl<__i, _Head, _Tail...>& __t) noexcept +{ return _Tuple_impl<__i, _Head, _Tail...>::_M_head(__t); } + + template +constexpr typename __add_c_ref<_Head>::type +__get_helper2(const _Tuple_impl<__i, _Head, _Tail...>& __t) noexcept +{ return _Tuple_impl<__i, _Head, _Tail...>::_M_head(__t); } + + template +constexpr _Tp& +get(tuple<_Types...>& __t) noexcept +{ return __get_helper2<_Tp>(__t); } + + template +constexpr _Tp&& +get(tuple<_Types...>&& __t) noexcept +{ return std::move(__get_helper2<_Tp>(__t)); } + + template +constexpr const _Tp& +get(const tuple<_Types...>& __t) noexcept +{ return __get_helper2<_Tp>(__t); } +#endif + // This class helps construct the various comparison operations on tuples template diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility index ee8c6b1..ad30ad7 100644 --- a/libstdc++-v3/include/std/utility +++ b/libstdc++-v3/include/std/utility @@ -153,8 +153,38 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return __pair_get<_Int>::__const_get(__in); } #if __cplusplus > 201103L + template +constexpr _Tp& +get(pair<_Tp, _Up>& __p) noexcept +{ return __p.first; } + + template +constexpr const _Tp& +get(const pair<_Tp, _Up>& __p) noexcept +{ return __p.first; } + + template +constexpr _Tp&& +get(pair<_Tp, _Up>&& __p) noexcept +{ return std::move(__p.first); } + + template +constexpr _Tp& +get(pair<_Up, _Tp>& __p) noexcept +{ return __p.second; } + + template +constexpr const _Tp& +get(const pair<_Up, _Tp>& __p) noexcept +{ return __p.second; } + + template +constexpr _Tp&& +get(pair<_Up, _Tp>&& __p) noexcept +{ return std::move(__p.second); } + /// Assign @p __new_val to @p __obj and return its previous value. - template + template inline _Tp exchange(_Tp& __obj, _Up&& __new_val) { diff --git a/libstdc++-v3/testsuite/20_util/pair/astuple/astuple.cc b/libstdc++-v3/testsuite/20_util/pair/astuple/astuple.cc new file mode 100644 index 000..32c22b8 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/pair/astuple/astuple.cc @@ -0,0 +1,37 @@ +// { dg-do compile } +// { dg-options "-std=gnu++11" } + +// Copyright (C) 2013 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 Pu
Re: [Patch][gcc-4_7-branch] Backport trunk revision 187838 into gcc-4_7-branch
Il 18/05/2013 04:29, Chung-Ju Wu ha scritto: > Ping: http://gcc.gnu.org/ml/gcc-patches/2013-05/msg00429.html > > The patch is to fix dependency issue of libgcc Makefile.in > by adding 'rm libgcc_tm.stamp' in the clean rule. > > That was fixed on main trunk (r187838) but not on gcc-4_7-branch. > Since gcc-4_7-branch is still open, is it OK to backport r187838 > into gcc-4_7-branch? It's trivial enough that you can go ahead and backport it. Thanks! Paolo
[patch, fortran] Simplify (-1.0)**i
Hello world, the attached patch replaces (-1.0)**i with (in C language) (i & 1) == 0 ? 1.0 : 1.0, see PR 57073. I tried doing it in the middle end, see the PR of where these approaches failed. So, rather than not doing the optimization at all, I would rather do it in the Fortran front end. If somebody jumps in with a middle-end solution that works, I would withdraw this patch. Regression-tested on trunk. OK? Thomas 2013-05-19 Thomas Koenig PR fortran/57073 * trans-expr.c: Simplify (-1.0)**i to (i & 1) == 0 ? 1.0 : -1.0. 2013-05-19 Thomas Koenig PR fortran/57073 * gfortran.dg/power_6.f90: New test. Index: trans-expr.c === --- trans-expr.c (Revision 199050) +++ trans-expr.c (Arbeitskopie) @@ -2110,18 +2110,41 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr) gfc_se lse; gfc_se rse; tree fndecl = NULL; + gfc_expr *op1, *op2; + op1 = expr->value.op.op1; + op2 = expr->value.op.op2; + gfc_init_se (&lse, se); - gfc_conv_expr_val (&lse, expr->value.op.op1); + gfc_conv_expr_val (&lse, op1); lse.expr = gfc_evaluate_now (lse.expr, &lse.pre); gfc_add_block_to_block (&se->pre, &lse.pre); gfc_init_se (&rse, se); - gfc_conv_expr_val (&rse, expr->value.op.op2); + gfc_conv_expr_val (&rse, op2); gfc_add_block_to_block (&se->pre, &rse.pre); - if (expr->value.op.op2->ts.type == BT_INTEGER - && expr->value.op.op2->expr_type == EXPR_CONSTANT) + if (op1->ts.type == BT_REAL && op1->expr_type == EXPR_CONSTANT + && op2->expr_type != EXPR_CONSTANT + && mpfr_cmp_si (op1->value.real, -1L) == 0) +{ + tree tmp, type_op1, type_op2; + + type_op1 = TREE_TYPE (lse.expr); + type_op2 = TREE_TYPE (rse.expr); + + tmp = fold_build2_loc (input_location, BIT_AND_EXPR, type_op2, + rse.expr, build_int_cst (type_op2, 1)); + tmp = fold_build2_loc (input_location, EQ_EXPR, boolean_type_node, + tmp, build_int_cst (type_op2, 0)); + se->expr = fold_build3_loc (input_location, COND_EXPR, type_op1, tmp, + build_real (type_op1, dconst1), + build_real (type_op1, dconstm1)); + return; +} + + if (op2->ts.type == BT_INTEGER + && op2->expr_type == EXPR_CONSTANT) if (gfc_conv_cst_int_power (se, lse.expr, rse.expr)) return; @@ -2134,11 +2157,11 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr) res_ikind_1 = -1; res_ikind_2 = -1; - kind = expr->value.op.op1->ts.kind; - switch (expr->value.op.op2->ts.type) + kind = op1->ts.kind; + switch (op2->ts.type) { case BT_INTEGER: - ikind = expr->value.op.op2->ts.kind; + ikind = op2->ts.kind; switch (ikind) { case 1: @@ -2166,7 +2189,7 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr) { case 1: case 2: - if (expr->value.op.op1->ts.type == BT_INTEGER) + if (op1->ts.type == BT_INTEGER) { lse.expr = convert (gfc_int4_type_node, lse.expr); res_ikind_1 = kind; @@ -2195,7 +2218,7 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr) gcc_unreachable (); } - switch (expr->value.op.op1->ts.type) + switch (op1->ts.type) { case BT_INTEGER: if (kind == 3) /* Case 16 was not handled properly above. */ ! { dg-do run } ! { dg-options "-fdump-tree-original" } ! PR 57073 - test that (-1.0)**n is transormed into n & 1 == 0 ? 1.0 : -1.0 program main integer :: i character(len=10) :: c real(8) :: a c = '-1.0' read (unit=c,fmt=*) a do i=-3,3 if ((-1.0_8)**i /= a**i) call abort end do end program main ! { dg-final { scan-tree-dump-times "__builtin_powi" 1 "original" } } ! { dg-final { scan-tree-dump-times "i & 1" 1 "original" } } ! { dg-final { cleanup-tree-dump "original" } }
[patch] Preserve the CFG until after final
Hello, This patch allows targets to keep the CFG around until after final, by skipping pass_free_cfg and CFG-destructive passes like dbr_schedule, and by making insn splitting before 'final' use split_all_insns instead of split_all_insns_noflow if pass_free_cfg was skipped. Most machine reorg passes also are not able to maintain the CFG, so I've split the machine_reorg hook into separate CFG-aware and CFG-unaware versions, renaming the existing hook (to signal that maintaining the CFG is desirable in new ports ;-). For the moment, only ix86 uses the CFG-aware version of the hook, but there are a handful of targets that can be converted to do this also (ia64, bfin, c6x, sparc, probably others). Other ports can change to the CFG-aware machine reorg pass and keep part of the current, non CFG-aware reorg pass for the second hook (mips). Some ports have CFG-aware machine-reorg passes but verify_flow_info fails after the machine-reorg pass because the port emits insns between basic blocks, e.g. for const pools. What's missing is a way for verify_flow_info to be tolerant of such non-insns but I'm not sure yet what the best approach for this will be (possibilities I've considered so far are: allow bare UNSPECV insns between basic blocks after machine-reorg; put a flag on such non-insns; maintain a bitmap of uids for non-insns; ...). I hope that maintainers will over time change their machine reorgs to maintain the CFG, so that passes like pass_dwarf2_frame can use the CFG instead of creating "a facsimile of one on the fly" (see dwarf2cfi.c). Bootstrapped&tested on x86_64-unknown-linux-gnu (unix{,-m32}). OK for trunk? Ciao! Steven * target.def (machine_dependent_reorg): Add documentation. (machine_dependent_reorg_nocfg): New hook. * doc/tm.texi.in (TARGET_MACHINE_DEPENDENT_REORG): Remove old documentation. (TARGET_MACHINE_DEPENDENT_REORG_NOCFG): New hook insert point. * doc/tm.texi: Regenerate * function.h (struct rtl_data): Add 'cfg_released' member. * cfgrtl.c (rest_of_pass_free_cfg): Set it at the end. * tree-pass.h (pass_cfg_unaware_passes, pass_machine_reorg_nocfg): New passes. * passes.c (init_optimization_passes): Schedule the new passes. Use pass_machine_reorg_nocfg to group passes that do not maintain the control flow graph. * reorg.c (gate_handle_machine_reorg_nocfg): New function. (rest_of_handle_machine_reorg_nocfg): New Function. (gate_cfg_unaware_passes): New function. (gate_handle_machine_reorg): New function. (rest_of_handle_machine_reorg): New function. (pass_machine_reorg_nocfg): New pass. (pass_cfg_unaware_passes): New pass. * recog.c (rest_of_handle_final_split): New function. (pass_split_for_short): Call rest_of_handle_final_split instead of directly calling split_all_insns_noflow. * sched-ebb.c (schedule_ebbs_init): Do not call compute_bb_for_insn. * config/i386/i386.c (ix86_reorg): Do not call compute_bb_for_insn. * config/alpha/alpha.c: Replace TARGET_MACHINE_DEPENDENT_REORG with TARGET_MACHINE_DEPENDENT_REORG_NOCFG. * config/frv/frv.c: Likewise. * config/s390/s390.c: Likewise. * config/spu/spu.c: Likewise. * config/mep/mep.c; * config/tilegx/tilegx.c: Likewise. * config/sh/sh.c: Likewise. * config/avr/avr.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/mn10300/mn10300.c: Likewise. * config/c6x/c6x.c: Likewise. * config/ia64/ia64.c: Likewise. * config/picochip/picochip.c: Likewise. * config/mcore/mcore.c: Likewise. * config/tilepro/tilepro.c: Likewise. * config/arm/arm.c: Likewise. * config/pa/pa.c: Likewise. * config/mips/mips.c: Likewise. * config/v850/v850.c: Likewise. * config/h8300/h8300.c: Likewise. * config/mmix/mmix.c: Likewise. * config/bfin/bfin.c: Likewise. Index: target.def === --- target.def (revision 199028) +++ target.def (working copy) @@ -1888,11 +1888,37 @@ DEFHOOK enum machine_mode, (enum machine_mode m1, enum machine_mode m2), default_cc_modes_compatible) -/* Do machine-dependent code transformations. Called just before - delayed-branch scheduling. */ +/* Do machine-dependent code transformations. */ DEFHOOK (machine_dependent_reorg, - "", + "If non-null, this hook can be used to perform target-specific passes \ +over the instruction stream near the very end of the compilation of \ +a function. The hook is called via @code{pass_machine_reorg} just \ +before the delayed-branch scheduling pass. This hook is optional, \ +@code{pass_machine_reorg} pass only runs if the hook non-null.\n\ +This target hook should maintain the CFG (@code{verify_flow_inf} \ +should not fail after this pass). Legacy
Fix PR tree-optimization/57322
The UID of a newly generated statement in build_and_add_sum is set to that of an adjacent statement in the BB. This is a problem in one case where the BB is empty. This fix sets the UID to be 1 if the BB is empty. Bootstraps and no test regressions on x86_64 . OK for trunk? Thanks, Easwaran --- 2013-05-19 Easwaran Raman PR tree-optimization/57322 * (build_and_add_sum): If a BB is empty, set the UID of the statement added to the BB to be 1. Index: gcc/tree-ssa-reassoc.c === --- gcc/tree-ssa-reassoc.c (revision 199048) +++ gcc/tree-ssa-reassoc.c (working copy) @@ -1165,8 +1165,12 @@ build_and_add_sum (tree type, tree op1, tree op2, if ((!op1def || gimple_nop_p (op1def)) && (!op2def || gimple_nop_p (op2def))) { + gimple first_stmt; + unsigned uid; gsi = gsi_after_labels (single_succ (ENTRY_BLOCK_PTR)); - gimple_set_uid (sum, gimple_uid (gsi_stmt (gsi))); + first_stmt = gsi_stmt (gsi); + uid = first_stmt ? gimple_uid (first_stmt) : 1; + gimple_set_uid (sum, uid); gsi_insert_before (&gsi, sum, GSI_NEW_STMT); } else if ((!op1def || gimple_nop_p (op1def))
Re: C++ copy elision and alignment
OK. Jason
Re: [C++ Patch] PR 57327
OK. Jason
Re: [C++ Patch] PR 10207
OK. Jason
Fix PR 53743 and other -freorder-blocks-and-partition failures
Patch 2 of 3 split out from the patch I sent last week that fixes problems with -freorder-blocks-and-partition, with changes/fixes discussed in that thread, along with some additional verification improvements. See http://gcc.gnu.org/ml/gcc-patches/2013-05/threads.html#00388 for context. This portion of the original patch fixes failures encountered when enabling -freorder-blocks-and-partition, including the failure reported in PR 53743. I attempted to make the handling of partition updates through the optimization passes much more consistent, removing a number of partial fixes in the code stream in the process. The code to fixup partitions (including the BB_PARTITION assignment, region crossing jump notes, and switch text section notes) is now handled in a few centralized locations. For example, inside rtl_redirect_edge_and_branch and force_nonfallthru_and_redirect, so that callers don't need to attempt the fixup themselves. The main changes from the earlier patch are: (1) The switch text section notes are not inserted until the free_cfg pass, avoiding the need to maintain these properly when going in and out of cfglayout mode; (2) Unnecessary forward blocks between partitions are avoided by suppressing unnecessary calls to force_nonfallthru during bbpart, avoiding the need for additional cleanup later; and (3) fixing a few places where region crossing jump notes were not being maintained properly, exposed by additional verification checks I added. Tested on x86_64-unknown-linux-gnu with bootstrap and profiledbootstrap builds and regression testing. Additionally built/ran cpu2006int with profile feedback and -freorder-blocks-and-partition enabled - all benchmarks now pass (previously only 6 passed). This also passes a profiledbootstrap with -freorder-blocks-and-partition enabled by default (although this required forcing the dwarf version down to 2 to workaround issues with debug range generation and partitioning that still need to be addressed for -g compilations). Ok for trunk? Thanks, Teresa 2013-05-19 Teresa Johnson * ifcvt.c (find_if_case_1): Replace BB_COPY_PARTITION with assert as this is now done by redirect_edge_and_branch_force. * function.c (thread_prologue_and_epilogue_insns): Insert new bb after barriers, and fix interaction with splitting. * emit-rtl.c (try_split): Copy REG_CROSSING_JUMP notes. * cfgcleanup.c (try_forward_edges): Fix early return value to properly reflect changes made in the routine. * bb-reorder.c (emit_barrier_after_bb): Handle insertion in non-cfglayout mode. (fix_up_fall_thru_edges): Remove incorrect check for bb layout order since this is called in cfglayout mode, and replace partition fixup with assert as that is now done by force_nonfallthru_and_redirect. (add_reg_crossing_jump_notes): Handle the fact that some jumps may already be marked with region crossing note. (insert_section_boundary_note): Make non-static, gate on flag has_bb_partition, rewrite to also check for multiple partitions. (rest_of_handle_reorder_blocks): Remove call to insert_section_boundary_note, now done later during free_cfg. * bb-reorder.h: Declare insert_section_boundary_note and emit_barrier_after_bb, which are no longer static. * Makefile.in (cfgrtl.o): Depend on bb-reorder.h * cfgrtl.c (rest_of_pass_free_cfg): If partitions exist invoke insert_section_boundary_note. (try_redirect_by_replacing_jump): Remove unnecessary check for region crossing note. (fixup_partition_crossing): New function. (rtl_redirect_edge_and_branch): Fixup partition boundaries. (force_nonfallthru_and_redirect): Fixup partition boundaries, remove old code that tried to do this. Emit barrier correctly when we are in cfglayout mode. (rtl_split_edge): Correctly fixup partition boundaries. (commit_one_edge_insertion): Remove old code that tried to fixup region crossing edge since this is now handled in split_block, and set up insertion point correctly since block may now end in a jump. (rtl_verify_edges): Add checks for incorrect/missing REG_CROSSING_JUMP notes. (fixup_reorder_chain): Remove old code that attempted to fixup region crossing note as this is now handled in force_nonfallthru_and_redirect. (duplicate_insn_chain): Don't duplicate switch section notes. (rtl_can_remove_branch_p): Remove unnecessary check for region crossing note. Index: ifcvt.c === --- ifcvt.c (revision 199014) +++ ifcvt.c (working copy) @@ -3905,10 +3905,9 @@ find_if_case_1 (basic_block test_bb, edge then_edg if (new_bb) { df_bb_replace (then_bb_index, new_bb); - /* Since the fallthru edge was redirected from test_bb
Re: Fix PR tree-optimization/57322
2013/5/20 Easwaran Raman : > The UID of a newly generated statement in build_and_add_sum is set to > that of an adjacent statement in the BB. This is a problem in one case > where the BB is empty. This fix sets the UID to be 1 if the BB is > empty. Bootstraps and no test regressions on x86_64 . OK for trunk? > > Thanks, > Easwaran > > --- > > 2013-05-19 Easwaran Raman > > PR tree-optimization/57322 > * (build_and_add_sum): If a BB is empty, set the UID of the statement > added to the BB to be 1. > > Index: gcc/tree-ssa-reassoc.c > === > --- gcc/tree-ssa-reassoc.c (revision 199048) > +++ gcc/tree-ssa-reassoc.c (working copy) > @@ -1165,8 +1165,12 @@ build_and_add_sum (tree type, tree op1, tree op2, >if ((!op1def || gimple_nop_p (op1def)) >&& (!op2def || gimple_nop_p (op2def))) > { > + gimple first_stmt; > + unsigned uid; >gsi = gsi_after_labels (single_succ (ENTRY_BLOCK_PTR)); > - gimple_set_uid (sum, gimple_uid (gsi_stmt (gsi))); > + first_stmt = gsi_stmt (gsi); > + uid = first_stmt ? gimple_uid (first_stmt) : 1; > + gimple_set_uid (sum, uid); >gsi_insert_before (&gsi, sum, GSI_NEW_STMT); > } >else if ((!op1def || gimple_nop_p (op1def)) How about having a new testcase? The followings are the ChangeLog and new testcase for your patch fix. (By the way, I notice there are three space characters after date "2013-05-17" in your previous ChangeLog patch. I think there should be only two space characters. So I modified it as well.) Index: gcc/testsuite/ChangeLog === --- gcc/testsuite/ChangeLog (revision 199075) +++ gcc/testsuite/ChangeLog (working copy) @@ -1,5 +1,10 @@ -2013-05-17 Easwaran Raman +2013-05-20 Easwaran Raman + PR tree-optimization/57322 + * gcc.dg/pr57322.c: New test. + +2013-05-17 Easwaran Raman + * gcc.dg/tree-ssa/reassoc-28.c: New testcase. 2013-05-17 Marc Glisse Index: gcc/testsuite/gcc.dg/pr57322.c === --- gcc/testsuite/gcc.dg/pr57322.c (revision 0) +++ gcc/testsuite/gcc.dg/pr57322.c (revision 0) @@ -0,0 +1,15 @@ +/* PR tree-optimization/57322 */ +/* { dg-do compile } */ +/* { dg-options "-w -O1" } */ +int a; + +void f (void) +{ + char b; + + for (;; a++) +{ + char *p = &b, *q; + *q = b < 0 & !!*p; +} +} Best regards, jasonwucj
Re: [Patch][gcc-4_7-branch] Backport trunk revision 187838 into gcc-4_7-branch
2013/5/19 Paolo Bonzini : > Il 18/05/2013 04:29, Chung-Ju Wu ha scritto: >> Ping: http://gcc.gnu.org/ml/gcc-patches/2013-05/msg00429.html >> >> The patch is to fix dependency issue of libgcc Makefile.in >> by adding 'rm libgcc_tm.stamp' in the clean rule. >> >> That was fixed on main trunk (r187838) but not on gcc-4_7-branch. >> Since gcc-4_7-branch is still open, is it OK to backport r187838 >> into gcc-4_7-branch? > > It's trivial enough that you can go ahead and backport it. > > Thanks! > > Paolo Thanks for both Ian and Paolo's approval. :) Committed into gcc-4_7-branch as Rev.199091. Best regards, jasonwucj