Download cmake/checks/cpu_fp16.cpp from tgollogly/test: direct link, hf CLI and curl.
- Browser
- Download file 953 Bytes
-
https://huggingface.co/tgollogly/test/resolve/main/cmake/checks/cpu_fp16.cpp
- Command line
-
hf download hf://tgollogly/test/cmake/checks/cpu_fp16.cpp
-
curl -L -o cpu_fp16.cpp https://huggingface.co/tgollogly/test/resolve/main/cmake/checks/cpu_fp16.cpp
953 Bytes
| int test() | |
| { | |
| const float src[] = { 0.0f, 0.0f, 0.0f, 0.0f }; | |
| short dst[8]; | |
| __m128 v_src = _mm_load_ps(src); | |
| __m128i v_dst = _mm_cvtps_ph(v_src, 0); | |
| _mm_storel_epi64((__m128i*)dst, v_dst); | |
| return (int)dst[0]; | |
| } | |
| // Windows + ARM64 case disabled: https://github.com/opencv/opencv/issues/25052 | |
| int test() | |
| { | |
| const float src[] = { 0.0f, 0.0f, 0.0f, 0.0f }; | |
| short dst[8]; | |
| float32x4_t v_src = *(float32x4_t*)src; | |
| float16x4_t v_dst = vcvt_f16_f32(v_src); | |
| *(float16x4_t*)dst = v_dst; | |
| return (int)dst[0]; | |
| } | |
| int main() | |
| { | |
| printf("%d\n", test()); | |
| return 0; | |
| } | |