Skip to content

whutbd/avx_mathfun

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AVX-optimized sin(), cos(), exp() and log() functions

Introduction

Origin from here. But fix several problem for it.

  • The origin file is not compatible with GCC 4.9+.
    • because header immintrin.h is changed between gcc 4.8 and gcc 4.9
    • In gcc 4.9, AVX2 function will always be defined whenever -mavx2 is set or not. So there are multi-define problems when use gcc 4.9 before.
    • In macos, the clang also use the header like gcc 4.9
    • I just add "avx_" prefix for each function in AVX2 to solve this problem.
  • There is a warning in int constant variable define.
    • Just add a cast to fix it.
  • AVX2 use intrinsics like '_mm256_and_si256', '_mm256_andnot_si256'
    • Change origin header to fix it. Make it work well in both avx and avx2.

Test and Compile

Test programs use cmake. Just do

# Install gtest before, and make sure your computer support avx2/avx.
mkdir build
cmake -D CMAKE_BUILD_TYPE=Release ..
make -j 2
./test_avx2 ; ./test_avx

It will run some unittest.

How to use this library

Just include "avx_mathfun.h" in your project.

License

The origin file uses zlib license. It is not changed.

About

AVX-optimized sin(), cos(), exp() and log() functions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 89.1%
  • C++ 8.9%
  • CMake 2.0%