Try to clarify semantics of fptrunc

Dan Liew via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 2 23:21:36 PDT 2015


On 2 September 2015 at 15:11, Dan Gohman <sunfish at mozilla.com> wrote:
> Clarifying that 'fptrunc' is not necessarily a truncation is indeed an
> improvement. It looks like WebAssembly CodeGen was previously nonconforming
> to LLVM's rules in that detail, because it's following the IEEE 754
> semantics.

This change makes it explicit that the rounding mode is not defined so
I don't understand what you mean by the WebAssembly CodeGen being non
conforming. The rounding mode can be anything, including any one of
the five IEEE754 rounding modes.

Although this is an improvement I think it would be better if fptrunc
actually took an operand that specified the rounding mode. It would
make static analysis easier, constant folding more correct and could
be used by backends that support different rounding modes. This change
would have a lot of impact though so I opted for the simpler change of
just making the poorly defined behaviour of ``fptrunc`` more explicit.

I'll fix up the comma issue and commit this change.

Thanks,
Dan.


More information about the llvm-commits mailing list