[LLVMdev] SIMD trigonometry/logarithms?

Ralf Karrenberg Chareos at gmx.de
Mon Jan 28 03:20:46 PST 2013


As Peter mentioned, most of the credit of the links below go to Julien 
Pommier - I basically took his code and ran the cpp-backend over it.

A few more comments:
- In the new implementation of WFV (that is not public yet, but is also 
under LLVM license), I moved that code to a .ll file, which (as Justin 
also pointed out) is a lot easier to maintain because the IR format 
changes a lot slower than LLVM's internal API.
- I also found versions for AVX and NEON based on the ones of Julien, I 
have the link somewhere if anybody is interested.
- There are quite a few interesting functions missing, most importantly 
a vector powf (the implementation I have has precision issues)
- I don't think it would be too bad to keep different versions for 
different vector widths and architectures. After all, these are meant to 
provide highly optimized code, so sacrificing some portability and 
maintainability may be okay.


On 1/28/13 7:06 AM, Peter Newman wrote:
> On 28/01/2013 12:49 AM, Hal Finkel wrote:
>> Ralf Karrenberg had implemented some of these as part of his
>> whole-function vectorization project:
>> https://github.com/karrenberg/wfv/blob/master/src/utils/nativeSSEMathFunctions.hpp
>> https://github.com/karrenberg/wfv/blob/master/src/utils/nativeAVXMathFunctions.hpp
>> Opinions on pulling these into the X86 backend? -Hal
> I've actually been considering doing the same as these for our project
> (using the same reference implementation by Julien Pommier). We use math
> functions a lot in our code so any performance gain would be useful.
> However, accuracy is quite important in our case, so we would want any
> implementation to at least match the accuracy of the current
> implementation. On X86 (at least in LLVM 2.8 which we currently use),
> the sin/cos intrinsics end up using the X87 fpsin instruction. On Win32,
> the system provided sin function also ends up using the same assembly
> instruction.
> Peter N
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

More information about the llvm-dev mailing list