dda6e080d2214414712bb7e4569ab94fd355440f
[platform/upstream/opencv.git] / cmake / checks / cpu_neon.cpp
1 #include <stdio.h>
2
3 #if defined _WIN32 && defined(_M_ARM)
4 # include <Intrin.h>
5 # include <arm_neon.h>
6 # define CV_NEON 1
7 #elif defined(__ARM_NEON__) || (defined (__ARM_NEON) && defined(__aarch64__))
8 #  include <arm_neon.h>
9 #  define CV_NEON 1
10 #endif
11
12 #if defined CV_NEON
13 int test()
14 {
15     const float src[] = { 0.0f, 0.0f, 0.0f, 0.0f };
16     float32x4_t val = vld1q_f32((const float32_t*)(src));
17     return (int)vgetq_lane_f32(val, 0);
18 }
19 #else
20 #error "NEON is not supported"
21 #endif
22
23 int main()
24 {
25   printf("%d\n", test());
26   return 0;
27 }