ia64.c (ia64_adjust_cost): Handle SUBREGs.

* config/ia64/ia64.c (ia64_adjust_cost): Handle SUBREGs.

	* gcc.c-torture/compile/20011114-2.c: New test.

From-SVN: r47049
This commit is contained in:
Jakub Jelinek 2001-11-15 11:30:59 +01:00 committed by Jakub Jelinek
parent 2b7d71b2b9
commit 8f5a5db818
4 changed files with 37 additions and 11 deletions

View File

@ -10,6 +10,8 @@
* ifcvt.c (dead_or_predicable): Return TRUE if squeeze_notes doesn't
find any real instructions.
* config/ia64/ia64.c (ia64_adjust_cost): Handle SUBREGs.
2001-11-15 Neil Booth <neil@daikokuya.demon.co.uk>
* c-common.c: Include c-lex.h.

View File

@ -5241,17 +5241,27 @@ ia64_adjust_cost (insn, link, dep_insn, cost)
src = set ? SET_SRC (set) : 0;
addr = 0;
if (set && GET_CODE (SET_DEST (set)) == MEM)
addr = XEXP (SET_DEST (set), 0);
else if (set && GET_CODE (src) == MEM)
addr = XEXP (src, 0);
else if (set && GET_CODE (src) == ZERO_EXTEND
&& GET_CODE (XEXP (src, 0)) == MEM)
addr = XEXP (XEXP (src, 0), 0);
else if (set && GET_CODE (src) == UNSPEC
&& XVECLEN (XEXP (src, 0), 0) > 0
&& GET_CODE (XVECEXP (src, 0, 0)) == MEM)
addr = XEXP (XVECEXP (src, 0, 0), 0);
if (set)
{
if (GET_CODE (SET_DEST (set)) == MEM)
addr = XEXP (SET_DEST (set), 0);
else if (GET_CODE (SET_DEST (set)) == SUBREG
&& GET_CODE (SUBREG_REG (SET_DEST (set))) == MEM)
addr = XEXP (SUBREG_REG (SET_DEST (set)), 0);
else
{
addr = src;
if (GET_CODE (addr) == UNSPEC && XVECLEN (addr, 0) > 0)
addr = XVECEXP (addr, 0, 0);
while (GET_CODE (addr) == SUBREG || GET_CODE (addr) == ZERO_EXTEND)
addr = XEXP (addr, 0);
if (GET_CODE (addr) == MEM)
addr = XEXP (addr, 0);
else
addr = 0;
}
}
if (addr && GET_CODE (addr) == POST_MODIFY)
addr = XEXP (addr, 0);

View File

@ -1,5 +1,6 @@
2001-11-15 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/compile/20011114-2.c: New test.
* gcc.c-torture/compile/20011114-4.c: New test.
2001-11-15 Nathan Sidwell <nathan@codesourcery.com>

View File

@ -0,0 +1,13 @@
typedef struct { int c, d, e, f, g; } D;
void bar (unsigned long, unsigned long);
void foo (D *y)
{
int x = 0;
if (y->f == 0)
x |= 0x1;
if (y->g == 0)
x |= 0x2;
bar ((x << 16) | (y->c & 0xffff), (y->d << 16) | (y->e & 0xffff));
}