Skip to main content
Associate
April 12, 2024
Solved

SPC58EC-DISP How to enable Floating-point multiply-add instructions

  • April 12, 2024
  • 2 replies
  • 1048 views

Hi,

I tried to write a piece of code involving multiplication and addition (a*b+c) hoping the compiler would automatically use the FMA (fused multiply-add) instruction. However, it seems to still decompose it into separate instructions, efsadd and efsmul. I've attempted to use compiler options like -O3 or -ffpcontract=fast, but I haven't seen it compile into FMA instructions. I'd like to ask if FMA instructions are supported? (I've seen instructions like fmadd mentioned in the documentation).

Best regards,

 

This topic has been closed for replies.
Best answer by Giuseppe DI-GIORE

Hello,

the FMA instruction is included in PowerPC instruction set (see the Reference Manual for Book-E processors).

However is the compiler responsible for generating FMADD instruction.

Which compiler did you use for testing?

The Hightec PowerPC compiler (available here) by default generates float-multiple-add instructions.

If you use SPC5Studio, install the Hightec PowerPC compiler suite via SPC5Studio market place, then apply for license.

Best Regards.

2 replies

Giuseppe DI-GIORE
ST Employee
April 13, 2024

Hello,

the FMA instruction is included in PowerPC instruction set (see the Reference Manual for Book-E processors).

However is the compiler responsible for generating FMADD instruction.

Which compiler did you use for testing?

The Hightec PowerPC compiler (available here) by default generates float-multiple-add instructions.

If you use SPC5Studio, install the Hightec PowerPC compiler suite via SPC5Studio market place, then apply for license.

Best Regards.

Ethan_CAuthor
Associate
April 16, 2024

I'm using the FreeFCC compiler with VLE support as the default option. I'll try switching to Hightect and see how it goes. Thank you very much for your help.

Best regards,