re PR target/6043 (IICE on ia64 for Blitz config test for C++ complex math)

PR target/6043
	* expr.c (emit_group_store): Handle storing into CONCAT.

	* g++.dg/opt/conj2.C: New test.

From-SVN: r51311
This commit is contained in:
Jakub Jelinek 2002-03-25 12:34:11 +01:00 committed by Jakub Jelinek
parent 9035ec7952
commit 6ddae61286
4 changed files with 48 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2002-03-25 Jakub Jelinek <jakub@redhat.com>
PR target/6043
* expr.c (emit_group_store): Handle storing into CONCAT.
2002-03-25 Jakub Jelinek <jakub@redhat.com>
* regrename.c (build_def_use): Share RTL between MATCH_OPERATOR and

View file

@ -2113,6 +2113,7 @@ emit_group_store (orig_dst, src, ssize)
HOST_WIDE_INT bytepos = INTVAL (XEXP (XVECEXP (src, 0, i), 1));
enum machine_mode mode = GET_MODE (tmps[i]);
unsigned int bytelen = GET_MODE_SIZE (mode);
rtx dest = dst;
/* Handle trailing fragments that run over the size of the struct. */
if (ssize >= 0 && bytepos + (HOST_WIDE_INT) bytelen > ssize)
@ -2126,14 +2127,27 @@ emit_group_store (orig_dst, src, ssize)
bytelen = ssize - bytepos;
}
if (GET_CODE (dst) == CONCAT)
{
if (bytepos + bytelen <= GET_MODE_SIZE (GET_MODE (XEXP (dst, 0))))
dest = XEXP (dst, 0);
else if (bytepos >= GET_MODE_SIZE (GET_MODE (XEXP (dst, 0))))
{
bytepos -= GET_MODE_SIZE (GET_MODE (XEXP (dst, 0)));
dest = XEXP (dst, 1);
}
else
abort ();
}
/* Optimize the access just a bit. */
if (GET_CODE (dst) == MEM
&& MEM_ALIGN (dst) >= GET_MODE_ALIGNMENT (mode)
if (GET_CODE (dest) == MEM
&& MEM_ALIGN (dest) >= GET_MODE_ALIGNMENT (mode)
&& bytepos * BITS_PER_UNIT % GET_MODE_ALIGNMENT (mode) == 0
&& bytelen == GET_MODE_SIZE (mode))
emit_move_insn (adjust_address (dst, mode, bytepos), tmps[i]);
emit_move_insn (adjust_address (dest, mode, bytepos), tmps[i]);
else
store_bit_field (dst, bytelen * BITS_PER_UNIT, bytepos * BITS_PER_UNIT,
store_bit_field (dest, bytelen * BITS_PER_UNIT, bytepos * BITS_PER_UNIT,
mode, tmps[i], ssize);
}

View file

@ -2,6 +2,8 @@
* gcc.c-torture/compile/20020323-1.c: New test.
* g++.dg/opt/conj2.C: New test.
2002-03-24 Richard Henderson <rth@redhat.com>
* gcc.dg/weak-1.c: Use -fno-common.

View file

@ -0,0 +1,23 @@
// PR target/6043
// This testcase ICEd on IA-64 because emit_group_store
// did not handle loading CONCAT from register group
// { dg-do compile }
struct C
{
C (double y, double z) { __real__ x = y; __imag__ x = z; }
double r () const { return __real__ x; }
double i () const { return __imag__ x; }
__complex__ double x;
};
inline C conj (const C& x)
{
return C (x.r (), - x.i ());
}
void foo (void)
{
C x (1.0, 1.0);
conj (x);
}