diff options
author | Dale Johannesen <dalej@apple.com> | 2005-11-30 18:19:16 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@gcc.gnu.org> | 2005-11-30 18:19:16 +0000 |
commit | f6173932d327c20b74dd73676deae86aafed35a8 (patch) | |
tree | c34dd7d789f3dd43cbf0595491f13705e8035ef6 /gcc | |
parent | 99c7ab426c16387fb2a27681f54b0ca4ff853b69 (diff) | |
download | gcc-f6173932d327c20b74dd73676deae86aafed35a8.zip gcc-f6173932d327c20b74dd73676deae86aafed35a8.tar.gz gcc-f6173932d327c20b74dd73676deae86aafed35a8.tar.bz2 |
combine.c (find_split_point): Sign extend bitmask when changing bitfield assignment to IOR of AND.
2005-11-30 Dale Johannesen <dalej@apple.com>
Andrew Pinski <pinskia@physics.uc.edu>
* combine.c (find_split_point): Sign extend bitmask
when changing bitfield assignment to IOR of AND.
2005-11-30 Dale Johannesen <dalej@apple.com>
* gcc.c-torture/compile/pr24930.c: New.
Co-Authored-By: Andrew Pinski <pinskia@physics.uc.edu>
From-SVN: r107731
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/combine.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr24930.c | 17 |
4 files changed, 31 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4b9e145..90d2fc8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-11-30 Dale Johannesen <dalej@apple.com> + Andrew Pinski <pinskia@physics.uc.edu> + + * combine.c (find_split_point): Sign extend bitmask + when changing bitfield assignment to IOR of AND. + 2005-11-30 Nathan Sidwell <nathan@codesourcery.com> * config/ms1/ms1.md (decrement_and_branch_until_zero): Add early diff --git a/gcc/combine.c b/gcc/combine.c index abd6458..08cacab 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -3361,13 +3361,15 @@ find_split_point (rtx *loc, rtx insn) rtx dest = XEXP (SET_DEST (x), 0); enum machine_mode mode = GET_MODE (dest); unsigned HOST_WIDE_INT mask = ((HOST_WIDE_INT) 1 << len) - 1; + rtx or_mask; if (BITS_BIG_ENDIAN) pos = GET_MODE_BITSIZE (mode) - len - pos; + or_mask = gen_int_mode (src << pos, mode); if (src == mask) SUBST (SET_SRC (x), - simplify_gen_binary (IOR, mode, dest, GEN_INT (src << pos))); + simplify_gen_binary (IOR, mode, dest, or_mask)); else { rtx negmask = gen_int_mode (~(mask << pos), mode); @@ -3375,7 +3377,7 @@ find_split_point (rtx *loc, rtx insn) simplify_gen_binary (IOR, mode, simplify_gen_binary (AND, mode, dest, negmask), - GEN_INT (src << pos))); + or_mask)); } SUBST (SET_DEST (x), dest); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index df3cbed..056b57e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2005-11-30 Dale Johannesen <dalej@apple.com> + + * gcc.c-torture/compile/pr24930.c: New. + 2005-11-30 Paul Thomas <pault@gcc.gnu.org> PR fortran/15809 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr24930.c b/gcc/testsuite/gcc.c-torture/compile/pr24930.c new file mode 100644 index 0000000..d52bb5c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr24930.c @@ -0,0 +1,17 @@ +/* PR 24930 */ +extern int foo(int u) __attribute__((noinline)); +int foo(int u) {return 0;} +int +main(int argc, char** argv) +{ + const char *buf = argv[1]; + + unsigned int data = (((unsigned int) buf[0]) << 8) + (unsigned int) buf[1]; + if (data & 0x8000) { + data &= 0x7fff ; + data ^= 0x7fff ; + data += 1 ; + data *= -1 ; + } + return foo((int)data); +} |