diff options
author | mrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-04 20:27:17 +0000 |
---|---|---|
committer | mrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-04 20:27:17 +0000 |
commit | db20fb4785ee648ca9ff51a2530bf5d1e9d06427 (patch) | |
tree | dbe6160ad6febabb7998df1b736a4d686b578623 /gcc/simplify-rtx.c | |
parent | f450da21479a2fae2c1acab5409a603541fca144 (diff) | |
download | gcc-db20fb4785ee648ca9ff51a2530bf5d1e9d06427.tar.gz |
* doc/rtl.texi (const_double): Document as sign-extending.
* expmed.c (expand_mult): Ensure we don't use shift
incorrectly.
* emit-rtl.c (immed_double_int_const): Refine to state the
value is signed.
* simplify-rtx.c (mode_signbit_p): Add a fixme for wider than
CONST_DOUBLE integers.
(simplify_const_unary_operation, UNSIGNED_FLOAT): Ensure no
negative values are converted. Fix conversions bigger than
HOST_BITS_PER_WIDE_INT.
(simplify_binary_operation_1): Ensure we don't use shift
incorrectly.
(simplify_immed_subreg): Sign-extend CONST_DOUBLEs.
* explow.c (plus_constant_mode): Add.
(plus_constant): Implement with plus_constant_mode.
* rtl.h (plus_constant_mode): Add.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186147 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r-- | gcc/simplify-rtx.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 35b7f2cdd29..1d82a375673 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -97,6 +97,7 @@ mode_signbit_p (enum machine_mode mode, const_rtx x) width -= HOST_BITS_PER_WIDE_INT; } else + /* FIXME: We don't yet have a representation for wider modes. */ return false; if (width < HOST_BITS_PER_WIDE_INT) @@ -1355,16 +1356,11 @@ simplify_const_unary_operation (enum rtx_code code, enum machine_mode mode, else lv = CONST_DOUBLE_LOW (op), hv = CONST_DOUBLE_HIGH (op); - if (op_mode == VOIDmode) - { - /* We don't know how to interpret negative-looking numbers in - this case, so don't try to fold those. */ - if (hv < 0) - return 0; - } - else if (GET_MODE_PRECISION (op_mode) >= HOST_BITS_PER_WIDE_INT * 2) - ; - else + if (op_mode == VOIDmode + || GET_MODE_PRECISION (op_mode) > 2 * HOST_BITS_PER_WIDE_INT) + /* We should never get a negative number. */ + gcc_assert (hv >= 0); + else if (GET_MODE_PRECISION (op_mode) <= HOST_BITS_PER_WIDE_INT) hv = 0, lv &= GET_MODE_MASK (op_mode); REAL_VALUE_FROM_UNSIGNED_INT (d, lv, hv, mode); @@ -1718,7 +1714,7 @@ simplify_const_unary_operation (enum rtx_code code, enum machine_mode mode, else if (GET_CODE (op) == CONST_DOUBLE && SCALAR_FLOAT_MODE_P (GET_MODE (op)) && GET_MODE_CLASS (mode) == MODE_INT - && width <= 2*HOST_BITS_PER_WIDE_INT && width > 0) + && width <= 2 * HOST_BITS_PER_WIDE_INT && width > 0) { /* Although the overflow semantics of RTL's FIX and UNSIGNED_FIX operators are intentionally left unspecified (to ease implementation @@ -1783,7 +1779,7 @@ simplify_const_unary_operation (enum rtx_code code, enum machine_mode mode, return const0_rtx; /* Test against the unsigned upper bound. */ - if (width == 2*HOST_BITS_PER_WIDE_INT) + if (width == 2 * HOST_BITS_PER_WIDE_INT) { th = -1; tl = -1; @@ -2380,7 +2376,9 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode, || GET_MODE_CLASS (GET_MODE (trueop1)) == MODE_INT) && GET_MODE (op0) == mode && CONST_DOUBLE_LOW (trueop1) == 0 - && (val = exact_log2 (CONST_DOUBLE_HIGH (trueop1))) >= 0) + && (val = exact_log2 (CONST_DOUBLE_HIGH (trueop1))) >= 0 + && (val < 2 * HOST_BITS_PER_WIDE_INT - 1 + || GET_MODE_BITSIZE (mode) <= 2 * HOST_BITS_PER_WIDE_INT)) return simplify_gen_binary (ASHIFT, mode, op0, GEN_INT (val + HOST_BITS_PER_WIDE_INT)); @@ -5189,6 +5187,7 @@ simplify_immed_subreg (enum machine_mode outermode, rtx op, case CONST_DOUBLE: if (GET_MODE (el) == VOIDmode) { + unsigned char extend = 0; /* If this triggers, someone should have generated a CONST_INT instead. */ gcc_assert (elem_bitsize > HOST_BITS_PER_WIDE_INT); @@ -5201,10 +5200,11 @@ simplify_immed_subreg (enum machine_mode outermode, rtx op, = CONST_DOUBLE_HIGH (el) >> (i - HOST_BITS_PER_WIDE_INT); i += value_bit; } - /* It shouldn't matter what's done here, so fill it with - zero. */ + + if (CONST_DOUBLE_HIGH (el) >> (HOST_BITS_PER_WIDE_INT - 1)) + extend = -1; for (; i < elem_bitsize; i += value_bit) - *vp++ = 0; + *vp++ = extend; } else { |