Hi,
I am working with cortex-r52 CPU, compiler toos is arm-none-eabi-gcc , I need to use The ARM-state integer division instructions in my code. Does cortex-r52 supports integer divide? If yes can you please let me know how to set integer division compiler option in my build configuration for GCC?
I tried with CCFLAGS+= -marm -mthumb -mcpu=cortex-r52+idev
with this option I am getting error: unrecognized argument in option '-mcpu=cortex-r52+idev'
Please help me to set the idev flag in compiler option/
JahnaviYes, this instruction is supported by the Cortex-R52.I did a quick test with the Arm compiler (armclang) and gcc 9.3.1*, and it was indeed generated.
unsigned int foo(unsigned int a, unsigned int b){ return (a/b); }
armclang -c --target=arm-arm-none-eabi -mcpu=cortex-r52 -marm -g -O3 udiv.c or arm-none-eabi-gcc -c -mcpu=cortex-r52 -marm -g -O3 udiv.c
and both generated
foo 0x00000000: e730f110 ..0. UDIV r0,r0,r1 0x00000004: e12fff1e ../. BX lr
Thanks Ronan for the reply.
If parameter a is of type unsigned long long (64bit), then will the divide applies udiv or does it execute some lib?
Thanks,
Jahnvi.
UDIV (and SDIV) operate on 32-bit values only.
Changing to long long, at least for armclang, does indeed invoke a library routine. I'm sure gcc does similar.
bar 0x00000000: e92d4800 .H-. PUSH {r11,lr} 0x00000004: ebfffffe .... BL __aeabi_uldivmod 0x00000008: e8bd8800 .... POP {r11,pc}
ok Thank you