On Tue, Sep 11, 2012 at 12:29:10PM +0200, Marc Glisse wrote:
> >Btw, this then happily fits into my suggestion that the "elementalness"
> >can be autodetected by the compiler simply by means of a proper IPA
> >pass and thus be fully LTO / whole-program aware.  No need for an
> >attribute (where you'd need to handle the case that the attribute was placed
> >there by error).
> 
> Note that, apart from preventing external calls, it removes this use case:
> 
> __attribute__((vector(4))) double mysqrt(double x){return sqrt(x);}
> 
> __m256d var;
> mysqrt(var);

I don't think those functions should be available for C++ overloading.
For one, it would be only for C++, not for C, and how would you handle
the case where the user already provides __m256d mysqrt(__m256d); overload
in addition to the one with vector attribute?
I'd say the compiler should when beneficial synthetize calls to those
in SLP or normal vectorizer instead, so you'd write:
  (__m256d){mysqrt(var[0]),mysqrt(var[1]),mysqrt(var[2]),mysqrt(var[3])};
instead of mysqrt(var); and the compiler would turn that into
  mysqrt.elem.V4DF(var)
(or whatever the mangling of the elemental functions would be).

        Jakub

Reply via email to