I imported the immintrin.h header file in my C++ project and tried to use the _mm256_cos_pd function, but encountered the error "Use of undeclared identifier '_mm256_cos_pd'".
According to Intel's documentation(https://www.intel.com/content/www/us/en/docs/cpp-compiler/developer-guide-reference/2021-8/mm-cos-pd-mm256-cos-pd.html), the _mm256_cos_pd function is a function that calculates the cosine of a 256-bit floating-point (double-precision) vector. It is part of the Intel AVX extended instruction set.
I can successfully use other commands (such as _mm256_add_pd and _mm256_mul_pd) but not _mm256_cos_pd.
I did the following tests:
The compiler used is gcc (13.1), which supports the AVX2 instruction set.
the compiler's build options enable the AVX2 instruction set. I used set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2") in the CMakeLists.txt file to enable the AVX2 instruction set.
Make sure the CPU supports the AVX2 instruction set.