[LLVMdev] Documentation of fmuladd intrinsic

Andrew Booker andrew.booker at arm.com
Fri Jan 11 10:08:43 PST 2013

The fmuladd intrinsic is described as saying that a multiply and
addition sequence can be fused into an fma instruction "if the code
generator determines that the fused expression would be legal and
efficient". (http://llvm.org/docs/LangRef.html#llvm-fma-intrinsic)

I've spent a bit of time puzzling over how a code generator is supposed
to know if it's legal to generate an fma instead of a multiply and add
- surely that's something for the frontend to determine, based on the
FP_CONTRACT setting, and not something for the code generator to work

However, recently I came across
which explains that "legal" in the above definition doesn't mean legal
from the point of view of the source language, but simply means whether
or not the target architecture has an fma instruction. The thread also
talks about updating the documentation to clarify this, but that
doesn't seem to have happened.

Assuming that the thread I've linked to is correct, would it be
possible to clarify the IR spec accordingly? I think that the current
use of the word "legal" is misleading.


Andrew Booker, Staff Software Engineer
Media Processing Division
ARM Ltd, 110 Fulbourn Road, Cambridge CB1 9NJ, UK
Tel: +44 1223 400695       Fax: +44 1223 400410

More information about the llvm-dev mailing list