Try to clarify semantics of fptrunc

Dan Liew via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 4 15:05:27 PDT 2015


Hi,

> I'm not sure I understand your proposal... but I want to make sure
> you're not suggesting that users' functions be duplicated :-)

I don't understand what you mean but in the interest of clarity what
I'm suggesting as an initial step is to:

* Change ``fptrunc`` to take an extra operand that **must be
immediate** that specifies a rounding mode.
* The available rounding modes would be the five defined by IEEE-754
2008 and "undef"
* The "undef" rounding mode would be special in that it means the
rounding mode is not specified i.e. the generator
  of the LLVM IR does not care how the rounding is done and it signals
to target backend that it can do
  floating point truncation however it likes. It would exist for
compatibility with existing frontends (e.g. Clang)
* In the LLVM backends if the rounding is not "undef" they would need
to emit instructions to round correctly and if
  instructions are not available either fallback to a software
implementation (I have one which I'd be happy to
  contribute to compiler-rt) or emit an error.

That is all.

Should we move this discussion to llvmdev? I don't think many people
will see this.

Thanks,
Dan.


More information about the llvm-commits mailing list