diff options
author | Jan Hubicka <jh@suse.cz> | 2003-02-10 11:56:05 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2003-02-10 10:56:05 +0000 |
commit | 949824fe3405af719e53f1818dcc8b6696a99d67 (patch) | |
tree | 18769d1b17973ac42ede44ef24b9f4c22778e8ff | |
parent | 546ff7777c7d980c60b8bacf194d37145f950aeb (diff) | |
download | gcc-949824fe3405af719e53f1818dcc8b6696a99d67.zip gcc-949824fe3405af719e53f1818dcc8b6696a99d67.tar.gz gcc-949824fe3405af719e53f1818dcc8b6696a99d67.tar.bz2 |
combine.c (combine_simplify_rtx): Simplify using (float_truncate (float x)) is (float x) (float_extend...
* combine.c (combine_simplify_rtx): Simplify using
(float_truncate (float x)) is (float x)
(float_extend (float_extend x)) is (float_extend x).
From-SVN: r62624
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/combine.c | 46 |
2 files changed, 52 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8cdbe92..4b08a63 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +Mon Feb 10 11:40:18 CET 2003 Jan Hubicka <jh@suse.cz> + + * combine.c (combine_simplify_rtx): Simplify using + (float_truncate (float x)) is (float x) + (float_extend (float_extend x)) is (float_extend x). + 2003-02-10 Alan Modra <amodra@bigpond.net.au> * calls.c (try_to_integrate): Tidy stack_usage_map access. diff --git a/gcc/combine.c b/gcc/combine.c index ad56e85..d33f280 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -4167,6 +4167,36 @@ combine_simplify_rtx (x, op0_mode, last, in_dest) && GET_MODE (XEXP (XEXP (x, 0), 0)) == mode) return XEXP (XEXP (x, 0), 0); + /* (float_truncate:SF (float_truncate:DF foo:XF)) + = (float_truncate:SF foo:XF). + This may elliminate double rounding, so it is unsafe. + + (float_truncate:SF (float_extend:XF foo:DF)) + = (float_truncate:SF foo:DF). + + (float_truncate:DF (float_extend:XF foo:SF)) + = (float_extend:SF foo:DF). */ + if ((GET_CODE (XEXP (x, 0)) == FLOAT_TRUNCATE + && flag_unsafe_math_optimizations) + || GET_CODE (XEXP (x, 0)) == FLOAT_EXTEND) + return simplify_gen_unary (GET_MODE_SIZE (GET_MODE (XEXP (XEXP (x, 0), + 0))) + > GET_MODE_SIZE (mode) + ? FLOAT_TRUNCATE : FLOAT_EXTEND, + mode, + XEXP (XEXP (XEXP (x, 0), 0), 0), mode); + + /* (float_truncate (float x)) is (float x) */ + if (GET_CODE (XEXP (x, 0)) == FLOAT + && (flag_unsafe_math_optimizations + || ((unsigned)significand_size (GET_MODE (XEXP (x, 0))) + >= (GET_MODE_BITSIZE (GET_MODE (XEXP (XEXP (x, 0), 0))) + - num_sign_bit_copies (XEXP (XEXP (x, 0), 0), + GET_MODE (XEXP (XEXP (x, 0), 0))))))) + return simplify_gen_unary (FLOAT, mode, + XEXP (XEXP (x, 0), 0), + GET_MODE (XEXP (XEXP (x, 0), 0))); + /* (float_truncate:SF (OP:DF (float_extend:DF foo:sf))) is (OP:SF foo:SF) if OP is NEG or ABS. */ if ((GET_CODE (XEXP (x, 0)) == ABS @@ -4183,7 +4213,23 @@ combine_simplify_rtx (x, op0_mode, last, in_dest) && GET_CODE (SUBREG_REG (XEXP (x, 0))) == FLOAT_TRUNCATE) return SUBREG_REG (XEXP (x, 0)); break; + case FLOAT_EXTEND: + /* (float_extend (float_extend x)) is (float_extend x) + + (float_extend (float x)) is (float x) assuming that double + rounding can't happen. + */ + if (GET_CODE (XEXP (x, 0)) == FLOAT_EXTEND + || (GET_CODE (XEXP (x, 0)) == FLOAT + && ((unsigned)significand_size (GET_MODE (XEXP (x, 0))) + >= (GET_MODE_BITSIZE (GET_MODE (XEXP (XEXP (x, 0), 0))) + - num_sign_bit_copies (XEXP (XEXP (x, 0), 0), + GET_MODE (XEXP (XEXP (x, 0), 0))))))) + return simplify_gen_unary (GET_CODE (XEXP (x, 0)), mode, + XEXP (XEXP (x, 0), 0), + GET_MODE (XEXP (XEXP (x, 0), 0))); + break; #ifdef HAVE_cc0 case COMPARE: /* Convert (compare FOO (const_int 0)) to FOO unless we aren't |