Commit 495db1a1 by Andreas Krebbel Committed by Andreas Krebbel

expmed.c (store_bit_field): Handle paradoxical subregs on big endian machines.

2006-04-25  Andreas Krebbel  <krebbel1@de.ibm.com>

	* expmed.c (store_bit_field): Handle paradoxical subregs on big endian
	machines.

2006-04-25  Andreas Krebbel  <krebbel1@de.ibm.com>

	* gcc.dg/20060425-1.c: New testcase.

From-SVN: r113248
parent 6d75cd5f
2006-04-25 Andreas Krebbel <krebbel1@de.ibm.com>
* expmed.c (store_bit_field): Handle paradoxical subregs on big endian
machines.
2006-04-25 Bernd Schmidt <bernd.schmidt@analog.com>
* genmodes.c (make_vector_mode): Allow making VECTOR_MODE_INT of a
......
......@@ -363,7 +363,25 @@ store_bit_field (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
meaningful at a much higher level; when structures are copied
between memory and regs, the higher-numbered regs
always get higher addresses. */
bitnum += SUBREG_BYTE (op0) * BITS_PER_UNIT;
int inner_mode_size = GET_MODE_SIZE (GET_MODE (SUBREG_REG (op0)));
int outer_mode_size = GET_MODE_SIZE (GET_MODE (op0));
byte_offset = 0;
/* Paradoxical subregs need special handling on big endian machines. */
if (SUBREG_BYTE (op0) == 0 && inner_mode_size < outer_mode_size)
{
int difference = inner_mode_size - outer_mode_size;
if (WORDS_BIG_ENDIAN)
byte_offset += (difference / UNITS_PER_WORD) * UNITS_PER_WORD;
if (BYTES_BIG_ENDIAN)
byte_offset += difference % UNITS_PER_WORD;
}
else
byte_offset = SUBREG_BYTE (op0);
bitnum += byte_offset * BITS_PER_UNIT;
op0 = SUBREG_REG (op0);
}
......
2006-04-25 Andreas Krebbel <krebbel1@de.ibm.com>
* gcc.dg/20060425-1.c: New testcase.
2006-04-25 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/26865
/* { dg-do run } */
/* { dg-options "-O1" } */
/* This failed because if conversion didn't handle insv patterns properly. */
void abort (void);
union y
{
int a;
unsigned short b;
};
void __attribute__ ((noinline))
bar (unsigned short u, union y v)
{
if (u != 1)
abort ();
}
void __attribute__ ((noinline))
foo (int check)
{
union y x;
if (check != 0)
x.b = 1;
else
x.b = 2;
bar (x.b, x);
}
int
main ()
{
foo (1);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment