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
xto machine modem.mmust be a fixed-point mode andxa fixed-point value of a mode narrower thanm.(zero_extend:m x)Represents the result of zero-extending the value
xto machine modem.mmust be a fixed-point mode andxa fixed-point value of a mode narrower thanm.(float_extend:m x)Represents the result of extending the value
xto machine modem.mmust be a floating point mode andxa floating point value of a mode narrower thanm.(truncate:m x)Represents the result of truncating the value
xto machine modem.mmust be a fixed-point mode andxa fixed-point value of a mode wider thanm.(ss_truncate:m x)Represents the result of truncating the value
xto machine modem, using signed saturation in the case of overflow. Bothmand the mode ofxmust be fixed-point modes.(us_truncate:m x)Represents the result of truncating the value
xto machine modem, using unsigned saturation in the case of overflow. Bothmand the mode ofxmust be fixed-point modes.(float_truncate:m x)Represents the result of truncating the value
xto machine modem.mmust be a floating point mode andxa floating point value of a mode wider thanm.(float:m x)Represents the result of converting fixed point value
x, regarded as signed, to floating point modem.(unsigned_float:m x)Represents the result of converting fixed point value
x, regarded as unsigned, to floating point modem.(fix:m x)When
mis a floating-point mode, represents the result of converting floating point valuex(valid for modem) to an integer, still represented in floating point modem, by rounding towards zero.When
mis a fixed-point mode, represents the result of converting floating point valuexto modem, 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
xto fixed point modem, regarded as unsigned. How rounding is done is not specified.(fract_convert:m x)Represents the result of converting fixed-point value
xto fixed-point modem, signed integer valuexto fixed-point modem, floating-point valuexto fixed-point modem, fixed-point valuexto integer modemregarded as signed, or fixed-point valuexto floating-point modem. When overflows or underflows happen, the results are undefined.(sat_fract:m x)Represents the result of converting fixed-point value
xto fixed-point modem, signed integer valuexto fixed-point modem, or floating-point valuexto fixed-point modem. When overflows or underflows happen, the results are saturated to the maximum or the minimum.(unsigned_fract_convert:m x)Represents the result of converting fixed-point value
xto integer modemregarded as unsigned, or unsigned integer valuexto fixed-point modem. When overflows or underflows happen, the results are undefined.(unsigned_sat_fract:m x)Represents the result of converting unsigned integer value
xto fixed-point modem. When overflows or underflows happen, the results are saturated to the maximum or the minimum.