simd-everywhere / simde

Implementations of SIMD instruction sets for systems which don't natively support them.
https://simd-everywhere.github.io/blog/
MIT License
2.36k stars 247 forks source link

vcvt_f32_s32 is not correct in visual studio #1124

Open xxxxxxLD opened 9 months ago

xxxxxxLD commented 9 months ago

I run and debug neon intrinsic by using simde in Visual Studio. When using simde_vcvt_f32_s32 to convert a slice of int number ,and it seems like the result not correct, the vector are all 12851, but the result of vcvt_f32_s32 is -nan(ind), 12851.0, 12851.0, ... Why the first of results is -nan(ind). By the way the specific intrinsic is _vcvt_f32_s32(vmovl_s16(vget_low_s16(vin))). Only the result of this intrinsic is not correct, _vcvt_f32_s32(vmovl_s16(vget_high_s16(vin))) is true.

mr-c commented 8 months ago

Hello @xxxxxxLD and thank you for sharing your issue

For which architecture are you compiling for? Which version of MS Visual Studio are you running? What compiler options are you using?

https://github.com/simd-everywhere/simde/blob/14311d60539303ca8bad6204dcbc6a29f51b0e09/simde/arm/neon/cvt.h#L1090

I'm also surprised to see the result you are reporting.

xxxxxxLD commented 8 months ago

I

Hello @xxxxxxLD and thank you for sharing your issue

For which architecture are you compiling for? Which version of MS Visual Studio are you running? What compiler options are you using?

https://github.com/simd-everywhere/simde/blob/14311d60539303ca8bad6204dcbc6a29f51b0e09/simde/arm/neon/cvt.h#L1090

I'm also surprised to see the result you are reporting.

I'm just compile it in Visual Studio 2019, and see the result by debuging the code step by step.Only the first result of _vcvt_f32_s32(vmovl_s16(vget_low_s16(vin))) is not correct.And the vcvt_f32_s32 is explained by HEDLEY_STATIC_CAST(T,expr) (static_cast(expr)) in LINE 854 of hedley.h.