[PATCH v4 0/1] Add vector math function acos/acosf to libmvec

H.J. Lu hjl.tools@gmail.com
Mon Dec 20 23:58:53 GMT 2021


On Mon, Dec 20, 2021 at 3:12 PM Noah Goldstein via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> On Mon, Dec 20, 2021 at 4:57 PM Joseph Myers <joseph@codesourcery.com> wrote:
> >
> > On Mon, 20 Dec 2021, Cornea, Marius via Libc-alpha wrote:
> >
> > > We put a lot of effort in making the changes you requested a few weeks
> > > ago, and we thought those were sufficient.
> >
> > A few weeks ago, there was no mention in the patch submission that this
> > was generated code at all.  So naturally I reviewed the code on the basis
> > that it was source code as defined in LGPLv2.1.  Likewise, I assumed for
> > the original libmvec submission that it was a good-faith submission of
> > free software source code.
> >
> > Now that the issue has been raised of the code coming out of a compiler,
> > there is a much higher review bar to be met to demonstrate that it is
> > nevertheless in the preferred form for modification - because the default
> > assumption that has to be overcome is that the output of a compiler is
> > *not* source code, and if it is not source code, it is not free software
> > and it is not acceptable for glibc.
>
> Think this code is "critical path" enough that it will be more
> frustrating trying
> to  get C to compile to the "right" assembly than to just use the assembly
> directly.

True.  We do manual peephole optimization on these compiler generated
assembly codes.  The final assembly codes are the preferred form for
performance and accuracy.

> The only issue is if the patches are pushed half-done where it is still
> difficult to make changes to the source without going through the original
> source + intel compiler.

Agreed.  But it can be done with care:

commit 78c9ec9000f873abe7a15a91b87080a2e4308260
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Aug 20 06:42:24 2021 -0700

    x86-64: Optimize load of all bits set into ZMM register [BZ #28252]

    Optimize loads of all bits set into ZMM register in AVX512 SVML codes
    by replacing

            vpbroadcastq .L_2il0floatpacket.16(%rip), %zmmX

    and

            vmovups   .L_2il0floatpacket.13(%rip), %zmmX

    with
            vpternlogd $0xff, %zmmX, %zmmX, %zmmX

    This fixes BZ #28252.


-- 
H.J.


More information about the Libc-alpha mailing list