Conversions
===========
All conversions between machine modes must be represented by
explicit conversion operations. For example, an expression which is
the sum of a byte and a full word cannot be written as `(plus:SI
(reg:QI 34) (reg:SI 80))' because the `plus' operation requires two
operands of the same machine mode. Therefore, the byte-sized operand
is enclosed in a conversion operation, as in
(plus:SI (sign_extend:SI (reg:QI 34)) (reg:SI 80))
The conversion operation is not a mere placeholder, because there
may be more than one way of converting from a given starting mode to
the desired final mode. The conversion operation code says how to do
it.
For all conversion operations, X must not be `VOIDmode' because the
mode in which to do the conversion would not be known. The conversion
must either be done at compile-time or X must be placed into a register.
`(sign_extend:M X)'
Represents the result of sign-extending the value X to machine
mode M. M must be a fixed-point mode and X a fixed-point value of
a mode narrower than M.
`(zero_extend:M X)'
Represents the result of zero-extending the value X to machine
mode M. M must be a fixed-point mode and X a fixed-point value of
a mode narrower than M.
`(float_extend:M X)'
Represents the result of extending the value X to machine mode M.
M must be a floating point mode and X a floating point value of a
mode narrower than M.
`(truncate:M X)'
Represents the result of truncating the value X to machine mode M.
M must be a fixed-point mode and X a fixed-point value of a mode
wider than M.
`(ss_truncate:M X)'
Represents the result of truncating the value X to machine mode M,
using signed saturation in the case of overflow. Both M and the
mode of X must be fixed-point modes.
`(us_truncate:M X)'
Represents the result of truncating the value X to machine mode M,
using unsigned saturation in the case of overflow. Both M and the
mode of X must be fixed-point modes.
`(float_truncate:M X)'
Represents the result of truncating the value X to machine mode M.
M must be a floating point mode and X a floating point value of a
mode wider than M.
`(float:M X)'
Represents the result of converting fixed point value X, regarded
as signed, to floating point mode M.
`(unsigned_float:M X)'
Represents the result of converting fixed point value X, regarded
as unsigned, to floating point mode M.
`(fix:M X)'
When M is a fixed point mode, represents the result of converting
floating point value X to mode M, regarded as signed. How
rounding is done is not specified, so this operation may be used
validly in compiling C code only for integer-valued operands.
`(unsigned_fix:M X)'
Represents the result of converting floating point value X to
fixed point mode M, regarded as unsigned. How rounding is done is
not specified.
`(fix:M X)'
When M is a floating point mode, represents the result of
converting floating point value X (valid for mode M) to an
integer, still represented in floating point mode M, by rounding
towards zero.