diff options
| author | falk <falk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-20 07:59:45 +0000 |
|---|---|---|
| committer | falk <falk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-20 07:59:45 +0000 |
| commit | 3a2f34208be65e79778d562ff4ffc34728e065ec (patch) | |
| tree | 63f17f5aeda65008c0cc5ad0b0897006c4dfc4c2 | |
| parent | 27bdc4aa63a0d686a9cbb47fa4cc084f7a3af953 (diff) | |
| download | ppe42-gcc-3a2f34208be65e79778d562ff4ffc34728e065ec.tar.gz ppe42-gcc-3a2f34208be65e79778d562ff4ffc34728e065ec.zip | |
PR target/12654
* config/alpha/alpha.c (alpha_emit_conditional_branch): Don't do
comparison against constant by adjusting the argument except for
EQ and NE.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72696 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 7 | ||||
| -rw-r--r-- | gcc/config/alpha/alpha.c | 8 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/20031020-1.c | 23 |
3 files changed, 34 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4ebb882cc77..20a8abcfc97 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2003-10-20 Falk Hueffner <falk@debian.org> + + PR target/12654 + * config/alpha/alpha.c (alpha_emit_conditional_branch): Don't do + comparison against constant by adjusting the argument except for + EQ and NE. + 2003-10-19 Mark Mitchell <mark@codesourcery.com> * config.gcc: Add support for arm926ejs, arm1026ejs, arm1136js, diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index c79a0b5799e..69d996a17cb 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -3160,10 +3160,10 @@ alpha_emit_conditional_branch (enum rtx_code code) if (op1 == const0_rtx) cmp_code = NIL, branch_code = code; - /* We want to use cmpcc/bcc when we can, since there is a zero delay - bypass between logicals and br/cmov on EV5. But we don't want to - force valid immediate constants into registers needlessly. */ - else if (GET_CODE (op1) == CONST_INT) + /* If the constants doesn't fit into an immediate, but can + be generated by lda/ldah, we adjust the argument and + compare against zero, so we can use beq/bne directly. */ + else if (GET_CODE (op1) == CONST_INT && (code == EQ || code == NE)) { HOST_WIDE_INT v = INTVAL (op1), n = -v; diff --git a/gcc/testsuite/gcc.c-torture/execute/20031020-1.c b/gcc/testsuite/gcc.c-torture/execute/20031020-1.c new file mode 100644 index 00000000000..526ca0402f9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20031020-1.c @@ -0,0 +1,23 @@ +/* PR target/12654 + The Alpha backend tried to do a >= 1024 as (a - 1024) >= 0, which fails + for very large negative values. */ +/* Origin: tg@swox.com */ + +#include <limits.h> + +extern void abort (void); + +void __attribute__((noinline)) +foo (long x) +{ + if (x >= 1024) + abort (); +} + +int +main () +{ + foo (LONG_MIN); + foo (LONG_MIN + 10000); + return 0; +} |

