pawosm-arm wrote:

This PR has a very low chance for approval as it seems to be going against the 
assumed goals set by the mathvec library maintainers. These goals can be 
clearly different than mine.

My goal is to introduce LLVM's mathvec as yet another vectorized math functions 
provider (namely, `-fveclib=mathvec`), similar to GLIBC's libmvec and ArmPL's 
libamath. As I assume, the original goal of the mathvec library was to make it 
act as a drop-in replacement for the GLIBC's libmvec. In effect I had to 
introduce some heavy trickery in the 
`clang/lib/Driver/ToolChains/CommonArgs.cpp` file, to make sure that the 
symbols exported by LLVM's mathvec were not shadowed by the same symbols from 
the GLIBC's libm pulling in the GLIBC's libmvec. This trickery alone is yet 
another reason for this PR being unlikely to be ever approved.

I've based the most of my work on the current libmvec supporting code, both in 
the Clang's frontent driver and the LLVM's TLI mappings. What is missing is the 
whole lot of the test cases currently covering libmvec that should similarly 
cover the mathvec functions. I'd continue with adding those missing test cases 
only if I'm seeing any chances for the approval of such work.

In theory, even without this PR we should already be able to use LLVM's mathvec 
with the existing `-fveclib=libmvec` support. It would probably work out of the 
box on x86_64. On AArch64 unfortunately, my tests showed the wrong results due 
to the calling convention issue. With my set of TLI mappings which use `NOCC` 
as a calling convention, the results are actually correct, so the best it would 
be if the LLVM's mathvec functions could also start supporting 
`CallingConv::AArch64_VectorCall`, similarly to libmvec and libamath.

>From other differences, the use of `-fveclib=mathvec` as introduced by my 
>patch, automatically implies `-fno-math-errno`, similarly to SLEEF and ArmPL's 
>libamath. Contrary to this, to use `-fveclib=libmvec` successfully, one needs 
>to specify `-fno-math-errno` explicitly.


https://github.com/llvm/llvm-project/pull/234621
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to