[llvm-dev] [X86] FMA transformation restrictions

via llvm-dev llvm-dev at lists.llvm.org
Mon Sep 12 10:24:21 PDT 2016


I noticed that the operand commuting code in X86InstrInfo.cpp treats
scalar FMA intrinsics specially.  It prevents operand commuting on these
scalar instructions because the scalar FMA instructions preserve the
upper bits of the vector.  Presumably, the restrictions are there
because commuting operands potentially changes the result upper bits.

However, AFAIK the Intel and GNU FMA intrinsics don't actually specify
which FMA (213, 132, 231) is going to be used and so the user can't rely
on knowing which operand is tied to the destination.  Thus the user
can't rely on knowing what the upper bits will be.

Is there some other reason these scalar FMA commuting restrictions are
in place?

Thanks!

                            -David


More information about the llvm-dev mailing list