Is there any way the RealView compiler can take advantage of the multiply-and-accumulate instructions of the Cortex M3?
I wrote a simple MAC loop and the compiler didn't generate any SMLAL or UMLAL instructions, which was disappointing.
Thanks, Andrew Queisser HP
When you use a High-Level Language (HLL) - any HLL - you delegate the choice of machine instructions to the compiler.
If the use of specific machine instructions is important to you, then you should not be using an HLL - any HLL!
While you might be happen to stumble upon some specific HLL construct that just happens to generate certain machine instructions under certain conditions, you cannot rely upon it to always continue to do so! You will always have to re-check the generated code to be sure.
Therefore, if it really is important, write an assembler module to call from the HLL.
See: http://www.keil.com/forum/17991/
Hi Andy,
Totally agree about HLL and specific machine instructions. However, in this case I'm not using the compiler as a HLL but as the frontend to the assembler. That way I don't have to remember the calling conventions and exact syntax of the assembler. Once I've forced the compiler to generate close to what I want, in this case the MAC instructions, I throw away the C-code and tweak the assembly. The ASM file is what goes into source control.
Andrew
Andrew,
is it worth the effort? The ARM compiler is so good that you can hardly beat it. My suggestion is to write your application in HLL and put only time-critical functions (cpu intensive) to assembly module and optimize it. You might even discover that there is no need for the assembly at all.
The project overview, maintenance later, etc. is much better in HLL.
Franc
Hi Franc,
Reading through my messages in this thread I realize I wan't really clear. The vast majority of our code is in C and we only resort to assembly for small time critical chunks, just as you suggest.
I agree that assembly is hard to maintain although at this point ARM is so prevalent (the last three projects I was on used it) that learning ARM assembly seems to be a good investment.
Thanks, Andrew