simplify-rtx.c (simplify_binary_operation): If gen_lowpart_common fails, use gen_lowpart_SUBREG.

* simplify-rtx.c (simplify_binary_operation) [DIV]: If
	gen_lowpart_common fails, use gen_lowpart_SUBREG.

	* gcc.c-torture/compile/20020103-1.c: New test.

From-SVN: r48514
This commit is contained in:
Jakub Jelinek 2002-01-03 18:24:13 +01:00 committed by Jakub Jelinek
parent 61d951df7b
commit cb1ac742b7
4 changed files with 38 additions and 1 deletions

View File

@ -1,4 +1,10 @@
2002-01-03 Jakub Jelinek <jakub@redhat.com>
* simplify-rtx.c (simplify_binary_operation) [DIV]: If
gen_lowpart_common fails, use gen_lowpart_SUBREG.
2002-01-03 Turly O'Connor <turly@apple.com>
* darwin.c (machopic_output_possible_stub_label): Don't generate
stub routines for pseudo-stubs which we've just defined.

View File

@ -1413,8 +1413,15 @@ simplify_binary_operation (code, mode, op0, op1)
case DIV:
if (trueop1 == CONST1_RTX (mode))
{
/* On some platforms DIV uses narrower mode than its
operands. */
rtx x = gen_lowpart_common (mode, op0);
return x ? x : op0;
if (x)
return x;
else if (mode != GET_MODE (op0) && GET_MODE (op0) != VOIDmode)
return gen_lowpart_SUBREG (mode, op0);
else
return op0;
}
/* In IEEE floating point, 0/x is not always 0. */

View File

@ -2,6 +2,8 @@
* g++.dg/other/debug2.C: New test.
* gcc.c-torture/compile/20020103-1.c: New test.
2002-01-02 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/gnu89-init-1.c: Added new tests.

View File

@ -0,0 +1,22 @@
/* This testcase failed on Alpha at -O2 when simplifying conditional
expressions. */
int foo (void);
struct A
{
int a, b, c, d;
};
void bar (struct A *x)
{
int e, f;
e = foo ();
e = e / x->b;
if (e < 1)
e = 1;
f = (x->a + x->c) / e;
if (f < x->d)
x->d -= (1 << 16) / 8;
}