https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111506
Bug ID: 111506 Summary: RISC-V: Failed to vectorize conversion from INT64 -> _Float16 Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: juzhe.zhong at rivai dot ai Target Milestone: --- #include <stdint.h> void foo (int64_t *__restrict a, _Float16 * b, int n) { for (int i = 0; i < n; i++) { b[i] = (_Float16)a[i]; } } -march=rv64gcv_zvfh_zfh -O3 -fno-trapping-math -fopt-info-vec-missed -march=rv64gcv_zvfh_zfh -O3 -ffast-math -fopt-info-vec-missed <source>:5:23: missed: couldn't vectorize loop <source>:6:27: missed: not vectorized: no vectype for stmt: _4 = *_3; scalar_type: int64_t Compiler returned: 0 https://godbolt.org/z/orevoq7E1 Consider LLVM can vectorize with -fno-trapping-math. However, LLVM can not vectorize when -ftrapping-math. So, we need an explicit patterns from INT64 -> _Float16 with !flag_trapping_math