I want to use FPU instruction of Cortex-M7, called VCVTR, to convert a double precision floating number to an integer.
int double_to_int(double value)
{
int result;
__asm("VCVTR.S32.F64 %0, %1" : "=r"(result), "r"(value));
return result;
}
But I get error information from the compiler.
Error: VFP single, double or Neon quad precision register expected -- `vcvtr.s32.f64 r3,r3'
How to fix this problem.
Maybe the constraint "=r" and "r" is not correct. But I don't know other constraints for FPU registers.
My compiler is arm-none-eabi-gcc, version is 7.2.1
My compiler option is
-mcpu=cortex-m7 -mthumb -mfloat-abi=hard -mfpu=fpv5-d16 -O3 -g -munaligned-access