cancel
Showing results for 
Search instead for 
Did you mean: 

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

Ethan_C
Associate II

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,

 

1 ACCEPTED SOLUTION

Accepted Solutions
Giuseppe DI-GIORE
ST Employee

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.

View solution in original post

2 REPLIES 2
Giuseppe DI-GIORE
ST Employee

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_C
Associate II

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,