https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110182

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |tree-optimization
   Last reconfirmed|                            |2023-06-08
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
```
typedef float vec2float __attribute__((vector_size(2*sizeof(float))));
typedef double vec2double __attribute__((vector_size(2*sizeof(double))));

vec2double f(vec2double a)
{
        auto t0 = a[0];
        auto t1 = a[1];
        float b0 = t0;
        float b1 = t1;
        double c0 = b0;
        double c1 = b1;
        auto r0 = t0 - c0;
        auto r1 = t1 - c1;
        return (vec2double){r0, r1};
}

double f1(double a)
{
        auto t0 = a;
        float b0 = t0;
        double c0 = b0;
        auto r0 = t0 - c0;
        return r0;
}
```

f should produce a similar results as f1 but does not.

The problem is not SLP directly, it is doing an ok job.
It produces:
  _12 = a_1(D);
  vect_b0_4.4_13 = (vector(2) float) _12;
  vect_c0_6.5_14 = (vector(2) double) vect_b0_4.4_13;
  vect_r0_8.6_15 = _12 - vect_c0_6.5_14;

Which is correct.
But then FRE comes along and does:
  vect_r0_8.6_15 = a_1(D) - a_1(D);


Because the code in match.pd that handles
/* Handle cases of two conversions in a row.  */

Messes up and uses TYPE_PRECISION for vector types but that stores the number
of elements in the vector .....

Reply via email to