public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* When does GCC need to use the functions decode_ieee_single()/decode_ieee_double() ?
@ 2022-09-19 13:22 pengsheng.chen
  2022-09-19 13:36 ` Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: pengsheng.chen @ 2022-09-19 13:22 UTC (permalink / raw)
  To: gcc

[-- Attachment #1: Type: text/plain, Size: 586 bytes --]

Dear all,



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?

Thank you for your help.


Peng-Sheng

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: When does GCC need to use the functions decode_ieee_single()/decode_ieee_double() ?
  2022-09-19 13:22 When does GCC need to use the functions decode_ieee_single()/decode_ieee_double() ? pengsheng.chen
@ 2022-09-19 13:36 ` Jakub Jelinek
  2022-09-22  3:04   ` pengsheng.chen
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2022-09-19 13:36 UTC (permalink / raw)
  To: pengsheng.chen; +Cc: gcc

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: When does GCC need to use the functions decode_ieee_single()/decode_ieee_double() ?
  2022-09-19 13:36 ` Jakub Jelinek
@ 2022-09-22  3:04   ` pengsheng.chen
  0 siblings, 0 replies; 3+ messages in thread
From: pengsheng.chen @ 2022-09-22  3:04 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc

[-- Attachment #1: Type: text/plain, Size: 1407 bytes --]

Dear Jakub,

Thank you for your reply promptly. I have tried many test cases, but I
still cannot trigger the functions: decode_ieee_xxx(). Can you give me some
cases for studying?

Thank you.

Peng-Sheng


On Mon, Sep 19, 2022 at 9:36 PM Jakub Jelinek <jakub@redhat.com> wrote:

> 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
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-22  3:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-19 13:22 When does GCC need to use the functions decode_ieee_single()/decode_ieee_double() ? pengsheng.chen
2022-09-19 13:36 ` Jakub Jelinek
2022-09-22  3:04   ` pengsheng.chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).