diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2001-02-13 11:07:43 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2001-02-13 11:07:43 +0000 |
commit | 42a6ff5138ad896ac47ab9a96a51a354be9522a8 (patch) | |
tree | cf1b0e9e8e028357c504fdaa229a158d18760e7a /gcc/combine.c | |
parent | 62415523eb8b4369892c63aa5e51942423178b78 (diff) | |
download | gcc-42a6ff5138ad896ac47ab9a96a51a354be9522a8.zip gcc-42a6ff5138ad896ac47ab9a96a51a354be9522a8.tar.gz gcc-42a6ff5138ad896ac47ab9a96a51a354be9522a8.tar.bz2 |
combine.c (UWIDE_SHIFT_LEFT_BY_BITS_PER_WORD): New macro.
* combine.c (UWIDE_SHIFT_LEFT_BY_BITS_PER_WORD): New macro.
(try_combine): Use it.
From-SVN: r39624
Diffstat (limited to 'gcc/combine.c')
-rw-r--r-- | gcc/combine.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/combine.c b/gcc/combine.c index 662f05f..c2fa5bb 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -146,6 +146,12 @@ static int max_uid_cuid; #define INSN_CUID(INSN) \ (INSN_UID (INSN) > max_uid_cuid ? insn_cuid (INSN) : uid_cuid[INSN_UID (INSN)]) +/* In case BITS_PER_WORD == HOST_BITS_PER_WIDE_INT, shifting by + BITS_PER_WORD would invoke undefined behavior. Work around it. */ + +#define UWIDE_SHIFT_LEFT_BY_BITS_PER_WORD(val) \ + (((unsigned HOST_WIDE_INT)(val) << (BITS_PER_WORD - 1)) << 1) + /* Maximum register number, which is the size of the tables below. */ static unsigned int combine_max_regno; @@ -1667,7 +1673,7 @@ try_combine (i3, i2, i1, new_direct_jump_p) if (HOST_BITS_PER_WIDE_INT < BITS_PER_WORD) abort (); - lo &= ~(((unsigned HOST_WIDE_INT)1 << BITS_PER_WORD) - 1); + lo &= ~(UWIDE_SHIFT_LEFT_BY_BITS_PER_WORD (1) - 1); lo |= INTVAL (SET_SRC (PATTERN (i3))); } else if (HOST_BITS_PER_WIDE_INT == BITS_PER_WORD) @@ -1677,9 +1683,10 @@ try_combine (i3, i2, i1, new_direct_jump_p) int sign = -(int) ((unsigned HOST_WIDE_INT) lo >> (HOST_BITS_PER_WIDE_INT - 1)); - lo &= ~((((unsigned HOST_WIDE_INT)1 << BITS_PER_WORD) - 1) - << BITS_PER_WORD); - lo |= INTVAL (SET_SRC (PATTERN (i3))) << BITS_PER_WORD; + lo &= ~ (UWIDE_SHIFT_LEFT_BY_BITS_PER_WORD + (UWIDE_SHIFT_LEFT_BY_BITS_PER_WORD (1) - 1)); + lo |= (UWIDE_SHIFT_LEFT_BY_BITS_PER_WORD + (INTVAL (SET_SRC (PATTERN (i3))))); if (hi == sign) hi = lo < 0 ? -1 : 0; } |