diff options
author | Richard Henderson <rth@cygnus.com> | 2000-05-22 01:20:47 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2000-05-22 01:20:47 -0700 |
commit | a774e06ec746cce0d602bfbcfe294d5848e4db83 (patch) | |
tree | 2b8b9f2d7bd1c4d44d452e22a733b32fb19a5585 | |
parent | 2e33f7fbff6d5f5983ec8395345ea6daaa2f21e4 (diff) | |
download | gcc-a774e06ec746cce0d602bfbcfe294d5848e4db83.zip gcc-a774e06ec746cce0d602bfbcfe294d5848e4db83.tar.gz gcc-a774e06ec746cce0d602bfbcfe294d5848e4db83.tar.bz2 |
simplify-rtx.c (simplify_ternary_operation): Try to simplify IF_THEN_ELSE to a setcc form.
* simplify-rtx.c (simplify_ternary_operation): Try to simplify
IF_THEN_ELSE to a setcc form.
From-SVN: r34076
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/simplify-rtx.c | 19 |
2 files changed, 24 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a53a42b..3c8be9e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2000-05-22 Richard Henderson <rth@cygnus.com> + + * simplify-rtx.c (simplify_ternary_operation): Try to simplify + IF_THEN_ELSE to a setcc form. + 2000-05-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * fixinc/inclhack.def (sun_malloc): Handle `calloc'. diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index af16f11..270371c 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -1963,6 +1963,25 @@ simplify_ternary_operation (code, mode, op0_mode, op0, op1, op2) return op2; else if (temp == const1_rtx) return op1; + else if (temp) + op0 = temp; + + /* Look for happy constants in op1 and op2. */ + if (GET_CODE (op1) == CONST_INT && GET_CODE (op2) == CONST_INT) + { + HOST_WIDE_INT t = INTVAL (op1); + HOST_WIDE_INT f = INTVAL (op2); + + if (t == STORE_FLAG_VALUE && f == 0) + code = GET_CODE (op0); + else if (t == 0 && f == STORE_FLAG_VALUE + && can_reverse_comparison_p (op0, NULL_RTX)) + code = reverse_condition (GET_CODE (op0)); + else + break; + + return gen_rtx_fmt_ee (code, mode, XEXP (op0, 0), XEXP (op0, 1)); + } } break; |