X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fdojump.c;h=d65347ec67cd1f54ab93c3bc272609aa5ebf6259;hb=1e8e992020adfba209ef30b3c369e2ca6282d837;hp=87efb170f2613eb990ca966385d7d950a7548e23;hpb=ff9e4fb2f8b04c302a6643a0dfa403e42d63dc93;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/dojump.c b/gcc/dojump.c index 87efb170f26..d65347ec67c 100644 --- a/gcc/dojump.c +++ b/gcc/dojump.c @@ -16,8 +16,8 @@ for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ +Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301, USA. */ #include "config.h" #include "system.h" @@ -510,6 +510,46 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label) } break; + case TRUTH_AND_EXPR: + /* High branch cost, expand as the bitwise AND of the conditions. + Do the same if the RHS has side effects, because we're effectively + turning a TRUTH_AND_EXPR into a TRUTH_ANDIF_EXPR. */ + if (BRANCH_COST >= 4 || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1))) + goto normal; + + if (if_false_label == NULL_RTX) + { + drop_through_label = gen_label_rtx (); + do_jump (TREE_OPERAND (exp, 0), drop_through_label, NULL_RTX); + do_jump (TREE_OPERAND (exp, 1), NULL_RTX, if_true_label); + } + else + { + do_jump (TREE_OPERAND (exp, 0), if_false_label, NULL_RTX); + do_jump (TREE_OPERAND (exp, 1), if_false_label, if_true_label); + } + break; + + case TRUTH_OR_EXPR: + /* High branch cost, expand as the bitwise OR of the conditions. + Do the same if the RHS has side effects, because we're effectively + turning a TRUTH_OR_EXPR into a TRUTH_ORIF_EXPR. */ + if (BRANCH_COST >= 4 || TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1))) + goto normal; + + if (if_true_label == NULL_RTX) + { + drop_through_label = gen_label_rtx (); + do_jump (TREE_OPERAND (exp, 0), NULL_RTX, drop_through_label); + do_jump (TREE_OPERAND (exp, 1), if_false_label, NULL_RTX); + } + else + { + do_jump (TREE_OPERAND (exp, 0), NULL_RTX, if_true_label); + do_jump (TREE_OPERAND (exp, 1), if_false_label, if_true_label); + } + break; + /* Special case: __builtin_expect (, 0) and __builtin_expect (, 1) @@ -540,8 +580,8 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label) } } } + /* Fall through and generate the normal code. */ - default: normal: temp = expand_expr (exp, NULL_RTX, VOIDmode, 0); @@ -761,12 +801,6 @@ compare_from_rtx (rtx op0, rtx op1, enum rtx_code code, int unsignedp, code = swap_condition (code); } - if (flag_force_mem) - { - op0 = force_not_mem (op0); - op1 = force_not_mem (op1); - } - do_pending_stack_adjust (); code = unsignedp ? unsigned_condition (code) : code; @@ -830,12 +864,6 @@ do_compare_rtx_and_jump (rtx op0, rtx op1, enum rtx_code code, int unsignedp, code = swap_condition (code); } - if (flag_force_mem) - { - op0 = force_not_mem (op0); - op1 = force_not_mem (op1); - } - do_pending_stack_adjust (); code = unsignedp ? unsigned_condition (code) : code;