diff --git a/modules/core/src/convert_scale.simd.hpp b/modules/core/src/convert_scale.simd.hpp index 9db95a50b5..9bf092f8af 100644 --- a/modules/core/src/convert_scale.simd.hpp +++ b/modules/core/src/convert_scale.simd.hpp @@ -22,14 +22,14 @@ template inline void cvtabs_32f( const _Ts* src, size_t sstep, _Td* dst, size_t dstep, Size size, float a, float b ) { -// Excluding GNU in CV_SIMD_SCALABLE because of "opencv/issues/26936" -#if (CV_SIMD || (CV_SIMD_SCALABLE && !(defined(__GNUC__) && !defined(__clang__))) ) +#if (CV_SIMD || CV_SIMD_SCALABLE) v_float32 va = vx_setall_f32(a), vb = vx_setall_f32(b); const int VECSZ = VTraits::vlanes()*2; - // GCC miscompiles this scalable block only on VLEN=128 RVV (opencv/issues/26936). - // v_float32 is LMUL=2, so vlanes()==8 means VLEN==128: use scalar there, keep SIMD elsewhere. -#if (CV_SIMD_SCALABLE && defined(__GNUC__) && !defined(__clang__)) - const bool useSIMD = VTraits::vlanes() != 8; + // GCC miscompiles this scalable block only on VLEN=128 RVV (opencv/issues/26936); + // use scalar there, keep SIMD on wider vectors. Ask the hardware for VLEN directly: + // vlanes() would depend on the LMUL the universal intrinsics happen to use. +#if (CV_RVV && CV_SIMD_SCALABLE && defined(__GNUC__) && !defined(__clang__)) + const bool useSIMD = __riscv_vlenb()*8 != 128; #else const bool useSIMD = true; #endif