diff options
author | Richard Guenther <rguenther@suse.de> | 2011-07-19 13:28:15 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-07-19 13:28:15 +0000 |
commit | d906fd7fec3b6fcdea45922c4475b1b6bcd5b34c (patch) | |
tree | d6fa623f7f1b41202ae3ba9147e8ed8746741ec3 | |
parent | b21a544bb1a94f29adc4fc812cda0766b9a048e9 (diff) | |
download | gcc-d906fd7fec3b6fcdea45922c4475b1b6bcd5b34c.zip gcc-d906fd7fec3b6fcdea45922c4475b1b6bcd5b34c.tar.gz gcc-d906fd7fec3b6fcdea45922c4475b1b6bcd5b34c.tar.bz2 |
re PR middle-end/18908 (Missed folding opportunities with bools)
2011-07-19 Richard Guenther <rguenther@suse.de>
* expr.c (expand_expr_real_2): Remove TRUTH_*_EXPR handling.
(expand_expr_real_1): Remove TRUTH_*IF_EXPR and STATEMENT_LIST
handling.
PR middle-end/18908
* expr.c (expand_expr_real_2): Do not unnecessarily truncate the
result of BIT_*_EXPR to bitfield precision.
From-SVN: r176460
-rw-r--r-- | gcc/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/expr.c | 77 |
2 files changed, 22 insertions, 71 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ee76d11..3b4ef1d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2011-07-19 Richard Guenther <rguenther@suse.de> + + * expr.c (expand_expr_real_2): Remove TRUTH_*_EXPR handling. + (expand_expr_real_1): Remove TRUTH_*IF_EXPR and STATEMENT_LIST + handling. + + PR middle-end/18908 + * expr.c (expand_expr_real_2): Do not unnecessarily truncate the + result of BIT_*_EXPR to bitfield precision. + 2011-07-19 Richard Sandiford <richard.sandiford@linaro.org> PR tree-optimization/49742 @@ -6,6 +16,12 @@ 2011-07-19 Richard Guenther <rguenther@suse.de> + * Makefile.in (tree-ssa-forwprop.o): Depend on gimple-pretty-print.h. + * tree-ssa-forwprop.c: Include gimple-pretty-print.h. + (forward_propagate_comparison): Simplify, remove obsolete code. + +2011-07-19 Richard Guenther <rguenther@suse.de> + * gimplify.c (gimplify_expr): Gimplify TRUTH_NOT_EXPR as BIT_XOR_EXPR, same as the RTL expander does. * tree-cfg.c (verify_expr): Disallow TRUTH_NOT_EXPR in the gimple IL. @@ -8054,26 +8054,8 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode, and (a bitwise1 b) bitwise2 b (etc) but that is probably not worth while. */ - /* BIT_AND_EXPR is for bitwise anding. TRUTH_AND_EXPR is for anding two - boolean values when we want in all cases to compute both of them. In - general it is fastest to do TRUTH_AND_EXPR by computing both operands - as actual zero-or-1 values and then bitwise anding. In cases where - there cannot be any side effects, better code would be made by - treating TRUTH_AND_EXPR like TRUTH_ANDIF_EXPR; but the question is - how to recognize those cases. */ - - case TRUTH_AND_EXPR: - code = BIT_AND_EXPR; case BIT_AND_EXPR: - goto binop; - - case TRUTH_OR_EXPR: - code = BIT_IOR_EXPR; case BIT_IOR_EXPR: - goto binop; - - case TRUTH_XOR_EXPR: - code = BIT_XOR_EXPR; case BIT_XOR_EXPR: goto binop; @@ -8152,18 +8134,6 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode, emit_label (op1); return target; - case TRUTH_NOT_EXPR: - if (modifier == EXPAND_STACK_PARM) - target = 0; - op0 = expand_expr (treeop0, target, - VOIDmode, EXPAND_NORMAL); - /* The parser is careful to generate TRUTH_NOT_EXPR - only with operands that are always zero or one. */ - temp = expand_binop (mode, xor_optab, op0, const1_rtx, - target, 1, OPTAB_LIB_WIDEN); - gcc_assert (temp); - return temp; - case COMPLEX_EXPR: /* Get the rtx code of the operands. */ op0 = expand_normal (treeop0); @@ -8319,6 +8289,12 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode, temp = expand_binop (mode, this_optab, op0, op1, target, unsignedp, OPTAB_LIB_WIDEN); gcc_assert (temp); + /* Bitwise operations do not need bitfield reduction as we expect their + operands being properly truncated. */ + if (code == BIT_XOR_EXPR + || code == BIT_AND_EXPR + || code == BIT_IOR_EXPR) + return temp; return REDUCE_BIT_FIELD (temp); } #undef REDUCE_BIT_FIELD @@ -9541,47 +9517,6 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, return op0; - /* Use a compare and a jump for BLKmode comparisons, or for function - type comparisons is HAVE_canonicalize_funcptr_for_compare. */ - - /* Although TRUTH_{AND,OR}IF_EXPR aren't present in GIMPLE, they - are occassionally created by folding during expansion. */ - case TRUTH_ANDIF_EXPR: - case TRUTH_ORIF_EXPR: - if (! ignore - && (target == 0 - || modifier == EXPAND_STACK_PARM - || ! safe_from_p (target, treeop0, 1) - || ! safe_from_p (target, treeop1, 1) - /* Make sure we don't have a hard reg (such as function's return - value) live across basic blocks, if not optimizing. */ - || (!optimize && REG_P (target) - && REGNO (target) < FIRST_PSEUDO_REGISTER))) - target = gen_reg_rtx (tmode != VOIDmode ? tmode : mode); - - if (target) - emit_move_insn (target, const0_rtx); - - op1 = gen_label_rtx (); - jumpifnot_1 (code, treeop0, treeop1, op1, -1); - - if (target) - emit_move_insn (target, const1_rtx); - - emit_label (op1); - return ignore ? const0_rtx : target; - - case STATEMENT_LIST: - { - tree_stmt_iterator iter; - - gcc_assert (ignore); - - for (iter = tsi_start (exp); !tsi_end_p (iter); tsi_next (&iter)) - expand_expr (tsi_stmt (iter), const0_rtx, VOIDmode, modifier); - } - return const0_rtx; - case COND_EXPR: /* A COND_EXPR with its type being VOID_TYPE represents a conditional jump and is handled in |