
Printf("AVX2 Double precision examples\n") _m256i ptrs_lo, ptrs_hi, ptrc_lo, ptrc_hi _m256i ptrs, ptrc /* Pointers to the elements of z_s and z_c */ Void _ZGVdN8vvv_sincosf(_m256 x, _m256i ptrs_lo, _m256i ptrs_hi, _m256i ptrc_lo, _m256i ptrc_hi) ĭouble z_s, z_c /* sincos output */įloat zf_s, zf_c /* sincosf output */ They are only needed to use the scalar */ #define _GNU_SOURCE /* These two lines are optional. * gcc -Wall -O3 -m64 -march=skylake libmvec_ex.c -lm */

This example runs successful on a standard Ubuntu 18.04 system (glibc version 2.27).
#Intel c compiler svml math functions how to#
The following example shows how to call the AVX2 vectorized functions. The -ffast-math compiler option is not necesary. Sufficient for not static builds, see here. The linker doesn't need -lmvec, linking the standard math library -lm is
#Intel c compiler svml math functions code#
To use the Libmvec functions one has to include the function declarationsĪnd link the code with the -lm (link with math library) option. However, these vector functions are also suitable forĭoes not give many examples that explain how to use these functions for

While it is auto-vectorizing scalar code, for example with -ffast-math or Usually gcc inserts calls to Libmvec functions, such as _ZGVdN4v_cos, The accuracy of these functions is 4-ulp maximum relative error.

Libmvec is a x86_64 glibc library with SSE4, AVX, AVX2, and AVX-512 vectorized functions forĬos, exp, log, sin, pow, and sincos, in single precision and double precision.
