1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

Try to clarify the semantics of fptrunc

* ``the value cannot fit within the destination type`` is ambiguous.
  It could mean overflow, underflow (not in the IEEE-754 sense) or a
  result that cannot be exactly represented and requires rounding or it
  could mean some combination of these. The semantics now state it means
  overflow **only**.

* Using "truncation" in the semantics is very misleading given that it
  doesn't necessarily truncate (i.e. round to zero). For example on
  x86_64 with SSE2 this is currently mapped to cvtsd2ss instruction
  who's rounding behaviour is dependent on the MXCSR register which
  is usually set to round to nearest even by default. The semantics
  now state that the rounding mode is undefined.

llvm-svn: 246792
This commit is contained in:
Dan Liew 2015-09-03 18:43:56 +00:00
parent ccb346dc8c
commit ac140b79c0

View File

@ -7524,10 +7524,12 @@ implies that ``fptrunc`` cannot be used to make a *no-op cast*.
Semantics:
""""""""""
The '``fptrunc``' instruction truncates a ``value`` from a larger
The '``fptrunc``' instruction casts a ``value`` from a larger
:ref:`floating point <t_floating>` type to a smaller :ref:`floating
point <t_floating>` type. If the value cannot fit within the
destination type, ``ty2``, then the results are undefined.
point <t_floating>` type. If the value cannot fit (i.e. overflows) within the
destination type, ``ty2``, then the results are undefined. If the cast produces
an inexact result, how rounding is performed (e.g. truncation, also known as
round to zero) is undefined.
Example:
""""""""