Using and Porting GNU CC
14.10: 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 bytesized 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 compiletime or x
must be placed into a register.
(sign_extend:m x)

Represents the result of signextending the value x
to machine mode m. m must be a fixedpoint mode
and x a fixedpoint value of a mode narrower than m.
(zero_extend:m x)

Represents the result of zeroextending the value x
to machine mode m. m must be a fixedpoint mode
and x a fixedpoint 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 fixedpoint mode
and x a fixedpoint value of a mode wider than m.
(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 integervalued 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.