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

--- Comment #14 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Guobing Chen from comment #13)
> (In reply to Martin Liška from comment #12)
> > > The background is that, we want to try optimize libm with avx2/avx512, and
> > > found that not all the libm math functions will have benefit when we
> > > generally use 'arch=haswell' or 'arch=skylake-avx512' to compile libm. So 
> > > we
> > > picked those 'good' libm math functions to add FMV attribute like
> > > target_clone("default", "arch=haswell", "arch=skylake-avx512") to get
> > > performance benefit. The alias is used in libm code by default. I have no
> > > idea why these two are conflicting that not allowed by GCC9.
> > 
> > That makes sense. Based on the test-case you provided, you just want:
> > 
> > __attribute__((target_clones("default", "arch=haswell",
> > "arch=skylake-avx512")))
> > double
> > __tanh (double x)
> > {
> >   double t, z;
> >   int32_t jx, ix, lx;
> > 
> > 
> >   do { ieee_double_shape_type ew_u; ew_u.value = (x); (jx) = ew_u.parts.msw;
> > (lx) = ew_u.parts.lsw; } while (0);
> >   ix = jx & 0x7fffffff;
> > ...
> > }
> > 
> > extern __typeof (__tanh) tanh __attribute__ ((weak, alias ("__tanh"))); //
> > __attribute__ ((__copy__ (__tanh)));
> > 
> > You don't want to use __copy__ attribute because it's responsible for
> > copying of target_clone attribute to the alias.
> > And it does not make sense to create clones of an alias.
> 
> The copy is from alias used by libm by default (Below I paste the src code),
> I cannot remove this copy seems. How can I then to use FMV for this function?
> 

Then you'll have to make one libm_alias_double_no_copy that will do the same
except setting the copy attribute.

Reply via email to