opencv/cmake/checks/cpu_neon.cpp
Vincent Rabaud f8aa2896a1
Merge pull request #25024 from vrabaud:neon
Replace legacy __ARM_NEON__ by __ARM_NEON #25024

Even ACLE 1.1 referes to __ARM_NEON
https://developer.arm.com/documentation/ihi0053/b/?lang=en

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2024-02-20 11:29:23 +03:00

33 lines
708 B
C++

#include <stdio.h>
#if defined _WIN32 && (defined(_M_ARM) || defined(_M_ARM64))
# define _ARM64_DISTINCT_NEON_TYPES
# include <Intrin.h>
# include <arm_neon.h>
# define CV_NEON 1
#elif defined(__ARM_NEON)
# include <arm_neon.h>
# define CV_NEON 1
#endif
// MSVC 2019 bug. Details: https://github.com/opencv/opencv/pull/16027
void test_aliased_type(const uint8x16_t& a) { }
void test_aliased_type(const int8x16_t& a) { }
#if defined CV_NEON
int test()
{
const float src[] = { 0.0f, 0.0f, 0.0f, 0.0f };
float32x4_t val = vld1q_f32((const float32_t*)(src));
return (int)vgetq_lane_f32(val, 0);
}
#else
#error "NEON is not supported"
#endif
int main()
{
printf("%d\n", test());
return 0;
}