On Mon, Sep 19, 2022 at 09:22:55PM +0800, pengsheng.chen--- via Gcc wrote: > The functions encode_ieee_single()/encode_ieee_double() encode the GCC > internal representation (i.e., REAL_VALUE_TYPE) to the corresponding IEEE > single precision/double precision formats. The constant values in a program > (i.e., float a = 3.14;) will be parsed and then transferred to GCC > REAL_VALUE_TYPE. Later, the REAL_VALUE_TYPE is encoded to IEEE > single/double formats. However, I do not know why we need > decode_ieee_single()/decode_ieee_double()? Which situations or C code > fragments are these decode_ieee_xxx functions used in?
Anywhere where real_from_target is called. That is usually when you say have a union of one of the floating point types and corresponding integral type, you store the integer into the union and read back the floating point, so e.g. when folding in the IL VIEW_CONVERT_EXPR <float> (some_int_value) etc. Or e.g. when folding RTL NOT of a constant, that inverts all the bits, so you need real_to_target, invert the bits and real_from_target back. Jakub