re PR target/12654 (Incorrect comparison code generated for Alpha)

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.

From-SVN: r72696
This commit is contained in:
Falk Hueffner 2003-10-20 09:59:45 +02:00 committed by Falk Hueffner
parent 8b7ebc31f2
commit e006ced29a
3 changed files with 34 additions and 4 deletions

View File

@ -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,

View File

@ -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;

View File

@ -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;
}