Simpler vercorclass

This commit is contained in:
proller 2017-03-14 18:57:27 +03:00 committed by alexey-milovidov
parent 930ac5b2ce
commit a08714105b
3 changed files with 22 additions and 6 deletions

View File

@ -1,4 +1,4 @@
option (USE_VECTORIZED_MATH_FUNCTIONS "Faster math functions" OFF) include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/find_vectorclass.cmake)
set (CONFIG_VERSION ${CMAKE_CURRENT_BINARY_DIR}/include/DB/Common/config_version.h) set (CONFIG_VERSION ${CMAKE_CURRENT_BINARY_DIR}/include/DB/Common/config_version.h)
set (CONFIG_COMMON ${CMAKE_CURRENT_BINARY_DIR}/include/DB/Common/config.h) set (CONFIG_COMMON ${CMAKE_CURRENT_BINARY_DIR}/include/DB/Common/config.h)

View File

@ -3,4 +3,4 @@
// .h autogenerated by cmake ! // .h autogenerated by cmake !
#cmakedefine01 USE_RE2_ST #cmakedefine01 USE_RE2_ST
#cmakedefine01 USE_VECTORIZED_MATH_FUNCTIONS #cmakedefine01 USE_VECTORCLASS

View File

@ -9,9 +9,25 @@
/** More effective implementations of mathematical functions are possible when connecting a separate library /** More effective implementations of mathematical functions are possible when connecting a separate library
* Disabled due licence compatibility limitations * Disabled due licence compatibility limitations
* To enable: rebuild with -DUSE_VECTORIZED_MATH_FUNCTIONS=1 * To enable: download http://www.agner.org/optimize/vectorclass.zip and unpack to contrib/vectorclass
* Then rebuild with -DENABLE_VECTORCLASS=1
*/ */
#if USE_VECTORCLASS
#if __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshift-negative-value"
#endif
#include <vectorf128.h>
#include <vectormath_exp.h>
#include <vectormath_trig.h>
#if __clang__
#pragma clang diagnostic pop
#endif
#endif
namespace DB namespace DB
{ {
@ -166,7 +182,7 @@ struct UnaryFunctionPlain
} }
}; };
#if USE_VECTORIZED_MATH_FUNCTIONS #if USE_VECTORCLASS
template <typename Name, Vec2d(&Function)(const Vec2d &)> template <typename Name, Vec2d(&Function)(const Vec2d &)>
struct UnaryFunctionVectorized struct UnaryFunctionVectorized
@ -436,7 +452,7 @@ struct BinaryFunctionPlain
} }
}; };
#if USE_VECTORIZED_MATH_FUNCTIONS #if USE_VECTORCLASS
template <typename Name, Vec2d(&Function)(const Vec2d &, const Vec2d &)> template <typename Name, Vec2d(&Function)(const Vec2d &, const Vec2d &)>
struct BinaryFunctionVectorized struct BinaryFunctionVectorized
@ -502,7 +518,7 @@ using FunctionLog10 = FunctionMathUnaryFloat64<UnaryFunctionVectorized<Log10Name
using FunctionSqrt = FunctionMathUnaryFloat64<UnaryFunctionVectorized<SqrtName, sqrt>>; using FunctionSqrt = FunctionMathUnaryFloat64<UnaryFunctionVectorized<SqrtName, sqrt>>;
using FunctionCbrt = FunctionMathUnaryFloat64<UnaryFunctionVectorized<CbrtName, using FunctionCbrt = FunctionMathUnaryFloat64<UnaryFunctionVectorized<CbrtName,
#if USE_VECTORIZED_MATH_FUNCTIONS #if USE_VECTORCLASS
Power_rational<1, 3>::pow Power_rational<1, 3>::pow
#else #else
cbrt cbrt