diff options
| author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-09-18 18:24:32 +0000 |
|---|---|---|
| committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-09-18 18:24:32 +0000 |
| commit | 069a05d1dee193f4df79d3e4b3bc067ebced3954 (patch) | |
| tree | ddee6e9c6a5df5d1308e04b8d34274665f561576 | |
| parent | bc8f8789e48ff14bedd9f87d767f83d57fb761aa (diff) | |
| download | ppe42-gcc-069a05d1dee193f4df79d3e4b3bc067ebced3954.tar.gz ppe42-gcc-069a05d1dee193f4df79d3e4b3bc067ebced3954.zip | |
* combine.c (combine_simplify_rtx): Use gen_unary to distribute
the NOT for De Morgan's rule.
* simplify-rtx.c (simplify_unary_operation): Simplify a BImode NOT
of a comparison to the reverse comparison.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36506 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 5 | ||||
| -rw-r--r-- | gcc/combine.c | 20 | ||||
| -rw-r--r-- | gcc/simplify-rtx.c | 17 |
3 files changed, 27 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a4612dd21a4..2e1a280d33b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2000-09-18 Richard Henderson <rth@cygnus.com> + * combine.c (combine_simplify_rtx): Use gen_unary to distribute + the NOT for De Morgan's rule. + * simplify-rtx.c (simplify_unary_operation): Simplify a BImode NOT + of a comparison to the reverse comparison. + * combine.c (try_combine): Allow split to create a single insn. * machmode.def: Add BImode. Add a column for bitsize. diff --git a/gcc/combine.c b/gcc/combine.c index 07c7e6733f4..033bfac8d64 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -3933,21 +3933,17 @@ combine_simplify_rtx (x, op0_mode, last, in_dest) if (GET_CODE (XEXP (x, 0)) == IOR || GET_CODE (XEXP (x, 0)) == AND) { rtx in1 = XEXP (XEXP (x, 0), 0), in2 = XEXP (XEXP (x, 0), 1); + enum machine_mode op_mode; - if (GET_CODE (in1) == NOT) - in1 = XEXP (in1, 0); - else - in1 = gen_rtx_combine (NOT, GET_MODE (in1), in1); + op_mode = GET_MODE (in1); + in1 = gen_unary (NOT, op_mode, op_mode, in1); - if (GET_CODE (in2) == NOT) - in2 = XEXP (in2, 0); - else if (GET_CODE (in2) == CONST_INT - && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT) - in2 = GEN_INT (GET_MODE_MASK (mode) & ~INTVAL (in2)); - else - in2 = gen_rtx_combine (NOT, GET_MODE (in2), in2); + op_mode = GET_MODE (in2); + if (op_mode == VOIDmode) + op_mode = mode; + in2 = gen_unary (NOT, op_mode, op_mode, in2); - if (GET_CODE (in2) == NOT) + if (GET_CODE (in2) == NOT && GET_CODE (in1) != NOT) { rtx tem = in2; in2 = in1; in1 = tem; diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 1e130768eed..eb1ac584dbb 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -583,10 +583,21 @@ simplify_unary_operation (code, mode, op, op_mode) aren't constant. */ switch (code) { - case NEG: case NOT: - /* (not (not X)) == X, similarly for NEG. */ - if (GET_CODE (op) == code) + /* (not (not X)) == X. */ + if (GET_CODE (op) == NOT) + return XEXP (op, 0); + + /* (not (eq X Y)) == (ne X Y), etc. */ + if (mode == BImode && GET_RTX_CLASS (GET_CODE (op)) == '<' + && can_reverse_comparison_p (op, NULL_RTX)) + return gen_rtx_fmt_ee (reverse_condition (GET_CODE (op)), + op_mode, XEXP (op, 0), XEXP (op, 1)); + break; + + case NEG: + /* (neg (neg X)) == X. */ + if (GET_CODE (op) == NEG) return XEXP (op, 0); break; |

