Reputation: 127
In my C program, I want the processor to compute a*b +c using FMADD instruction rather than MUL and ADD. How do I specify this to the compiler to do this. Also I would like to see FMADD instruction in the assembly code after compile.
gcc version 4.9.2 ARM v7 Processor
Upvotes: 0
Views: 1536
Reputation: 22420
You need to have one of the following FPUs,
You must use the hard-float ABI option.
An example with integers.
An example with floats.
You shouldn't need to specify any special function calls; the compiler will use the instruction if it finds they are beneficial.
The code in arm.c responsible for generation is,
case FMA:
if (TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_FMA)
With TARGET_FMA being a version '4' or better FPU.
Upvotes: 0