Try to clarify semantics of fptrunc

JF Bastien via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 3 09:37:05 PDT 2015


> 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.

How would that work for C/C++? I may be lacking creativity, but I
think clang would need to generate a built-in "rounding mode"
thread-local value, and load from it before any truncation? It would
expose more optimization opportunities, but may get in the way of
others.


More information about the llvm-commits mailing list