aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJ"orn Rennecke <joern.rennecke@superh.com>2002-07-11 23:53:01 +0000
committerJoern Rennecke <amylaar@gcc.gnu.org>2002-07-12 00:53:01 +0100
commit226cfe61eadd70c97919b77040d8a81b9f65ecb9 (patch)
tree1fb2c564da28735bf50b88b6f3009be6cea0918c /gcc
parentf0ab6bf29c9ae5dcba3957958ce6e2ae1d069b0f (diff)
downloadgcc-226cfe61eadd70c97919b77040d8a81b9f65ecb9.zip
gcc-226cfe61eadd70c97919b77040d8a81b9f65ecb9.tar.gz
gcc-226cfe61eadd70c97919b77040d8a81b9f65ecb9.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/simplify-rtx.c20
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/simd-2.c17
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/simd-3.c17
5 files changed, 67 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index aece9e4..6df98f2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index ebb4644..95a2af0 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -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. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 13605c9..f9f6bb6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-2.c b/gcc/testsuite/gcc.c-torture/compile/simd-2.c
new file mode 100644
index 0000000..694e94f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/simd-2.c
@@ -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];
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/simd-3.c b/gcc/testsuite/gcc.c-torture/compile/simd-3.c
new file mode 100644
index 0000000..24d2f48
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/simd-3.c
@@ -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];
+}