diff options
author | Jim Wilson <wilson@cygnus.com> | 1997-10-20 23:49:48 +0000 |
---|---|---|
committer | Jim Wilson <wilson@gcc.gnu.org> | 1997-10-20 16:49:48 -0700 |
commit | 3bf1b08254ade026581bee54226b2f42d7ec3482 (patch) | |
tree | d03ad1ae624e997721b0f00f9bfa6a320d91490b | |
parent | ded17aad241cb2df363f63b514a91dc477d182fc (diff) | |
download | gcc-3bf1b08254ade026581bee54226b2f42d7ec3482.zip gcc-3bf1b08254ade026581bee54226b2f42d7ec3482.tar.gz gcc-3bf1b08254ade026581bee54226b2f42d7ec3482.tar.bz2 |
Patches to fix minor optimizer bugs
Patches to fix minor optimizer bugs
* expmed.c (extract_bit_field): Don't make flag_force_mem disable
extzv for memory operands.
* cse.c (simplify_ternary_operation, case IF_THEN_ELSE): Collapse
redundant conditional moves to single operand.
From-SVN: r16129
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cse.c | 10 | ||||
-rw-r--r-- | gcc/expmed.c | 5 |
3 files changed, 20 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 238bdde..e50aab8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +Mon Oct 20 16:47:08 1997 Jim Wilson <wilson@cygnus.com> + + * expmed.c (extract_bit_field): Don't make flag_force_mem disable + extzv for memory operands. + + * cse.c (simplify_ternary_operation, case IF_THEN_ELSE): Collapse + redundant conditional moves to single operand. + Mon Oct 20 15:30:26 1997 Nick Clifton <nickc@cygnus.com> * v850.h: Move define of __v850__ from CPP_PREDEFINES @@ -4669,6 +4669,16 @@ simplify_ternary_operation (code, mode, op0_mode, op0, op1, op2) case IF_THEN_ELSE: if (GET_CODE (op0) == CONST_INT) return op0 != const0_rtx ? op1 : op2; + + /* Convert a == b ? b : a to "a". */ + if (GET_CODE (op0) == NE && ! side_effects_p (op0) + && rtx_equal_p (XEXP (op0, 0), op1) + && rtx_equal_p (XEXP (op0, 1), op2)) + return op1; + else if (GET_CODE (op0) == EQ && ! side_effects_p (op0) + && rtx_equal_p (XEXP (op0, 1), op1) + && rtx_equal_p (XEXP (op0, 0), op2)) + return op2; break; default: diff --git a/gcc/expmed.c b/gcc/expmed.c index b6f77c8..ce48705 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -1084,9 +1084,8 @@ extract_bit_field (str_rtx, bitsize, bitnum, unsignedp, volatile_ok = 1; /* Is the memory operand acceptable? */ - if (flag_force_mem - || ! ((*insn_operand_predicate[(int) CODE_FOR_extzv][1]) - (xop0, GET_MODE (xop0)))) + if (! ((*insn_operand_predicate[(int) CODE_FOR_extzv][1]) + (xop0, GET_MODE (xop0)))) { /* No, load into a reg and extract from there. */ enum machine_mode bestmode; |