unfused fma question

Steve Ellcey sellcey@imgtec.com
Sat Feb 21 00:56:00 GMT 2015

I have a question about *unfused* fma instructions.  MIPS has processors
with both fused and unfused multiple and add instructions and for fused
madd's it is clear what to do; define 'fma' instructions in the md file
and let convert_mult_to_fma decide whether or not to use them.

But for non-fused multiply and adds, it is less clear.  One could
define '*madd' instructions with the plus and mult operator and
let the peephole optimizer convert normal expressions that have 
these operators into (unfused) instructions.  This is what MIPS
currently does.

Or one could change convert_mult_to_fma to add a check if fma is fused
vs. non-fused in addition to the check for the flag_fp_contract_mode in
order to decide whether to convert expressions into an fma and then
define fma instructions in the md file.

I was wondering if anyone had an opinion about the advantages or
disadvantages of these two approaches.

Steve Ellcey

More information about the Gcc mailing list