aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBernd Schmidt <bernds@codesourcery.com>2011-07-08 13:03:38 +0000
committerBernd Schmidt <bernds@gcc.gnu.org>2011-07-08 13:03:38 +0000
commit0d44736e759f00ddadd0ab5188a86297fac5d284 (patch)
treed3cb9244ced6ff224a76525334a1a776a361f70c /gcc
parent86cdf39313b1c1bd212037be84f9161eda0d4c7f (diff)
downloadgcc-0d44736e759f00ddadd0ab5188a86297fac5d284.zip
gcc-0d44736e759f00ddadd0ab5188a86297fac5d284.tar.gz
gcc-0d44736e759f00ddadd0ab5188a86297fac5d284.tar.bz2
optabs.c (expand_binop): Tighten conditions for doubleword expansions.
* optabs.c (expand_binop): Tighten conditions for doubleword expansions. (widen_bswap): Assert that mode bitsize and precision are the same. * stor-layout.c (get_best_mode): Skip modes that have lower precision than bitsize. * recog.c (simplify_while_replacing): Assert that bitsize and precision are the same. From-SVN: r176040
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/optabs.c11
-rw-r--r--gcc/recog.c2
-rw-r--r--gcc/stor-layout.c6
4 files changed, 22 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 151211b..f1cabbb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -16,6 +16,15 @@
* rtlanal.c (nonzero_bits1): Don't compare GET_MODE_SIZE against
a bitsize.
+ * optabs.c (expand_binop): Tighten conditions for doubleword
+ expansions.
+ (widen_bswap): Assert that mode bitsize and precision are the
+ same.
+ * stor-layout.c (get_best_mode): Skip modes that have lower
+ precision than bitsize.
+ * recog.c (simplify_while_replacing): Assert that bitsize and
+ precision are the same.
+
2011-07-08 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* Makefile.in (LIBGCOV): Remove.
diff --git a/gcc/optabs.c b/gcc/optabs.c
index e1e172b..915a45e 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -1428,12 +1428,12 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
takes operands of this mode and makes a wider mode. */
if (binoptab == smul_optab
- && GET_MODE_WIDER_MODE (mode) != VOIDmode
+ && GET_MODE_2XWIDER_MODE (mode) != VOIDmode
&& (optab_handler ((unsignedp ? umul_widen_optab : smul_widen_optab),
- GET_MODE_WIDER_MODE (mode))
+ GET_MODE_2XWIDER_MODE (mode))
!= CODE_FOR_nothing))
{
- temp = expand_binop (GET_MODE_WIDER_MODE (mode),
+ temp = expand_binop (GET_MODE_2XWIDER_MODE (mode),
unsignedp ? umul_widen_optab : smul_widen_optab,
op0, op1, NULL_RTX, unsignedp, OPTAB_DIRECT);
@@ -1575,6 +1575,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
&& mclass == MODE_INT
&& (CONST_INT_P (op1) || optimize_insn_for_speed_p ())
&& GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
+ && GET_MODE_PRECISION (mode) == GET_MODE_BITSIZE (mode)
&& optab_handler (binoptab, word_mode) != CODE_FOR_nothing
&& optab_handler (ashl_optab, word_mode) != CODE_FOR_nothing
&& optab_handler (lshr_optab, word_mode) != CODE_FOR_nothing)
@@ -1647,7 +1648,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
if ((binoptab == rotl_optab || binoptab == rotr_optab)
&& mclass == MODE_INT
&& CONST_INT_P (op1)
- && GET_MODE_SIZE (mode) == 2 * UNITS_PER_WORD
+ && GET_MODE_PRECISION (mode) == 2 * BITS_PER_WORD
&& optab_handler (ashl_optab, word_mode) != CODE_FOR_nothing
&& optab_handler (lshr_optab, word_mode) != CODE_FOR_nothing)
{
@@ -2463,6 +2464,8 @@ widen_bswap (enum machine_mode mode, rtx op0, rtx target)
x = widen_operand (op0, wider_mode, mode, true, true);
x = expand_unop (wider_mode, bswap_optab, x, NULL_RTX, true);
+ gcc_assert (GET_MODE_PRECISION (wider_mode) == GET_MODE_BITSIZE (wider_mode)
+ && GET_MODE_PRECISION (mode) == GET_MODE_BITSIZE (mode));
if (x != 0)
x = expand_shift (RSHIFT_EXPR, wider_mode, x,
GET_MODE_BITSIZE (wider_mode)
diff --git a/gcc/recog.c b/gcc/recog.c
index 0c26c0d..9331681 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -638,6 +638,8 @@ simplify_while_replacing (rtx *loc, rtx to, rtx object,
(GET_MODE_SIZE (is_mode) - GET_MODE_SIZE (wanted_mode) -
offset);
+ gcc_assert (GET_MODE_PRECISION (wanted_mode)
+ == GET_MODE_BITSIZE (wanted_mode));
pos %= GET_MODE_BITSIZE (wanted_mode);
newmem = adjust_address_nv (XEXP (x, 0), wanted_mode, offset);
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 0601440..76f27b2 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -2389,7 +2389,8 @@ get_best_mode (int bitsize, int bitpos, unsigned int align,
mode = GET_MODE_WIDER_MODE (mode))
{
unit = GET_MODE_BITSIZE (mode);
- if ((bitpos % unit) + bitsize <= unit)
+ if (unit == GET_MODE_PRECISION (mode)
+ && (bitpos % unit) + bitsize <= unit)
break;
}
@@ -2414,7 +2415,8 @@ get_best_mode (int bitsize, int bitpos, unsigned int align,
tmode = GET_MODE_WIDER_MODE (tmode))
{
unit = GET_MODE_BITSIZE (tmode);
- if (bitpos / unit == (bitpos + bitsize - 1) / unit
+ if (unit == GET_MODE_PRECISION (tmode)
+ && bitpos / unit == (bitpos + bitsize - 1) / unit
&& unit <= BITS_PER_WORD
&& unit <= MIN (align, BIGGEST_ALIGNMENT)
&& (largest_mode == VOIDmode