RFA: integer subregs of float vectors / Re: c/7225: ice on generic vectors (floats)
Joern Rennecke
joern.rennecke@superh.com
Thu Jul 11 08:21:00 GMT 2002
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7225
Regression tested on i686-linux-gnu. The new testcases also succeed.
--
--------------------------
SuperH
2430 Aztec West / Almondsbury / BRISTOL / BS32 4AQ
T:+44 1454 462330
-------------- next part --------------
The second hunk is not covered by the original testcase, therefore
I made a variant that uses double instead of float.
We still don't conver integer CONST_DOUBLES, but I think we should
have a testcase first to see that we get this right.
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.
Index: simplify-rtx.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/simplify-rtx.c,v
retrieving revision 1.109
diff -p -r1.109 simplify-rtx.c
*** simplify-rtx.c 4 Jul 2002 06:38:54 -0000 1.109
--- simplify-rtx.c 11 Jul 2002 14:35:17 -0000
*************** simplify_subreg (outermode, op, innermod
*** 2307,2312 ****
--- 2307,2320 ----
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);
*************** simplify_subreg (outermode, op, innermod
*** 2319,2324 ****
--- 2327,2344 ----
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. */
*** /dev/null Thu Aug 30 21:30:55 2001
--- testsuite/gcc.c-torture/compile/simd-2.c Thu Jul 11 15:38:21 2002
***************
*** 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];
+ }
*** /dev/null Thu Aug 30 21:30:55 2001
--- testsuite/gcc.c-torture/compile/simd-3.c Thu Jul 11 15:38:29 2002
***************
*** 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];
+ }
More information about the Gcc-patches
mailing list