simplify-rtx.c (simplify_subreg): Handle floating point CONST_DOUBLEs.
authorJ"orn Rennecke <joern.rennecke@superh.com>
Thu, 11 Jul 2002 23:53:01 +0000 (23:53 +0000)
committerJoern Rennecke <amylaar@gcc.gnu.org>
Thu, 11 Jul 2002 23:53:01 +0000 (00:53 +0100)
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

gcc/ChangeLog
gcc/simplify-rtx.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/simd-2.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/compile/simd-3.c [new file with mode: 0644]

index aece9e4a123f878bf2a3160264c66ec4e2ce0ed1..6df98f2a8687d6f5412b576223827fc42e6afad8 100644 (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
index ebb464465b8574dc611b080c8bda071d4479b566..95a2af09dc280de370e3a0aaaa45525a03ada558 100644 (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.  */
index 13605c9e619cb7486d0692782bff689140c46598..f9f6bb64997016386b7509acd4f3c61c7633b6d8 100644 (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
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 (file)
index 0000000..694e94f
--- /dev/null
@@ -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 (file)
index 0000000..24d2f48
--- /dev/null
@@ -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];
+}