[LLVMdev] Proposal for adding rounding variant of fpto?i instructions
clattner at apple.com
Tue Jul 13 12:43:53 PDT 2010
On Jul 12, 2010, at 9:28 AM, Anton Lokhmotov wrote:
> Hi Peter,
>> I would appreciate comments/feedback on this proposal to extend the
>> fpto?i instructions to support rounding.
> I think this might be useful. Actually, LLVM specifies that fpto?i convert
> their operand into the nearest (rounding towards zero) signed integer value.
> Do you have other rounding modes in mind? Currently I use custom metadata to
> represent conversions with other rounding modes.
My high level thought on this is that it would be great to have, but is a major new feature. In addition to adding rounding mode selection to fpto?i, we should add it to all the rest of the fp operators. We also want to eventually add support for the optimizer to know that the user is messing around with rounding modes (which needs to disable inexact constant folding and other optimizations) as well. Modeling this properly will require some fairly substantial changes throughout the compiler similar to when NUW/NSW were added on the integer side.
More information about the llvm-dev