diff options
author | Roger Sayle <roger@eyesopen.com> | 2003-09-21 02:22:45 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2003-09-21 02:22:45 +0000 |
commit | ccea753c0563b847b42d9ca5fc1b8afaee49f343 (patch) | |
tree | acf58ff562afe4d4ab8da62ef0daa92460f43367 | |
parent | 86b0a4f337873565e5b2b13c1ff5926aada3f9ae (diff) | |
download | gcc-ccea753c0563b847b42d9ca5fc1b8afaee49f343.zip gcc-ccea753c0563b847b42d9ca5fc1b8afaee49f343.tar.gz gcc-ccea753c0563b847b42d9ca5fc1b8afaee49f343.tar.bz2 |
i386.c (ix86_expand_carry_flag_compare): Fix transformation of a>=0 into (unsigned)a<0x80000000.
* config/i386/i386.c (ix86_expand_carry_flag_compare): Fix
transformation of a>=0 into (unsigned)a<0x80000000.
* gcc.c-torture/execute/20030920-1.c: New test case.
From-SVN: r71618
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/20030920-1.c | 15 |
4 files changed, 27 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9346701..6e8f5a0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2003-09-20 Roger Sayle <roger@eyesopen.com> + + * config/i386/i386.c (ix86_expand_carry_flag_compare): Fix + transformation of a>=0 into (unsigned)a<0x80000000. + 2003-09-20 Andrew Pinski <apinski@apple.com> * config/darwin.c (machopic_select_rtx_section): Fix check for PIC code. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index de867f3..c1e8ac6 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -9469,19 +9469,19 @@ ix86_expand_carry_flag_compare (enum rtx_code code, rtx op0, rtx op1, rtx *pop) } break; - /* Convert a>0 into (unsigned)a<0x7fffffff. */ + /* Convert a>=0 into (unsigned)a<0x80000000. */ case LT: case GE: if (mode == DImode || op1 != const0_rtx) return false; - op1 = gen_int_mode (~(1 << (GET_MODE_BITSIZE (mode) - 1)), mode); + op1 = gen_int_mode (1 << (GET_MODE_BITSIZE (mode) - 1), mode); code = (code == LT ? GEU : LTU); break; case LE: case GT: if (mode == DImode || op1 != constm1_rtx) return false; - op1 = gen_int_mode (~(1 << (GET_MODE_BITSIZE (mode) - 1)), mode); + op1 = gen_int_mode (1 << (GET_MODE_BITSIZE (mode) - 1), mode); code = (code == LE ? GEU : LTU); break; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2cfb257..1ba55f6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2003-09-20 Roger Sayle <roger@eyesopen.com> + + * gcc.c-torture/execute/20030920-1.c: New test case. + 2003-09-20 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> * g++.dg/rtti/typeid3.C: Correct expected error message. diff --git a/gcc/testsuite/gcc.c-torture/execute/20030920-1.c b/gcc/testsuite/gcc.c-torture/execute/20030920-1.c new file mode 100644 index 0000000..2d22115 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20030920-1.c @@ -0,0 +1,15 @@ +extern void abort (void); + +int main() +{ + int hicount = 0; + unsigned char *c; + char *str = "\x7f\xff"; + for (c = (unsigned char *)str; *c ; c++) { + if (!(((unsigned int)(*c)) < 0x80)) hicount++; + } + if (hicount != 1) + abort (); + return 0; +} + |