simplify-rtx.c (simplify_subreg): Handle floating point CONST_DOUBLEs.

gcc:
Thu Jul 11 15:39:21 2002  J"orn Rennecke <joern.rennecke@superh.com>

	* simplify-rtx.c (simplify_subreg): Handle floating point
	CONST_DOUBLEs.  When an integer subreg of a smaller mode than
	the element mode is requested, compute a subreg with an
	integer mode of the same size as the element mode first.

testsuite:
Thu Jul 11 15:39:21 2002  J"orn Rennecke <joern.rennecke@superh.com>
                          Andrew Pinski  <pinskia@physics.uc.edu>

	gcc.c-torture/compile/simd-2.c: New testcase.
	gcc.c-torture/compile/simd-3.c: Likewise.

Co-Authored-By: Andrew Pinski <pinskia@physics.uc.edu>

From-SVN: r55410
This commit is contained in:
J"orn Rennecke 2002-07-11 23:53:01 +00:00 committed by Joern Rennecke
parent f0ab6bf29c
commit 226cfe61ea
5 changed files with 67 additions and 0 deletions

View File

@ -1,3 +1,10 @@
Fri Jul 12 00:49:36 2002 J"orn Rennecke <joern.rennecke@superh.com>
* simplify-rtx.c (simplify_subreg): Handle floating point
CONST_DOUBLEs. When an integer subreg of a smaller mode than
the element mode is requested, compute a subreg with an
integer mode of the same size as the element mode first.
Thu Jul 11 22:02:57 2002 J"orn Rennecke <joern.rennecke@superh.com>
* combine.c (try_combine): When converting a paradoxical subreg

View File

@ -2307,6 +2307,14 @@ simplify_subreg (outermode, op, innermode, byte)
for (; n_elts--; i += step)
{
elt = CONST_VECTOR_ELT (op, i);
if (GET_CODE (elt) == CONST_DOUBLE
&& GET_MODE_CLASS (GET_MODE (elt)) == MODE_FLOAT)
{
elt = gen_lowpart_common (int_mode_for_mode (GET_MODE (elt)),
elt);
if (! elt)
return NULL_RTX;
}
if (GET_CODE (elt) != CONST_INT)
return NULL_RTX;
high = high << shift | sum >> (HOST_BITS_PER_WIDE_INT - shift);
@ -2319,6 +2327,18 @@ simplify_subreg (outermode, op, innermode, byte)
else
return NULL_RTX;
}
else if (GET_MODE_CLASS (outermode) == MODE_INT
&& (elt_size % GET_MODE_SIZE (outermode) == 0))
{
enum machine_mode new_mode
= int_mode_for_mode (GET_MODE_INNER (innermode));
int subbyte = byte % elt_size;
op = simplify_subreg (new_mode, op, innermode, byte - subbyte);
if (! op)
return NULL_RTX;
return simplify_subreg (outermode, op, new_mode, subbyte);
}
else if (GET_MODE_CLASS (outermode) != MODE_VECTOR_INT
&& GET_MODE_CLASS (outermode) != MODE_VECTOR_FLOAT)
/* This shouldn't happen, but let's not do anything stupid. */

View File

@ -1,3 +1,9 @@
Thu Jul 11 15:39:21 2002 J"orn Rennecke <joern.rennecke@superh.com>
Andrew Pinski <pinskia@physics.uc.edu>
gcc.c-torture/compile/simd-2.c: New testcase.
gcc.c-torture/compile/simd-3.c: Likewise.
2002-07-11 Mark Mitchell <mark@codesourcery.com>
PR c++/7224

View File

@ -0,0 +1,17 @@
typedef float floatvect2 __attribute__((mode(V2SF)));
typedef union
{
floatvect2 vector;
float f[2];
}resfloatvect2;
void tempf(float *x, float *y)
{
floatvect2 temp={x[0],x[1]};
floatvect2 temp1={y[0],y[1]};
resfloatvect2 temp2;
temp2.vector=temp+temp1;
x[0]=temp2.f[0];
x[1]=temp2.f[1];
}

View File

@ -0,0 +1,17 @@
typedef float floatvect2 __attribute__((mode(V2DF)));
typedef union
{
floatvect2 vector;
double f[2];
}resfloatvect2;
void tempf(double *x, double *y)
{
floatvect2 temp={x[0],x[1]};
floatvect2 temp1={y[0],y[1]};
resfloatvect2 temp2;
temp2.vector=temp+temp1;
x[0]=temp2.f[0];
x[1]=temp2.f[1];
}