diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/combine.c | 74 | ||||
-rw-r--r-- | gcc/double-int.h | 10 |
3 files changed, 26 insertions, 64 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f336b11..9476e77 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-05-25 Anatoly Sokolov <aesok@post.ru> + + * double-int.h (double_int_and): New. + * combine.c (try_combine): Clean up, use double_int_* and + immed_double_int_const functions. + 2010-05-25 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> * configure.ac (gcc_cv_as_ld_jalr_reloc): Redirect grep stdout, diff --git a/gcc/combine.c b/gcc/combine.c index 2e81efc..9809565 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -2595,74 +2595,20 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) if (offset >= 0 && (GET_MODE_BITSIZE (GET_MODE (SET_DEST (temp))) - <= HOST_BITS_PER_WIDE_INT * 2)) + <= HOST_BITS_PER_DOUBLE_INT)) { - HOST_WIDE_INT mhi, ohi, ihi; - HOST_WIDE_INT mlo, olo, ilo; + double_int m, o, i; rtx inner = SET_SRC (PATTERN (i3)); rtx outer = SET_SRC (temp); - if (CONST_INT_P (outer)) - { - olo = INTVAL (outer); - ohi = olo < 0 ? -1 : 0; - } - else - { - olo = CONST_DOUBLE_LOW (outer); - ohi = CONST_DOUBLE_HIGH (outer); - } - - if (CONST_INT_P (inner)) - { - ilo = INTVAL (inner); - ihi = ilo < 0 ? -1 : 0; - } - else - { - ilo = CONST_DOUBLE_LOW (inner); - ihi = CONST_DOUBLE_HIGH (inner); - } - - if (width < HOST_BITS_PER_WIDE_INT) - { - mlo = ((unsigned HOST_WIDE_INT) 1 << width) - 1; - mhi = 0; - } - else if (width < HOST_BITS_PER_WIDE_INT * 2) - { - mhi = ((unsigned HOST_WIDE_INT) 1 - << (width - HOST_BITS_PER_WIDE_INT)) - 1; - mlo = -1; - } - else - { - mlo = -1; - mhi = -1; - } - - ilo &= mlo; - ihi &= mhi; - - if (offset >= HOST_BITS_PER_WIDE_INT) - { - mhi = mlo << (offset - HOST_BITS_PER_WIDE_INT); - mlo = 0; - ihi = ilo << (offset - HOST_BITS_PER_WIDE_INT); - ilo = 0; - } - else if (offset > 0) - { - mhi = (mhi << offset) | ((unsigned HOST_WIDE_INT) mlo - >> (HOST_BITS_PER_WIDE_INT - offset)); - mlo = mlo << offset; - ihi = (ihi << offset) | ((unsigned HOST_WIDE_INT) ilo - >> (HOST_BITS_PER_WIDE_INT - offset)); - ilo = ilo << offset; - } + o = rtx_to_double_int (outer); + i = rtx_to_double_int (inner); - olo = (olo & ~mlo) | ilo; - ohi = (ohi & ~mhi) | ihi; + m = double_int_mask (width); + i = double_int_and (i, m); + m = double_int_lshift (m, offset, HOST_BITS_PER_DOUBLE_INT, false); + i = double_int_lshift (i, offset, HOST_BITS_PER_DOUBLE_INT, false); + o = double_int_ior (double_int_and (o, double_int_not (m)), i); combine_merges++; subst_insn = i3; @@ -2675,7 +2621,7 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) resulting insn the new pattern for I3. Then skip to where we validate the pattern. Everything was set up above. */ SUBST (SET_SRC (temp), - immed_double_const (olo, ohi, GET_MODE (SET_DEST (temp)))); + immed_double_int_const (o, GET_MODE (SET_DEST (temp)))); newpat = PATTERN (i2); diff --git a/gcc/double-int.h b/gcc/double-int.h index 370f619..c13b112 100644 --- a/gcc/double-int.h +++ b/gcc/double-int.h @@ -147,6 +147,16 @@ double_int_ior (double_int a, double_int b) return a; } +/* Returns A & B. */ + +static inline double_int +double_int_and (double_int a, double_int b) +{ + a.low &= b.low; + a.high &= b.high; + return a; +} + /* Shift operations. */ double_int double_int_lshift (double_int, HOST_WIDE_INT, unsigned int, bool); double_int double_int_rshift (double_int, HOST_WIDE_INT, unsigned int, bool); |