Keil MDK arm C compiler doesn't optize VLDMIA instructions calls even in -O3 -Otime mode for Cortex M4-F CPU:
In the following example:
float * M = 0x10; float f1,f2,f3,f4;
f1 = *(M++); f2 = *(M++); f3 = *(M++); f4 = *(M++);
C compiler generates: 0x080005CC ECB40A01 VLDMIA r4!, {s0-s0} 0x080005CC ECB40A01 VLDMIA r4!, {s1-s1} 0x080005CC ECB40A01 VLDMIA r4!, {s2-s2} 0x080005CC ECB40A01 VLDMIA r4!, {s3-s3}
Instead of expected of only following instruction that will have the same result: 0x080005CC ECB40A01 VLDMIA r4!, {s0-s3}
Is there an option to activate this or another way to force it?
"Is there an option to activate this or another way to force it?"
Yes - Use assembler.