GithubHelp home page GithubHelp logo

whutbd / avx_mathfun Goto Github PK

View Code? Open in Web Editor NEW

This project forked from reyoung/avx_mathfun

0.0 0.0 0.0 8 KB

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

C++ 8.87% C 89.12% CMake 2.01%

avx_mathfun's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.