public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: pengsheng.chen@gmail.com
Cc: gcc@gcc.gnu.org
Subject: Re: When does GCC need to use the functions decode_ieee_single()/decode_ieee_double() ?
Date: Mon, 19 Sep 2022 15:36:54 +0200	[thread overview]
Message-ID: <Yyhwdqv1YULmq/Xm@tucnak> (raw)
In-Reply-To: <CANY1fJT2kDCVV45=zy7DfhsgvnzRmY0JpQ3wo3P3u2aK1LnF1A@mail.gmail.com>

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


  reply	other threads:[~2022-09-19 13:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-19 13:22 pengsheng.chen
2022-09-19 13:36 ` Jakub Jelinek [this message]
2022-09-22  3:04   ` pengsheng.chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yyhwdqv1YULmq/Xm@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=pengsheng.chen@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).