public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/106652] [C++23] P1467 - Extended floating-point types and standard names
Date: Sat, 10 Sep 2022 10:20:55 +0000	[thread overview]
Message-ID: <bug-106652-4-Dki0XpgScv@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106652-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106652

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #53557|0                           |1
        is obsolete|                            |
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
   Last reconfirmed|                            |2022-09-10
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 53558
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53558&action=edit
gcc13-pr106652.patch

The other conversion better should use backend support if available, but
could be implemented in libgcc __truncsfbf2 or inline.  I believe Intel docs
document it as
__bf16
__truncsfbf2 (_Float32 x)
{
  unsigned int y;
  memcpy (&y, &x, sizeof (y));
  unsigned int z = x & 0x7fffffff;
  unsigned short r;
  __bf16 ret;
  if (z < 0x800000)
    // Zero or denormal, flush to zero.
    r = (x & 0x80000000) >> 16;
  else if (z < 0x7f800000)
    // Normal, round to nearest.
    r = (x + 0x7fff + ((x >> 16) & 1)) >> 16;
  else if (z == 0x7f800000)
    // Inf.
    r = x >> 16;
  else
    // NaN.
    r = (x >> 16) | (1 << 6);
  memcpy (&ret, &r, sizeof (r));
  return ret;
}

  parent reply	other threads:[~2022-09-10 10:20 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-16 17:14 [Bug c++/106652] New: " mpolacek at gcc dot gnu.org
2022-08-24 14:27 ` [Bug c++/106652] " jakub at gcc dot gnu.org
2022-08-24 14:49 ` jakub at gcc dot gnu.org
2022-08-24 16:56 ` jakub at gcc dot gnu.org
2022-08-24 17:35 ` joseph at codesourcery dot com
2022-08-25 12:51 ` jakub at gcc dot gnu.org
2022-08-25 12:55 ` jakub at gcc dot gnu.org
2022-08-25 14:39 ` jakub at gcc dot gnu.org
2022-09-09  9:44 ` jakub at gcc dot gnu.org
2022-09-09 18:12 ` jakub at gcc dot gnu.org
2022-09-10 10:20 ` jakub at gcc dot gnu.org [this message]
2022-09-10 10:22 ` jakub at gcc dot gnu.org
2022-09-10 17:28 ` jakub at gcc dot gnu.org
2022-09-10 17:31 ` jakub at gcc dot gnu.org
2022-09-10 18:13 ` jakub at gcc dot gnu.org
2022-09-27  6:18 ` cvs-commit at gcc dot gnu.org
2022-10-18  9:43 ` cvs-commit at gcc dot gnu.org
2022-10-19  9:26 ` cvs-commit at gcc dot gnu.org
2022-11-19  9:24 ` jakub at gcc dot gnu.org
2022-11-28 22:31 ` pinskia at gcc dot gnu.org
2022-12-09 15:20 ` pinskia at gcc dot gnu.org
2023-08-21 15:57 ` igorkuo at meta dot ua
2023-08-22 14:15 ` cvs-commit at gcc dot gnu.org
2023-08-22 14:16 ` cvs-commit at gcc dot gnu.org

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=bug-106652-4-Dki0XpgScv@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).